39#define SDP_TIMEOUT 100
43#define MESSAGE_DELAY_TIME_WHEN_FAIL 1
46#define FIRST_SEQ_NUM 0
49#define MAX_CHIP_INDEX 8
74#define SDRAM_VS_DTCM_THRESHOLD 40000
92#define ALL_MISSING_FLAG 0xFFFFFFFE
95#define ROUTER_TIMEOUT_MASK 0xFF
340 while (spin1_send_mc_packet(key, payload,
WITH_PAYLOAD) == 0) {
396 log_error(
"Allocating seq num store when already one exists at 0x%08x",
412 "Failed to allocate %u bytes for missing seq num store",
426 log_error(
"Freeing a non-existent seq num store");
464 "received location message with transaction id %d when "
465 "already processing stream with transaction id %d",
480 "received location message with unexpected "
481 "transaction id %d; mine is %d",
499 "Changed stream target chip to %d,%d for transaction id %d",
503 log_debug(
"Writing %u packets to 0x%08x for transaction id %d",
543 "received missing seq numbers before a location with a "
544 "transaction id which is stale.");
549 log_debug(
"received tell request when already sent finish. resending");
567 log_debug(
"Looking for %d missing packets",
624 while (n_words-- > 0) {
639 log_debug(
"received data before being given a location");
643 log_debug(
"received data from a different transaction");
665 log_debug(
"n elements is %d", n_elements);
727 while (spin1_send_mc_packet(
742 log_debug(
"sent reinjection timeout mc");
746 log_debug(
"sent reinjection emergency timeout mc");
756 "ignoring message as don't know what to do with it when "
757 "command id is %d", msg->
cmd_rc);
795 log_error(
"Got a funky seq num in sending; max is %d, received %d",
814 log_info(
"sending surplus data from new seq setting");
818 log_info(
"new seq num to set is %d", payload);
825 log_error(
"Got a funky seq num; max is %d, received %d",
833 log_debug(
"received new stream with max %d", payload);
871 log_error(
"Failed to read the data spec header");
886 log_info(
"new seq key = %d, first data key = %d, transaction id key = %d, "
887 "end flag key = %d, basic_data_key = %d",
916 for (
uint i = 0;
i < n_extra_monitors;
i++) {
938 log_info(
"Configuring packet gatherer");
Command structure, describing a SpiNNaker multicast packet to be sent at some point.
Data type definitions for SpiNNaker Neuron-modelling.
uint32_t * address_t
A generic pointer to a word.
Common definitions for the non-SCAMP system binaries.
static void initialise_reinjection_mc_api(uint32_t base_mc_key)
sets up the multicast keys for the reinjection multicast API
static uint reinject_clear_mc_key
the multicast key used for clear reinjector queue to all extra monitors
@ CMD_DPRI_SET_ROUTER_EMERGENCY_TIMEOUT
Set the router's wait2 timeout.
@ CMD_DPRI_SET_ROUTER_TIMEOUT
Set the router's wait1 timeout.
@ CMD_DPRI_CLEAR
Clear the reinjection queue.
static uint reinject_emergency_timeout_mc_key
the multicast key used for emergency timeouts to all extra monitors
static uint reinject_timeout_mc_key
the multicast key used for basic timeouts to all extra monitors
#define SDP_REPLY_HEADER_LEN
Number of bytes in an SDP header.
#define TRANSACTION_CAP
Flag for cap on transaction id.
static void reflect_sdp_message(sdp_msg_t *msg, uint body_length)
Updates an SDP message so its content (a response to the message) goes back to where the message came...
Data Specification region access API.
data_specification_metadata_t * data_specification_get_data_address(void)
Gets the location of the data for this core using the user0 entry of the SARK VCPU structure.
bool data_specification_read_header(data_specification_metadata_t *ds_regions)
Reads the header from the address given and checks if the parameters are of the correct values.
static void * data_specification_get_region(uint32_t region, data_specification_metadata_t *ds_regions)
Gets the address of a region.
uint transaction_id
The transaction that the message is taking part in.
@ DATA_IN_NORMAL_PACKET_WORDS
size of data stored in packet with command and seq
@ ITEMS_PER_MISSING_PACKET
size of payload for a packet describing the batch of missing inbound seqs
uint command
The meaning of the message.
static void send_finished_response(void)
sends the finished request
#define SDRAM_VS_DTCM_THRESHOLD
threshold for SDRAM vs DTCM when allocating received_seq_nums_store
static void receive_data(uint key, uint payload)
Handles receipt of a fixed route packet with payload from the SpiNNaker network.
static void send_data(void)
sends data to the host via SDP (using my_msg)
static uint32_t basic_data_key
the key that marks an ordinary word within a data out stream
const uint first_data_key
The key used to indicate the first word of a stream.
ushort chip_y
Board-local y coordinate of chip to do write on.
@ PROVENANCE_REGION
Index of provenance region.
@ CONFIG
Index of general configuration region.
@ CHIP_TO_KEY
Index of chip-to-key mapping table.
uint data[ITEMS_PER_MISSING_PACKET]
The payload data of the message.
static void process_missing_seq_nums_and_request_retransmission(const sdp_msg_pure_data *msg)
searches through received sequence numbers and transmits missing ones back to host for retransmission
const uint transaction_id_key
The key used to indicate a transaction ID.
static void send_sdp_message(void)
sends the SDP message built in the my_msg global
static sdp_msg_pure_data my_msg
SDP message holder for transmissions.
static uint32_t position_in_store
index into data
const uint end_flag_key
The key used to indicate a stream end.
@ WRITE_ADDR_KEY_OFFSET
Payload contains a write address.
@ BOUNDARY_KEY_OFFSET
Write stream complete. Payload irrelevant.
@ DATA_KEY_OFFSET
Payload contains a data word.
const uint new_seq_key
The key used to indicate a new sequence/stream.
#define ALL_MISSING_FLAG
flag when all seq numbers are missing
static uint32_t transaction_id_key
the key that provides a new data out transaction ID
static dsupg_provenance_t prov
The DTCM copy of the provenance.
static void process_address_data(const receive_data_to_location_msg_t *receive_data_cmd)
handles reading the address, chips and max packets from a SDP message (command: SDP_SEND_DATA_TO_LOCA...
const uint32_t reinjector_base_key
The base key for reinjection control messages.
static bit_field_t received_seq_nums_store
Records what sequence numbers we have received from host during Data In.
static void receive_seq_data(const sdp_msg_pure_data *msg)
Handles receipt and parsing of a message full of sequence numbers that need to be retransmitted (comm...
#define SDP_TIMEOUT
timeout used in sending SDP messages
uint command
The meaning of the message.
static void free_sequence_number_bitfield(void)
Frees the allocated sequence number store.
uint32_t n_sdp_recvd
The number of SDP messages received (excluding those for SARK)
uint seq_num
The sequence number of this message.
static void sanity_check_write(uint write_address, uint n_elements)
Sanity checking for writes, ensuring that they're to the buffered SDRAM range.
static uint32_t first_data_key
the key that says this is the first item of data in a data out stream
uint command
The meaning of the message.
static uint32_t data[ITEMS_PER_DATA_PACKET]
uint32_t x_coord
Board local x coordinate of extra monitor.
static uint size_of_bitfield
The size of the bitfield in received_seq_nums_store.
static void create_sequence_number_bitfield(uint max_seq)
creates a store for sequence numbers in a memory store.
static void reinjection_sdp_command(sdp_msg_t *msg)
handles the commands for the reinjector code.
functionality_to_port_num_map
values for port numbers this core will respond to
@ REINJECTION_PORT
Reinjection control messages.
@ DATA_SPEED_UP_IN_PORT
Data Speed Up Inbound messages.
static void data_in_receive_sdp_data(const sdp_msg_pure_data *msg)
processes SDP messages for the Data In protocol
uint transaction_id
The transaction associated with the message.
static bool alloc_in_sdram
Whether received_seq_nums_store was allocated in SDRAM.
uint max_seq_num
Maximum sequence number of data stream.
static void receive_sdp_message(uint mailbox, uint port)
processes SDP messages
static void send_timeout(sdp_msg_t *msg, uint32_t key)
sends the basic timeout command via multicast to the extra monitors
static void copy_data(void *restrict target, const void *source, uint n_words)
because spin1_memcpy() is stupid, especially for access to SDRAM
#define ROUTER_TIMEOUT_MASK
mask needed by router timeout
static uint32_t transaction_id
The Data In transaction ID. Used to distinguish streams of packets.
static void send_mc_message(key_offsets command, uint payload)
sends a multicast (with payload) message to the current target chip
static uint32_t seq_num
default seq num
static dsupg_provenance_t * sdram_prov
The SDRAM copy of the provenance.
address_t address
Where the stream will be writing to in memory.
static uint total_received_seq_nums
Count of received sequence numbers.
void c_main(void)
This function is called at application start-up.
static uint32_t end_flag_key
the key that marks the end of a data out stream
#define MESSAGE_DELAY_TIME_WHEN_FAIL
the time to wait before trying again to send a message (MC, SDP) in microseconds
static uint start_sdram_address
Where the current stream of data started in SDRAM.
static uint data_in_mc_key_map[MAX_CHIP_INDEX][MAX_CHIP_INDEX]
How to find which key to use to talk to which chip on this board.
static uint32_t max_seq_num
maximum sequence number
uint transaction_id
The transaction that the message is taking part in.
uint32_t base_key
Base key to use for talking to that chip.
const uint tag_id
The ID of the IPtag to send the SDP packets out to host on.
@ SDP
SDP receive priority standard (high)
@ MC_PACKET
Multicast packet receive uses FIQ.
static uint32_t data_out_transaction_id
The Data Out transaction ID. Used to distinguish streams of packets.
const struct chip_key_data_t chip_to_key[]
The configuration data for routing messages to specific extra monitors.
@ COMMAND_ID
location of command IDs in SDP message
@ SEQ_NUM_LOC
location of where the seq num is in the packet
@ TRANSACTION_ID
location of the transaction id in the packet
@ START_OF_DATA
location of the start of raw data in the packet
uint32_t y_coord
Board local y coordinate of extra monitor.
ushort chip_x
Board-local x coordinate of chip to do write on.
@ SEND_DATA_LOCATION_HEADER_WORDS
offset with command, transaction id, address in bytes, [x, y], max seq,
@ SEND_SEQ_DATA_HEADER_WORDS
offset with just command transaction id and seq in bytes
@ SEND_MISSING_SEQ_HEADER_WORDS
offset with just command, transaction id
@ ABSOLUTE_MAX_SIZE_OF_SDP_IN_BYTES
absolute maximum size of a SDP message
static void send_clear_message(sdp_msg_t *msg)
sends the clear message to all extra monitors on this board
static uint n_elements_in_msg(const sdp_msg_pure_data *msg, const uint *data_start)
Calculates the number of words of data in an SDP message.
uint data[]
The payload of real data.
static uint calculate_sdram_address_from_seq_num(uint seq_num)
calculates the new sdram location for a given seq num
const uint32_t n_extra_monitors
The number of extra monitors that we can talk to.
static void publish_transaction_id_to_user_1(int transaction_id)
Writes the updated transaction ID to the user1.
sdp_port_commands
SDP port commands relating to the Data In protocol.
@ SDP_SEND_SEQ_DATA_CMD
Data In: Received message contains data to write.
@ SDP_SEND_MISSING_SEQ_DATA_IN_CMD
Data In: Sent message contains missing sequence numbers.
@ SDP_TELL_MISSING_BACK_TO_HOST
Data In: Received message asks for missing sequence numbers.
@ SDP_SEND_FINISHED_DATA_IN_CMD
Data In: Sent message indicates that everything has been received.
@ SDP_SEND_DATA_TO_LOCATION_CMD
Data In: Received message describes where to send data.
static void set_message_length(const void *end)
Sets the length of the outbound SDP message in my_msg.
#define MAX_CHIP_INDEX
max index needed to cover the chips in either direction on a spinn-5 board
const uint basic_data_key
The key used to indicate a general data item in a stream.
static uint32_t new_sequence_key
the key that causes data out sequence number to be processed
#define FIRST_SEQ_NUM
first sequence number to use and reset to
static void initialise(void)
Sets up the application.
static uint last_seen_seq_num
The most recently seen sequence number.
static void process_sdp_message_into_mc_messages(const uint *data, uint n_elements, bool set_write_address, uint write_address)
sends multicast messages accordingly for an SDP message
static uint chip_y
Board-relative y-coordinate of current chip being written to.
static uint chip_x
Board-relative x-coordinate of current chip being written to.
uint32_t n_in_streams
The number of input streams.
uint32_t n_out_streams
The number of output streams (technically, output transactions)
uint32_t n_sdp_sent
The number of SDP messages sent.
The layout of the Data In configuration region.
The layout of the Data Out configuration region.
The structure of the provenance region FIXME.
meaning of payload in first data in SDP packet
meaning of payload in subsequent data in SDP packets
SDP packet payload definition.
SpiNNaker debug header file.
void log_error(const char *message,...)
This function logs errors. Errors usually indicate a serious fault in the program,...
void log_debug(const char *message,...)
This function logs debugging messages. This level of message is normally not printed except when the ...
void log_info(const char *message,...)
This function logs informational messages. This is the lowest level of message normally printed.
static uint32_t packets_sent
The number of packets sent so far this timestamp.
The configuration parameters for the application.
void * sark_xalloc(heap_t *heap, uint size, uint tag, uint flag)
void sark_free(void *ptr)
void rt_error(uint code,...)
void sark_xfree(heap_t *heap, void *ptr, uint flag)
uint8_t flags
SDP flag byte; first byte actually sent.
uint8_t srce_port
SDP source port/CPU.
uint16_t length
Length (measured from flags field start)
uint8_t dest_port
SDP destination port/CPU.
uint16_t dest_addr
SDP destination address.
uint32_t data[ITEMS_PER_DATA_PACKET]
User data (272 bytes when no SCP header)
uint16_t srce_addr
SDP source address.
@ ITEMS_PER_DATA_PACKET
How many multicast packets are to be received per SDP packet.
An SDP message with purely data, no SCP header.
Simulation Functions Header File.
uint spin1_get_core_id(void)
uint spin1_start(sync_bool sync)
void spin1_callback_on(uint event_id, callback_t cback, int priority)