55#define DMA_BURST_SIZE 4
58#define N_DMA_BUFFERS 2
65#define END_FLAG_SIZE 4
67#define END_FLAG 0xFFFFFFFF
99#define SDP_TIMEOUT 1000
102#define LENGTH_OF_SDP_HEADER 8
109#define N_ROUTER_ENTRIES 1024
112#define INVALID_ROUTER_ENTRY_KEY 0xFFFFFFFF
115#define INVALID_ROUTER_ENTRY_MASK 0x00000000
118#define INVALID_ROUTER_ENTRY_ROUTE 0xFF000000
121#define APP_ID_MASK_FROM_FREE 0x000000FF
124#define APP_ID_OFFSET_FROM_FREE 24
127#define N_BASIC_SYSTEM_ROUTER_ENTRIES 1
130#define N_USABLE_ROUTER_ENTRIES (N_ROUTER_ENTRIES - N_BASIC_SYSTEM_ROUTER_ENTRIES)
137#define TDMA_WAIT_PERIOD 0
140#define ROUTER_INITIAL_TIMEOUT 0x4f
143#define TICK_PERIOD 10
146#define PKT_QUEUE_SIZE 4096
149#define ROUTER_TIMEOUT_MAX 0xFF
227typedef struct data_in_data_items {
242 POSITION_OF_NO_MISSING_SEQ_PACKETS = 2,
243 START_OF_MISSING_MORE = 2,
244 START_OF_MISSING_SEQ_NUMS = 3,
293 uint reinjection_base_mc_key;
299 DATA_SPEED_UP_OUT_PORT = 5,
548static vcpu_t *
const _sark_virtual_processor_info = (
vcpu_t *) SV_VCPU;
637 .cc_tx_not_full =
true
645 .cc_tx_not_full =
true
687 .control_byte = pkt->
hdr.control
691 .route = pkt->
hdr.route
697 if (control.payload) {
747static inline void extract_dropped_packet_details(
754 __builtin_popcount(rtr_dump_outputs.
processor);
758 if (rtr_dump_outputs.
link > 0) {
763 __builtin_popcount(rtr_dump_outputs.
link);
793 extract_dropped_packet_details(rtr_dump_outputs);
823 extract_dropped_packet_details(rtr_dump_outputs);
831 if (
config->multicast_flag == 1) {
838 if (
config->point_to_point_flag == 1) {
845 if (
config->fixed_route_flag == 1) {
852 if (
config->nearest_neighbour_flag == 1) {
859 "[INFO] Setting reinject mc to %d\n[INFO] Setting reinject pp to %d\n"
860 "[INFO] Setting reinject fr to %d\n[INFO] Setting reinject nn to %d\n",
890#ifdef DEBUG_REINJECTOR
914#ifdef DEBUG_REINJECTOR
915 io_printf(
IO_BUF,
"[DEBUG] setting router emergency timeouts via sdp\n");
942 "[INFO] Setting reinject mc to %d\n[INFO] Setting reinject pp to %d\n"
943 "[INFO] Setting reinject fr to %d\n[INFO] Setting reinject nn to %d\n",
974 data->packet_types_reinjected = 0;
977 for (
int i = 0; i < 4; i++) {
978 data->packet_types_reinjected |= (values_to_check[i] << i);
1017 .router_dump =
false
1057#ifdef DEBUG_REINJECTOR
1061#ifdef DEBUG_REINJECTOR
1066#ifdef DEBUG_REINJECTOR
1071#ifdef DEBUG_REINJECTOR
1076#ifdef DEBUG_REINJECTOR
1081#ifdef DEBUG_REINJECTOR
1086#ifdef DEBUG_REINJECTOR
1091#ifdef DEBUG_REINJECTOR
1108 .interrupt_enable =
false
1200 io_printf(
IO_BUF,
"[ERROR] Write address not set when write data received!\n");
1237 "[WARNING] failed to recognise multicast packet key 0x%08x\n",
1253 if (n_entries == 0) {
1257 if (start_entry_id == 0) {
1259 "[ERROR] Received error with requesting %u router entries.\n",
1264 for (
uint idx = 0; idx < n_entries; idx++) {
1273 "[DEBUG] Setting key %08x, mask %08x, route %08x for entry %u\n",
1274 sdram_address[idx].key, sdram_address[idx].
mask,
1275 sdram_address[idx].route, idx + start_entry_id);
1278 if (
rtr_mc_set(idx + start_entry_id, sdram_address[idx].key,
1279 sdram_address[idx].
mask, sdram_address[idx].route) != 1) {
1281 "with key %08x, mask %08x, route %08x\n",
1282 idx + start_entry_id, sdram_address[idx].key,
1283 sdram_address[idx].
mask, sdram_address[idx].route);
1359 io_printf(
IO_BUF,
"[INFO] Saving application router entries from router\n");
1373 "[WARNING] Already loaded system router; ignoring but replying\n");
1385 "[WARNING] Received unknown SDP packet in data in speed up port"
1386 " with command id %d\n", msg->
cmd_rc);
1419 .control_byte = fixed_route_with_payload.value
1433 uint32_t current_dma_pointer, uint32_t n_elements_to_send,
1434 uint32_t first_packet_key, uint32_t second_packet_key) {
1436 for (
uint i = 0; i < n_elements_to_send; i++) {
1443 first_packet_key = second_packet_key;
1461 uint32_t dma_tag,
void *source,
void *destination,
uint n_words) {
1469 .length_words = n_words
1480 uint32_t dma_tag, uint32_t offset, uint32_t items_to_read) {
1524 items_read_this_time += 2;
1531 uint32_t next_position_in_store =
1544 key_to_transmit, second_key_to_transmit);
1547 key_to_transmit, second_key_to_transmit);
1566 uint32_t
data[],
uint length, uint32_t start_offset) {
1568 i < length; i++, j++) {
1570#ifdef DEBUG_DATA_OUT
1590 uint32_t
data[],
uint length,
bool first) {
1591 uint32_t start_reading_offset = START_OF_MISSING_MORE;
1594 data[POSITION_OF_NO_MISSING_SEQ_PACKETS];
1596 uint32_t size_of_data =
1613 "[ERROR] Can't allocate SDRAM for missing seq nums\n");
1616#ifdef DEBUG_DATA_OUT
1626 start_reading_offset = START_OF_MISSING_SEQ_NUMS;
1631 data, length, start_reading_offset);
1633#ifdef DEBUG_DATA_OUT
1635 io_printf(
IO_BUF,
"[WARNING] Unable to save missing sequence number\n");
1675 uint32_t left_over_portion =
1707#ifdef DEBUG_DATA_OUT
1710 "[WARNING] Got some bad seq num here; max is %d, got %d\n",
1727#ifdef DEBUG_DATA_OUT
1750 "[WARNING] received start message with unexpected "
1751 "transaction id %d; mine is %d\n",
1766 uint32_t bytes_to_read_write = message->
length;
1777 bytes_to_read_write /
sizeof(
uint);
1791 "[WARNING] received data from a different transaction for "
1792 "start of missing. expected %d got %d\n",
1799#ifdef DEBUG_DATA_OUT
1815 "[WARNING] received data from different transaction for "
1816 "more missing; expected %d, got %d\n",
1849 "[WARNING] received data from different transaction for "
1850 "clear; expected %d, got %d\n",
1854#ifdef DEBUG_DATA_OUT
1875 .clear_done_int =
true
1917 .clear_timeout_int =
true
1926void __real_sark_int(
void *pc);
1929void __wrap_sark_int(
void *pc) {
1933 __real_sark_int(pc);
1949 switch ((msg->
dest_port & PORT_MASK) >> PORT_SHIFT) {
1953#ifdef DEBUG_REINJECTOR
1954 io_printf(IO_BUF,
"[DEBUG] timeout when sending reinjection reply\n");
1959 case DATA_SPEED_UP_OUT_PORT:
1968 io_printf(IO_BUF,
"[DEBUG] timeout when sending speedup ctl reply\n");
1974 io_printf(IO_BUF,
"[WARNING] unexpected port %d\n",
1975 (msg->
dest_port & PORT_MASK) >> PORT_SHIFT);
1977 "[INFO] from:%04x:%02x to:%04x:%02x cmd:%04x len:%d iam:%04x\n",
2024#ifdef DEBUG_DATA_OUT
2026 "[INFO] new seq key = %d, first data key = %d, transaction id key = %d, "
2027 "end flag key = %d, basic_data_key = %d\n",
2043 .clear_done_int =
true,
2044 .clear_timeout_int =
true,
2045 .clear_write_buffer_int =
true
2051 .clear_done_int =
true
2055 .transfer_done_interrupt =
true,
2056 .transfer2_done_interrupt =
true,
2057 .timeout_interrupt =
true,
2058 .crc_error_interrupt =
true,
2059 .tcm_error_interrupt =
true,
2060 .axi_error_interrupt =
true,
2061 .user_abort_interrupt =
true,
2062 .soft_reset_interrupt =
true,
2063 .write_buffer_error_interrupt =
true
2073 "[ERROR] failed to allocate SDRAM for application mc router entries\n");
2128 .router_dump =
true,
2131 .dma_timeout =
true,
2151 .interrupt_enable =
true,
2152 .periodic_mode =
true,
@ DMA
DMA processing is lowest priority.
@ SDP
Responding to communications from host is next highest.
callback_priorities
values for the priority for each callback
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_RESET_COUNTERS
Reset the reinjection counters.
@ CMD_DPRI_SET_ROUTER_TIMEOUT
Set the router's wait1 timeout.
@ CMD_DPRI_GET_STATUS
Get the status of the reinjector.
@ CMD_DPRI_EXIT
Stop doing reinjection.
@ CMD_DPRI_CLEAR
Clear the reinjection queue.
@ CMD_DPRI_SET_PACKET_TYPES
Set what packet types are reinjected.
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 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.
static uint32_t data[ITEMS_PER_DATA_PACKET]
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 uint32_t transaction_id
The Data In transaction ID. Used to distinguish streams of packets.
static uint32_t mask
Mask for keys to determine if the key matches the key_space.
The configuration parameters for the application.
void sark_delay_us(uint delay)
void * sark_xalloc(heap_t *heap, uint size, uint tag, uint flag)
void io_printf(char *stream, char *format,...)
uint rtr_alloc_id(uint size, uint app_id)
void cpu_int_restore(uint cpsr)
uint sark_msg_send(sdp_msg_t *msg, uint timeout)
volatile uchar mbox_ap_cmd
void rtr_free(uint entry, uint clear)
void sark_shmsg_free(sdp_msg_t *msg)
uint cpu_fiq_disable(void)
uint rtr_mc_set(uint entry, uint key, uint mask, uint route)
void sark_msg_free(sdp_msg_t *msg)
void sark_cpu_state(cpu_state state)
uint sark_heap_max(heap_t *heap, uint flag)
sdp_msg_t * sark_msg_get(void)
void rt_error(uint code,...)
void sark_msg_cpy(sdp_msg_t *to, sdp_msg_t *from)
uint rtr_mc_get(uint entry, rtr_entry_t *r)
void sark_xfree(heap_t *heap, void *ptr, uint flag)
uint16_t length
Length (measured from flags field start)
uint32_t data[ITEMS_PER_DATA_PACKET]
User data (272 bytes when no SCP header)
@ ITEMS_PER_DATA_PACKET
How many multicast packets are to be received per SDP packet.
An SDP message with purely data, no SCP header.
cback_t callback[NUM_EVENTS]
static void wait_for_interrupt(void)
Wait for any interrupt to occur.