KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cfg_msg.h File Reference

Defines all remote commands. More...

Go to the source code of this file.

Macros

#define MSG_GROUP_SHIFT   6
 Group bit shift.
 
#define MSG_TYPE(GROUP, ID)   ( ( ( GROUP ) << ( MSG_GROUP_SHIFT ) ) | ( ID ) )
 Creates a message type.
 
#define MSG_EVENTS   MSG_SYS_EVENTS
 List containing all events.
 
#define MSG_COMMANDS
 List containing all commands. More...
 
Debug Group

Defines the debug commands.

These commands are only used for debugging and should not be used during normal operation.

#define GROUP_DEBUG   0x01
 debugging commands group identifier
 
#define MSG_DBG_BUS_READ   MSG_TYPE(GROUP_DEBUG, 0x01)
 Read & Write Bus commands.
 
#define MSG_DBG_BUS_WRITE   MSG_TYPE(GROUP_DEBUG, 0x02)
 
#define MSG_DBG_BUS_RMW   MSG_TYPE(GROUP_DEBUG, 0x03)
 
#define MSG_DBG_I2C_READ   MSG_TYPE(GROUP_DEBUG, 0x04)
 Read & Write I2C (not implemented yet)
 
#define MSG_DBG_I2C_WRITE   MSG_TYPE(GROUP_DEBUG, 0x05)
 
#define MSG_DBG_UART_TX   MSG_TYPE(GROUP_DEBUG, 0x06)
 
#define MSG_DBG_UART_RX   MSG_TYPE(GROUP_DEBUG, 0x07)
 
#define MSG_DBG_FLASH_READ   MSG_TYPE(GROUP_DEBUG, 0x08)
 
#define MSG_DBG_RXPKTLOG_READ   MSG_TYPE(GROUP_DEBUG, 0x09)
 
#define MSG_DBG_RXPKTLOG_RESET   MSG_TYPE(GROUP_DEBUG, 0x0A)
 
#define MSG_DBG_COMMANDS
 Define all messages in a list, including function prototype suffix. More...
 
System Group

Defines the system group commands.

System group commands are not specific to the functionality of the software, but general. For example, version information is generic, system load values etc.

#define GROUP_SYS   0x02
 
#define MSG_SYS_PING   MSG_TYPE(GROUP_SYS, 0x01)
 Ping command.
 
#define MSG_SYS_DATEREV   MSG_TYPE(GROUP_SYS, 0x02)
 Date and Revision Information.
 
#define MSG_SYS_EVT_TARGET   MSG_TYPE(GROUP_SYS, 0x03)
 Sets the sender as the event target, after this all events, will be send to this target.
 
#define MSG_SYS_RESET   MSG_TYPE(GROUP_SYS, 0x04)
 Resets the board.
 
#define MSG_SYS_UPDATE_START   MSG_TYPE(GROUP_SYS, 0x05)
 Command required for starting an update.
 
#define EVT_SYS_UPDATE   MSG_TYPE(GROUP_SYS, 0x06)
 Event emitted to update a part of a firmware image (broadcast)
 
#define MSG_SYS_UPDATE   MSG_TYPE(GROUP_SYS, 0x06)
 Command to update a part of a firmware image(unicast)
 
#define MSG_SYS_UPDATE_END   MSG_TYPE(GROUP_SYS, 0x07)
 Command to end the update procedure.
 
#define MSG_SYS_VERIFY   MSG_TYPE(GROUP_SYS, 0x08)
 Command to verify image data on the flash.
 
#define MSG_SYS_BOOT   MSG_TYPE(GROUP_SYS, 0x09)
 Command to issue boot of specific image.
 
#define MSG_SYS_GOLDEN_STOP   MSG_TYPE(GROUP_SYS, 0x0A)
 Command to stop the golden image for proceeding and booting the main image. More...
 
#define MSG_SYS_GOLDEN_UNLOCK   MSG_TYPE(GROUP_SYS, 0x0B)
 Unlocks the golden image for writing.
 
#define MSG_SYS_LOG_GET   MSG_TYPE(GROUP_SYS, 0x0C)
 Get the last live log lines.
 
