spinnaker_tools (BMP) latest
SpiNNaker BMP firmware
|
Event handling routines for BMP LPC1768. More...
Macros | |
#define | NUM_EVENTS 16 |
Number of events available for use. | |
Functions | |
void | event_set_byte (uint32_t addr, uint32_t data) |
Set a byte at an address. | |
void | event_init (uint32_t priority) |
Initialise the event processing system. | |
void | proc_queue_add (event_t *e) |
Adds an event to a list of events which can (all) be executed at some later time. | |
void | proc_queue_run (void) |
Execute a list of events (in the order in which they were added to the list). | |
void | TIMER3_IRQHandler (void) |
Interrupt handler for the timer which is handling events. | |
void | event_cancel (event_t *e, uint32_t ID) |
Cancel an event that was previously scheduled. | |
event_t * | event_new (event_proc proc, uint32_t arg1, uint32_t arg2) |
Allocates a new event. | |
void | event_schedule (event_t *e, uint32_t time) |
Schedules an event to occur some time in the future. | |
Variables | |
static event_t * | event_list |
List of free events. | |
static event_t * | event_queue |
List of active events. | |
static event_t * | proc_head |
List of queued "proc" events. | |
static event_t * | proc_tail |
and tail of that list | |
static uint32_t | event_id |
Makes unique ID for active events. | |
static uint32_t | event_count |
Number of events currently in use. | |
static uint32_t | event_max |
Maximum number ever used. | |
static event_t | events [NUM_EVENTS] |
Storage for events. | |
Event handling routines for BMP LPC1768.
void event_set_byte | ( | uint32_t | addr, |
uint32_t | data | ||
) |
Set a byte at an address.
[in] | addr | The address to write at. |
[in] | data | The value to write there. |
void event_init | ( | uint32_t | priority | ) |
Initialise the event processing system.
[in] | priority | Priority to use for the driving timer interrupt |
void proc_queue_add | ( | event_t * | e | ) |
Adds an event to a list of events which can (all) be executed at some later time.
The order of execution is the same as that of addition to the list.
[in] | e | The event to add. |
void proc_queue_run | ( | void | ) |
Execute a list of events (in the order in which they were added to the list).
Events are returned to the free queue after execution.
void TIMER3_IRQHandler | ( | void | ) |
Interrupt handler for the timer which is handling events.
Timer 3 interrupt handler.
Events added to the queue while this interrupt is processing will not be processed until the next time this interrupt is called.
void event_cancel | ( | event_t * | e, |
uint32_t | ID | ||
) |
Cancel an event that was previously scheduled.
The ID that was allocated when the event was created must be given in case the event has already executed and possibly been recycled.
It is potentially quite difficult to cancel an event at the head of the event queue so in this case the "proc" is made NULL and the event left to terminate on the timer interrupt.
[in] | e | The event to cancel. |
[in] | ID | The ID that the event is expected to have. |
event_t * event_new | ( | event_proc | proc, |
uint32_t | arg1, | ||
uint32_t | arg2 | ||
) |
Allocates a new event.
Allocates a new event from the free queue and intialise "proc", "arg1" and "arg2" fields. The "ID", "next" and "time" fields are also set.
[in] | proc | The event handler |
[in] | arg1 | First argument to pass to proc when event fires |
[in] | arg2 | Second argument to pass to proc when event fires |
NULL
if no event can be allocated void event_schedule | ( | event_t * | e, |
uint32_t | time | ||
) |
Schedules an event to occur some time in the future.
[in] | e | The event to schedule |
[in] | time | How many μs in the future to schedule the event firing at |