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

Command handling for SC&MP. More...

#include "sark.h"
#include "scamp.h"
#include "spinn_net.h"

Macros

#define SCAMP_ID_STR   "SC&MP/SpiNNaker"
 Version command string for SC&MP.
 

Enumerations

enum  signal_type { SIG_TYPE_MC = 0 , SIG_TYPE_P2P = 1 , SIG_TYPE_NN = 2 }
 The types of messages to use to send signals. More...
 

Functions

uint cmd_nnp (sdp_msg_t *msg)
 Generic nearest-neighbour message injection command handler.
 
uint cmd_ffd (sdp_msg_t *msg)
 Flood fill data command handler.
 
uint cmd_iptag (sdp_msg_t *msg, uint srce_ip)
 IPTag manipulation command handler.
 
uint cmd_ver (sdp_msg_t *msg)
 Version command handler.
 
uint cmd_link_read (sdp_msg_t *msg)
 Link read command handler.
 
uint cmd_link_write (sdp_msg_t *msg)
 Link write command handler.
 
uint cmd_as (sdp_msg_t *msg)
 Application start command handler.
 
uint cmd_ar (sdp_msg_t *msg)
 Application reset command handler.
 
uint cmd_rtr (sdp_msg_t *msg)
 Router control command handler.
 
uint cmd_info (sdp_msg_t *msg)
 General chip information command handler.
 
uint pkt_tx (uint tcr, uint data, uint key)
 Add a SpiNNaker message to the queue of messages to send.
 
uint cmd_sig (sdp_msg_t *msg)
 Signal command handler.
 
uint cmd_alloc (sdp_msg_t *msg)
 Resource allocation command handler.
 
uint cmd_remap (sdp_msg_t *msg)
 Core remap command handler.
 
uint cmd_app_copy_run (sdp_msg_t *msg)
 Copy an application from an adjacent chip, then start it.
 
uint cmd_sync (sdp_msg_t *msg)
 Synchronization of cores handler.
 
uint n_cores_in_state (uint app_id, uint state)
 
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 send_count_response (uint msg_ptr, uint n_sent_packets)
 
uint cmd_count (sdp_msg_t *msg)
 
uint scamp_debug (sdp_msg_t *msg, uint srce_ip)
 General debugging and control command handler.
 

Variables

volatile uint do_sync
 Whether to perform clock synchronization (on by default at start)
 
uint n_beacons_sent
 Time beacon counter.
 
char eth_map [12][12]
 Local ethernet chip locator map.
 
volatile uint p2p_count_result
 Reserved for performing a P2P count operation.
 
volatile uint p2p_count_n_results
 
uint p2p_count_id
 
static uint count_in_progress = 0
 

Detailed Description

Command handling for SC&MP.

Author
Steve Temple, APT Group, School of Computer Science

Enumeration Type Documentation

◆ signal_type

The types of messages to use to send signals.

Enumerator
SIG_TYPE_MC 

Use multicast packets (standard signals)

SIG_TYPE_P2P 

Use P2P packets (state counting)

SIG_TYPE_NN 

Use nearest neighbour packets (flood machine)

Function Documentation

◆ cmd_nnp()

uint cmd_nnp ( sdp_msg_t msg)

Generic nearest-neighbour message injection command handler.

arg1 = key
arg2 = data
arg3 = mark[31] : : fwd : retry
Bit 31 of arg3 causes an ID to be generated
Parameters
[in]msgSCP message
Returns
zero; this command never has any payload in its response

◆ cmd_ffd()

uint cmd_ffd ( sdp_msg_t msg)

Flood fill data command handler.

msg->arg1 = srce_fwd : srce_rty : 00 : ID
msg->arg2 = 00 : blk_num : word_cnt : 00
msg->arg3 = load_addr
msg->buf -> load data
volatile uchar load
The current system load.
Definition scamp-3.c:184
Parameters
[in]msgSCP message
Returns
zero; this command never has any payload in its response

◆ cmd_iptag()

uint cmd_iptag ( sdp_msg_t msg,
uint  srce_ip 
)

IPTag manipulation command handler.

arg1 = flags[11:8] : timeout : command : dest_port : tag
arg2 = dest_addr : port
arg3 = IP
Parameters
[in,out]msgSCP message; will be updated with response code and payload
[in]srce_ipSource IP address (needed in some modes)
Returns
the length of the response payload

◆ cmd_ver()

uint cmd_ver ( sdp_msg_t msg)

Version command handler.

Parameters
[in,out]msgSCP message; will be updated with response code and payload
Returns
the length of the response payload

◆ cmd_link_read()

uint cmd_link_read ( sdp_msg_t msg)

Link read command handler.

Parameters
[in,out]msgSCP message, will be updated with result + payload
Returns
The length of the payload of msg

◆ cmd_link_write()

uint cmd_link_write ( sdp_msg_t msg)

Link write command handler.

Parameters
[in,out]msgSCP message, will be updated with result
Returns
Zero; no payload