#define MSG_SYS_P_LOG_GET   MSG_TYPE(GROUP_SYS, 0x0D)
 Get the last persistent log lines. More...
 
#define MSG_SYS_IMG_GET   MSG_TYPE(GROUP_SYS, 0x0E)
 Returns information on the images in the current CLB. More...
 
#define MSG_SYS_COREDUMP_CLR   MSG_TYPE(GROUP_SYS, 0x0F)
 Command to issue boot of specific image.
 
#define MSG_SYS_CONTUN_INIT   MSG_TYPE(GROUP_SYS, 0x10)
 Initialize/uninitialize console tunnel. More...
 
#define MSG_SYS_CONTUN_SEND   MSG_TYPE(GROUP_SYS, 0x11)
 Send one or more characters to a console. More...
 
#define EVT_SYS_CONTUN_RECV   MSG_TYPE(GROUP_SYS, 0x12)
 Event when character data is available on any of the consoles. More...
 
#define MSG_SYS_RT_CONFIG   MSG_TYPE(GROUP_SYS, 0x18)
 Gets/Sets the runtime configuration. More...
 
#define MSG_SYS_COMMANDS
 Define all messages in a list, including function prototype suffix. More...
 
#define MSG_SYS_EVENTS
 Define all events which can be received. More...
 
CLB Group

Defines commands in the CLB group.

The CLB group contains commands which are not tied to a specific peripheral. For example, state change commands, configuration commands, or generic status requests should be in this group.

#define GROUP_CLB   0x03
 
#define MSG_CLB_GET_STATE   MSG_TYPE(GROUP_CLB, 0x01)
 
#define MSG_CLB_EVENT   MSG_TYPE(GROUP_CLB, 0x02)
 
#define EVT_CLB_STATE   MSG_TYPE(GROUP_CLB, 0x03)
 
#define EVT_CLB_UPDATE   MSG_TYPE(GROUP_CLB, 0x04)
 
#define MSG_CLB_ACTIVATE_CFG   MSG_TYPE(GROUP_CLB, 0x05)
 
#define MSG_CLB_STORE_CFG   MSG_TYPE(GROUP_CLB, 0x06)
 
#define MSG_CLB_GET_VARS   MSG_TYPE(GROUP_CLB, 0x07)
 
#define MSG_CLB_SET_VARS   MSG_TYPE(GROUP_CLB, 0x08)
 
#define MSG_CLB_SUB_VARS   MSG_TYPE(GROUP_CLB, 0x09)
 
#define MSG_CLB_UNSUB_VARS   MSG_TYPE(GROUP_CLB, 0x10)
 
#define EVT_CLB_UPDATE_VARS   MSG_TYPE(GROUP_CLB, 0x11)
 
#define MSG_CLB_EXT_UPDATE   MSG_TYPE(GROUP_CLB, 0x12)
 
#define MSG_CLB_CLR_ERR_STATE   MSG_TYPE(GROUP_CLB, 0x13)
 Clear the error state. More...
 
#define MSG_CLB_SUB_VARSRATE   MSG_TYPE(GROUP_CLB, 0x14)
 Subscribes to one or more variables with a specific rate. More...
 
#define MSG_CLB_COMMANDS
 Define all messages in a list, including function prototype suffix. More...
 
Network Group

Defines all commands for network configuration.

#define GROUP_NET   0x04
 
#define MSG_NET_MUX_DEST   MSG_TYPE(GROUP_NET, 0x01)
 
#define MSG_NET_WL_TUNE_INFO   MSG_TYPE(GROUP_NET, 0x02)
 Gets wavelength tuning info. More...
 
#define MSG_NET_WL_TUNE_SET   MSG_TYPE(GROUP_NET, 0x03)
 Set wavelength tuning word. More...
 
#define MSG_NET_WL_TUNE_ACK   MSG_TYPE(GROUP_NET, 0x04)
 Send ACK, to confirm tuning. More...
 
#define MSG_NET_COMMANDS
 Define all messages in a list, including function prototype suffix. More...
 
OPT Group

All commands for controlling the optical detector of the CLB, i.e.

