add comment add enhance code coherent

This commit is contained in:
Gatsby Van
2024-03-16 16:18:03 +08:00
parent 62cc15c3d4
commit 66529637a3
2 changed files with 65 additions and 12 deletions
+26 -3
View File
@@ -1,10 +1,12 @@
#ifndef __SYSTEM_MONITOR_H_
#define __SYSTEM_MONITOR_H_
/***************************** Include Files *********************************/
#include <stdint.h>
#include <stdbool.h>
#include "util.h"
/************************** Constant Definitions *****************************/
#define PAYLOAD_LEN_MAX 256
#define PAYLOAD_LEN_FLJ_RX 168
#define PAYLOAD_LEN_FLJ_TX 66
@@ -36,12 +38,19 @@
#define VOLT_ANT_NIL_OK BIT(4)
#define ANT_STATE_OK BIT(6)
// Xilinx Recommended
// #define IS_PS_VALID(x) (x <= 1.05 && x >= 0.95)
// #define IS_PSAUX_VALID(x) (x <= 1.89 && x >= 1.71)
// #define IS_DDR_VALID(x) (x <= 1.89 && x >= 1.14)
// #define IS_PL_VALID(x) (x <= 1.03 && x >= 0.97)
// #define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
// #define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.97)
#define IS_PS_VALID(x) (x <= 1.05 && x >= 0.95)
#define IS_PSAUX_VALID(x) (x <= 1.89 && x >= 1.71)
#define IS_DDR_VALID(x) (x <= 1.89 && x >= 1.14)
#define IS_PL_VALID(x) (x <= 1.03 && x >= 0.97)
#define IS_PL_VALID(x) (x <= 1.03 && x >= 0.96)
#define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
#define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.97)
#define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.96)
#define CLK_SP_PLL0_LOCK BIT(0)
#define CLK_SP_PLL1_LOCK BIT(2)
@@ -59,6 +68,9 @@
#define TEMPERATURE_MAX 127.0 // Celsius degree
#define TEMPERATURE_MIN -128.0 // Celsius degree
/************************** Data Type Definitions ****************************/
/** @name System Info
*/
typedef struct __attribute__((packed))
{
// -- unit: ms, 0~604799999
@@ -98,6 +110,8 @@ typedef struct __attribute__((packed))
float roll;
} SYSINFO;
/** @name System Bus Log
*/
typedef struct __attribute__((packed))
{
// SystemBus log
@@ -110,6 +124,8 @@ typedef struct __attribute__((packed))
uint32_t remoteCnt;
} SYSBUSLOG;
/** @name Linklayer Log
*/
typedef struct __attribute__((packed))
{
// Network log
@@ -138,6 +154,8 @@ typedef struct __attribute__((packed))
uint8_t reserve[4];
} LINKLOG;
/** @name Physical layer Log
*/
typedef struct __attribute__((packed))
{
uint32_t acqCnt;
@@ -156,6 +174,8 @@ typedef struct __attribute__((packed))
uint8_t reserve[3];
} PHYLOG;
/** @name Hardware Status Log
*/
typedef struct __attribute__((packed))
{
// Hardware status
@@ -177,12 +197,15 @@ typedef struct __attribute__((packed))
uint8_t reserve[2];
} HWSTATE;
/** @name Payload
*/
typedef struct
{
uint32_t dataId;
uint8_t data[PAYLOAD_LEN_MAX];
} PAYLOAD;
/************************** Function Prototypes ******************************/
int32_t SysMonitor_Init(void);
void SysMonitor_Destroy(void);
@@ -190,7 +213,7 @@ 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, 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);