spinnaker_tools 3.4.0
SpiNNaker API, sark, sc&mp, bmp firmware and build tools
Loading...
Searching...
No Matches
Functions | Variables
sark_timer.c File Reference

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
 

Detailed Description

Timer routines for SARK.

Author
Steve Temple, APT Group, School of Computer Science

Function Documentation

◆ event_register_timer()

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.

Parameters
slotthe VIC slot to use for the timer interrupt

◆ timer_schedule()

void timer_schedule ( event_t e,
uint  time 
)

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()

Note
this procedure assumes the following event conditions on entry:
e->next == NULL
e->time == 0
Parameters
eevent to execute
timedelay in microseconds (non-zero)

◆ timer_schedule_proc()

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()

Parameters
procpointer to an event_proc
arg1argument 1 to the event_proc
arg2argument 2 to the event_proc
timedelay in microseconds (non-zero)
Returns
zero: if allocation of new event failed, one otherwise

◆ timer_cancel()

void timer_cancel ( event_t e,
uint  ID 
)

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.

Parameters
eevent to cancel
IDID of event to cancel

◆ timer_cancel_init()

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.