PMTs, TDCs, etc...

Todo:
#define GROUP_OPT   0x05
 
#define MSG_OPT_COMMANDS
 Define all messages in a list, including function prototype suffix. More...
 
Acoustics Group

Description not yet written

Todo:
#define GROUP_ACS   0x06
 
#define MSG_ACS_COMMANDS
 Define all messages in a list, including function prototype suffix. More...
 
Instrumetnation group

This group contains peripherals that do not require a lot of commands.

Todo:
#define GROUP_INS   0x08
 
#define MSG_INS_AHRS_SET_REG   MSG_TYPE(GROUP_INS, 0x01)
 
#define MSG_INS_AHRS_GET_REG   MSG_TYPE(GROUP_INS, 0x02)
 
#define MSG_INS_AHRS_GET_REG_EX   MSG_TYPE(GROUP_INS, 0x03)
 
#define MSG_INS_COMMANDS
 Define all messages in a list, including function prototype suffix. More...
 
#define GROUP_BSE   0x07
 
#define MSG_BSE_CONFIGURE   MSG_TYPE(GROUP_BSE, 0x01)
 
#define MSG_BSE_RESET   MSG_TYPE(GROUP_BSE, 0x02)
 
#define MSG_BSE_EDFA_DBG_CMD   MSG_TYPE(GROUP_BSE, 0x11)
 
#define MSG_BSE_EDFA_DBG_CMDRPLY   MSG_TYPE(GROUP_BSE, 0x12)
 
#define MSG_BSE_BPS_DBG_CMDRPLY   MSG_TYPE(GROUP_BSE, 0x13)
 BSP Debug Command/Reply. More...
 
#define MSG_BSE_COMMANDS
 Define all messages in a list, including function prototype suffix. More...
 

Detailed Description

Defines all remote commands.

A command belongs to a group. Each group has a unique identifier. To add a command first find the correct group, and then add your command ID by defining a new type identifier:

#define MSG_{group_name}_{cmd_name} MSG_TYPE({group_id}, {#id})

For example, the reset command would be in the system group, with ID is defined as follows:

#define MSG_SYS_REBOOT MSG_TYPE(GROUP_SYS, 0x2)

Then a link must be made to the actual command. This can be done with the MSG_CMD({type}, {function suffix}) macro, which should be inside the MSG_<group>_COMMANDS list:

#define MSG_SYS_COMMANDS \
MSG_CMD(MSG_SYS_PING, Ping) \
MSG_CMD(MSG_SYS_REBOOT, Reboot)

Now the message module (msg.h) will generate a function prototype:

bool _msgReboot(MsgId * msgId, DataBuffer * cmd);

You must then fill in the body of this function. Please see msg.h for more details.

Definition in file cfg_msg.h.

Macro Definition Documentation

#define EVT_SYS_CONTUN_RECV   MSG_TYPE(GROUP_SYS, 0x12)

Event when character data is available on any of the consoles.

Also includes two strings. First string is of the PTP core, second is of the LM32.

Definition at line 233 of file cfg_msg.h.

#define MSG_ACS_COMMANDS

Define all messages in a list, including function prototype suffix.

Definition at line 489 of file cfg_msg.h.

#define MSG_BSE_BPS_DBG_CMDRPLY   MSG_TYPE(GROUP_BSE, 0x13)

BSP Debug Command/Reply.

Command: u8 cmdCode BPS command code u8 rplCode Expected BPS reply code u8 rplNData Expected number of returned bytes u8 cmdNData Number of command bytes u8[cmdNData] cmdData Command data

Reply: u8 rplNData Number of returned bytes u8[rplNData] rplData Reply data u8 cmdCode* Command which caused the reply u8 rplCode* Reply code

  • Added as of 1 dec 2015, VvB

Definition at line 546 of file cfg_msg.h.

