spinnaker_tools 3.4.0
SpiNNaker API, sark, sc&mp, bmp firmware and build tools
|
Spinnaker hardware/peripheral support routines. More...
#include <sark.h>
Functions | |
void | null_int_han (void) |
The interrupt handler that does absolutely nothing at all. | |
void | vic_error (void) |
Used to indicate that the VIC has not been configured. Triggers an RTE. | |
void | sark_vic_init (void) |
Performs a full software initialisation of the VIC. | |
void | sark_vic_set (vic_slot slot, uint interrupt, uint enable, int_handler handler) |
Initialises one of the VIC slots to set up an interrupt handler. | |
uint | v2p_mask (uint virt_mask) |
Given a bit mask of virtual core IDs, returns a mask of the corresponding physical core IDs. | |
static uint | get4 (const uint *word, uint index) |
Extracts value from packed array of 4-bit unsigned integers. | |
void | sark_led_init (void) |
Initialises the hardware (GPIO port) which drives the LEDs attached to the SpiNNaker chip. | |
void | sark_led_set (uint leds) |
Controls one or more of the LEDs attached to the SpiNNaker chip. | |
uint | pl340_init (uint mem_clk) |
Initialises the PL340 memory controller. | |
uint | rtr_mc_clear (uint start, uint count) |
Initialises a set of the router's multicast (MC) table registers so that routing is disabled. | |
void | rtr_mc_init (uint start) |
Initialises the router's multicast (MC) tables and sets up the data structures for allocating router entries. | |
uint | rtr_mc_load (rtr_entry_t *e, uint count, uint offset, uint app_id) |
Load router MC table from a table in memory. | |
uint | rtr_mc_set (uint entry, uint key, uint mask, uint route) |
Sets a given entry in the router MC table. | |
uint | rtr_mc_get (uint entry, rtr_entry_t *r) |
Gets a given entry in the router MC table. | |
void | rtr_fr_set (uint route) |
Sets the fixed-route register in the router. | |
uint | rtr_fr_get (void) |
Gets the fixed-route register from the router and masks off the top 8 bits. | |
void | rtr_p2p_init (void) |
Initialise the router point-to-point (P2P) table. | |
void | rtr_p2p_set (uint entry, uint value) |
Sets a P2P table entry. | |
uint | rtr_p2p_get (uint entry) |
Gets a P2P table entry. | |
void | rtr_diag_init (const uint *table) |
Initialises the 16 diagnostic registers in the router using the supplied table (which should have 16 entries). | |
void | rtr_init (uint monitor) |
Performs a full initialisation of the router. | |
Variables | |
static const ushort | pl340_data [] |
PL340 SDRAM controller configuration data. | |
static const uint | dgf_init [] |
Default router diagnostic configuration. | |
Spinnaker hardware/peripheral support routines.
void sark_vic_init | ( | void | ) |
Performs a full software initialisation of the VIC.
All interrupts are disabled and all vector entries are initialised to a disabled state. The default handler address is set to point to a return from interrupt instruction.
void sark_vic_set | ( | vic_slot | slot, |
uint | interrupt, | ||
uint | enable, | ||
int_handler | handler | ||
) |
Initialises one of the VIC slots to set up an interrupt handler.
No check is made that the slot is not already in use. The slot can be SLOT_FIQ in which case the FIQ interrupt is set up.
slot | the slot to be used |
interrupt | the interrupt number (0..31) |
enable | non-zero if the interrupt should be enabled |
handler | pointer to the handler code |
Given a bit mask of virtual core IDs, returns a mask of the corresponding physical core IDs.
(Unlikely to be used by application code).
virt_mask | virtual core bit mask |
Extracts value from packed array of 4-bit unsigned integers.
[in] | word | The array |
[in] | index | The index, as if the array isn't packed. |
void sark_led_init | ( | void | ) |
Initialises the hardware (GPIO port) which drives the LEDs attached to the SpiNNaker chip.
(Unlikely to be used by application code)
void sark_led_set | ( | uint | leds | ) |
Controls one or more of the LEDs attached to the SpiNNaker chip.
The argument should be a sum of calls to macros LED_ON, LED_OFF, LED_INV which turn on, turn off or flip a LED. The argument to each macro is the LED number, an integer starting at zero. All SpiNNaker boards to date have at least one LED so LED_ON(0) will always work!
To turn on LED 1 and turn off LED 2 the call looks like this...
leds | encoded value specifying LEDs and operations thereon |
Initialises the PL340 memory controller.
(Extremely unlikely to be used by application code.)
[in] | mem_clk | memory clock speed in MHz |
Initialises a set of the router's multicast (MC) table registers so that routing is disabled.
Because some of the MC hardware registers are not readable, copies of these registers are kept in memory to allow them to be read back. These copies are also initialised here. The entries in the router are disabled by setting route and mask to zero and the key to all ones.
start | first entry to be cleared |
count | number of entries to be cleared |
void rtr_mc_init | ( | uint | start | ) |
Initialises the router's multicast (MC) tables and sets up the data structures for allocating router entries.
Because some of the MC hardware registers are not readable, copies of these registers are kept in memory to allow them to be read back. These copies are also initialised here. All entries in the router are disabled (route and mask set to zero and key set to all ones). The start parameter allows some low entries to be left unchanged.
start | first entry to clear - usually 0 or 1 |
uint rtr_mc_load | ( | rtr_entry_t * | e, |
uint | count, | ||
uint | offset, | ||
uint | app_id | ||
) |
Load router MC table from a table in memory.
Within the table, which is an array of "rtr_entry_t". the "next" field holds the entry number to be loaded. If the count parameter is zero, the count is taken from the "free" field of the first entry entry in the table. The offset parameter is added to the entry number to address each router table entry. The "app_id" parameter sets the app_id in the router table copy if non-zero. Otherwise it will be taken from SARK.
[in] | e | pointer to first entry in table |
[in] | count | size of table (or 0 to use count from table) |
[in] | offset | added to entry numbers from table |
[in] | app_id | sets app_id in table if non-zero |
Sets a given entry in the router MC table.
The supplied route is based on virtual core numbers and this is mapped into physical core numbers before being written to the router. Copies of all three router registers are also maintained in memory so that they can be read back even though the router hardware doesn't support reading of key and mask registers.
[in] | entry | the router entry number (should be in range 0..1023) |
[in] | key | the key field |
[in] | mask | the mask field |
[in] | route | the route field |
uint rtr_mc_get | ( | uint | entry, |
rtr_entry_t * | r | ||
) |
Gets a given entry in the router MC table.
The parameter r
is a pointer to a rtr_entry_t structure. The router register fields in the struct are filled in from the RAM copy of the router registers which is maintained by the system.
[in] | entry | number of entry |
[out] | r | pointer to rtr_entry_t |
void rtr_fr_set | ( | uint | route | ) |
Sets the fixed-route register in the router.
Only the lower 24 bits are used as the register has bits with another function in its top 8 bits.
route | fixed-route mask (bottom 24 bits) |
uint rtr_fr_get | ( | void | ) |
Gets the fixed-route register from the router and masks off the top 8 bits.
void rtr_p2p_init | ( | void | ) |
Initialise the router point-to-point (P2P) table.
All 64K entries are set to 6. (Unlikely to be used by application code).
Sets a P2P table entry.
The value should be in the range 0 to 7. Values from 0 to 5 cause the packet to be routed to one of the external links while 7 causes the packet to be sent to the monitor processor. The value 6 causes the packet to be dropped. (Unlikely to be used by application code).
[in] | entry | the entry number in the range 0..65535 |
[in] | value | the value to be written in the range 0..7 |
Gets a P2P table entry.
entry | the entry number in the range 0..65535 |
void rtr_diag_init | ( | const uint * | table | ) |
Initialises the 16 diagnostic registers in the router using the supplied table (which should have 16 entries).
The count registers are first disabled and cleared, the new register values set and and then the counters are enabled. (Unlikely to be used by application code).
table | pointer to table of 16 initialisation words |
void rtr_init | ( | uint | monitor | ) |
Performs a full initialisation of the router.
Calls rtr_mc_init(), rtr_p2p_init() and rtr_diag_init() and also sets the router control register. The control register Wait1 field is set to 0x40 and the Wait2 field is set to 0x00. The initialisation of the diagnostic registers places 'useful' values in 12 of the registers and leaves 4 (numbers 12 to 15) free for applications. (Unlikely to be used by application code).
monitor | physical core ID of monitor processor |
|
static |
PL340 SDRAM controller configuration data.
|
static |
Default router diagnostic configuration.
Counter 0: local multicast packets
Counter 1: non-local multicast packets
Counter 2: local peer-to-peer packets
Counter 3: non-local peer-to-peer packets
Counter 4: local nearest-neighbour packets
Counter 5: non-local nearest-neighbour packets
Counter 6: local fixed-route packets
Counter 7: non-local fixed-route packets
Counter 8: dumped multicast packets
Counter 9: dumped peer-to-peer packets
Counter 10: dumped nearest-neighbour packets
Counter 11: dumped fixed-route packets
Counters 12–15 are turned off by default and are fully available for users.