◆ cmd_as()

uint cmd_as ( sdp_msg_t msg)

Application start command handler.

Parameters
[in]msgSCP message
Returns
Zero; no payload

◆ cmd_ar()

uint cmd_ar ( sdp_msg_t msg)

Application reset command handler.

Parameters
[in,out]msgSCP message, will be updated with result
Returns
Zero; no payload

◆ cmd_rtr()

uint cmd_rtr ( sdp_msg_t msg)

Router control command handler.

Parameters
[in,out]msgSCP message, will be updated with result + payload
Returns
The length of the payload of msg

◆ cmd_info()

uint cmd_info ( sdp_msg_t msg)

General chip information command handler.

Get information about this chip. Intended to support a host probing the machine for its basic information.

No input arguments expected.

The response will contain arg1-3 as desribed below with an additional data payload indicating the application states of all cores.

  • arg1:
    • Bits 4:0 - The number of working cores (including the monitor)
    • Bits 13:8 - A bitmap of links, 1 if responding correctly to PEEK of Chip ID in system controller, 0 otherwise. This check is performed on demand.
    • Bits 24:14 - The number of routing table entries in the largest free block.
    • Bit 25 - 1 if Ethernet is up, 0 otherwise.
    • Bits 31:26 - Undefined
  • arg2: The size (in bytes) of the largest free block in the SDRAM heap
  • arg3: The size (in bytes) of the largest free block in the SysRAM heap

The data payload consists of (in order):

  • an 18-byte block which gives the cpu_state_e of each application core with byte 0 containing core 0's state and so-on.
  • a short giving the P2P address of the closest chip with an active Ethernet. Note that this is the chip to which SDP packets will be sent to from this chip when they contain a destination address indicating that they should be sent over Ethernet.
  • a 4-byte block containing the IPv4 address of the Ethernet connection on this chip, made up of the 4 segments of the IPv4 address, each between 0 and 255. This might equate to an address of 0.0.0.0 if this chip is not physically connected to the Ethernet port of a board.
Parameters
[in,out]msgSCP message, will be updated with result + payload
Returns
The length of the payload of msg

◆ pkt_tx()

uint pkt_tx ( uint  tcr,
uint  data,
uint  key 
)
extern

Add a SpiNNaker message to the queue of messages to send.

Parameters
[in]tcrControl word
[in]dataPayload word
[in]keyKey word
Returns
True if the packet was correctly enqueued

◆ cmd_sig()

uint cmd_sig ( sdp_msg_t msg)

Signal command handler.

Parameters
[in,out]msgSCP message; will be updated with response code and payload
Returns
the length of the response payload

◆ cmd_alloc()

uint cmd_alloc ( sdp_msg_t msg)

Resource allocation command handler.

Parameters
[in,out]msgSCP message, will be updated with result + payload
Returns
The length of the payload of msg

◆ cmd_remap()

uint cmd_remap ( sdp_msg_t msg)

Core remap command handler.

Parameters
[in,out]msgSCP message, will be updated with result
Returns
Always zero; result never has a payload

◆ cmd_app_copy_run()

uint cmd_app_copy_run ( sdp_msg_t msg)

Copy an application from an adjacent chip, then start it.

Parameters
[in,out]msgSCP message, will be updated with result
Returns
The length of the payload of msg

◆ cmd_sync()

uint cmd_sync ( sdp_msg_t msg)

Synchronization of cores handler.

Parameters
[in,out]msgSCP message, will be updated with result
Returns
Always zero; result never has a payload

◆ return_msg_err()

void return_msg_err ( sdp_msg_t msg,
uint  rc,
uint  extra_size 
)
extern

Adds a result message to the main message queue.

Parameters
[in]msgThe SCP message holding the reply. Ownership transferred by this call.
[in]rcThe return code.
[in]extra_sizeSize over and above error size

◆ return_msg_ok()

void return_msg_ok ( sdp_msg_t msg)
extern

Adds an OK result message to the main message queue.

Parameters
[in]msgThe SCP message holding the reply. Ownership transferred by this call.

◆ scamp_debug()

uint scamp_debug ( sdp_msg_t msg,
uint  srce_ip 
)

General debugging and control command handler.

Delegates to:

based on the sdp_msg_t::cmd_rc contents.

Parameters
[in,out]msgThe SCP message. Will be updated with response.
[in]srce_ipSource IP address. Only used for cmd_iptag()
Returns
the length of the content in the response message. 0 means there's just a header

Variable Documentation

◆ eth_map

char eth_map[12][12]
extern

Local ethernet chip locator map.

Given a P2P address, compute P2P address of chip with Ethernet interface on same PCB. Table is for standard 48-chip boards only. Will work with 4-chip boards - may not work for more exotic combinations! Also computes the position of the chip on the PCB as offset from (0,0)

Each byte in this table is a pair of X,Y values which are subtracted from a P2P address to give the address of the Ethernet-attached chip on the same 48-chip PCB.