Common Update: Better Doxygen Style
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Description: Time sync implementation file.
|
||||
*
|
||||
* Author: Author's name
|
||||
* Date: 2023-12-20 16:32
|
||||
* LastEditors: FanHao
|
||||
* LastEditTime: 2023-12-22 20:43
|
||||
* Revisions: Rev 0.0
|
||||
* History:
|
||||
* [2023-12-20]: Initial version.
|
||||
*
|
||||
* Copyright(c) 2021 Beijing Institute of Technology.
|
||||
* Lab of Communication and Networking
|
||||
* @file time_ctrl.c
|
||||
* @author FanHao ([email protected])
|
||||
* @brief Time sync controller driver implementation file.
|
||||
* @version 0.0
|
||||
* @date 2023-12-20
|
||||
* @copyright Copyright(c) 2024 Beijing Institute of Technology.\n
|
||||
* Lab of Communication and Network
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* @addtogroup TimeController_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
#include <string.h>
|
||||
#include "time_ctrl.h"
|
||||
@@ -23,6 +24,10 @@
|
||||
#include "util.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
/**
|
||||
* @name TimeController_REG_Constants
|
||||
* @{
|
||||
*/
|
||||
#define VERSION_REG 0x00000004
|
||||
#define TIME_INT_REG 0x00000008
|
||||
#define TIME_FRAC_REG 0x0000000C
|
||||
@@ -36,6 +41,9 @@
|
||||
#define CNTSTEP_OPT 0x0000002c
|
||||
|
||||
#define TM_RESET_CODE 0x5253542E
|
||||
|
||||
/** @} TimeController_REG_Constants*/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
#define TMC_Read(instPtr, addr) IO_In32(instPtr->config.baseAddr + addr)
|
||||
#define TMC_Write(instPtr, addr, value) IO_Out32(instPtr->config.baseAddr + addr, value)
|
||||
@@ -295,4 +303,6 @@ void TimeCtrl_CalculateTimeGap(const TIME_WORD *a, const TIME_WORD *b, TIME_WORD
|
||||
timeDiff -= (uint64_t)a->frac_part;
|
||||
gap->frac_part = (TIME_FRAC)(timeDiff % TIME_FRAC_MAX);
|
||||
gap->frac_part = (TIME_INT)(timeDiff / TIME_FRAC_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
/** @} TimeController_Driver*/
|
||||
@@ -1,19 +1,20 @@
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Description: A simplified version of timesync for datalink 814 (Dijian)
|
||||
*
|
||||
* Date: 2023-12-20-04 16:32
|
||||
* LastEditors: Fan Hao
|
||||
* LastEditTime: 2023-12-20 16:32
|
||||
* Revisions: Rev 0.0
|
||||
* History:
|
||||
* [2023-12-20]: Initial version.
|
||||
*
|
||||
* Copyright(c) 2021 Beijing Institute of Technology.
|
||||
* Lab of Communication and Networking
|
||||
* @file time_ctrl.h
|
||||
* @author FanHao ([email protected])
|
||||
* @brief Time sync controller driver header file.
|
||||
* @version 0.0
|
||||
* @date 2023-12-20
|
||||
* @copyright Copyright(c) 2024 Beijing Institute of Technology.\n
|
||||
* Lab of Communication and Network
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* @defgroup TimeController_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef TIME_CTRL_H_
|
||||
#define TIME_CTRL_H_
|
||||
|
||||
@@ -23,30 +24,43 @@
|
||||
#define TIME_FRAC_MAX 500000 // how many 10ns in a 5ms
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
/**************************** Type Definitions *******************************/
|
||||
/**
|
||||
* @enum TIMECTRL_ADJ_TYPE
|
||||
* @brief defines the time adjustment methods
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
TM_ADJ_NONE = 0,
|
||||
TM_ADJ_ADD = 1,
|
||||
TM_ADJ_SET = 2
|
||||
TM_ADJ_NONE = 0, ///< none
|
||||
TM_ADJ_ADD = 1, ///< adjust time by add
|
||||
TM_ADJ_SET = 2 ///< adjust time by set
|
||||
} TIMECTRL_ADJ_TYPE;
|
||||
|
||||
typedef uint32_t TIME_FRAC;
|
||||
typedef uint32_t TIME_INT;
|
||||
|
||||
/**
|
||||
* @struct TimeWord
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* 5ms each LSB */
|
||||
TIME_INT int_part;
|
||||
/* 10ns each LSB */
|
||||
TIME_FRAC frac_part;
|
||||
TIME_INT int_part; ///< 5ms each LSB
|
||||
TIME_FRAC frac_part; ///< 10ns each LSB
|
||||
} TIME_WORD;
|
||||
|
||||
/**
|
||||
* @struct TmcConfig.
|
||||
* @brief TmcConfig holds the initialization parameters of time controller
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uintptr_t baseAddr;
|
||||
uint32_t reset; // time for reset (unit: us)
|
||||
} TMC_CONFIG;
|
||||
|
||||
/**
|
||||
* @struct TmcInst.
|
||||
* @brief An instance struct of time controller
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
TMC_CONFIG config;
|
||||
@@ -72,3 +86,5 @@ void TimeCtrl_TimeAdjust(TMC_INST *instPtr, const TIME_WORD *tmWord, TIMECTRL_AD
|
||||
void TimeCtrl_CalculateTimeGap(const TIME_WORD *a, const TIME_WORD *b, TIME_WORD *gap);
|
||||
|
||||
#endif /* TIME_SYNC_H_ */
|
||||
|
||||
/** @} */
|
||||
Reference in New Issue
Block a user