spinnaker_tools (BMP) latest
SpiNNaker BMP firmware
Loading...
Searching...
No Matches
Macros | Functions | Variables
bmp_event.c File Reference

Event handling routines for BMP LPC1768. More...

#include "lpc17xx.h"
#include "bmp.h"

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_tevent_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_tevent_list
 List of free events.
 
static event_tevent_queue
 List of active events.
 
static event_tproc_head
 List of queued "proc" events.
 
static event_tproc_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.
 

Detailed Description

Event handling routines for BMP LPC1768.

Author
Steve Temple, APT Group, School of Computer Science

Function Documentation

◆ event_set_byte()

void event_set_byte ( uint32_t  addr,
uint32_t  data 
)

Set a byte at an address.

Parameters
[in]addrThe address to write at.
[in]dataThe value to write there.

◆ event_init()

void event_init ( uint32_t  priority)

Initialise the event processing system.

Parameters
[in]priorityPriority to use for the driving timer interrupt

◆ proc_queue_add()

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.

Parameters
[in]eThe event to add.

◆ proc_queue_run()

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.

◆ TIMER3_IRQHandler()

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.

◆ event_cancel()

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.

Parameters
[in]eThe event to cancel.
[in]IDThe ID that the event is expected to have.

◆ event_new()

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.

Parameters
[in]procThe event handler
[in]arg1First argument to pass to proc when event fires
[in]arg2Second argument to pass to proc when event fires
Returns
The allocated event, or NULL if no event can be allocated

◆ event_schedule()

void event_schedule ( event_t e,
uint32_t  time 
)

Schedules an event to occur some time in the future.

Parameters
[in]eThe event to schedule
[in]timeHow many μs in the future to schedule the event firing at