Better struct comment

This commit is contained in:
bit-cyber-fh
2024-03-28 15:58:15 +08:00
parent 16d1ad30a7
commit 8d72288675
15 changed files with 154 additions and 131 deletions
+6 -5
View File
@@ -29,15 +29,16 @@
#include <stddef.h> #include <stddef.h>
/** /**
* @struct CircularQueueInst * @struct CIRC_QUEUE
* @brief Circular queue Instance
*/ */
typedef struct typedef struct
{ {
void **data; void **data;
volatile uint32_t nelts; /**< # elements */ volatile uint32_t nelts; ///< number of elements
uint32_t in; /**< next empty location */ uint32_t in; ///< next empty location
uint32_t out; /**< next filled location */ uint32_t out; ///< next filled location
uint32_t bounds; /**< max size of queue */ uint32_t bounds; ///< max size of queue
} CIRC_QUEUE; } CIRC_QUEUE;
/** /**
+73 -77
View File
@@ -32,104 +32,100 @@ extern "C"
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
/** /**
* @enum cListDirection * @enum clist_direction_t
* @brief clist_t iterator direction. * @brief clist_t iterator direction.
*/ */
typedef enum
{
LIST_HEAD,
LIST_TAIL
} clist_direction_t;
typedef enum /**
{ * @struct clist_node_t
LIST_HEAD, * @brief clist_t node struct.
LIST_TAIL */
} clist_direction_t; typedef struct
{
struct clist_node *prev; ///< previous node
struct clist_node *next; ///< next node
void *val;
} clist_node_t;
/** /**
* @struct cListNode * @struct clist_t
* @brief clist_t node struct. * @brief clist_t struct.
*/ */
typedef struct
{
clist_node_t *head; ///< first node
clist_node_t *tail; ///< last node
uint32_t len; ///< list length
void (*free)(void *val); ///< node free function handle
int8_t (*compare)(void *a, void *b); ///< node compare function handle
} clist_t;
typedef struct clist_node /**
{ * @struct clist_iterator_t
struct clist_node *prev; * @brief clist_t iterator struct.
struct clist_node *next; */
void *val; typedef struct
} clist_node_t; {
clist_node_t *next; ///< next element
clist_direction_t direction; ///< iter direction
} clist_iterator_t;
/** // Node prototypes.
* @struct cListInst
* @brief clist_t struct.
*/
typedef struct clist_node_t *
{ clist_node_new(void *val);
clist_node_t *head;
clist_node_t *tail;
uint32_t len;
void (*free)(void *val);
int8_t (*compare)(void *a, void *b);
} clist_t;
/** // clist_t prototypes.
* @struct cListIter
* @brief clist_t iterator struct.
*/
typedef struct clist_t *
{ clist_new(void);
clist_node_t *next;
clist_direction_t direction;
} clist_iterator_t;
// Node prototypes. clist_node_t *
clist_rpush(clist_t *self, clist_node_t *node);
clist_node_t * clist_node_t *
clist_node_new(void *val); clist_lpush(clist_t *self, clist_node_t *node);
// clist_t prototypes. clist_node_t *
clist_find(clist_t *self, void *val);
clist_t * clist_node_t *
clist_new(void); clist_at(clist_t *self, int index);
clist_node_t * clist_node_t *
clist_rpush(clist_t *self, clist_node_t *node); clist_rpop(clist_t *self);
clist_node_t * clist_node_t *
clist_lpush(clist_t *self, clist_node_t *node); clist_lpop(clist_t *self);
clist_node_t * void
clist_find(clist_t *self, void *val); clist_remove(clist_t *self, clist_node_t *node);
clist_node_t * void
clist_at(clist_t *self, int index); clist_clear(clist_t *self);
clist_node_t * void
clist_rpop(clist_t *self); clist_destroy(clist_t *self);
clist_node_t * // clist_t iterator prototypes.
clist_lpop(clist_t *self);
void clist_iterator_t *
clist_remove(clist_t *self, clist_node_t *node); clist_iterator_new(clist_t *list, clist_direction_t direction);
void clist_iterator_t *
clist_clear(clist_t *self); clist_iterator_new_from_node(clist_node_t *node, clist_direction_t direction);
void clist_node_t *
clist_destroy(clist_t *self); clist_iterator_next(clist_iterator_t *self);
// clist_t iterator prototypes. void
clist_iterator_destroy(clist_iterator_t *self);
clist_iterator_t *
clist_iterator_new(clist_t *list, clist_direction_t direction);
clist_iterator_t *
clist_iterator_new_from_node(clist_node_t *node, clist_direction_t direction);
clist_node_t *
clist_iterator_next(clist_iterator_t *self);
void
clist_iterator_destroy(clist_iterator_t *self);
#ifdef __cplusplus #ifdef __cplusplus
} }
@@ -28,7 +28,7 @@
*/ */
/** /**
* @struct Coordinate * @struct COORD
* @brief Structure for storing 3D coordinates. * @brief Structure for storing 3D coordinates.
*/ */
typedef struct typedef struct
@@ -45,7 +45,7 @@
*/ */
/** /**
* @struct EulerAngles * @struct EULERANGLES
* @brief Structure for standard quaternion * @brief Structure for standard quaternion
*/ */
typedef struct typedef struct
@@ -32,7 +32,7 @@
#include "eulerangles.h" #include "eulerangles.h"
/** /**
* @struct Quaternion * @struct QUATERNION
* @brief Structure for standard quaternion * @brief Structure for standard quaternion
*/ */
typedef struct typedef struct
@@ -33,7 +33,7 @@
/**************************** Type Definitions *******************************/ /**************************** Type Definitions *******************************/
/** /**
* @struct LinklayerConfig * @struct L2_CONFIG
* @brief A struct holds all linklayer initialization parameters * @brief A struct holds all linklayer initialization parameters
*/ */
typedef struct typedef struct
@@ -50,7 +50,7 @@ typedef struct
} L2_CONFIG; } L2_CONFIG;
/** /**
* @struct LinklayerLogLocal * @struct L2_LOG
* @brief A struct holds linklayer operating log * @brief A struct holds linklayer operating log
*/ */
typedef struct typedef struct
@@ -84,7 +84,7 @@ typedef struct
} L2_LOG; } L2_LOG;
/** /**
* @struct LinklayerInst * @struct L2_INST
* @brief A linklayer instance * @brief A linklayer instance
*/ */
typedef struct typedef struct
@@ -59,7 +59,8 @@
/**************************** Type Definitions *******************************/ /**************************** Type Definitions *******************************/
/** /**
* @struct LinklayerRecord * @struct L2_RCD
* @brief Linklayer recode buffer
*/ */
typedef struct typedef struct
{ {
@@ -69,7 +70,7 @@ typedef struct
} L2_RCD; } L2_RCD;
/** /**
* @enum LinklayerTorType * @enum L2_TOR_TYPE
*/ */
typedef enum typedef enum
{ {
@@ -79,7 +80,7 @@ typedef enum
} L2_TOR_TYPE; } L2_TOR_TYPE;
/** /**
* @enum LinkLayerNodeType * @enum L2_NODE_TYPE
*/ */
typedef enum typedef enum
{ {
@@ -90,7 +91,7 @@ typedef enum
} L2_NODE_TYPE; } L2_NODE_TYPE;
/** /**
* @enum LinklayerNodeState * @enum L2_NODE_STATE
*/ */
typedef enum typedef enum
{ {
@@ -103,7 +104,7 @@ typedef enum
} L2_NODE_STATE; } L2_NODE_STATE;
/** /**
* @struct LinklayerNodeInfo * @struct L2_NODE_INFO
* @brief Node information struct contains the detail node info which needed by the link layer. * @brief Node information struct contains the detail node info which needed by the link layer.
*/ */
typedef struct typedef struct
@@ -119,7 +120,7 @@ typedef struct
} L2_NODE_INFO; } L2_NODE_INFO;
/** /**
* @enum LinklayerEvent * @enum L2_EVENT_TYPE
*/ */
typedef enum typedef enum
{ {
@@ -138,7 +139,8 @@ typedef enum
} L2_EVENT_TYPE; } L2_EVENT_TYPE;
/** /**
* @struct LinklayerEvent * @struct L2_EVENT
* @brief Linklayer event instance
*/ */
typedef struct typedef struct
{ {
@@ -147,7 +149,7 @@ typedef struct
} L2_EVENT; } L2_EVENT;
/** /**
* @enum LinklayerSlotType * @enum L2_SLOT_TYPE
*/ */
typedef enum typedef enum
{ {
@@ -160,7 +162,7 @@ typedef enum
} L2_SLOT_TYPE; } L2_SLOT_TYPE;
/** /**
* @enum LinklayerFrameType * @enum L2_FRAME_TYPE
*/ */
typedef enum typedef enum
{ {
@@ -172,7 +174,7 @@ typedef enum
} L2_FRAME_TYPE; } L2_FRAME_TYPE;
/** /**
* @enum LinklayerCRCType * @enum L2_CRC_TYPE
*/ */
typedef enum typedef enum
{ {
@@ -183,7 +185,8 @@ typedef enum
} L2_CRC_TYPE; } L2_CRC_TYPE;
/** /**
* @struct LinklayerRoutineTableEntry * @struct L2_RTNE_TABLE_ENTRY
* @brief Linklayer routine table entry
*/ */
typedef struct typedef struct
{ {
@@ -194,7 +197,7 @@ typedef struct
} L2_RTNE_TABLE_ENTRY; } L2_RTNE_TABLE_ENTRY;
/** /**
* @enum LinklayerScanStage * @enum SCAN_STAGE
*/ */
typedef enum typedef enum
{ {
@@ -205,7 +208,8 @@ typedef enum
} SCAN_STAGE; } SCAN_STAGE;
/** /**
* @struct LinklayerScanFSM * @struct L2_SCAN_FSM
* @brief Linklayer scan process FSM instance
*/ */
typedef struct typedef struct
{ {
@@ -222,7 +226,8 @@ typedef struct
} L2_SCAN_FSM; } L2_SCAN_FSM;
/** /**
* @struct LinklayerServiceFSM * @struct L2_SVC_FSM
* @brief Linklayer service process FSM
*/ */
typedef struct typedef struct
{ {
@@ -238,7 +243,8 @@ typedef struct
} L2_SVC_FSM; } L2_SVC_FSM;
/** /**
* @struct LinklayerRoutineConfig * @struct L2_RTNE_CONFIG
* @brief Linklayer routine table configuration
*/ */
typedef struct typedef struct
{ {
@@ -38,9 +38,10 @@
/***************** Macros (Inline Functions) Definitions *********************/ /***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/ /**************************** Type Definitions *******************************/
/** /**
* @struct NodeList_Entry * @struct NODE_ENTRY
* @brief Linklayer discovered node list node entry
*/ */
typedef struct NODE_LIST_ENTRY typedef struct
{ {
L2_NODE_INFO nodeInfo; L2_NODE_INFO nodeInfo;
uint32_t ttlCnt; uint32_t ttlCnt;
@@ -31,7 +31,8 @@
/***************** Macros (Inline Functions) Definitions *********************/ /***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/ /**************************** Type Definitions *******************************/
/** /**
* @struct LinklayerEvent * @struct L2_SCHD_EVENT
* @brief Linklayer scheduled event descriptor
*/ */
typedef struct typedef struct
{ {
@@ -45,7 +46,8 @@ typedef struct
} L2_SCHD_EVENT; } L2_SCHD_EVENT;
/** /**
* @struct L2 event * @struct L2_SCHD_POOL
* @brief Linklayer schedule event pool instance
*/ */
typedef struct typedef struct
{ {
@@ -56,7 +56,7 @@
/***************** Macros (Inline Functions) Definitions *********************/ /***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/ /**************************** Type Definitions *******************************/
/** /**
* @enum PhysicalLayerFrameType * @enum L1_FRAME_TYPE
*/ */
typedef enum typedef enum
{ {
@@ -72,7 +72,8 @@ typedef enum
} L1_FRAME_TYPE; } L1_FRAME_TYPE;
/** /**
* @struct PhysicalLayerAntennaConfig * @struct PHY_ANT_CONFIG
* @brief PhysicalLayer antenna config
*/ */
typedef struct typedef struct
{ {
@@ -113,7 +114,8 @@ typedef struct
} PHY_ANT_CONFIG; } PHY_ANT_CONFIG;
/** /**
* @struct PhysicalLayerAntennaAngle * @struct PHY_ANT_ANGLE
* @brief Describe the PhysicalLayer antenna angle
*/ */
typedef struct typedef struct
{ {
@@ -124,7 +126,7 @@ typedef struct
} PHY_ANT_ANGLE; } PHY_ANT_ANGLE;
/** /**
* @enum PhysicalLayerTimeWordType * @enum PHY_TIME_WORD_TYPE
*/ */
typedef enum typedef enum
{ {
@@ -134,7 +136,7 @@ typedef enum
} PHY_TIME_WORD_TYPE; } PHY_TIME_WORD_TYPE;
/** /**
* @enum PhysicalLayerAntennaBeamWidth * @enum PHY_ANT_BEAM_WIDTH
*/ */
typedef enum typedef enum
{ {
@@ -146,7 +148,7 @@ typedef enum
} PHY_ANT_BEAM_WIDTH; } PHY_ANT_BEAM_WIDTH;
/** /**
* @enum PhysicalLayerTorState * @enum PHY_TOR_TYPE
*/ */
typedef enum typedef enum
{ {
@@ -156,7 +158,7 @@ typedef enum
} PHY_TOR_TYPE; } PHY_TOR_TYPE;
/** /**
* @enum PhysicalLayerWorkMode * @enum PHY_MODE
*/ */
typedef enum typedef enum
{ {
@@ -167,7 +169,7 @@ typedef enum
} PHY_MODE; } PHY_MODE;
/** /**
* @enum PhysicalLayerAntennaMode * @enum PHY_ANT_MODE
*/ */
typedef enum typedef enum
{ {
@@ -178,7 +180,8 @@ typedef enum
} PHY_ANT_MODE; } PHY_ANT_MODE;
/** /**
* @struct PhysicalLayerRecord * @struct PHY_RCD
* @brief Physical Layer recode buffer
*/ */
typedef struct typedef struct
{ {
@@ -188,7 +191,7 @@ typedef struct
} PHY_RCD; } PHY_RCD;
/** /**
* @struct PhysicalLayerConfig * @struct PHY_CONFIG
* @brief struct holds all physical layer initialization parameters * @brief struct holds all physical layer initialization parameters
*/ */
typedef struct typedef struct
@@ -209,7 +212,7 @@ typedef struct
} PHY_CONFIG; } PHY_CONFIG;
/** /**
* @struct PhysicalLayerInst * @struct PHY_INST
* @brief Physical Layer operating instance * @brief Physical Layer operating instance
*/ */
typedef struct typedef struct
+2 -2
View File
@@ -26,7 +26,7 @@
/** @} SystemMonitor_Private_Constants*/ /** @} SystemMonitor_Private_Constants*/
/************************** Data Type Definitions ****************************/ /************************** Data Type Definitions ****************************/
/** /**
* @struct PingPong * @struct PINGPONG
* @brief PingPing Control * @brief PingPing Control
*/ */
typedef struct typedef struct
@@ -37,7 +37,7 @@ typedef struct
} PINGPONG; } PINGPONG;
/** /**
* @struct System_Monitor_Inst * @struct SYSMONITOR
* @brief System Monitor struct holds all the system log info * @brief System Monitor struct holds all the system log info
*/ */
typedef struct typedef struct
+7 -6
View File
@@ -81,7 +81,8 @@
/************************* Data Type Definitions ****************************/ /************************* Data Type Definitions ****************************/
/** /**
* @struct System_Info * @struct SYSINFO
* @brief System Infomation log
*/ */
typedef struct __attribute__((packed)) typedef struct __attribute__((packed))
{ {
@@ -112,7 +113,7 @@ typedef struct __attribute__((packed))
} SYSINFO; } SYSINFO;
/** /**
* @struct System_Bus_Log * @struct SYSBUSLOG
* @brief System Info holds the system bus log * @brief System Info holds the system bus log
*/ */
typedef struct __attribute__((packed)) typedef struct __attribute__((packed))
@@ -128,7 +129,7 @@ typedef struct __attribute__((packed))
} SYSBUSLOG; } SYSBUSLOG;
/** /**
* @struct Linklayer_Log * @struct LINKLOG
* @brief Linklayer Log struct holds the Linklayer log * @brief Linklayer Log struct holds the Linklayer log
*/ */
typedef struct __attribute__((packed)) typedef struct __attribute__((packed))
@@ -160,7 +161,7 @@ typedef struct __attribute__((packed))
} LINKLOG; } LINKLOG;
/** /**
* @struct Physical_Layer_Log * @struct PHYLOG
* @brief Physical Layer Log struct holds the Linklayer log * @brief Physical Layer Log struct holds the Linklayer log
*/ */
typedef struct __attribute__((packed)) typedef struct __attribute__((packed))
@@ -182,7 +183,7 @@ typedef struct __attribute__((packed))
} PHYLOG; } PHYLOG;
/** /**
* @struct Hardware_Status_Log * @struct HWSTATE
* @brief Hardware Status Log struct holds all hardware status * @brief Hardware Status Log struct holds all hardware status
*/ */
typedef struct __attribute__((packed)) typedef struct __attribute__((packed))
@@ -206,7 +207,7 @@ typedef struct __attribute__((packed))
} HWSTATE; } HWSTATE;
/** /**
* @struct Payload * @struct PAYLOAD
* @brief Payload struct holds the service payload * @brief Payload struct holds the service payload
*/ */
typedef struct typedef struct
+2 -2
View File
@@ -29,7 +29,7 @@
/************************** Data Type Definitions ****************************/ /************************** Data Type Definitions ****************************/
/** /**
* @struct SystemBus Config * @struct SYSBUS_CONFIG
* @brief SystemBus Config struct holds SystemBus initialization parameters * @brief SystemBus Config struct holds SystemBus initialization parameters
*/ */
typedef struct typedef struct
@@ -40,7 +40,7 @@ typedef struct
} SYSBUS_CONFIG; } SYSBUS_CONFIG;
/** /**
* @struct SystemBus Instance * @struct SYSBUS
* @brief SystemBus Instance struct * @brief SystemBus Instance struct
*/ */
typedef struct typedef struct
@@ -69,16 +69,28 @@
IO_In32((baseAddr) + (offset)) IO_In32((baseAddr) + (offset))
/************************** Data Type Definitions ****************************/ /************************** Data Type Definitions ****************************/
/**
* @struct SYSBUS_UART_CONFIG
* @brief SystemBus UART driver initialization parameters
*/
typedef struct typedef struct
{ {
uintptr_t baseAddr; uintptr_t baseAddr;
} SYSBUS_UART_CONFIG; } SYSBUS_UART_CONFIG;
/**
* @struct SYSBUS_UART
* @brief SystemBus UART driver instance
*/
typedef struct typedef struct
{ {
SYSBUS_UART_CONFIG config; SYSBUS_UART_CONFIG config;
} SYSBUS_UART; } SYSBUS_UART;
/**
* @struct SYSBUS_UART_FRAME
* @brief SystemBus UART frame definition
*/
typedef struct typedef struct
{ {
uint16_t len; uint16_t len;
+4 -3
View File
@@ -39,7 +39,8 @@ typedef uint32_t TIME_FRAC;
typedef uint32_t TIME_INT; typedef uint32_t TIME_INT;
/** /**
* @struct TimeWord * @struct TIME_WORD
* @brief Time controller time word
*/ */
typedef struct typedef struct
{ {
@@ -48,7 +49,7 @@ typedef struct
} TIME_WORD; } TIME_WORD;
/** /**
* @struct TmcConfig. * @struct TMC_CONFIG
* @brief TmcConfig holds the initialization parameters of time controller * @brief TmcConfig holds the initialization parameters of time controller
*/ */
typedef struct typedef struct
@@ -58,7 +59,7 @@ typedef struct
} TMC_CONFIG; } TMC_CONFIG;
/** /**
* @struct TmcInst. * @struct TMC_INST
* @brief An instance struct of time controller * @brief An instance struct of time controller
*/ */
typedef struct typedef struct