SpiNNFrontEndCommon  development
Common support code for user-facing front end systems.
common.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 The University of Manchester
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
22 #ifndef __COMMON_H__
23 #define __COMMON_H__
24 #include <common-typedefs.h>
25 #include <sdp_no_scp.h>
26 
42  CMD_DPRI_CLEAR = 6
43 };
44 
49 typedef enum {
57 
58 // ------------------------------------------------------------------------
59 // global variables for the reinjection mc interface
60 // ------------------------------------------------------------------------
61 
64 
67 
70 
73 static void initialise_reinjection_mc_api(uint32_t base_mc_key) {
74  // set the router timeout keys
77  base_mc_key + ROUTER_EMERGENCY_TIMEOUT_OFFSET;
79 }
80 
82 #define SDP_REPLY_HEADER_LEN 12
83 
85 #define TRANSACTION_CAP 0xFFFFFFF
86 
91 static inline void reflect_sdp_message(sdp_msg_t *msg, uint body_length) {
92  msg->length = SDP_REPLY_HEADER_LEN + body_length;
93  uint dest_port = msg->dest_port;
94  uint dest_addr = msg->dest_addr;
95 
96  msg->dest_port = msg->srce_port;
97  msg->srce_port = dest_port;
98 
99  msg->dest_addr = msg->srce_addr;
100  msg->srce_addr = dest_addr;
101 }
102 
103 #endif // __COMMON_H__
Data type definitions for SpiNNaker Neuron-modelling.
static void initialise_reinjection_mc_api(uint32_t base_mc_key)
sets up the multicast keys for the reinjection multicast API
Definition: common.h:73
static uint reinject_clear_mc_key
the multicast key used for clear reinjector queue to all extra monitors
Definition: common.h:69
reinjector_command_codes
Dropped packet re-injection internal control commands (RC of SCP message)
Definition: common.h:28
@ CMD_DPRI_SET_ROUTER_EMERGENCY_TIMEOUT
Set the router's wait2 timeout.
Definition: common.h:32
@ CMD_DPRI_RESET_COUNTERS
Reset the reinjection counters.
Definition: common.h:38
@ CMD_DPRI_SET_ROUTER_TIMEOUT
Set the router's wait1 timeout.
Definition: common.h:30
@ CMD_DPRI_GET_STATUS
Get the status of the reinjector.
Definition: common.h:36
@ CMD_DPRI_EXIT
Stop doing reinjection.
Definition: common.h:40
@ CMD_DPRI_CLEAR
Clear the reinjection queue.
Definition: common.h:42
@ CMD_DPRI_SET_PACKET_TYPES
Set what packet types are reinjected.
Definition: common.h:34
static uint reinject_emergency_timeout_mc_key
the multicast key used for emergency timeouts to all extra monitors
Definition: common.h:66
reinjector_key_offsets
Human readable definitions of the offsets for multicast key elements for reinjection.
Definition: common.h:49
@ ROUTER_EMERGENCY_TIMEOUT_OFFSET
Set the router's wait2 timeout.
Definition: common.h:53
@ ROUTER_TIMEOUT_OFFSET
Set the router's wait1 timeout.
Definition: common.h:51
@ REINJECTOR_CLEAR_QUEUE_OFFSET
Clear the reinjection queue.
Definition: common.h:55
static uint reinject_timeout_mc_key
the multicast key used for basic timeouts to all extra monitors
Definition: common.h:63
#define SDP_REPLY_HEADER_LEN
Number of bytes in an SDP header.
Definition: common.h:82
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...
Definition: common.h:91
Describes a pure SDP message (without SCP payload)