#define MSG_BSE_COMMANDS
Value:
MSG_CMD(MSG_BSE_CONFIGURE, BseConfigure) \
MSG_CMD(MSG_BSE_RESET, BseReset) \
MSG_CMD(MSG_BSE_EDFA_DBG_CMD, BseEdfaDbgCmd) \
MSG_CMD(MSG_BSE_EDFA_DBG_CMDRPLY, BseEdfaDbgCmdRply) \
#define MSG_CMD(CMD_TYPE, CMD_STUB)
Generate all message callbacks.
Definition: msg.h:441
#define MSG_BSE_BPS_DBG_CMDRPLY
BSP Debug Command/Reply.
Definition: cfg_msg.h:546

Define all messages in a list, including function prototype suffix.

Definition at line 550 of file cfg_msg.h.

#define MSG_CLB_CLR_ERR_STATE   MSG_TYPE(GROUP_CLB, 0x13)

Clear the error state.

Command pay-load: SUBID u8 Subsystem ID

Reply:

Definition at line 341 of file cfg_msg.h.

#define MSG_CLB_COMMANDS
Value:
MSG_CMD(MSG_CLB_GET_STATE, ClbGetState) \
MSG_CMD(MSG_CLB_EVENT, ClbEvent) \
MSG_CMD(MSG_CLB_GET_VARS, ClbGetVars) \
MSG_CMD(MSG_CLB_SET_VARS, ClbSetVars) \
MSG_CMD(MSG_CLB_SUB_VARS, ClbSubVars) \
MSG_CMD(MSG_CLB_UNSUB_VARS, ClbUnSubVars) \
MSG_CMD(MSG_CLB_EXT_UPDATE, ClbExtUpdate) \
#define MSG_CLB_CLR_ERR_STATE
Clear the error state.
Definition: cfg_msg.h:341
ClbEvent
All state change events.
Definition: clbstate.h:88
#define MSG_CLB_SUB_VARSRATE
Subscribes to one or more variables with a specific rate.
Definition: cfg_msg.h:355
#define MSG_CMD(CMD_TYPE, CMD_STUB)
Generate all message callbacks.
Definition: msg.h:441

Define all messages in a list, including function prototype suffix.

Definition at line 359 of file cfg_msg.h.

#define MSG_CLB_SUB_VARSRATE   MSG_TYPE(GROUP_CLB, 0x14)

Subscribes to one or more variables with a specific rate.

Command pay-load: RATE u8 Rate: 0 - each frame 1 - each second 2 - every 10 seconds 3 - every 60 seconds. COUNT u16 No. of vars VARIDS i32[COUNT] Variable ID of each variable.

Definition at line 355 of file cfg_msg.h.

#define MSG_COMMANDS
Value:

List containing all commands.

Definition at line 565 of file cfg_msg.h.

#define MSG_DBG_COMMANDS
Value:
MSG_CMD(MSG_DBG_BUS_WRITE, BusWrite) \
MSG_CMD(MSG_DBG_I2C_WRITE, I2CWrite) \
MSG_CMD(MSG_DBG_UART_TX, UartTx) \
MSG_CMD(MSG_DBG_UART_RX, UartRx) \
MSG_CMD(MSG_DBG_FLASH_READ, FlashRead) \
MSG_CMD(MSG_DBG_RXPKTLOG_READ, RxPktLogRead) \
MSG_CMD(MSG_DBG_RXPKTLOG_RESET, RxPktLogReset) \
#define MSG_DBG_I2C_READ
Read &amp; Write I2C (not implemented yet)
Definition: cfg_msg.h:77
#define MSG_CMD(CMD_TYPE, CMD_STUB)
Generate all message callbacks.
Definition: msg.h:441
#define MSG_DBG_BUS_READ
Read &amp; Write Bus commands.
Definition: cfg_msg.h:70

Define all messages in a list, including function prototype suffix.

Definition at line 106 of file cfg_msg.h.

#define MSG_INS_COMMANDS
Value:
MSG_CMD(MSG_INS_AHRS_SET_REG, InsAHRSSetReg) \
MSG_CMD(MSG_INS_AHRS_GET_REG, InsAHRSGetReg) \
MSG_CMD(MSG_INS_AHRS_GET_REG_EX,InsAHRSGetRegEx)
#define MSG_CMD(CMD_TYPE, CMD_STUB)
Generate all message callbacks.
Definition: msg.h:441

Define all messages in a list, including function prototype suffix.

