spinnaker_tools 3.4.0
SpiNNaker API, sark, sc&mp, bmp firmware and build tools
Loading...
Searching...
No Matches
Macros | Functions | Variables
scamp-isr.c File Reference

SC&MP interrupt routines. More...

#include "spinnaker.h"
#include "sark.h"
#include "scamp.h"
#include <scamp_spin1_sync.h>

Macros

#define MAX_DIFF   10000
 Maximum difference between timers over 2 seconds in clock ticks.
 
#define N_ITEMS   16
 Number of samples to keep to get an average.
 
#define N_BEACONS_MASK   0xFFF
 The mask of the n_beacons part of the message.
 
#define N_BEACONS_SHIFT   20
 The shift of the n_beacons part of the message.
 
#define SOURCE_T1_COUNT_MASK   0xFFFFF
 The mask of the source tc[T1_COUNT] part of the message.
 

Functions

void p2p_rcv_data (uint data, uint key)
 Receive data on channel.
 
void p2p_rcv_ctrl (uint data, uint key)
 Received P2P control packet.
 
void nn_rcv_pkt (uint link, uint data, uint key)
 Nearest-neighbour packet received handler.
 
void peek_ack_pkt (uint link, uint data, uint key)
 Initialises peek_pkt to contain the given arguments (presumably an acknowledge)
 
void poke_ack_pkt (uint link, uint data, uint key)
 Initialises poke_pkt to contain the given arguments (presumably an acknowledge)
 
void proc_1khz (uint a1, uint a2)
 Regular 1kHz timer callback, put on the event queue every millisecond.
 
void proc_100hz (uint a1, uint a2)
 Regular 100Hz timer callback, put on the event queue every 10ms.
 
void proc_1hz (uint a1, uint a2)
 Regular 1Hz timer callback, put on the event queue every second.
 
void msg_queue_insert (sdp_msg_t *msg, uint srce_ip)
 Adds a message to SCAMP's master message queue, to be processed by proc_route_msg().
 
void pkt_tx_int (void)
 Packet transmit ready handler.
 
void eth_rx_int (void)
 Ethernet packet received handler. Delegates to eth_receive()
 
void pkt_mc_int (void)
 Multicast packet received handler. Delegates to signal_app()
 
void test_mc_int (void)
 
void pkt_nn_int (void)
 Nearest-neighbour packet received handler.
 
void pkt_p2p_int (void)
 Peer-to-peer packet received handler.
 
void ms_timer_int (void)
 Millisecond timer interrupt handler.
 
void ap_int (void)
 Application (local core) message available handler.
 
void timer2_int_han (void)
 Interrupt handler for timer 2. Delegates to timer2_int()
 
void vic_setup (void)
 Initialise the VIC.
 

Variables

pkt_queue_t tx_pkt_queue
 Packet transmit queue.
 
uint num_cpus
 Number of operational CPUs.
 
volatile uint do_sync
 Whether to perform clock synchronization (on by default at start)
 
uint mc_ping_count [NUM_LINKS]
 Reserved for performing MC and P2P pings.
 
static uint centi_ms
 Counts 0 to 9 in ms.
 
static int samples [N_ITEMS]
 Samples used when synchronising time.
 
static int sum = 0
 Sum to make moving average easy.
 
static int last_ticks = 0
 Ticks recorded last time.
 
static int n_samples = 0
 Number of samples recorded.
 
static uint sample_pos = 0
 Position of next sample.
 
static int last_beacon = 0
 Beacon id recorded last time to detect missed packets.
 
uint n_beacons_sent = 0
 Time beacon counter.
 
static uint time_to_next_sync = TIME_BETWEEN_SYNC_US
 Inter-synchronisation time, in microseconds.
 
static uint next_box
 Round robin counter for ap_int()
 

Detailed Description

SC&MP interrupt routines.

Author
Steve Temple, APT Group, School of Computer Science

Macro Definition Documentation

◆ MAX_DIFF

#define MAX_DIFF   10000

