SpiNNFrontEndCommon  development
Common support code for user-facing front end systems.
Data Structures | Enumerations | Functions | Variables
command_sender_multicast_source.c File Reference

The implementation of the Command Sender Multicast Source. More...

#include <common-typedefs.h>
#include <data_specification.h>
#include <debug.h>
#include <simulation.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  command
 Command structure, describing a SpiNNaker multicast packet to be sent at some point. More...
 
struct  timed_command
 A command that happens at a particular simulation time. More...
 
struct  command_list
 A collection of commands to be sent in response to an event. More...
 
struct  timed_command_list
 A collection of commands to be sent at particular simulation times. More...
 
struct  cs_provenance_t
 custom provenance data More...
 

Enumerations

enum  callback_priorities {
  SDP = 0 , DMA = 1 , TIMER = 2 , SDP = 0 ,
  DMA = 0
}
 values for the priority for each callback More...
 
enum  region_identifiers {
  SYSTEM_REGION = 0 , COMMANDS_WITH_ARBITRARY_TIMES , COMMANDS_AT_START_RESUME , COMMANDS_AT_STOP_PAUSE ,
  PROVENANCE_REGION
}
 region identifiers More...
 
enum  { FIRST_TIME = 0 }
 time ID
 

Functions

static void transmit_command (command *command_to_send)
 Immediately sends SpiNNaker multicast packets in response to a command. More...
 
static void run_stop_pause_commands (void)
 Sends all the commands registered for sending on simulation stop or pause.
 
static void run_start_resume_commands (void)
 Sends all the commands registered for sending on simulation start or resume.
 
static bool read_scheduled_parameters (timed_command_list *sdram_timed_commands)
 Copy the list of commands to run at particular times into DTCM. More...
 
static bool read_start_resume_commands (command_list *sdram_commands)
 Copy the list of commands to run on start or resume into DTCM. More...
 
static bool read_pause_stop_commands (command_list *sdram_commands)
 Copy the list of commands to run on stop or pause into DTCM. More...
 
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. More...
 
static void write_provenance (address_t address)
 Write our provenance data into the provenance region. More...
 
static bool initialize (uint32_t *timer_period)
 Initialises the core. More...
 
void c_main (void)
 Entry point.
 

Variables

static uint32_t time
 The simulation timer.
 
static uint32_t simulation_ticks
 The number of ticks to run for.
 
static uint32_t infinite_run
 Whether the simulation is running "forever" (robotics mode).
 
static timed_commandtimed_commands
 The commands to send at particular times.
 
static commandstart_resume_commands
 The commands to run when a simulation starts or resumes after pause.
 
static commandpause_stop_commands
 The commands to run when a simulation stops or pauses.
 
static uint32_t n_timed_commands
 The number of timed commands.
 
static uint32_t n_start_resume_commands
 The number of commands to send on start/resume.
 
static uint32_t n_pause_stop_commands
 The number of commands to send on stop/pause.
 
static uint32_t next_timed_command
 The index of the next timed command to run.
 
static bool resume = true
 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.
 

Detailed Description

The implementation of the Command Sender Multicast Source.

The purpose of this application is to inject SpiNNaker packets into the on-chip network at specified times. It is used (among other things) to implement the SpikeSourceArray model in sPyNNaker.

Definition in file command_sender_multicast_source.c.


Data Structure Documentation

◆ command

struct command

Command structure, describing a SpiNNaker multicast packet to be sent at some point.

Note that the delay actually comes after sending each mandated packet when repeats are requested rather than just between packets.

Definition at line 36 of file command_sender_multicast_source.c.

Data Fields
uint32_t key The key of the packet.
bool has_payload Whether to send a payload with the packet.
uint32_t payload The payload for the packet.
uint32_t repeats The number of times to repeat the packet.

If zero, the packet is only sent once.

uint32_t delay The time (in microseconds) to delay between sending each repeat.

◆ timed_command

struct timed_command

A command that happens at a particular simulation time.

