138 if (command_to_send->
repeats != 0) {
139 for (uint32_t repeat_count = 0;
140 repeat_count <= command_to_send->
repeats;
143 log_debug(
"Sending %08x, %08x at time %u with %u repeats and "
147 spin1_send_mc_packet(
148 command_to_send->
key, command_to_send->
payload,
151 log_debug(
"Sending %08x at time %u with %u repeats and "
154 command_to_send->
delay);
160 if (command_to_send->
delay > 0) {
161 spin1_delay_us(command_to_send->
delay);
166 log_debug(
"Sending %08x, %08x at time %u",
170 spin1_send_mc_packet(
171 command_to_send->
key, command_to_send->
payload,
184 log_info(
"Transmit pause/stop commands");
193 log_info(
"Transmit start/resume commands");
216 log_error(
"Could not allocate the scheduled commands");
223 log_info(
"Schedule commands starts at time %u",
244 log_error(
"Could not allocate the start/resume commands");
269 log_error(
"Could not allocate the pause/stop commands");
288 log_info(
"running first start resume commands");
362 uint32_t timer_period = 0;
364 log_error(
"Error in initialisation - exiting!");
369 spin1_set_timer_tick(timer_period);
static bool initialize(void)
Initialises the program.
uint32_t n_commands_sent
The number of commands sent.
static bool resume
Whether we are in the state where the next run will be a start/resume.
static uint32_t n_commands_sent
The number of commands sent.
static timed_command * timed_commands
The commands to send at particular times.
static uint32_t simulation_ticks
The number of ticks to run for.
static command * start_resume_commands
The commands to run when a simulation starts or resumes after pause.
uint32_t repeats
The number of times to repeat the packet.
uint32_t time
The simulation time to send a packet.
command commands[]
The commands to send.
static uint32_t n_start_resume_commands
The number of commands to send on start/resume.
uint32_t key
The key of the packet.
callback_priorities
values for the priority for each callback
@ TIMER
Responding to timers is lowest priority, and most common.
@ DMA
Handling memory transfers is next highest.
@ SDP
Responding to network traffic is highest priority.
static bool read_scheduled_parameters(timed_command_list *sdram_timed_commands)
Copy the list of commands to run at particular times into DTCM.
uint32_t payload
The payload for the packet.
region_identifiers
region identifiers
@ COMMANDS_WITH_ARBITRARY_TIMES
@ PROVENANCE_REGION
Where to record provenance data. (Format: cs_provenance_t)
@ SYSTEM_REGION
Where simulation system information is stored.
@ COMMANDS_AT_START_RESUME
static void run_start_resume_commands(void)
Sends all the commands registered for sending on simulation start or resume.
uint32_t size
The number of commands to send.
static void write_provenance(address_t address)
Write our provenance data into the provenance region.
static uint32_t n_timed_commands
The number of timed commands.
uint32_t size
The number of commands to send.
static uint32_t infinite_run
Whether the simulation is running "forever" (robotics mode).
static bool read_start_resume_commands(command_list *sdram_commands)
Copy the list of commands to run on start or resume into DTCM.
void c_main(void)
Entry point.
static uint32_t next_timed_command
The index of the next timed command to run.
static uint32_t n_pause_stop_commands
The number of commands to send on stop/pause.
static void timer_callback(uint unused0, uint unused1)
The timer tick callback. Sends those commands that are due in the current simulation state and time.
static bool read_pause_stop_commands(command_list *sdram_commands)
Copy the list of commands to run on stop or pause into DTCM.
static void run_stop_pause_commands(void)
Sends all the commands registered for sending on simulation stop or pause.
static command * pause_stop_commands
The commands to run when a simulation stops or pauses.
command command
What to send.
uint32_t delay
The time (in microseconds) to delay between sending each repeat.
static uint32_t time
The simulation timer.
static void transmit_command(command *command_to_send)
Immediately sends SpiNNaker multicast packets in response to a command.
timed_command commands[]
The commands to send, sorted in time order.
bool has_payload
Whether to send a payload with the packet.
Command structure, describing a SpiNNaker multicast packet to be sent at some point.
A collection of commands to be sent in response to an event.
A command that happens at a particular simulation time.
A collection of commands to be sent at particular simulation times.
Data type definitions for SpiNNaker Neuron-modelling.
uint32_t * address_t
A generic pointer to a word.
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 dsupg_provenance_t * sdram_prov
The SDRAM copy of the provenance.
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.
void rt_error(uint code,...)
Simulation Functions Header File.
void simulation_handle_pause_resume(resume_callback_t callback)
cleans up the house keeping, falls into a sync state and handles the resetting up of states as requir...
void simulation_set_provenance_function(prov_callback_t provenance_function, address_t provenance_data_address)
Set an additional callback function to store extra provenance data.
void simulation_set_exit_function(exit_callback_t exit_function)
Set an additional function to call before exiting the binary when running without a fixed duration of...
bool simulation_is_finished(void)
determine if the simulation is finished. Will also pause the simulation for resynchronisation if requ...
void simulation_ready_to_read(void)
Indicates that all data has been written and the core is going idle, so any data can now be read.
void simulation_run(void)
Starts the simulation running, returning when it is complete,.
bool simulation_initialise(address_t address, uint32_t expected_application_magic_number, uint32_t *timer_period, uint32_t *simulation_ticks_pointer, uint32_t *infinite_run_pointer, uint32_t *time_pointer, int sdp_packet_callback_priority, int dma_transfer_complete_priority)
initialises the simulation interface which involves:
void spin1_memcpy(void *dst, void const *src, uint len)
void spin1_callback_on(uint event_id, callback_t cback, int priority)