simplified naming.

This commit is contained in:
Gatsby Van
2024-01-22 16:12:10 +08:00
parent 35df4d059a
commit 26d22b67fb
7 changed files with 38 additions and 38 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ typedef struct
uint8_t bkpHeadId;
uint8_t netScale;
PHY_INST *phyInstPtr;
TIMECTRL_INST *tmcInstPtr;
TMC_INST *tmcInstPtr;
} L2_CONFIG;
typedef struct
+2 -2
View File
@@ -49,7 +49,7 @@ L2_CONFIG l2Config = {
.phyInstPtr = NULL,
.tmcInstPtr = NULL};
TIMECTRL_CONFIG tmcConfig = {
TMC_CONFIG tmcConfig = {
.baseAddr = TIME_CONTROLLER_BASEADDR,
.reset = 10};
@@ -73,7 +73,7 @@ void MPC_IntrHandler(void *callBackRef);
#endif
/*********************** Driver Instance Definitions **************************/
TIMECTRL_INST *tmcInstPtr = NULL;
TMC_INST *tmcInstPtr = NULL;
PHY_INST *phyInstPtr = NULL;
L2_INST *linkInstPtr = NULL;
static XScuGic gicInst; // General interrupt controller intance
+14 -14
View File
@@ -51,12 +51,12 @@
* FAILURE Initialization failed
*
******************************************************************************/
int32_t TimeCtrl_Init(TIMECTRL_INST **instPtr, TIMECTRL_CONFIG *config)
int32_t TimeCtrl_Init(TMC_INST **instPtr, TMC_CONFIG *config)
{
ASSERT(config != NULL);
ASSERT(instPtr != NULL);
(*instPtr) = malloc(sizeof(TIMECTRL_INST));
memcpy(&((*instPtr)->config), config, sizeof(TIMECTRL_CONFIG));
(*instPtr) = malloc(sizeof(TMC_INST));
memcpy(&((*instPtr)->config), config, sizeof(TMC_CONFIG));
(*instPtr)->modelVer = TMC_Read((*instPtr), VERSION_REG);
return SUCCESS;
}
@@ -70,7 +70,7 @@ int32_t TimeCtrl_Init(TIMECTRL_INST **instPtr, TIMECTRL_CONFIG *config)
* @return NONE
*
******************************************************************************/
void TimeCtrl_Destroy(TIMECTRL_INST *instPtr)
void TimeCtrl_Destroy(TMC_INST *instPtr)
{
free(instPtr);
}
@@ -84,7 +84,7 @@ void TimeCtrl_Destroy(TIMECTRL_INST *instPtr)
* @return timer controller version.
*
******************************************************************************/
uint32_t TimeCtrl_GetVersion(TIMECTRL_INST *instPtr)
uint32_t TimeCtrl_GetVersion(TMC_INST *instPtr)
{
ASSERT(instPtr != NULL);
return TMC_Read(instPtr, VERSION_REG);
@@ -100,7 +100,7 @@ uint32_t TimeCtrl_GetVersion(TIMECTRL_INST *instPtr)
* FAILURE Initialization failed
*
******************************************************************************/
void TimeCtrl_Reset(TIMECTRL_INST *instPtr)
void TimeCtrl_Reset(TMC_INST *instPtr)
{
ASSERT(instPtr != NULL);
TMC_Write(instPtr, CNTSTEP_OPT, TM_RESET_CODE);
@@ -115,7 +115,7 @@ void TimeCtrl_Reset(TIMECTRL_INST *instPtr)
* @return NONE
*
******************************************************************************/
void TimeCtrl_ResetHigh(TIMECTRL_INST *instPtr)
void TimeCtrl_ResetHigh(TMC_INST *instPtr)
{
ASSERT(instPtr != NULL);
// TODO:
@@ -130,7 +130,7 @@ void TimeCtrl_ResetHigh(TIMECTRL_INST *instPtr)
* @return NONE
*
******************************************************************************/
void TimeCtrl_ResetLow(TIMECTRL_INST *instPtr)
void TimeCtrl_ResetLow(TMC_INST *instPtr)
{
ASSERT(instPtr != NULL);
// TODO:
@@ -145,7 +145,7 @@ void TimeCtrl_ResetLow(TIMECTRL_INST *instPtr)
* @return integer value
*
******************************************************************************/
inline TIME_INT TimeCtrl_GetIntCnt(TIMECTRL_INST *instPtr)
inline TIME_INT TimeCtrl_GetIntCnt(TMC_INST *instPtr)
{
ASSERT(instPtr != NULL);
return TMC_Read(instPtr, TIME_INT_REG);
@@ -160,7 +160,7 @@ inline TIME_INT TimeCtrl_GetIntCnt(TIMECTRL_INST *instPtr)
* @return fractional value
*
******************************************************************************/
inline TIME_FRAC TimeCtrl_GetFracCnt(TIMECTRL_INST *instPtr)
inline TIME_FRAC TimeCtrl_GetFracCnt(TMC_INST *instPtr)
{
ASSERT(instPtr != NULL);
return TMC_Read(instPtr, TIME_FRAC_REG);
@@ -176,7 +176,7 @@ inline TIME_FRAC TimeCtrl_GetFracCnt(TIMECTRL_INST *instPtr)
* @return NONE
*
******************************************************************************/
void TimeCtrl_GetCurrentTime(TIMECTRL_INST *instPtr, TIME_WORD *tmWord)
void TimeCtrl_GetCurrentTime(TMC_INST *instPtr, TIME_WORD *tmWord)
{
ASSERT(instPtr != NULL);
ASSERT(tmWord != NULL);
@@ -194,7 +194,7 @@ void TimeCtrl_GetCurrentTime(TIMECTRL_INST *instPtr, TIME_WORD *tmWord)
* @return NONE.
*
******************************************************************************/
void TimeCtrl_GetCurrentStep(TIMECTRL_INST *instPtr, TIME_FRAC *tmFrac)
void TimeCtrl_GetCurrentStep(TMC_INST *instPtr, TIME_FRAC *tmFrac)
{
ASSERT(instPtr != NULL);
ASSERT(tmFrac != NULL);
@@ -212,7 +212,7 @@ void TimeCtrl_GetCurrentStep(TIMECTRL_INST *instPtr, TIME_FRAC *tmFrac)
* @return NONE.
*
******************************************************************************/
void TimeCtrl_TimeAdjust(TIMECTRL_INST *instPtr, const TIME_WORD *tmWord, TIMECTRL_ADJ_TYPE type)
void TimeCtrl_TimeAdjust(TMC_INST *instPtr, const TIME_WORD *tmWord, TIMECTRL_ADJ_TYPE type)
{
ASSERT(instPtr != NULL);
ASSERT(tmWord != NULL);
@@ -243,7 +243,7 @@ void TimeCtrl_TimeAdjust(TIMECTRL_INST *instPtr, const TIME_WORD *tmWord, TIMECT
* @return NONE.
*
******************************************************************************/
void TimeCtrl_SetOptimizeStep(TIMECTRL_INST *instPtr, TIME_FRAC *tmFrac)
void TimeCtrl_SetOptimizeStep(TMC_INST *instPtr, TIME_FRAC *tmFrac)
{
ASSERT(instPtr != NULL);
ASSERT(tmFrac != NULL);
+15 -15
View File
@@ -45,30 +45,30 @@ typedef struct
{
uintptr_t baseAddr;
uint32_t reset; // time for reset (unit: us)
} TIMECTRL_CONFIG;
} TMC_CONFIG;
typedef struct
{
TIMECTRL_CONFIG config;
TMC_CONFIG config;
uint32_t modelVer;
} TIMECTRL_INST;
} TMC_INST;
/************************** Function Prototypes ******************************/
int32_t TimeCtrl_Init(TIMECTRL_INST **instPtr, TIMECTRL_CONFIG *config);
uint32_t TimeCtrl_GetVersion(TIMECTRL_INST *instPtr);
void TimeCtrl_Destroy(TIMECTRL_INST *instPtr);
void TimeCtrl_Reset(TIMECTRL_INST *instPtr);
void TimeCtrl_ResetLow(TIMECTRL_INST *instPtr);
void TimeCtrl_ResetHigh(TIMECTRL_INST *instPtr);
int32_t TimeCtrl_Init(TMC_INST **instPtr, TMC_CONFIG *config);
uint32_t TimeCtrl_GetVersion(TMC_INST *instPtr);
void TimeCtrl_Destroy(TMC_INST *instPtr);
void TimeCtrl_Reset(TMC_INST *instPtr);
void TimeCtrl_ResetLow(TMC_INST *instPtr);
void TimeCtrl_ResetHigh(TMC_INST *instPtr);
TIME_INT TimeCtrl_GetIntCnt(TIMECTRL_INST *instPtr);
TIME_FRAC TimeCtrl_GetFracCnt(TIMECTRL_INST *instPtr);
TIME_INT TimeCtrl_GetIntCnt(TMC_INST *instPtr);
TIME_FRAC TimeCtrl_GetFracCnt(TMC_INST *instPtr);
void TimeCtrl_GetCurrentTime(TIMECTRL_INST *instPtr, TIME_WORD *tmWord);
void TimeCtrl_GetCurrentStep(TIMECTRL_INST *instPtr, TIME_FRAC *tmFrac);
void TimeCtrl_GetCurrentTime(TMC_INST *instPtr, TIME_WORD *tmWord);
void TimeCtrl_GetCurrentStep(TMC_INST *instPtr, TIME_FRAC *tmFrac);
void TimeCtrl_SetOptimizeStep(TIMECTRL_INST *instPtr, TIME_FRAC *tmFrac);
void TimeCtrl_TimeAdjust(TIMECTRL_INST *instPtr, const TIME_WORD *tmWord, TIMECTRL_ADJ_TYPE type);
void TimeCtrl_SetOptimizeStep(TMC_INST *instPtr, TIME_FRAC *tmFrac);
void TimeCtrl_TimeAdjust(TMC_INST *instPtr, const TIME_WORD *tmWord, TIMECTRL_ADJ_TYPE type);
void TimeCtrl_CalculateTimeGap(const TIME_WORD *a, const TIME_WORD *b, TIME_WORD *gap);
#endif /* TIME_SYNC_H_ */
@@ -15,7 +15,7 @@
#define TIME_ADJ_TRIG (0x00000024 >> 2)
#define CNTSTEP_OPT (0x00000028 >> 2)
TIMECTRL_INST *tmcInstPtr = NULL;
TMC_INST *tmcInstPtr = NULL;
PHY_INST *phyInstPtr = NULL;
L2_INST *linkInstPtr = NULL;
@@ -197,7 +197,7 @@ PHY_CONFIG l1Config =
.baseAddr = (uintptr_t)phycReg
};
TIMECTRL_CONFIG tmcConfig =
TMC_CONFIG tmcConfig =
{
.baseAddr = (uintptr_t)tmcReg,
.reset = 10
@@ -7,11 +7,11 @@
#define HARDWARE_VERSION 0x00000001
#define MAX_OPT_DELAY 100 // 1us = 100*10ns
TIMECTRL_CONFIG tmcConfig = {
TMC_CONFIG tmcConfig = {
.baseAddr = 0 /*TODO: fill withe real base address*/,
.reset = 10};
TIMECTRL_INST *tmcInstPtr = NULL;
TMC_INST *tmcInstPtr = NULL;
void tmc_setup(void)
{
@@ -11,11 +11,11 @@
uint32_t tmcReg[32] = {0};
TIMECTRL_CONFIG tmcConfig = {
TMC_CONFIG tmcConfig = {
.baseAddr = 0,
.reset = 10};
TIMECTRL_INST *tmcInstPtr = NULL;
TMC_INST *tmcInstPtr = NULL;
void tmc_setup(void)
{