Definition at line 51 of file command_sender_multicast_source.c.

Data Fields
uint32_t time The simulation time to send a packet.
command command What to send.

◆ command_list

struct command_list

A collection of commands to be sent in response to an event.

This is used for SDRAM only.

Definition at line 59 of file command_sender_multicast_source.c.

Data Fields
uint32_t size The number of commands to send.
command commands[] The commands to send.

◆ timed_command_list

struct timed_command_list

A collection of commands to be sent at particular simulation times.

This is used for SDRAM only.

Definition at line 67 of file command_sender_multicast_source.c.

Data Fields
uint32_t size The number of commands to send.
timed_command commands[] The commands to send, sorted in time order.

◆ cs_provenance_t

struct cs_provenance_t

custom provenance data

Definition at line 123 of file command_sender_multicast_source.c.

Data Fields
uint32_t n_commands_sent The number of commands sent.

Enumeration Type Documentation

◆ callback_priorities

values for the priority for each callback

Enumerator
SDP 

Responding to network traffic is highest priority.

DMA 

Handling memory transfers is next highest.

TIMER 

Responding to timers is lowest priority, and most common.

Definition at line 99 of file command_sender_multicast_source.c.

◆ region_identifiers

region identifiers

Enumerator
SYSTEM_REGION 

Where simulation system information is stored.

COMMANDS_WITH_ARBITRARY_TIMES 

Where to read timed commands from. The region is formatted as a timed_command_list.

COMMANDS_AT_START_RESUME 

Where to read start/resume commands from. The region is formatted as a command_list.

COMMANDS_AT_STOP_PAUSE 

Where to read stop/pause commands from. The region is formatted as a command_list.

PROVENANCE_REGION 

Where to record provenance data. (Format: cs_provenance_t)

Definition at line 106 of file command_sender_multicast_source.c.

Function Documentation

◆ transmit_command()

static void transmit_command ( command command_to_send)
static

Immediately sends SpiNNaker multicast packets in response to a command.

Parameters
[in]command_to_sendThe command to send.

Definition at line 136 of file command_sender_multicast_source.c.

◆ read_scheduled_parameters()

static bool read_scheduled_parameters ( timed_command_list sdram_timed_commands)
static

Copy the list of commands to run at particular times into DTCM.

Parameters
[in]sdram_timed_commandsThe memory region containing the description of what commands to send and when.
Returns
True if we succeeded, false if we failed (due to memory problems)

Definition at line 203 of file command_sender_multicast_source.c.

◆ read_start_resume_commands()

static bool read_start_resume_commands ( command_list sdram_commands)
static

Copy the list of commands to run on start or resume into DTCM.

Parameters
[in]sdram_commandsThe memory region containing the description of what commands to send.
Returns
True if we succeeded, false if we failed (due to memory problems)

Definition at line 232 of file command_sender_multicast_source.c.

◆ read_pause_stop_commands()

static bool read_pause_stop_commands ( command_list sdram_commands)
static

Copy the list of commands to run on stop or pause into DTCM.

Parameters
[in]sdram_commandsThe memory region containing the description of what commands to send.
Returns
True if we succeeded, false if we failed (due to memory problems)

Definition at line 257 of file command_sender_multicast_source.c.

◆ timer_callback()

static void timer_callback ( uint  unused0,
uint  unused1 
)
static

The timer tick callback. Sends those commands that are due in the current simulation state and time.

Parameters
unused0unused
unused1unused

Definition at line 284 of file command_sender_multicast_source.c.

◆ write_provenance()

static void write_provenance ( address_t  address)
static

Write our provenance data into the provenance region.

Parameters
[in]addressWhere to write

Definition at line 318 of file command_sender_multicast_source.c.

◆ initialize()

static bool initialize ( uint32_t *  timer_period)
static

Initialises the core.

Parameters
[out]timer_periodThe timer tick period.
Returns
True if initialisation succeeded.

Definition at line 326 of file command_sender_multicast_source.c.