Cycle timers are callbacks that will be called when "when" cycle is reached these timers are one shots, then get cleared if the timer function returns zero, they get reset if the callback function returns a new cycle number.
More...
|
struct | avr_cycle_timer_slot_t |
| Each timer instance contains the absolute cycle number they are hoping to run at, a function pointer to call and a parameter. More...
|
|
struct | avr_cycle_timer_pool_t |
| Timer pool contains a pool of timer slots available, they all start queued into the 'free' qeueue, are migrated to the 'active' queue when needed and are re-queued to the free one when done. More...
|
|
|
void | avr_cycle_timer_register (struct avr_t *avr, avr_cycle_count_t when, avr_cycle_timer_t timer, void *param) |
| register for calling 'timer' in 'when' cycles More...
|
|
void | avr_cycle_timer_register_usec (struct avr_t *avr, uint32_t when, avr_cycle_timer_t timer, void *param) |
| register a timer to call in 'when' usec More...
|
|
void | avr_cycle_timer_cancel (struct avr_t *avr, avr_cycle_timer_t timer, void *param) |
| cancel a previously set timer More...
|
|
avr_cycle_count_t | avr_cycle_timer_status (struct avr_t *avr, avr_cycle_timer_t timer, void *param) |
| Check to see if a timer is present, if so, return the number (+1) of cycles left for it to fire, and if not present, return zero. More...
|
|
avr_cycle_count_t | avr_cycle_timer_process (struct avr_t *avr) |
|
void | avr_cycle_timer_reset (struct avr_t *avr) |
|
Cycle timers are callbacks that will be called when "when" cycle is reached these timers are one shots, then get cleared if the timer function returns zero, they get reset if the callback function returns a new cycle number.
The implementation maintains a list of 'pending' timers, sorted by when they should run, it allows very quick comparison with the next timer to run, and quick removal of then from the pile once dispatched.
#define MAX_CYCLE_TIMERS 64 |
Timer pool contains a pool of timer slots available, they all start queued into the 'free' qeueue, are migrated to the 'active' queue when needed and are re-queued to the free one when done.
Each timer instance contains the absolute cycle number they are hoping to run at, a function pointer to call and a parameter.
it will NEVER be the exact cycle specified, as each instruction is not divisible and might take 2 or more cycles anyway.
However if there was a LOT of cycle lag, the timer migth be called repeteadly until it 'caches up'.
cancel a previously set timer
register for calling 'timer' in 'when' cycles
void avr_cycle_timer_register_usec |
( |
struct avr_t * |
avr, |
|
|
uint32_t |
when, |
|
|
avr_cycle_timer_t |
timer, |
|
|
void * |
param |
|
) |
| |
register a timer to call in 'when' usec
void avr_cycle_timer_reset |
( |
struct avr_t * |
avr | ) |
|
Check to see if a timer is present, if so, return the number (+1) of cycles left for it to fire, and if not present, return zero.