Definition at line 512 of file cfg_msg.h.

#define MSG_NET_COMMANDS
Value:
MSG_CMD(MSG_NET_MUX_DEST, NetMuxDest) \
MSG_CMD(MSG_NET_WL_TUNE_ACK, NetWlTuneAck) \
#define MSG_NET_WL_TUNE_ACK
Send ACK, to confirm tuning.
Definition: cfg_msg.h:441
#define MSG_NET_WL_TUNE_INFO
Gets wavelength tuning info.
Definition: cfg_msg.h:412
#define MSG_CMD(CMD_TYPE, CMD_STUB)
Generate all message callbacks.
Definition: msg.h:441
#define MSG_NET_WL_TUNE_SET
Set wavelength tuning word.
Definition: cfg_msg.h:428

Define all messages in a list, including function prototype suffix.

Definition at line 444 of file cfg_msg.h.

#define MSG_NET_WL_TUNE_ACK   MSG_TYPE(GROUP_NET, 0x04)

Send ACK, to confirm tuning.

Must be done within 15 seconds.

REQUEST:

Empty

RESPONE:

Ack or Error.

Definition at line 441 of file cfg_msg.h.

#define MSG_NET_WL_TUNE_INFO   MSG_TYPE(GROUP_NET, 0x02)

Gets wavelength tuning info.

REQUEST:

Emtpy

RESPONSE:

Off Len Type Description


0 1 U8 WL Tuning vendor procedure where 0 - Not supported 1 - EOPTOLINK procedure (Tuning word must be -80 to 80) 2 - OESolutions procedure (Tuning word must be 0-65536) 3..255 - Reserved 1 1 U8 Status bit field Bits 2..0: State (enumeration) 0 - Idle 1 - Busy 2 - Waiting for ACK 7 - Reserved Bit 3 : Last ACK failed, laser reset 2 2 U16 Value from the Optional Laser Wavelength (SFP+ Addr A2, 106-107) or 0x0000 if not implemented. 4 4 I32 Current Tuning word value (must in in range of procedure)

Definition at line 412 of file cfg_msg.h.

#define MSG_NET_WL_TUNE_SET   MSG_TYPE(GROUP_NET, 0x03)

Set wavelength tuning word.

REQUEST:

Off Len Type Description


0 4 I32 Tuning word to set, must be in supported range. See byte 0 of WL_TUNE_INFO response

RESPONE:

Ack or Error. After ACK the WL will be tuned

Definition at line 428 of file cfg_msg.h.

#define MSG_OPT_COMMANDS

Define all messages in a list, including function prototype suffix.

Definition at line 470 of file cfg_msg.h.

#define MSG_SYS_COMMANDS
Value:
MSG_CMD(MSG_SYS_UPDATE, SysUpdateRecv) \
MSG_CMD(MSG_SYS_VERIFY, SysUpdateVerify)\
#define MSG_SYS_P_LOG_GET
Get the last persistent log lines.
Definition: cfg_msg.h:189
#define MSG_SYS_UPDATE_END
Command to end the update procedure.
Definition: cfg_msg.h:157
#define MSG_SYS_VERIFY
Command to verify image data on the flash.
Definition: cfg_msg.h:161
#define MSG_SYS_PING
Ping command.
Definition: cfg_msg.h:135
#define MSG_SYS_BOOT
Command to issue boot of specific image.
Definition: cfg_msg.h:164
#define MSG_SYS_COREDUMP_CLR
Command to issue boot of specific image.
Definition: cfg_msg.h:209
#define MSG_SYS_RT_CONFIG
Gets/Sets the runtime configuration.
Definition: cfg_msg.h:249
#define MSG_SYS_CONTUN_SEND
Send one or more characters to a console.
Definition: cfg_msg.h:227
#define MSG_SYS_UPDATE_START
Command required for starting an update.
Definition: cfg_msg.h:147
#define MSG_SYS_GOLDEN_STOP
Command to stop the golden image for proceeding and booting the main image.
Definition: cfg_msg.h:168
#define MSG_CMD(CMD_TYPE, CMD_STUB)
Generate all message callbacks.
Definition: msg.h:441
#define MSG_SYS_CONTUN_INIT
Initialize/uninitialize console tunnel.
Definition: cfg_msg.h:221
#define MSG_SYS_LOG_GET
Get the last live log lines.
Definition: cfg_msg.h:174
#define MSG_SYS_IMG_GET
Returns information on the images in the current CLB.
Definition: cfg_msg.h:206
#define MSG_SYS_EVT_TARGET
Sets the sender as the event target, after this all events, will be send to this target.
Definition: cfg_msg.h:141
#define MSG_SYS_DATEREV
Date and Revision Information.
Definition: cfg_msg.h:138
#define MSG_SYS_RESET
Resets the board.
Definition: cfg_msg.h:144
#define MSG_SYS_UPDATE
Command to update a part of a firmware image(unicast)
Definition: cfg_msg.h:153
#define MSG_SYS_GOLDEN_UNLOCK
Unlocks the golden image for writing.
Definition: cfg_msg.h:171

