forked from 0xha0/df_datalink
feat: 完成上位机控制逻辑修改
仅在业务阶段传输上位机数据, 上位机下发数据入队, 待发送时隙进行发送, 收到数据自动上传
This commit is contained in:
+35
-26
@@ -16,11 +16,7 @@
|
||||
* @name SystemMonitor_Constants
|
||||
* @{
|
||||
*/
|
||||
#define PAYLOAD_LEN_MAX 256
|
||||
#define PAYLOAD_LEN_FLJ_RX 168
|
||||
#define PAYLOAD_LEN_FLJ_TX 66
|
||||
#define PAYLOAD_LEN_LJ_RX 66
|
||||
#define PAYLOAD_LEN_LJ_TX 168
|
||||
#define PAYLOAD_LEN_MAX 1000
|
||||
|
||||
#define DATA_ID_NONE UINT32_MAX
|
||||
#define DATA_ID_TEST 0x02030203
|
||||
@@ -120,11 +116,13 @@ typedef struct __attribute__((packed))
|
||||
{
|
||||
// SystemBus log
|
||||
|
||||
uint8_t lastConfig[2]; ///< Last valid config \n
|
||||
// byte 0: 0x11 FLJ, 0x00 LJ \n
|
||||
// byte 1: 0x66 Full Power, 0x88 Low Power
|
||||
uint32_t pollCnt; ///< number of poll commands
|
||||
uint32_t svcCnt; ///< number of service commands
|
||||
uint8_t lastConfig[4]; ///< Last valid config \n
|
||||
// byte 0: Enable control, 0xAA - enable, 0x55 - disable \n
|
||||
// byte 1: Node ID \n
|
||||
// byte 2: Service rate \n
|
||||
// byte 3: routing table number
|
||||
uint32_t recvCnt; ///< number of received data packet
|
||||
uint32_t sendCnt; ///< number of send data packet
|
||||
uint32_t remoteCnt; ///< number of remote check commands
|
||||
} SYSBUSLOG;
|
||||
|
||||
@@ -142,9 +140,9 @@ typedef struct __attribute__((packed))
|
||||
uint8_t linkStage; ///< current linklayer working stage
|
||||
uint32_t recxnCnt; ///< reconnect trial count
|
||||
uint8_t antIndex; ///< current working antenna index
|
||||
uint16_t advTxCnt; ///< adv frame send count
|
||||
uint16_t advRecvCnt; ///< adv frame received count
|
||||
uint16_t advCorrectCnt; ///< adv frame received correctly count
|
||||
uint32_t advTxCnt; ///< adv frame send count
|
||||
uint32_t advRecvCnt; ///< adv frame received count
|
||||
uint32_t advCorrectCnt; ///< adv frame received correctly count
|
||||
uint32_t ackTxCnt; ///< ack frame send count
|
||||
uint32_t ackRecvCnt; ///< ack frame received count
|
||||
uint32_t ackCorrectCnt; ///< ack frame received correctly count
|
||||
@@ -163,7 +161,7 @@ typedef struct __attribute__((packed))
|
||||
int32_t timeDev; ///< last time deviation result
|
||||
uint32_t sendId; ///< last send data id
|
||||
uint32_t recvId; ///< last received data id
|
||||
uint8_t reserve[4]; ///< reserved data
|
||||
uint8_t reserve[3]; ///< reserved data
|
||||
} LINKLOG;
|
||||
|
||||
/**
|
||||
@@ -172,7 +170,7 @@ typedef struct __attribute__((packed))
|
||||
*/
|
||||
typedef struct __attribute__((packed))
|
||||
{
|
||||
uint32_t acqCnt; ///< aquisition count
|
||||
uint32_t acqCnt; ///< acquisition count
|
||||
uint32_t fsyncCnt; ///< frame sync count
|
||||
uint32_t decodeCnt; ///< decode count
|
||||
uint32_t crcCnt; ///< crc valid count
|
||||
@@ -185,7 +183,7 @@ typedef struct __attribute__((packed))
|
||||
uint8_t fsyncFreqCh; ///< last frame sync frequency estimation
|
||||
uint16_t deintlvAmpEst; ///< de-interleave amplitude estimation
|
||||
uint8_t antControl; ///< current antenna rf mode
|
||||
uint8_t reserve[3]; ///< reserved data
|
||||
uint8_t reserve[2]; ///< reserved data
|
||||
} PHYLOG;
|
||||
|
||||
/**
|
||||
@@ -212,30 +210,41 @@ typedef struct __attribute__((packed))
|
||||
int8_t antTemp; ///< Antenna rf temperature
|
||||
uint8_t antRsvd; ///< Antenna reserved status register
|
||||
uint8_t phyId;
|
||||
uint8_t reserve[1];
|
||||
uint8_t reserve[3];
|
||||
} HWSTATE;
|
||||
|
||||
/**
|
||||
* @struct PAYLOAD
|
||||
* @brief Payload struct holds the service payload
|
||||
* @struct SYSMON_CONFIG
|
||||
* @brief System monitor config struct holds system monitor initialization parameters
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t dataId;
|
||||
uint32_t sendQueueMax; ///< maximum send queue length
|
||||
uint32_t recvQueueMax; ///< maximum receive queue length
|
||||
} SYSMON_CONFIG;
|
||||
|
||||
/**
|
||||
* @struct SYSMON_SVC_PAYLOAD
|
||||
* @brief Payload struct that holds the service payload
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t dataId; ///< data identifier
|
||||
uint8_t nodeId; ///< destination ID for tx, source ID for rx
|
||||
uint16_t dataLen; ///< data length
|
||||
uint8_t data[PAYLOAD_LEN_MAX];
|
||||
} PAYLOAD;
|
||||
} SYSMON_SVC_PAYLOAD;
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
int32_t SysMonitor_Init(void);
|
||||
int32_t SysMonitor_Init(SYSMON_CONFIG *config);
|
||||
void SysMonitor_Destroy(void);
|
||||
|
||||
void SysMonitor_UpdateSysinfo(const SYSINFO *info);
|
||||
void SysMonitor_GetSysinfo(SYSINFO *info);
|
||||
|
||||
void SysMonitor_UpdateSendPayload(const uint8_t *buff, size_t len);
|
||||
void SysMonitor_UpdateRecvPayload(const uint8_t *buff, uint32_t id, size_t len);
|
||||
void SysMonitor_GetSendPayload(uint8_t *buff, uint32_t *id, size_t len);
|
||||
void SysMonitor_GetRecvPayload(uint8_t *buff, uint32_t *id, size_t len);
|
||||
int32_t SysMonitor_UpdateSendPayload(SYSMON_SVC_PAYLOAD *payload);
|
||||
void SysMonitor_GetSendPayload(SYSMON_SVC_PAYLOAD *payload);
|
||||
int32_t SysMonitor_GenRecvRsp(SYSMON_SVC_PAYLOAD *payload);
|
||||
|
||||
void SysMonitor_UpdateLinklayerLog(const LINKLOG *log);
|
||||
void SysMonitor_UpdatePhysicalLayerLog(const PHYLOG *log);
|
||||
|
||||
Reference in New Issue
Block a user