SpiNNFrontEndCommon 7.3.1
Common support code for user-facing front end systems.
Loading...
Searching...
No Matches
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 }
 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 More...
 

Functions

static void transmit_command (command *command_to_send)
 Immediately sends SpiNNaker multicast packets in response to a command.
 
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.
 
static bool read_start_resume_commands (command_list *sdram_commands)
 Copy the list of commands to run on start or resume into DTCM.
 
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 timer_callback (uint unused0, uint unused1)
 The timer tick callback. Sends those commands that are due in the current simulation state and time.
 
static void write_provenance (address_t address)
 Write our provenance data into the provenance region.
 
static bool initialize (uint32_t *timer_period)
 Initialises the core.
 
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.

◆ anonymous enum

time ID

Definition at line 129 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.

◆ run_stop_pause_commands()

static void run_stop_pause_commands ( void  )
static

Sends all the commands registered for sending on simulation stop or pause.

Definition at line 183 of file command_sender_multicast_source.c.

◆ run_start_resume_commands()

static void run_start_resume_commands ( void  )
static

Sends all the commands registered for sending on simulation start or resume.

Definition at line 192 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.

◆ c_main()

void c_main ( void  )

Entry point.

Definition at line 360 of file command_sender_multicast_source.c.

Variable Documentation

◆ time

uint32_t time
static

The simulation timer.

Definition at line 74 of file command_sender_multicast_source.c.

◆ simulation_ticks

uint32_t simulation_ticks
static

The number of ticks to run for.

Definition at line 76 of file command_sender_multicast_source.c.

◆ infinite_run

uint32_t infinite_run
static

Whether the simulation is running "forever" (robotics mode).

Definition at line 78 of file command_sender_multicast_source.c.

◆ timed_commands

timed_command* timed_commands
static

The commands to send at particular times.

Definition at line 80 of file command_sender_multicast_source.c.

◆ start_resume_commands

command* start_resume_commands
static

The commands to run when a simulation starts or resumes after pause.

Definition at line 82 of file command_sender_multicast_source.c.

◆ pause_stop_commands

command* pause_stop_commands
static

The commands to run when a simulation stops or pauses.

Definition at line 84 of file command_sender_multicast_source.c.

◆ n_timed_commands

uint32_t n_timed_commands
static

The number of timed commands.

Definition at line 86 of file command_sender_multicast_source.c.

◆ n_start_resume_commands

uint32_t n_start_resume_commands
static

The number of commands to send on start/resume.

Definition at line 88 of file command_sender_multicast_source.c.

◆ n_pause_stop_commands

uint32_t n_pause_stop_commands
static

The number of commands to send on stop/pause.

Definition at line 90 of file command_sender_multicast_source.c.

◆ next_timed_command

uint32_t next_timed_command
static

The index of the next timed command to run.

Definition at line 92 of file command_sender_multicast_source.c.

◆ resume

bool resume ( void  ) = true
static

Whether we are in the state where the next run will be a start/resume.

Definition at line 94 of file command_sender_multicast_source.c.

◆ n_commands_sent

uint32_t n_commands_sent
static

The number of commands sent.

Definition at line 96 of file command_sender_multicast_source.c.