Rockchip Timers — Implementation Details
typedef void hal_timer_callback(int timer, void *data
void hal_timer_set_callback(int timer, hal_timer_callback *callback, void *data
cyg_uint64 hal_timer_current(int timer
cyg_uint32 hal_timer_frequency(int timer
void hal_timer_start(int timer, cyg_uint64 start, cyg_uint64 end, cyg_uint32 mode
void hal_timer_stop(int timer
The HAL contains simple functions to support access to a Rockchip timer. This is primarily aimed at virtual machines running on a hypervisor that is hosted by a Rockchip RK3399 or RK3308. In these cases it is expected that the raw hardware device is accessed using passthrough in the hypervisor. The Rockchip timers are implemented in consecutive blocks that cannot be separately mapped into virtual machines, so eCos code must be careful to only access the timer that it has been allocated.
These timers are very simple, and the API to access them is likewise very simple. The reader is referred to the hardware manual for the Rockchip device for details.
used to register a callback function with the given timer. This
function will be called from a DSR whenever the interrupt
associated with the timer if triggered. This function should
obey all the rules associated with code that runs in a DSR. The
template of the function is given in the
hal_timer_start() starts the
timer running. It counts from the given start value to the end
value and optionally raises an interrupt when the end is
reached. The mode argument is a bit mask of the following values.
- This puts the timer into free-running mode. When the timer reaches the end value, the start value will be reloaded automatically and the timer will run through a new cycle.
This puts the timer into user-defined mode. When the
timer reaches the end value it will not auto reload
the start value but will continue counting beyond that
value. This mode and
HAL_TIMER_MODE_FREEare mutually exclusively.
- This determines whether an interrupt is raised when the timer reaches the end value. Setting this option will cause an interrupt to be raised, and the callback invoked.
hal_timer_stop() disables the
timer, masks the interrupt and otherwise stops the timer
the current value of the timer counter and the function
hal_timer_frequency() returns the input
clock frequency of the selected timer.
The bench test application contains examples of how the timer API is used.
|2020-06-15||eCosPro Non-Commercial Public License|