forked from gatsby/df_datalink
159 lines
3.4 KiB
C
159 lines
3.4 KiB
C
#ifndef __SYSTEM_MONITOR_H_
|
|
#define __SYSTEM_MONITOR_H_
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#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 DATA_ID_NONE UINT32_MAX
|
|
#define DATA_ID_TEST 0x02030203
|
|
|
|
typedef struct
|
|
{
|
|
// FIXME: To Complete
|
|
uint8_t dummy;
|
|
} SYSCONFIG;
|
|
|
|
typedef struct
|
|
{
|
|
// -- unit: ms, 0~604799999
|
|
uint32_t psBDS;
|
|
// -- unit: week, 0~0~8191
|
|
uint16_t pBDS;
|
|
// -- unit: ms, 0~604799999
|
|
uint32_t psGPS;
|
|
// -- unit: week, 0~0~8191
|
|
uint16_t pGPS;
|
|
// Time validation indicator
|
|
// -- [0] GPS
|
|
// -- [1] reserve.
|
|
// -- [2] UTC
|
|
// -- [3] BDS
|
|
uint8_t tmInd;
|
|
// Time of flying
|
|
// uint: s
|
|
float tmFly;
|
|
// Status of flying
|
|
// [7:6] departure status 11 - departed/00 - not departed
|
|
// [5:4] ready status 11 - ready/00 - not ready
|
|
// [3:2] attitude status 11 - attitude ok/00 - attitude not ok
|
|
// [1:0] attitude adjust status 11 - adjusted/00 - not adjusted
|
|
uint8_t stFly;
|
|
// Position in launch coordinate system
|
|
float posX;
|
|
float posY;
|
|
float posZ;
|
|
// Speed in launch coordinate system
|
|
float vX;
|
|
float vY;
|
|
float vZ;
|
|
// Attitude in launch inertia coordinate system
|
|
float pitch;
|
|
float yaw;
|
|
float roll;
|
|
} SYSINFO;
|
|
|
|
typedef struct
|
|
{
|
|
uint32_t dataId;
|
|
uint8_t data[PAYLOAD_LEN_MAX];
|
|
} PAYLOAD;
|
|
|
|
typedef struct
|
|
{
|
|
// Network log
|
|
uint32_t tuNo;
|
|
uint8_t slotNo;
|
|
uint8_t frameType;
|
|
// Payload
|
|
uint8_t payload[PAYLOAD_LEN_MAX];
|
|
// Time sync info
|
|
uint64_t tmStamp;
|
|
uint32_t tmDevi;
|
|
uint32_t freqDevi;
|
|
} SLOTLOG;
|
|
|
|
typedef struct
|
|
{
|
|
// Protocol log
|
|
// -- System time
|
|
uint32_t tmSys;
|
|
// -- Physical layer status
|
|
uint8_t phySt;
|
|
// -- Link layer status
|
|
uint64_t tmLocal;
|
|
uint16_t beamNo;
|
|
uint8_t beamWidth;
|
|
// -- Network layer status
|
|
uint8_t stage;
|
|
uint32_t recvCnt;
|
|
uint32_t recvCorrect;
|
|
} PRTCLLOG;
|
|
|
|
typedef struct
|
|
{
|
|
// Hardware log
|
|
// -- Signal processor status
|
|
uint16_t spVolt;
|
|
uint16_t spTemp;
|
|
uint8_t chipSt;
|
|
// -- Antenna status
|
|
uint8_t antVolt;
|
|
uint8_t antTemp;
|
|
uint8_t antPll;
|
|
uint16_t antMgc;
|
|
uint8_t antSt;
|
|
} HWSTATE;
|
|
|
|
typedef struct
|
|
{
|
|
// Send slot log
|
|
SLOTLOG sendLog;
|
|
|
|
// Receive slot log
|
|
SLOTLOG recvLog;
|
|
|
|
// Protocol log
|
|
PRTCLLOG protocolLog;
|
|
|
|
// Hardware status
|
|
HWSTATE hwSate;
|
|
} SYSLOG;
|
|
|
|
int32_t SysMonitor_Init(void);
|
|
void SysMonitor_Destroy(void);
|
|
|
|
void SysMonitor_UpdateSysinfo(SYSINFO *info);
|
|
void SysMonitor_UpdateSysinfoRaw(uint8_t *buff);
|
|
void SysMonitor_GetSysinfo(SYSINFO *info);
|
|
void SysMonitor_GetSysinfoRaw(uint8_t *buff);
|
|
|
|
void SysMonitor_UpdateSendPayloadRaw(uint8_t *buff, size_t len);
|
|
void SysMonitor_UpdateRecvPayloadRaw(uint8_t *buff, size_t len);
|
|
void SysMonitor_GetSendPayloadRaw(uint8_t *buff, uint32_t *id, size_t len);
|
|
void SysMonitor_GetRecvPayloadRaw(uint8_t *buff, uint32_t *id, size_t len);
|
|
|
|
void SysMonitor_UpdateSendSlotLog(SLOTLOG *log);
|
|
void SysMonitor_UpdateRecvSlotLog(SLOTLOG *log);
|
|
void SysMonitor_UpdateProtocolLog(PRTCLLOG *log);
|
|
void SysMonitor_GetSendSlotLog(SLOTLOG *log);
|
|
void SysMonitor_GetRecvSlotLog(SLOTLOG *log);
|
|
void SysMonitor_GetProtocolLog(PRTCLLOG *log);
|
|
void SysMonitor_GetSendSlotLogRaw(uint8_t *buff);
|
|
void SysMonitor_GetRecvSlotLogRaw(uint8_t *buff);
|
|
void SysMonitor_GetProtocolLogRaw(uint8_t *buff);
|
|
|
|
void SysMonitor_UpdateHardwareStatus(HWSTATE *state);
|
|
void SysMonitor_GetHardwareStatus(HWSTATE *state);
|
|
void SysMonitor_GetHardwareStatusRaw(uint8_t *buff);
|
|
|
|
void SysMonitor_GetSyslog(SYSLOG *log);
|
|
void SysMonitor_GetSyslogRaw(uint8_t *buff);
|
|
|
|
#endif //__SYSTEM_MONITOR_H_
|