spinnaker_tools 3.4.0
SpiNNaker API, sark, sc&mp, bmp firmware and build tools
|
Header file describing the SpiNNaker API runtime environment. More...
#include "sark.h"
Go to the source code of this file.
Data Structures | |
struct | diagnostics_t |
diagnostic data available to the application More... | |
Macros | |
#define | SPINN_SYSRAM_BASE SYSRAM_BASE |
System RAM base address. | |
#define | SPINN_SYSRAM_SIZE SYSRAM_SIZE |
System RAM size. | |
#define | SPINN_SDRAM_BASE SDRAM_BASE |
SDRAM base address. | |
#define | SPINN_SDRAM_SIZE SDRAM_SIZE |
SDRAM size. | |
#define | TRUE (0 == 0) |
Boolean true. | |
#define | FALSE (0 != 0) |
Boolean false. | |
#define | SUCCESS (uint) 1 |
Function result: Success. | |
#define | FAILURE (uint) 0 |
Function result: Failure. | |
#define | NULL 0 |
#define | SPIN1_INLINE static __inline __attribute__((always_inline)) |
Typedefs | |
typedef void(* | callback_t) (uint, uint) |
User callback for event handling. | |
Enumerations | |
enum | { NUM_EVENTS = 8 , MC_PACKET_RECEIVED = 0 , DMA_TRANSFER_DONE = 1 , TIMER_TICK = 2 , SDP_PACKET_RX = 3 , USER_EVENT = 4 , MCPL_PACKET_RECEIVED = 5 , FR_PACKET_RECEIVED = 6 , FRPL_PACKET_RECEIVED = 7 } |
event-related parameters More... | |
enum | { DMA_READ = 0 , DMA_WRITE = 1 } |
DMA transfer direction (from core point of view) More... | |
enum | { NO_PAYLOAD = 0 , WITH_PAYLOAD = 1 } |
Spinnaker packet payload presence flag. More... | |
Functions | |
uint | spin1_start (sync_bool sync) |
Begins a simulation by enabling the timer (if called for) and beginning the dispatcher loop. Only returns once told to exit (with spin1_exit()). | |
uint | spin1_start_paused (void) |
Begins a simulation by enabling the timer (if called for) and beginning the dispatcher loop once the system is told (via spin1_resume()) to resume. Only returns once told to exit (with spin1_exit()). | |
void | spin1_exit (uint error) |
Terminates a simulation passing a return code. | |
void | spin1_set_timer_tick_and_phase (uint time, uint phase) |
Set the timer tick rate and phase offset. | |
static void | spin1_set_timer_tick (uint time) |
Set the timer tick rate. No phase offset. | |
uint | spin1_get_simulation_time (void) |
Returns the number of timer periods which have elapsed since the beginning of the simulation. | |
void | spin1_pause (void) |
Pause the simulation on this core. Waits for spin1_resume(). | |
void | spin1_resume (sync_bool sync) |
Resume the simulation on this core that was paused with spin1_pause(). | |
void | spin1_rte (rte_code code) |
Soft-RTEs the core. | |
static void | spin1_delay_us (uint n) |
This function implements a delay measured in microseconds. | |
void | spin1_enable_timer_schedule_proc (void) |
This function enables the use of timer_schedule_proc. | |
void | spin1_callback_on (uint event_id, callback_t cback, int priority) |
Enables a callback for a class of event. | |
void | spin1_callback_off (uint event_id) |
Disables a callback for a class of event. | |
uint | spin1_schedule_callback (callback_t cback, uint arg0, uint arg1, uint priority) |
This function places a cback into the scheduling queue corresponding to its priority. | |
uint | spin1_trigger_user_event (uint arg0, uint arg1) |
This function triggers a USER EVENT, i.e., a software interrupt. | |
uint | spin1_dma_transfer (uint tag, void *system_address, void *tcm_address, uint direction, uint length) |
Initiates a DMA transfer. | |
void | spin1_dma_flush (void) |
Flushes any current transfers in the DMA controller. | |
void | spin1_memcpy (void *dst, void const *src, uint len) |
Directly copies data from src to dst . | |
void | spin1_flush_rx_packet_queue (void) |
Discards all received packets which are yet to be processed. | |
void | spin1_flush_tx_packet_queue (void) |
Flushes the outbound packet queue. | |
uint | spin1_send_packet (uint key, uint data, uint TCR) |
Send a packet. Do not normally call directly; use spin1_send_mc_packet() and spin1_send_fr_packet() instead. | |
static uint | spin1_send_mc_packet (uint key, uint data, uint load) |
This function enqueues a request to send a multicast packet. | |
static uint | spin1_send_fr_packet (uint key, uint data, uint load) |
This function enqueues a request to send a fixed-route packet. | |
static void | spin1_msg_free (sdp_msg_t *msg) |
Frees a received SDP message. | |
static sdp_msg_t * | spin1_msg_get (void) |
Gets an SDP message that has been sent to this core. | |
static uint | spin1_send_sdp_msg (sdp_msg_t *msg, uint timeout) |
Sends an SDP message. | |
SPIN1_INLINE void | spin1_store_barrier (void) |
SPIN1_INLINE void | spin1_memory_barrier (void) |
uint | spin1_irq_disable (void) |
Sets the I bit in the CPSR in order to disable IRQ interrupts to the processor. | |
uint | spin1_fiq_disable (void) |
Sets the F bit in the CPSR in order to disable FIQ interrupts in the processor. | |
uint | spin1_int_disable (void) |
Sets the F and I bits in the CPSR in order to disable FIQ and IRQ interrupts in the processor. | |
void | spin1_mode_restore (uint value) |
Sets the CPSR to the value given in sr , in order to restore the CPSR following a call to spin1_irq_disable(). | |
uint | spin1_get_id (void) |
Returns a global (machine-wide) ID for the processor. | |
uint | spin1_get_core_id (void) |
Returns the core ID. | |
uint | spin1_get_chip_id (void) |
Returns the (machine-wide) chip ID. | |
static void * | spin1_malloc (uint bytes) |
Returns a pointer to a newly-allocated block of memory of size "bytes" in DTCM. | |
static void | spin1_led_control (uint p) |
This function controls LEDs according to an input pattern. | |
static void | spin1_srand (uint seed) |
This function is used to initialize the seed for the pseudo-random number generator. | |
static uint | spin1_rand (void) |
This function generates a pseudo-random 32-bit integer. | |
Variables | |
static const uint | VIC_EVENTS [] |
Match events above to their VIC interrupts. Indices must match! | |
diagnostics_t | diagnostics |
Miscellaneous diagnostic information, available to the application. | |
uchar | leadAp |
lead appl. core has special functions | |
Header file describing the SpiNNaker API runtime environment.
struct diagnostics_t |
diagnostic data available to the application
Data Fields | ||
---|---|---|
uint | exit_code | simulation exit code |
uint | warnings | warnings type bit map |
uint | total_mc_packets | total routed MC packets during simulation |
uint | dumped_mc_packets | total dumped MC packets by the router |
volatile uint | discarded_mc_packets | total discarded MC packets by API |
uint | dma_transfers | total DMA transfers requested |
uint | dma_bursts | total DMA bursts completed |
uint | dma_queue_full | DMA queue full count. |
uint | task_queue_full | task queue full count |
uint | tx_packet_queue_full | transmitter packet queue full count |
uint | user_event_queue_full | user event queue full count |
uint | writeBack_errors | write-back buffer error count |
uint | total_fr_packets | total routed FR packets during simulation |
uint | dumped_fr_packets | total dumped FR packets by the router |
uint | discarded_fr_packets | total discarded FR packets by API |
uint | in_timer_callback | bool which states if currently in timer callback |
uint | number_timer_tic_in_queue | the number of timer tic callbacks in the queue |
uint | largest_number_of_concurrent_timer_tic_overruns | the max number of timer tics callbacks being queued at any time |
uint | total_times_tick_tic_callback_overran | the total number of times the timer tic callback overran |
#define NULL 0 |
Null pointer value
anonymous enum |
event-related parameters
anonymous enum |
anonymous enum |
Begins a simulation by enabling the timer (if called for) and beginning the dispatcher loop. Only returns once told to exit (with spin1_exit()).
[in] | sync | Whether to synchronise with other cores |
uint spin1_start_paused | ( | void | ) |
Begins a simulation by enabling the timer (if called for) and beginning the dispatcher loop once the system is told (via spin1_resume()) to resume. Only returns once told to exit (with spin1_exit()).
void spin1_exit | ( | uint | error | ) |
Terminates a simulation passing a return code.
[in] | error | error exit code |
Set the timer tick rate and phase offset.
[in] | time | The timer tick rate |
[in] | phase | The phase offset |
|
inlinestatic |
Set the timer tick rate. No phase offset.
[in] | time | The timer tick rate |
uint spin1_get_simulation_time | ( | void | ) |
Returns the number of timer periods which have elapsed since the beginning of the simulation.
void spin1_resume | ( | sync_bool | sync | ) |
Resume the simulation on this core that was paused with spin1_pause().
[in] | sync | Whether to synchronise the resume with other cores |
void spin1_rte | ( | rte_code | code | ) |
Soft-RTEs the core.
Sets the CPU into an RTE code and stops the timer.
[in] | code | the error code |
|
inlinestatic |
This function implements a delay measured in microseconds.
The function busy waits to implement the delay.
[in] | n | requested delay (in microseconds) |
void spin1_callback_on | ( | uint | event_id, |
callback_t | cback, | ||
int | priority | ||
) |
Enables a callback for a class of event.
This function sets the given callback to be scheduled on occurrence of the specified event. The priority argument dictates the order in which callbacks are executed by the scheduler.
[in] | event_id | Which event to enable |
[in] | cback | The callback handler |
[in] | priority | The priority of interrupt handling. 0 = non-queueable callback (associated to irq)
|
void spin1_callback_off | ( | uint | event_id | ) |
Disables a callback for a class of event.
This function disables the callback for the specified event.
[in] | event_id | Which event to disable |
uint spin1_schedule_callback | ( | callback_t | cback, |
uint | arg0, | ||
uint | arg1, | ||
uint | priority | ||
) |
uint spin1_dma_transfer | ( | uint | tag, |
void * | system_address, | ||
void * | tcm_address, | ||
uint | direction, | ||
uint | length | ||
) |
Initiates a DMA transfer.
[in] | tag | A label for the transfer. Can be used by DMA complete callback to work out what to do. |
system_address | Address in SDRAM. May be source or destination. Must be word-aligned. | |
tcm_address | Address in TCM. May be source or destination. Must be word-aligned. | |
[in] | direction | Which direction is data being moved in. |
[in] | length | How much data is being moved. Must be a whole number of words. |
void spin1_dma_flush | ( | void | ) |
Flushes any current transfers in the DMA controller.
flushes the hardware queue in the DMA controller, aborts any ongoing transfer in the DMA controller, clears any pending DMA_COMPLETE interrupts in the DMA controller and purges any queued DMA_COMPLETE callbacks in the callback queues. flushes the software DMA queue,
void spin1_memcpy | ( | void * | dst, |
void const * | src, | ||
uint | len | ||
) |
Directly copies data from src
to dst
.
Does not require alignment.
[out] | dst | Where to copy to |
[in] | src | Where to copy from |
[in] | len | Number of bytes to copy |
void spin1_flush_rx_packet_queue | ( | void | ) |
Discards all received packets which are yet to be processed.
Works by calling deschedule() for each queue.
void spin1_flush_tx_packet_queue | ( | void | ) |
Flushes the outbound packet queue.
Works by adjusting the queue pointers to make it appear empty to the consumer
Send a packet. Do not normally call directly; use spin1_send_mc_packet() and spin1_send_fr_packet() instead.
[in] | key | The key of the packet. Determines destinations. |
[in] | data | The payload (if any). |
[in] | TCR | Transmission control. Especially includes the payload-present bit and the packet type. |
This function enqueues a request to send a multicast packet.
If the software buffer is full then a failure code is returned. If the comms controller hardware buffer and the software buffer are empty then the the packet is sent immediately, otherwise it is placed in a queue to be consumed later by cc_tx_empty() interrupt service routine.
[in] | key | packet routing key |
[in] | data | packet payload |
[in] | load | 0 = no payload (ignore data param), 1 = send payload |
This function enqueues a request to send a fixed-route packet.
If the software buffer is full then a failure code is returned. If the comms controller hardware buffer and the software buffer are empty then the the packet is sent immediately, otherwise it is placed in a queue to be consumed later by cc_tx_empty() interrupt service routine.
[in] | key | packet routing key |
[in] | data | packet payload |
[in] | load | 0 = no payload (ignore data param), 1 = send payload |
|
inlinestatic |
Frees a received SDP message.
[in] | msg | The message to free. |
|
inlinestatic |
Gets an SDP message that has been sent to this core.
|
extern |
Sets the I bit in the CPSR in order to disable IRQ interrupts to the processor.
|
extern |
Sets the F bit in the CPSR in order to disable FIQ interrupts in the processor.
|
extern |
Sets the F and I bits in the CPSR in order to disable FIQ and IRQ interrupts in the processor.
|
extern |
Sets the CPSR to the value given in sr
, in order to restore the CPSR following a call to spin1_irq_disable().
[in] | value | value with which to set the CPSR |
uint spin1_get_id | ( | void | ) |
Returns a global (machine-wide) ID for the processor.
uint spin1_get_core_id | ( | void | ) |
Returns the core ID.
uint spin1_get_chip_id | ( | void | ) |
Returns the (machine-wide) chip ID.
|
inlinestatic |
Returns a pointer to a newly-allocated block of memory of size "bytes" in DTCM.
[in] | bytes | size, in bytes, of the requested memory block |
|
inlinestatic |
This function controls LEDs according to an input pattern.
Macros for turning LED number N on, off or inverted are defined in spinnaker.h.
To turn LEDs 0 and 1 on, then invert LED2 and finally turn LED 0 off:
spin1_led_control(LED_ON(0) + LED_ON(1)); spin1_led_control(LED_INV(2)); spin1_led_control(LED_OFF(0));
[in] | p | led control word |
|
inlinestatic |
This function is used to initialize the seed for the pseudo-random number generator.
[in] | seed | The seed for the PRNG |
|
inlinestatic |
This function generates a pseudo-random 32-bit integer.
Taken from "Programming Techniques" ARM document ARM DUI 0021A
|
static |
Match events above to their VIC interrupts. Indices must match!