spinnaker_tools 3.4.0
SpiNNaker API, sark, sc&mp, bmp firmware and build tools
|
SC&MP - Spinnaker Control & Monitor Program. More...
#include "sark.h"
#include "scamp.h"
#include "spinn_net.h"
#include "spinn_phy.h"
#include "spinn_regs.h"
#include <string.h>
Macros | |
#define | LIVENESS_FLASH_INTERVAL 256 |
#define | LIVENESS_FLASH_SPACING 5 |
#define | LOAD_FRAC_BITS 1 |
#define | PWM_BITS 4 |
#define | MINIMUM_PINGS_RECEIVED 60 |
The minimum number of packets we expect to receive over P2P or MC. | |
#define | P2PB_DIVISOR 8192 |
Division to apply to n_chips to work out the repeats. | |
#define | TX_NOT_FULL_MASK 0x10000000 |
Mask to recognise the Comms Controller "not full" flag. | |
Functions | |
void | pkt_mc_int (void) |
Interrupt handlers for multicast. | |
void | test_mc_int (void) |
void | send_nn_netinit (uint netinit_phase) |
void | p2pc_reth_nn_send (uint, uint) |
Transmit our address back to an Ethernet. | |
void | iptag_timer (void) |
Update timeouts in IPTags. | |
uint | iptag_new (void) |
Find a free IPTag. | |
uint | transient_tag (uchar *ip, uchar *mac, uint port, uint timeout) |
Get and initialise a transient IPTag, used for later handling replies to a request. | |
void | queue_init (void) |
Initialise the packet transmission queue. | |
void | proc_byte_set (uint a1, uint a2) |
Write a byte at a location. | |
void | proc_word_set (uint a1, uint a2) |
Write a word at a location. | |
void | proc_route_msg (uint arg1, uint srce_ip) |
Main message dispatcher. | |
void | msg_queue_insert (sdp_msg_t *msg, uint srce_ip) |
Adds a message to SCAMP's master message queue, to be processed by proc_route_msg(). | |
uint | pkt_tx (uint tcr, uint data, uint key) |
Add a SpiNNaker message to the queue of messages to send. | |
static uint | wait_for_cc (void) |
uint | pkt_tx_wait (uint tcr, uint data, uint key) |
static void | timer1_init (uint count) |
Initialise the primary timer to count down. | |
void | eth_discard (void) |
Release the currently received Ethernet packet's buffer. | |
void | udp_pkt (uchar *rx_pkt, uint rx_len) |
Handle a received UDP packet. | |
void | eth_receive (void) |
Receive and handle all pending ethernet packets. | |
void | eth_send_msg (uint tag, sdp_msg_t *msg) |
Send an SDP message to the outside world via ethernet using an IPTag to say where to go. | |
uint | shm_ping (uint dest) |
Ping an application core to see if it is alive. | |
uint | shm_send_msg (uint dest, sdp_msg_t *msg) |
Send an SDP message to an application core. | |
void | swap_sdp_hdr (sdp_msg_t *msg) |
Swap source and destination in an SDP message. This allows us to use a message (buffer) as its own reply. | |
void | return_msg_err (sdp_msg_t *msg, uint rc, uint extra_size) |
Adds a result message to the main message queue. | |
void | return_msg_ok (sdp_msg_t *msg) |
Adds an OK result message to the main message queue. | |
void | assign_virt_cpu (uint phys_cpu) |
Build virtual/physical CPU maps. | |
void | remap_phys_cores (uint phys_cores) |
Disables a specified core and recomputes the virtual core map accordingly. | |
uint | ram_size (void *mem) |
Determine the size of RAM. | |
void | get_board_info (void) |
Get board information from SROM. | |
void | sv_init (void) |
Initialise the System Variables area. | |
void | sdram_init (void) |
Initialise SDRAM (controller and critical pointers into it) | |
void | random_init (void) |
Initialise the SARK PRNG. | |
void | update_load (uint arg1, uint arg2) |
Update the 'load' variable with an estimate of the system's load. | |
void | proc_1hz (uint a1, uint a2) |
Regular 1Hz timer callback, put on the event queue every second. | |
void | soft_wdog (uint max) |
Software watchdog check. | |
uint | n_addr (uint link) |
uint | opp_link (uint link) |
void | init_link_en_nn () |
Initialise inter-chip link state bitmap. | |
static void | send_link_checks_pp () |
static void | send_link_checks_mc () |
static void | final_link_checks () |
static void | setup_link_checks () |
Set up for link checking. | |
static void | disable_unidirectional_links (void) |
Disable links that have been disabled by neighbours. | |
void | netinit_start (void) |
Start the higher-level network initialisation process. | |
void | compute_st (void) |
Sets up a broadcast MC route by constructing a spanning tree of the P2P routes constructed routing back to chip used to boot the machine (see p2p_root). | |
static uint | netinit_biff_barrier () |
void | proc_100hz (uint a1, uint a2) |
Regular 100Hz timer callback, put on the event queue every 10ms. | |
void | proc_1khz (uint a1, uint a2) |
Regular 1kHz timer callback, put on the event queue every millisecond. | |
static uint | pll_mult (uint freq) |
Get the PLL multiplier for a frequency. | |
void | pll_init (void) |
Initialise PLLs. | |
void | eth_setup (void) |
Set up the ethernet (if present) | |
void | jtag_init (void) |
Initialise JTAG support. | |
void | sark_config (void) |
Initialise SARK. | |
void | delegate (void) |
Delegate acting as a monitor to another core. | |
void | chk_bl_del (void) |
Check for problems in blacklist and delegate if necessary. | |
void | c_main (void) |
Main entry point. | |
Board information flood fill | |
void | send_nn_links (uint links_enabled) |
Variables | |
uint | num_cpus |
Number of operational CPUs. | |
uint | ping_cpu = 1 |
Which application CPU to ping next in soft_wdog() | |
uchar | v2p_map [MAX_CPUS] |
Virtual-core-ID to physical-core-ID map. | |
uint | p2p_addr = 0 |
Our P2P address. | |
uint | p2p_dims = 0 |
Dimensions of the P2P-addressable area. | |
uint | p2p_root = 0 |
The address of the P2P root. | |
uint | p2p_up = 0 |
Whether the P2P system is operational or still needs to be initialised. | |
uint | ltpc_timer |
Counter used to decide when to send an LTPC packet. | |
uint | link_en = 0x3f |
Bitmap of enabled links. | |
srom_data_t | srom |
Copy of SROM struct. | |
pkt_queue_t | tx_pkt_queue |
Packet transmit queue. | |
uchar | watchdog [20] |
Watchdog counters. | |
iptag_t | tag_table [TAG_TABLE_SIZE] |
Table of all IPTags. | |
uint | tag_tto = 9 |
IPTag timeout (logarithmic) | |
enum netinit_phase_e | netinit_phase |
The network initialisation process phase currently in progress. | |
enum ethinit_phase_e | ethinit_phase |
The Ethernet initialisation process phase currently in progress. | |
volatile uint | ticks_since_last_p2pc_new |
Number of 10ms ticks ellapsed since the last P2PC_NEW arrived. | |
volatile uint | ticks_since_last_p2pc_dims |
Number of 10ms ticks ellapsed since the last P2PC_DIMS arrived. | |
uchar * | p2p_addr_table = NULL |
volatile uchar | load = 0 |
The current system load. | |
volatile uint | disp_load = 0 << LOAD_FRAC_BITS |
The actual, displayed load value (fixed point). | |
volatile uint | do_sync = 1 |
Whether to perform clock synchronization (on by default at start) | |
volatile uint | mc_ping_count [NUM_LINKS] |
Reserved for performing MC and P2P pings. | |
volatile uint | pp_ping_count [NUM_LINKS] |
Reserved for performing P2P pings. | |
uint | opposite_link [NUM_LINKS] |
uint | ping_addr [NUM_LINKS] |
static uint | x |
The x coordinate of this chip. | |
static uint | y |
The y coordinate of this chip. | |
static uint | w |
The width of the machine. | |
static uint | h |
The height of the machine. | |
static uint | p2pb_repeats |
The count of p2pb repeats to go. | |
static uint | p2pb_period |
The total time over which p2pb will be sent. | |
static uint | n_biff_words |
Counter of how many more BIFF words need to be sent. | |
static uint * | next_biff_word |
Pointer to the next BIFF word to send. | |
const signed char | dx [6] = { 1, 1, 0, -1, -1, 0} |
X deltas, by link ID. | |
const signed char | dy [6] = { 0, 1, 1, 0, -1, -1} |
Y deltas, by link ID. | |
static uint | netinit_biff_tick_counter = 0 |
volatile uint | neighbour_netinit_level [NUM_LINKS] |
neighbour over link netinit level | |
volatile uint | neighbour_links_enabled [NUM_LINKS] |
neighbour over link links enabled | |
const uint | rst_init [] |
Reset vectors. | |
P2P Address Guess | |
During NETINIT_PHASE_P2P_ADDR, the current best guess of P2P address.
| |
volatile int | p2p_addr_guess_x |
X coordinate of the current best guess of P2P address. | |
volatile int | p2p_addr_guess_y |
Y coordinate of the current best guess of P2P address. | |
P2P Dimension Guess | |
During NETINIT_PHASE_P2P_DIMS, records the current best guess of the system's dimensions. | |
volatile int | p2p_min_x |
Estimated minimum X size. | |
volatile int | p2p_max_x |
Estimated maximum X size. | |
volatile int | p2p_min_y |
Estimated minimum Y size. | |
volatile int | p2p_max_y |
SC&MP - Spinnaker Control & Monitor Program.
#define LIVENESS_FLASH_INTERVAL 256 |
Interval between flashing the LEDs when displaying load to indicate chip liveness in 10ms units
#define LIVENESS_FLASH_SPACING 5 |
Spacing between flashing adjacent chips when indicating liveness in 10ms units
#define LOAD_FRAC_BITS 1 |
The number of fractional bits to use for the internal representation of the load. The more bits, the longer the displayed load will take to catch up with the actual load.
#define PWM_BITS 4 |
The number of bits to use for the PWM generator. The larger this is, the greater the resolution of the brightness but the more flicker-y it will look.
|
extern |
Interrupt handlers for multicast.
Interrupt handlers for multicast.
Transmit our address back to an Ethernet.
eth | The Ethernet address to send to |
arg2 | unused |
uint iptag_new | ( | void | ) |
Find a free IPTag.
Get and initialise a transient IPTag, used for later handling replies to a request.
[in] | ip | IP address of the requesting host |
[in] | mac | MAC address that the ethernet packet came from |
[in] | port | UDP port of the requesting host's socket |
[in] | timeout | log2 of how long the tag should last for |
Write a byte at a location.
[in] | a1 | The location to write |
[in] | a2 | The byte to write there |
Write a word at a location.
[in] | a1 | The location to write |
[in] | a2 | The byte to write there |
Main message dispatcher.
[in] | arg1 | SDP message. This function will free this message! |
[in] | srce_ip | Source IP address for message (where known). |
Adds a message to SCAMP's master message queue, to be processed by proc_route_msg().
[in] | msg | The message to dispatch. Transfers ownership of the message. |
[in] | srce_ip | Source IP address (if meaningful). |
Add a SpiNNaker message to the queue of messages to send.
[in] | tcr | Control word |
[in] | data | Payload word |
[in] | key | Key word |
|
static |
Initialise the primary timer to count down.
[in] | count | What value should be counted down from. |
void eth_discard | ( | void | ) |
Release the currently received Ethernet packet's buffer.
After calling this, the received packet is unsafe to access!
Handle a received UDP packet.
[in] | rx_pkt | The UDP packet, including the IP header. Note that this pointer is only half-word aligned! |
[in] | rx_len | The length of the packet in rx_pkt |
void eth_receive | ( | void | ) |
Receive and handle all pending ethernet packets.
Delegates the handling of received messages to:
Send an SDP message to the outside world via ethernet using an IPTag to say where to go.
Should only be invoked on cores with an ethernet connection
[in] | tag | The tag, contains information about the message destination (IP address, UDP port, MAC address, etc.) |
[in] | msg | The SDP message to send |
Ping an application core to see if it is alive.
[in] | dest | The destination virtual core ID |
Send an SDP message to an application core.
[in] | dest | The destination virtual core ID |
[in] | msg | The message to send. |
void swap_sdp_hdr | ( | sdp_msg_t * | msg | ) |
Swap source and destination in an SDP message. This allows us to use a message (buffer) as its own reply.
[in,out] | msg | The message to modify. |
Adds a result message to the main message queue.
[in] | msg | The SCP message holding the reply. Ownership transferred by this call. |
[in] | rc | The return code. |
[in] | extra_size | Size over and above error size |
void return_msg_ok | ( | sdp_msg_t * | msg | ) |
Adds an OK result message to the main message queue.
[in] | msg | The SCP message holding the reply. Ownership transferred by this call. |
void assign_virt_cpu | ( | uint | phys_cpu | ) |
Build virtual/physical CPU maps.
Caller is monitor processor and passes its physical CPU.
[in] | phys_cpu | What our physical CPU number is. |
void remap_phys_cores | ( | uint | phys_cores | ) |
Disables a specified core and recomputes the virtual core map accordingly.
This command has a number of dangerous effects:
[in] | phys_cores | Bitmap of which cores to remap. |
uint ram_size | ( | void * | mem | ) |
Determine the size of RAM.
[in] | mem | The start of the memory. Will be written to. |
Update the 'load' variable with an estimate of the system's load.
arg1 | unused |
arg2 | unused |
Regular 1Hz timer callback, put on the event queue every second.
It handles network physical state monitoring.
a1 | unused |
a2 | unused |
void soft_wdog | ( | uint | max | ) |
Software watchdog check.
[in] | max | Number of pings of a CPU (without reply) when that CPU should be marked as watchdogged. |
void netinit_start | ( | void | ) |
Start the higher-level network initialisation process.
Must be called only once, before the nearest neighbour interrupt handler is enabled.
Regular 100Hz timer callback, put on the event queue every 10ms.
Handles:
a1 | unused |
a2 | unused |
Regular 1kHz timer callback, put on the event queue every millisecond.
Used to PWM the LEDs.
a1 | unused |
a2 | unused |
Get the PLL multiplier for a frequency.
[in] | freq | The desired frequency (in MHz) |
uint tag_tto = 9 |
IPTag timeout (logarithmic)
2.56s = 10ms * (1 << (9-1))
volatile int p2p_max_y |
Estimated maximum Y size
A bitmap giving the coordinates of all P2P coordinates which have been seen mentioned in a P2PC_NEW message. A 2D array of bits whose bit indexes are ((bx<<9) | by)
where bx
and by
are x + 256
and y + 256
respectively.
volatile uchar load = 0 |
The current system load.
The LED brightness smoothly will track this value (when in load-tracking mode). 0 = idle, 255 = saturated.
volatile uint disp_load = 0 << LOAD_FRAC_BITS |
The actual, displayed load value (fixed point).
This value tracks the load value above, transitioning smoothly towards it over time.
const uint rst_init[] |
Reset vectors.