Maximum difference between timers over 2 seconds in clock ticks.

Experiments have shown maximum difference is about 1ms over 160 seconds which is 6.25us over 1 second, which is 2500 clock ticks at 200Mhz. This is multiplied by 2 as drift could be in either direction. Further experiments show that slightly higher values are encountered, so 10000 is used.

◆ SOURCE_T1_COUNT_MASK

#define SOURCE_T1_COUNT_MASK   0xFFFFF

The mask of the source tc[T1_COUNT] part of the message.

The timer is set to 200,000 which fits in the bottom 20 bits.

Function Documentation

◆ p2p_rcv_data()

void p2p_rcv_data ( uint  data,
uint  addr 
)
extern

Receive data on channel.

May write 1 or 2 bytes beyond end of buffer (buffer has pad word)

Parameters
[in]dataThe payload from the packet
[in]addrThe sender address (lower 16 bits) from the packet

◆ p2p_rcv_ctrl()

void p2p_rcv_ctrl ( uint  data,
uint  addr 
)
extern

Received P2P control packet.

Delegates to:

Parameters
[in]dataThe payload from the packet
[in]addrThe sender address (lower 16 bits) from the packet

◆ nn_rcv_pkt()

void nn_rcv_pkt ( uint  link,
uint  data,
uint  key 
)
extern

Nearest-neighbour packet received handler.

Parameters
[in]linkWhat link was the packet received on
[in]dataThe payload from the packet
[in]keyThe key from the packet

◆ peek_ack_pkt()

void peek_ack_pkt ( uint  link,
uint  data,
uint  key 
)
extern

Initialises peek_pkt to contain the given arguments (presumably an acknowledge)

Parameters
[in]linkWhich link to send the packet on
[in]dataThe payload of the packet
[in]keyThe key of the packet

◆ poke_ack_pkt()

void poke_ack_pkt ( uint  link,
uint  data,
uint  key 
)
extern

Initialises poke_pkt to contain the given arguments (presumably an acknowledge)

Parameters
[in]linkWhich link to send the packet on
[in]dataThe payload of the packet
[in]keyThe key of the packet

◆ proc_1khz()

void proc_1khz ( uint  a1,
uint  a2 
)
extern

Regular 1kHz timer callback, put on the event queue every millisecond.

Used to PWM the LEDs.

Parameters
a1unused
a2unused

◆ proc_100hz()

void proc_100hz ( uint  a1,
uint  a2 
)
extern

Regular 100Hz timer callback, put on the event queue every 10ms.

Handles:

  1. Discovery of the machine.
  2. Initialisation of the P2P network.
  3. LED state update (liveness monitoring)
  4. IPTag timeouts
  5. Watchdog ping
  6. LTPC
    Parameters
    a1unused
    a2unused

◆ proc_1hz()

void proc_1hz ( uint  a1,
uint  a2 
)
extern

Regular 1Hz timer callback, put on the event queue every second.

It handles network physical state monitoring.

Parameters
a1unused
a2unused

◆ msg_queue_insert()

void msg_queue_insert ( sdp_msg_t msg,
uint  srce_ip 
)
extern

Adds a message to SCAMP's master message queue, to be processed by proc_route_msg().

Note
This silently drops messages if the queue is full.
Parameters
[in]msgThe message to dispatch. Transfers ownership of the message.
[in]srce_ipSource IP address (if meaningful).

◆ pkt_mc_int()

void pkt_mc_int ( void  )

Multicast packet received handler. Delegates to signal_app()

Interrupt handlers for multicast.

◆ pkt_nn_int()

void pkt_nn_int ( void  )

Nearest-neighbour packet received handler.

Delegates to one of:

◆ pkt_p2p_int()

void pkt_p2p_int ( void  )

Peer-to-peer packet received handler.

Delegates to one of:

◆ ms_timer_int()

void ms_timer_int ( void  )

Millisecond timer interrupt handler.

Delegates (with appropriate frequency) to: