Common Update: Better Doxygen Style

This commit is contained in:
bit-cyber-fh
2024-03-28 00:00:59 +08:00
parent 9b416114a1
commit bab91e13df
43 changed files with 1800 additions and 1195 deletions
+106 -25
View File
@@ -1,3 +1,8 @@
/**
* @addtogroup SystemMonitor
* @{
*/
/***************************** Include Files *********************************/
#include <string.h>
#include <stdlib.h>
@@ -5,6 +10,10 @@
#include "common.h"
#include "system_monitor.h"
/************************** Constant Definitions *****************************/
/**
* @name SystemMonitor_Private_Constants
* @{
*/
#define BUFF_A 0x00
#define BUFF_B 0x01
#define BUFF_NONE 0xFF
@@ -14,15 +23,23 @@
#define SLOTLOG_PACK_LEN 88 // bytes
#define PRTCLLOG_PACK_ELN 24 // bytes
#define HWSTATE_PACK_ELN 12 // bytes
/** @} SystemMonitor_Private_Constants*/
/************************** Data Type Definitions ****************************/
/**
* @struct PingPong
* @brief PingPing Control
*/
typedef struct
{
uint8_t latest;
uint8_t rBusy;
uint8_t wBusy;
uint8_t latest; ///< latest available index
uint8_t rBusy; ///< current read busy index
uint8_t wBusy; ///< current write busy index
} PINGPONG;
/**
* @struct System_Monitor_Inst
* @brief System Monitor struct holds all the system log info
*/
typedef struct
{
PINGPONG recvCtrl;
@@ -64,7 +81,11 @@ inline static uint8_t GetReadable(PINGPONG ctrllor)
return ((ctrllor.wBusy == BUFF_B) ? BUFF_A : BUFF_B);
}
// System monitor initialise
/**
* @brief Initialize System monitor
*
* @return SUCCESS
*/
int32_t SysMonitor_Init(void)
{
sysMonitorInst = calloc(1, sizeof(SYSMONITOR));
@@ -86,15 +107,23 @@ int32_t SysMonitor_Init(void)
return SUCCESS;
}
// System monitor initialise
/**
* @brief Destroy system monitor release all allocated memory
*/
void SysMonitor_Destroy(void)
{
free(sysMonitorInst);
}
// @System Info
/**
* Update system info.
* @name SystemInfo_API
* @{
*/
/**
* @brief Update system info.
*
* @param info
*/
void SysMonitor_UpdateSysinfo(const SYSINFO *info)
{
@@ -107,7 +136,9 @@ void SysMonitor_UpdateSysinfo(const SYSINFO *info)
}
/**
* Get system info.
* @brief Get system info.
*
* @param info
*/
void SysMonitor_GetSysinfo(SYSINFO *info)
{
@@ -122,10 +153,18 @@ void SysMonitor_GetSysinfo(SYSINFO *info)
memcpy(info, &(sysMonitorInst->sysInfo[buffIndx]), sizeof(SYSINFO));
sysMonitorInst->sysInfoCtrl.rBusy = buffIndex_old;
}
/** @} SystemInfo_API*/
// @Send Payload
/**
* Update send payload by.
* @name ServicePayload_API
* @{
*/
/**
* @brief Update send payload by
*
* @param buff
* @param len
*/
void SysMonitor_UpdateSendPayload(const uint8_t *buff, size_t len)
{
@@ -144,7 +183,11 @@ void SysMonitor_UpdateSendPayload(const uint8_t *buff, size_t len)
}
/**
* Get the latest send payload.
* @brief Get the latest send payload.
*
* @param buff
* @param id
* @param len
*/
void SysMonitor_GetSendPayload(uint8_t *buff, uint32_t *id, size_t len)
{
@@ -170,9 +213,12 @@ void SysMonitor_GetSendPayload(uint8_t *buff, uint32_t *id, size_t len)
sysMonitorInst->sendCtrl.rBusy = buffIndex_old;
}
// @Receive Payload
/**
* Update receive payload.
* @brief Update receive payload.
*
* @param buff
* @param id
* @param len
*/
void SysMonitor_UpdateRecvPayload(const uint8_t *buff, uint32_t id, size_t len)
{
@@ -192,14 +238,18 @@ void SysMonitor_UpdateRecvPayload(const uint8_t *buff, uint32_t id, size_t len)
}
/**
* Get the latest receive payload.
* @brief Get the latest receive payload.
*
* @param buff
* @param id
* @param len
*/
void SysMonitor_GetRecvPayload(uint8_t *buff, uint32_t *id, size_t len)
{
ASSERT(sysMonitorInst != NULL);
ASSERT(buff != NULL);
ASSERT(id != NULL);
if(len > PAYLOAD_LEN_MAX)
if (len > PAYLOAD_LEN_MAX)
{
return;
}
@@ -217,10 +267,17 @@ void SysMonitor_GetRecvPayload(uint8_t *buff, uint32_t *id, size_t len)
*id = sysMonitorInst->recv[buffIndx].dataId;
sysMonitorInst->recvCtrl.rBusy = buffIndex_old;
}
/** @} ServicePayload_API*/
// @Link layer log
/**
* Update link layer log
* @name Linklayer_Log_API
* @{
*/
/**
* @brief Update link layer log
*
* @param log
*/
void SysMonitor_UpdateLinklayerLog(const LINKLOG *log)
{
@@ -235,7 +292,9 @@ void SysMonitor_UpdateLinklayerLog(const LINKLOG *log)
}
/**
* Get the latest link layer log
* @brief Get the latest link layer log
*
* @param log
*/
void SysMonitor_GetLinklayerLog(LINKLOG *log)
{
@@ -251,10 +310,17 @@ void SysMonitor_GetLinklayerLog(LINKLOG *log)
memcpy(log, &(sysMonitorInst->linkLog[buffIndx]), sizeof(LINKLOG));
sysMonitorInst->linkLogCtrl.rBusy = buffIndex_old;
}
/** @} Linklayer_Log_API*/
// @Physical layer log
/**
* Update physical layer log
* @name PhysicalLayer_Log_API
* @{
*/
/**
* @brief Update physical layer log
*
* @param log
*/
void SysMonitor_UpdatePhysicalLayerLog(const PHYLOG *log)
{
@@ -269,7 +335,9 @@ void SysMonitor_UpdatePhysicalLayerLog(const PHYLOG *log)
}
/**
* Get the latest physical layer log
* @brief Get the latest physical layer log
*
* @param log
*/
void SysMonitor_GetPhysicalLayerLog(PHYLOG *log)
{
@@ -285,10 +353,17 @@ void SysMonitor_GetPhysicalLayerLog(PHYLOG *log)
memcpy(log, &(sysMonitorInst->phyLog[buffIndx]), sizeof(PHYLOG));
sysMonitorInst->phyLogCtrl.rBusy = buffIndex_old;
}
/** @} */
// @Hardware state
/**
* Log hardware running status.
* @name HardwareState_Log_API
* @{
*/
/**
* @brief Log hardware running status.
*
* @param state
*/
void SysMonitor_UpdateHardwareStatus(const HWSTATE *state)
{
@@ -303,7 +378,9 @@ void SysMonitor_UpdateHardwareStatus(const HWSTATE *state)
}
/**
* Get the latest hardware running status.
* @brief Get the latest hardware running status.
*
* @param state
*/
void SysMonitor_GetHardwareStatus(HWSTATE *state)
{
@@ -319,3 +396,7 @@ void SysMonitor_GetHardwareStatus(HWSTATE *state)
memcpy(state, &(sysMonitorInst->hwState[buffIndx]), sizeof(HWSTATE));
sysMonitorInst->hwStateCtrl.rBusy = buffIndex_old;
}
/** @} HardwareState_Log_API */
/** @} SystemMonitor*/