update physical layer logging scheme
This commit is contained in:
@@ -416,6 +416,10 @@ void ScuTimer_IntrHandler(void *context)
|
|||||||
{
|
{
|
||||||
// Refresh log
|
// Refresh log
|
||||||
Phy_RefreshHwSate(phyInstPtr);
|
Phy_RefreshHwSate(phyInstPtr);
|
||||||
|
if (TimeCtrl_GetIntCnt(tmcInstPtr) - phyInstPtr->lastLogTime >= PHY_LOG_EXPIRE)
|
||||||
|
{
|
||||||
|
Phy_UpdateLogging(phyInstPtr);
|
||||||
|
}
|
||||||
|
|
||||||
if (Mpc_IsEnable(mpcDescPtr))
|
if (Mpc_IsEnable(mpcDescPtr))
|
||||||
{
|
{
|
||||||
@@ -494,7 +498,7 @@ int main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Physical Layer Initialize */
|
/* Physical Layer Initialize */
|
||||||
Status = Phy_InstInit(&phyInstPtr, &phyConfig);
|
Status = Phy_Init(&phyInstPtr, &phyConfig);
|
||||||
if (Status == SUCCESS)
|
if (Status == SUCCESS)
|
||||||
{
|
{
|
||||||
DBG_PRINT("Physical layer Init SUCCESS! \n");
|
DBG_PRINT("Physical layer Init SUCCESS! \n");
|
||||||
|
|||||||
@@ -360,6 +360,11 @@ void ScuTimer_IntrHandler(void *context)
|
|||||||
{
|
{
|
||||||
// Refresh log
|
// Refresh log
|
||||||
Phy_RefreshHwSate(phyInstPtr);
|
Phy_RefreshHwSate(phyInstPtr);
|
||||||
|
if (TimeCtrl_GetIntCnt(tmcInstPtr) - phyInstPtr->lastLogTime >= PHY_LOG_EXPIRE)
|
||||||
|
{
|
||||||
|
Phy_UpdateLogging(phyInstPtr);
|
||||||
|
}
|
||||||
|
|
||||||
XScuTimer_ClearInterruptStatus((XScuTimer *)xdesc->instance);
|
XScuTimer_ClearInterruptStatus((XScuTimer *)xdesc->instance);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -420,7 +425,7 @@ int main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Physical Layer Initialize */
|
/* Physical Layer Initialize */
|
||||||
Status = Phy_InstInit(&phyInstPtr, &phyConfig);
|
Status = Phy_Init(&phyInstPtr, &phyConfig);
|
||||||
if (Status == SUCCESS)
|
if (Status == SUCCESS)
|
||||||
{
|
{
|
||||||
DBG_PRINT("Physical layer Init SUCCESS! \n");
|
DBG_PRINT("Physical layer Init SUCCESS! \n");
|
||||||
|
|||||||
@@ -35,6 +35,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************** Constant Definitions *****************************/
|
/************************** Constant Definitions *****************************/
|
||||||
|
#define PHY_TIME_WORD_H_MAX UINT32_MAX
|
||||||
|
#define PHY_TIME_WORD_L_MAX 0x0007A120 // 5ms/10ns
|
||||||
|
|
||||||
#define L1_FRAME_LEN_MAX (8192 / 8) // byte
|
#define L1_FRAME_LEN_MAX (8192 / 8) // byte
|
||||||
#define L1_FRAME_2KBPS_20MS_LEN 0 // byte
|
#define L1_FRAME_2KBPS_20MS_LEN 0 // byte
|
||||||
#define L1_FRAME_2KBPS_100MS_LEN (312 / 8) // byte
|
#define L1_FRAME_2KBPS_100MS_LEN (312 / 8) // byte
|
||||||
@@ -318,7 +321,22 @@ void Phy_UpdateState(PHY_INST *instPtr)
|
|||||||
{
|
{
|
||||||
instPtr->isValid = false;
|
instPtr->isValid = false;
|
||||||
}
|
}
|
||||||
|
Phy_UpdateLogging(instPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief Update physical layer logging.
|
||||||
|
*
|
||||||
|
* @param instPtr A pointer to physical layer control instance.
|
||||||
|
*
|
||||||
|
* @return NONE.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
void Phy_UpdateLogging(PHY_INST *instPtr)
|
||||||
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
|
uint64_t peak, avg;
|
||||||
// Logging
|
// Logging
|
||||||
instPtr->recvSlotTime.int_part = PhyRead(instPtr, TM_TARGET_H);
|
instPtr->recvSlotTime.int_part = PhyRead(instPtr, TM_TARGET_H);
|
||||||
instPtr->recvSlotTime.frac_part = PhyRead(instPtr, TM_TARGET_L);
|
instPtr->recvSlotTime.frac_part = PhyRead(instPtr, TM_TARGET_L);
|
||||||
@@ -330,7 +348,6 @@ void Phy_UpdateState(PHY_INST *instPtr)
|
|||||||
instPtr->phyLog.crcCnt = PhyRead(instPtr, PHY_CRC_OK_CNT);
|
instPtr->phyLog.crcCnt = PhyRead(instPtr, PHY_CRC_OK_CNT);
|
||||||
instPtr->phyLog.doppler = Phy_GetFreqEst(instPtr);
|
instPtr->phyLog.doppler = Phy_GetFreqEst(instPtr);
|
||||||
instPtr->phyLog.recvStamp = (uint64_t)instPtr->recvFsTime.int_part * TIME_FRAC_MAX + instPtr->recvFsTime.frac_part;
|
instPtr->phyLog.recvStamp = (uint64_t)instPtr->recvFsTime.int_part * TIME_FRAC_MAX + instPtr->recvFsTime.frac_part;
|
||||||
uint64_t peak, avg;
|
|
||||||
peak = PhyRead(instPtr, PHY_ACQ_PEAK_L);
|
peak = PhyRead(instPtr, PHY_ACQ_PEAK_L);
|
||||||
peak |= ((uint64_t)PhyRead(instPtr, PHY_ACQ_PEAK_H)) << 32;
|
peak |= ((uint64_t)PhyRead(instPtr, PHY_ACQ_PEAK_H)) << 32;
|
||||||
avg = PhyRead(instPtr, PHY_ACQ_MEAN_L);
|
avg = PhyRead(instPtr, PHY_ACQ_MEAN_L);
|
||||||
@@ -348,6 +365,7 @@ void Phy_UpdateState(PHY_INST *instPtr)
|
|||||||
memset(instPtr->phyLog.reserve, 0x00, sizeof(instPtr->phyLog.reserve));
|
memset(instPtr->phyLog.reserve, 0x00, sizeof(instPtr->phyLog.reserve));
|
||||||
// Sync logs to system monitor
|
// Sync logs to system monitor
|
||||||
SysMonitor_UpdatePhysicalLayerLog(&(instPtr->phyLog));
|
SysMonitor_UpdatePhysicalLayerLog(&(instPtr->phyLog));
|
||||||
|
instPtr->lastLogTime = PhyRead(instPtr, TM_TARGET_H);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -361,7 +379,7 @@ void Phy_UpdateState(PHY_INST *instPtr)
|
|||||||
* @return SUCCESS
|
* @return SUCCESS
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
int32_t Phy_InstInit(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
ASSERT(phyConfig != NULL);
|
ASSERT(phyConfig != NULL);
|
||||||
@@ -387,6 +405,7 @@ int32_t Phy_InstInit(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
(*instPtr)->recvSlotTime.frac_part = UINT32_MAX;
|
(*instPtr)->recvSlotTime.frac_part = UINT32_MAX;
|
||||||
(*instPtr)->antConfigOffset = 0;
|
(*instPtr)->antConfigOffset = 0;
|
||||||
(*instPtr)->sendDataOffset = 0;
|
(*instPtr)->sendDataOffset = 0;
|
||||||
|
(*instPtr)->lastLogTime = 0;
|
||||||
Phy_AntConfigInit(&((*instPtr)->antConfig));
|
Phy_AntConfigInit(&((*instPtr)->antConfig));
|
||||||
|
|
||||||
memset(&((*instPtr))->tor, PHY_TOR_SUSPEND, sizeof(PHY_RCD));
|
memset(&((*instPtr))->tor, PHY_TOR_SUSPEND, sizeof(PHY_RCD));
|
||||||
|
|||||||
@@ -53,8 +53,7 @@
|
|||||||
#define L1_FRAME_200KBPS_5MS_HOPS 20
|
#define L1_FRAME_200KBPS_5MS_HOPS 20
|
||||||
#define L1_FRAME_1M2BPS_5MS_HOPS 20
|
#define L1_FRAME_1M2BPS_5MS_HOPS 20
|
||||||
|
|
||||||
#define PHY_TIME_WORD_H_MAX UINT32_MAX
|
#define PHY_LOG_EXPIRE 40 // 50*5ms
|
||||||
#define PHY_TIME_WORD_L_MAX 0x0007A120 // 5ms/10ns
|
|
||||||
/***************** Macros (Inline Functions) Definitions *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
/**************************** Type Definitions *******************************/
|
/**************************** Type Definitions *******************************/
|
||||||
typedef enum
|
typedef enum
|
||||||
@@ -227,6 +226,7 @@ typedef struct
|
|||||||
PHY_ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN];
|
PHY_ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN];
|
||||||
HWSTATE hwSate;
|
HWSTATE hwSate;
|
||||||
PHYLOG phyLog;
|
PHYLOG phyLog;
|
||||||
|
uint32_t lastLogTime;
|
||||||
} PHY_INST;
|
} PHY_INST;
|
||||||
|
|
||||||
/************************** Variable Definitions *****************************/
|
/************************** Variable Definitions *****************************/
|
||||||
@@ -242,10 +242,11 @@ extern uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
|
|||||||
extern uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
|
extern uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
|
||||||
|
|
||||||
/************************** Function Prototypes ******************************/
|
/************************** Function Prototypes ******************************/
|
||||||
int32_t Phy_InstInit(PHY_INST **instPtr, PHY_CONFIG *phyConfig);
|
int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig);
|
||||||
void Phy_Destroy(PHY_INST *instPtr);
|
void Phy_Destroy(PHY_INST *instPtr);
|
||||||
|
|
||||||
void Phy_UpdateState(PHY_INST *instPtr);
|
void Phy_UpdateState(PHY_INST *instPtr);
|
||||||
|
void Phy_UpdateLogging(PHY_INST *instPtr);
|
||||||
void Phy_RefreshHwSate(PHY_INST *instPtr);
|
void Phy_RefreshHwSate(PHY_INST *instPtr);
|
||||||
|
|
||||||
void Phy_Start(PHY_INST *instPtr);
|
void Phy_Start(PHY_INST *instPtr);
|
||||||
|
|||||||
Reference in New Issue
Block a user