* merge GE code * update fold structure * enable to build two types of projects separately
204 lines
5.3 KiB
C
204 lines
5.3 KiB
C
#ifndef SYSTEMBUS_MSG_H
|
|
#define SYSTEMBUS_MSG_H
|
|
#include <string.h>
|
|
/**
|
|
* @addtogroup SystemBus
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* @addtogroup SystemBus_Protocol_Routine
|
|
* @{
|
|
*/
|
|
|
|
// Handle pointer
|
|
#define ASSEMBLE_MSG_POINTER(buff, offset, data, len) \
|
|
memcpy((buff) + (offset), (data), (len))
|
|
|
|
// Handle scalar
|
|
#define ASSEMBLE_MSG_SCALAR(buff, offset, data) \
|
|
memcpy((buff) + (offset), &(data), sizeof(data))
|
|
|
|
// Handle immediate
|
|
#define ASSEMBLE_MSG_IMMEDIATE(buff, offset, value) \
|
|
{ \
|
|
(buff)[(offset)] = (uint16_t)(value); \
|
|
}
|
|
|
|
/************************** Constant Definitions *****************************/
|
|
/**
|
|
* @name SystemBus_MSG_Constants
|
|
* @{
|
|
*/
|
|
// Common Field
|
|
// -- Command word
|
|
#define WD_CMD 0U
|
|
#define SATID_LEO 0x0044
|
|
#define SATID_TT 0x0055
|
|
#define SATID_NEW 0x0066
|
|
#define ANTID_PAA 0xAA11
|
|
#define ANTID_LEO 0xAA44
|
|
#define ANTID_TT 0xAA55
|
|
#define SPEED_LEO_1KBPS 0x001B
|
|
#define SPEED_LEO_2KBPS 0x002B
|
|
#define SPEED_LEO_4KBPS 0x003B
|
|
#define SPEED_LEO_8KBPS 0x004B
|
|
#define SPEED_TT_1KBPS 0x005B
|
|
#define SPEED_TT_2KBPS 0x006B
|
|
#define SPEED_TT_4K8BPS 0x007B
|
|
#define SPEED_TT_90K6BPS 0x008B
|
|
#define SPEED_NEW_128KBPS 0x009B
|
|
#define SPEED_NEW_256KBPS 0x00AB
|
|
#define SPEED_NEW_2KBPS 0x00BB
|
|
|
|
// Configure load
|
|
#define CMD_CONFIG 0x0002
|
|
// -- Request
|
|
// TODO: Ephemeris length unknown.
|
|
#define WD_CFG_DID 1U
|
|
#define WD_CFG_EPM 2U //??
|
|
#define WD_CFG_FREQ 3U
|
|
#define WD_CFG_PATTERN 4U
|
|
#define WD_CFG_ANGEL 5U
|
|
// -- Response
|
|
#define RSP_CONFIG 0x0012
|
|
#define RSP_CONFIG_LEN 4U
|
|
#define WD_RSP_STATE 1U
|
|
#define RSP_STA_OK 0xAAAA
|
|
#define RSP_STA_ERROR 0x5555
|
|
|
|
// Self-Test
|
|
#define CMD_SELF_TEST 0x0022
|
|
// -- Request
|
|
#define WD_ST_CMD 1U
|
|
#define ST_COMMAND 0x1111
|
|
// -- Response
|
|
// -- -- Self-Test Result
|
|
#define RSP_SELF_TEST 0x0032
|
|
#define RSP_SELF_TEST_LEN 44U
|
|
#define WD_RSP_ST_STATE 1U
|
|
#define RSP_ST_OK 0xAAAA
|
|
#define RSP_ST_ERROR 0x5555
|
|
// 0x02~0x09 a bunch of unknown device ID and error number.
|
|
#define WD_RSP_ST_XKZID 10U // should be 0xAA44
|
|
#define WD_RSP_ST_XKZERRNO 11U
|
|
// 0x0C~0x14 another bunch of random device ID and error number.
|
|
|
|
// Power UP command
|
|
// -- Request
|
|
#define CMD_POWERUP 0x0042
|
|
#define WD_PWUP_SATID 1U
|
|
#define WD_PWUP_SATMODE 2U
|
|
#define PWUP_SATMODE_DOWN 0xAAAA
|
|
#define PWUP_SATMODE_UP 0xCCCC
|
|
#define WD_PWUP_ANTID 3U
|
|
#define WD_PWUP_ANTMODE 4U
|
|
#define PWUP_ANTMODE_DOWN 0xAAAA
|
|
#define PWUP_ANTMODE_UP 0xCCCC
|
|
#define WD_PWUP_BACKWARD 5U
|
|
#define WD_PWUP_FORWARD 6U
|
|
#define WD_PWUP_FRQSWITCH 6U
|
|
// -- Response
|
|
#define RSP_POWERUP 0x0052
|
|
#define RSP_POWERUP_LEN 4U
|
|
#define WD_RSP_PWUP_SATE 1U
|
|
#define RSP_PWUP_OK 0xAAAA
|
|
|
|
// Power UP command
|
|
// -- Request
|
|
#define CMD_MODE_SWITCH 0x0072
|
|
#define WD_MODESW_SATID_0 1U
|
|
#define WD_MODESW_SATID_1 5U
|
|
#define WD_MODESW_SATMODE_0 2U
|
|
#define WD_MODESW_SATMODE_1 6U
|
|
#define WD_MODESW_ANTMODE_0 4U
|
|
#define WD_MODESW_ANTMODE_1 8U
|
|
#define MODESW_SATMODE_LOW_POWER 0xAAAA
|
|
#define MODESW_ANTMODE_LOW_POWER 0xCCCC
|
|
#define MODESW_ANTMODE_FULL_POWER 0xBBBB
|
|
|
|
// -- Response
|
|
#define RSP_MODE_SWITCH 0x0082
|
|
#define RSP_MODE_SWITCH_LEN 4U
|
|
#define WD_RSP_MODESW_SATE 1U
|
|
#define RSP_MODESW_OK 0xAAAA
|
|
|
|
|
|
// Parameter configure
|
|
// -- Request
|
|
#define CMD_PARM_CONFIG 0x0172
|
|
#define WD_PARMCFG_SATID 1U
|
|
|
|
#define WD_PARMCFG_BACKWARD 2U
|
|
#define WD_PARMCFG_FORWARD 3U
|
|
// -- Response
|
|
#define RSP_PARM_CONFIG 0x0182
|
|
#define WD_RSP_PARCFG_SATE 1U
|
|
#define RSP_PARCFG_OK 0xAAAA
|
|
|
|
// Service Data
|
|
// -- Request
|
|
#define DATA_DLUL_LEN 510U
|
|
#define CMD_DATA_DL 0x0092
|
|
#define CMD_DATA_UL 0x00A2
|
|
#define WD_DATA_SATID 1U
|
|
#define WD_DATA_SEQID 2U
|
|
#define WD_DATA_SEQPKT 3U
|
|
#define WD_DATA_DLEN 4U
|
|
#define WD_DATA_PAYLOAD 5U
|
|
#define DATA_PAYLOAD_MAX 500U
|
|
// -- Response
|
|
// -- -- none response
|
|
|
|
// Remote Test
|
|
// -- Request
|
|
// -- -- none request
|
|
// -- Response
|
|
// -- -- none responses
|
|
#define RSP_REMOTE_TEST 0x00B2
|
|
#define RSP_REMOTE_TEST_LEN 68U
|
|
#define WD_RSP_RT_CNT 1U
|
|
#define WD_RSP_RT_SATID 3U
|
|
#define WD_RSP_RT_SATMODE 4U
|
|
#define RSP_RT_SATMODE_LOWPOWER 0x5555
|
|
#define RSP_RT_SATMODE_FULLPOWER 0xAAAA
|
|
#define WD_RSP_RT_NETSTATE 5U
|
|
#define RSP_RT_NETSTATE_NOCXN 0x0000
|
|
#define RSP_RT_NETSTATE_JOIN 0x1111
|
|
#define RSP_RT_NETSTATE_SUCCESS 0x2222
|
|
#define RSP_RT_NETSTATE_FAILED 0x3333
|
|
#define RSP_RT_NETSTATE_INSERVICE 0x4444
|
|
#define RSP_RT_NETSTATE_ENDSERVICE 0x5555
|
|
#define WD_RSP_RT_RECXN_CNT 6U
|
|
#define WD_RSP_RT_TXSVC_CNT 8U
|
|
#define WD_RSP_RT_RXSVC_CNT 10U
|
|
#define WD_RSP_RT_CRCTSVC_CNT 12U
|
|
#define WD_RSP_RT_ANT_BEAMID 13U
|
|
#define WD_RSP_RT_ANT_BEAMWIDTH 14U
|
|
#define WD_RSP_RT_ANT_OFFAX 15U
|
|
#define WD_RSP_RT_ANT_RNDAX 17U
|
|
#define WD_RSP_RT_HWSTATE 19U
|
|
#define RSP_RT_HWSTATE_OK 0xAAAA
|
|
#define WD_RSP_RT_FPGA_VOLT 20U
|
|
#define RSP_RT_FPGA_VOLT_OK 0x00FF
|
|
#define WD_RSP_RT_FPGA_TEMP 21U
|
|
#define WD_RSP_RT_ZYNQ_TEMP 22U
|
|
#define WD_RSP_RT_CLK_LOCK 23U
|
|
#define RSP_RT_CLK_LOCK_OK 0x00FF
|
|
#define WD_RSP_RT_ADC_TEMP 24U
|
|
#define WD_RSP_RT_ANTID 25U
|
|
#define WD_RSP_RT_ANTMODE 26U
|
|
#define RSP_RT_ANTMODE_FULLPOWER 0xCCCC
|
|
#define RSP_RT_ANTMODE_LOWPOWER 0xAAAA
|
|
#define WD_RSP_RT_ANT_VOLT 27U
|
|
#define WD_RSP_RT_ANT_TEMP 28U
|
|
#define WD_RSP_RT_ANT_LOCK 29U
|
|
#define RSP_RT_ANT_LOCK_OK 0x00FF
|
|
#define WD_RSP_RT_ANT_MGC_0 30U
|
|
#define WD_RSP_RT_ANT_MGC_1 31U
|
|
|
|
/** @} SystemBus_MSG_Constants*/
|
|
|
|
/** @} SystemBus*/
|
|
#endif
|