spinnaker_tools 3.4.0
SpiNNaker API, sark, sc&mp, bmp firmware and build tools
|
Timer routines for SARK. More...
#include <sark.h>
Functions | |
void | timer2_int_han (void) |
Interrupt handler for timer 2. Delegates to timer2_int() | |
void | event_register_timer (vic_slot slot) |
Register the use of the second timer on the core so that it can be used to provide delayed events via timer_schedule(). | |
void | timer_schedule (event_t *e, uint time) |
Schedule an event to occur at some time in the future. | |
uint | timer_schedule_proc (event_proc proc, uint arg1, uint arg2, uint time) |
Allocates an event, initialises it with the supplied parameters and schedules it to occur at some time in the future. | |
void | timer_cancel (event_t *e, uint ID) |
Cancel a timer event that was previously scheduled. | |
void | timer_cancel_init (void) |
Initialise a statically allocated event to be used in place of an event that is cancelled at the head of the timer queue. | |
void | timer2_int (void) |
Interrupt handler for the timer which is handling timers. | |
Variables | |
static event_t | cancelled |
placeholder for events cancelled @ timer_queue head | |
Timer routines for SARK.
void event_register_timer | ( | vic_slot | slot | ) |
Register the use of the second timer on the core so that it can be used to provide delayed events via timer_schedule().
A runtime error will occur if the VIC slot is already in use.
slot | the VIC slot to use for the timer interrupt |
Schedule an event to occur at some time in the future.
Requires that (hardware) TIMER2 has been set up by a call to timer_register()
e->next == NULL e->time == 0
e | event to execute |
time | delay in microseconds (non-zero) |
uint timer_schedule_proc | ( | event_proc | proc, |
uint | arg1, | ||
uint | arg2, | ||
uint | time | ||
) |
Allocates an event, initialises it with the supplied parameters and schedules it to occur at some time in the future.
Requires that the second timer has been set up by a call to timer_register()
proc | pointer to an event_proc |
arg1 | argument 1 to the event_proc |
arg2 | argument 2 to the event_proc |
time | delay in microseconds (non-zero) |
Cancel a timer event that was previously scheduled.
The ID that was allocated when the timer was created must be given in case the timer has already executed and the event has possibly been recycled. This means that a timer event which may be cancelled must be allocated by event_new(), the ID noted and the event then scheduled with timer_schedule().
It is potentially quite difficult to cancel a timer at the head of the timer queue so in that case the timer is replaced with a placeholder with "proc" set to NULL and the placeholder is left to terminate on the timer interrupt.
e | event to cancel |
ID | ID of event to cancel |
void timer_cancel_init | ( | void | ) |
Initialise a statically allocated event to be used in place of an event that is cancelled at the head of the timer queue.
It is potentially quite difficult to cancel a timer at the head of the timer queue so in that case the timer is replaced with a placeholder with "proc" set to NULL and the placeholder is left to terminate on the timer interrupt.