Define all messages in a list, including function prototype suffix.

Definition at line 255 of file cfg_msg.h.

#define MSG_SYS_CONTUN_INIT   MSG_TYPE(GROUP_SYS, 0x10)

Initialize/uninitialize console tunnel.

When provided with a 32-bit integer + 16 bit port number tunneling is configured. If the both numbers are zero, the sender IP and PORT are used.

When provided with no arguments tunneling is uninitialized. It is custom to do this before disconnecting. Otherwise stale packets will be send.

Definition at line 221 of file cfg_msg.h.

#define MSG_SYS_CONTUN_SEND   MSG_TYPE(GROUP_SYS, 0x11)

Send one or more characters to a console.

Two strings must be provided. First string is for the PTP core, second is for the LM32. Strings may be empty.

Definition at line 227 of file cfg_msg.h.

#define MSG_SYS_EVENTS
Value:
MSG_EVT(EVT_SYS_UPDATE, SysUpdateRecv) \
MSG_EVT(EVT_SYS_CONTUN_RECV, ConTunRecv)
#define EVT_SYS_CONTUN_RECV
Event when character data is available on any of the consoles.
Definition: cfg_msg.h:233
#define EVT_SYS_UPDATE
Event emitted to update a part of a firmware image (broadcast)
Definition: cfg_msg.h:150

Define all events which can be received.

Definition at line 277 of file cfg_msg.h.

#define MSG_SYS_GOLDEN_STOP   MSG_TYPE(GROUP_SYS, 0x0A)

Command to stop the golden image for proceeding and booting the main image.

Will not do anything for the normal runtime image.

Definition at line 168 of file cfg_msg.h.

#define MSG_SYS_IMG_GET   MSG_TYPE(GROUP_SYS, 0x0E)

Returns information on the images in the current CLB.

Off Len Type Description 0 1 U8 Number of positions, N, let n = { 0 .. N-1 } 9n + 1 4 U32 Firmware version / date 9n + 5 4 U32 Software version / date 9n + 9 1 I8 The image type, where -1: No image 0: Uknown image (there is an image, but there is no meta-data) 1: Golden 2: Runtime 3: Base 4: Calibration

Definition at line 206 of file cfg_msg.h.

#define MSG_SYS_P_LOG_GET   MSG_TYPE(GROUP_SYS, 0x0D)

Get the last persistent log lines.

Oldest first.

Call first with an 32 bit integer, for the number of log-lines.

The returned message contains a batch of strings.

Call the function again but w/o the 32 bit integer to continue to read the next log lines.

Call as long as the last string as not empty. Once you read an empty line the output is at an end.

Definition at line 189 of file cfg_msg.h.

#define MSG_SYS_RT_CONFIG   MSG_TYPE(GROUP_SYS, 0x18)

Gets/Sets the runtime configuration.

When queried with no payload, the runtime configuration is returned.

The runtime configuration can also be set if put into the payload of the request.

Runtime configuration set

Off Len Type Description 0 1 U8 Version (must be 1 when setting) 1 1 U8 Runtime image number to start after golden (1..3)

Definition at line 249 of file cfg_msg.h.