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

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.
 

Detailed Description

Spinnaker hardware/peripheral support routines.

Author
Steve Temple, APT Group, School of Computer Science

Function Documentation

◆ sark_vic_init()

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.

◆ sark_vic_set()

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.

Parameters
slotthe slot to be used
interruptthe interrupt number (0..31)
enablenon-zero if the interrupt should be enabled
handlerpointer to the handler code

◆ v2p_mask()

uint v2p_mask ( uint  virt_mask)

Given a bit mask of virtual core IDs, returns a mask of the corresponding physical core IDs.

(Unlikely to be used by application code).

Parameters
virt_maskvirtual core bit mask
Returns
physical core bit mask

◆ get4()

static uint get4 ( const uint word,
uint  index 
)
static

Extracts value from packed array of 4-bit unsigned integers.

Parameters
[in]wordThe array
[in]indexThe index, as if the array isn't packed.
Returns
the value, in range 0–15

◆ sark_led_init()

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)

◆ sark_led_set()

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...

#define LED_OFF(n)
Turn LED off.
Definition sark.h:372
void sark_led_set(uint leds)
Controls one or more of the LEDs attached to the SpiNNaker chip.
Definition sark_hw.c:146
#define LED_ON(n)
Turn LED on.
Definition sark.h:371
Parameters
ledsencoded value specifying LEDs and operations thereon

◆ pl340_init()

uint pl340_init ( uint  mem_clk)

Initialises the PL340 memory controller.

(Extremely unlikely to be used by application code.)

Parameters
[in]mem_clkmemory clock speed in MHz
Returns
0 on failure, 1 on success

◆ rtr_mc_clear()

uint rtr_mc_clear ( uint  start,
uint  count 
)

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.

Parameters
startfirst entry to be cleared
countnumber of entries to be cleared
Returns
1 if OK, 0 on failure (last entry out of range)

◆ rtr_mc_init()

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.

Parameters
startfirst entry to clear - usually 0 or 1

◆ rtr_mc_load()

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.

Parameters
[in]epointer to first entry in table
[in]countsize of table (or 0 to use count from table)
[in]offsetadded to entry numbers from table
[in]app_idsets app_id in table if non-zero
Returns
1 if successful, 0 on failure (count or entry out of range)

◆ rtr_mc_set()

uint rtr_mc_set ( uint  entry,
uint  key,
uint  mask,
uint  route 
)

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.

Parameters
[in]entrythe router entry number (should be in range 0..1023)
[in]keythe key field
[in]maskthe mask field
[in]routethe route field
Returns
1 on success, 0 on failure (entry out of range)

◆ rtr_mc_get()

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.

Parameters
[in]entrynumber of entry
[out]rpointer to rtr_entry_t
Returns
1 on success, 0 on failure (entry out of range)

◆ rtr_fr_set()

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.

Parameters
routefixed-route mask (bottom 24 bits)

◆ rtr_fr_get()

uint rtr_fr_get ( void  )

Gets the fixed-route register from the router and masks off the top 8 bits.

Returns
Value of router FR register (bottom 24 bits only)

◆ rtr_p2p_init()

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

◆ rtr_p2p_set()

void rtr_p2p_set ( uint  entry,
uint  value 
)

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

Parameters
[in]entrythe entry number in the range 0..65535
[in]valuethe value to be written in the range 0..7

◆ rtr_p2p_get()

uint rtr_p2p_get ( uint  entry)

Gets a P2P table entry.

Parameters
entrythe entry number in the range 0..65535
Returns
table entry (range 0 to 7)

◆ rtr_diag_init()

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

Parameters
tablepointer to table of 16 initialisation words

◆ rtr_init()

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

Parameters
monitorphysical core ID of monitor processor

Variable Documentation

◆ pl340_data

const ushort pl340_data[]
static
Initial value:
= {
0x0006,
0x0001,
0x0002,
0x0007,
0x000A,
0x0003,
0x0275,
0x0003,
0x0002,
0x0003,
0x0001,
0x0005,
0x0017,
0x0014
}

PL340 SDRAM controller configuration data.

◆ dgf_init

const uint dgf_init[]
static
Initial value:
= {
0x01fe7cf1,
0x01febcf1,
0x01fe7cf2,
0x01febcf2,
0x01fe7cf4,
0x01febcf4,
0x01fe7cf8,
0x01febcf8,
0x0001fcf1,
0x0001fcf2,
0x0001fcf4,
0x0001fcf8,
0x00000000,
0x00000000,
0x00000000,
0x00000000
}

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.