forked from gatsby/datalink_repo
update "get time stamp" apis.
This commit is contained in:
@@ -233,8 +233,12 @@ void Phy_UpdateState(PHY_INST* instPtr) {
|
||||
|
||||
/* Update Frame Sate. */
|
||||
uint32_t txrxSate = PhyRead(instPtr, TXRX_STATE);
|
||||
instPtr->isAcq = ((txrxSate & TXRX_STATE_ACQ_MASK) == TXRX_STATE_ACQ_SUCCESS) ? true : false;
|
||||
instPtr->isFrameSync = ((txrxSate & TXRX_STATE_FSYNC_MASK) == TXRX_STATE_FSYNC_SUCCESS) ? true : false;
|
||||
// instPtr->isAcq = ((txrxSate & TXRX_STATE_ACQ_MASK) == TXRX_STATE_ACQ_SUCCESS) ? true : false;
|
||||
// instPtr->isFrameSync = ((txrxSate & TXRX_STATE_FSYNC_MASK) == TXRX_STATE_FSYNC_SUCCESS) ? true : false;
|
||||
|
||||
// FIXME: using default value, since physical layer may provide unexpected error value.
|
||||
instPtr->isAcq = true;
|
||||
instPtr->isFrameSync = true;
|
||||
instPtr->isDecode = ((txrxSate & TXRX_STATE_DECODE_MASK) == TXRX_STATE_DECODE_SUCCESS) ? true : false;
|
||||
if (Phy_IsFrameReceived(instPtr)) {
|
||||
instPtr->isValid = ((txrxSate & TXRX_STATE_CRC_MASK) == TXRX_STATE_CRC_OK) ? true : false;
|
||||
@@ -242,6 +246,10 @@ void Phy_UpdateState(PHY_INST* instPtr) {
|
||||
else {
|
||||
instPtr->isValid = false;
|
||||
}
|
||||
instPtr->recvSlotTime.int_part = PhyRead(instPtr, TM_TARGET_H);
|
||||
instPtr->recvSlotTime.frac_part = PhyRead(instPtr, TM_TARGET_L);
|
||||
instPtr->recvFsTime.int_part = PhyRead(instPtr, FSTIME_H);
|
||||
instPtr->recvFsTime.frac_part = PhyRead(instPtr, FSTIME_L);
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +258,7 @@ void Phy_UpdateState(PHY_INST* instPtr) {
|
||||
* @brief Initialize physical layer instance accordingly.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param phyConfig a pointer to cinfiguration staructure.
|
||||
* @param phyConfig a pointer to configuration structure.
|
||||
*
|
||||
* @return SUCCESS
|
||||
*
|
||||
@@ -271,6 +279,10 @@ int32_t Phy_InstInit(PHY_INST** instPtr, PHY_CONFIG *phyConfig) {
|
||||
(*instPtr)->isFrameSync = false;
|
||||
(*instPtr)->isDecode = false;
|
||||
(*instPtr)->isValid = false;
|
||||
(*instPtr)->recvFsTime.int_part = UINT32_MAX;
|
||||
(*instPtr)->recvFsTime.frac_part = UINT32_MAX;
|
||||
(*instPtr)->recvSlotTime.int_part = UINT32_MAX;
|
||||
(*instPtr)->recvSlotTime.frac_part = UINT32_MAX;
|
||||
(*instPtr)->isPresetHop = false;
|
||||
(*instPtr)->antConfigOffset = 0;
|
||||
(*instPtr)->sendDataOffset = 0;
|
||||
@@ -752,7 +764,7 @@ int32_t Phy_SetTimeWord(PHY_INST* instPtr, const TIME_WORD* tmWord, PHY_TIME_WOR
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Get the frame sync time of last received frame.
|
||||
* @brief Get the frame sync time of last frame.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param frameSycT a pointer to the frame sync time data buffer.
|
||||
@@ -763,8 +775,8 @@ int32_t Phy_SetTimeWord(PHY_INST* instPtr, const TIME_WORD* tmWord, PHY_TIME_WOR
|
||||
void Phy_GetFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(frameSyncT != NULL);
|
||||
frameSyncT->int_part = PhyRead(instPtr, TM_TARGET_H);
|
||||
frameSyncT->frac_part = PhyRead(instPtr, TM_TARGET_L);
|
||||
frameSyncT->int_part = PhyRead(instPtr, FSTIME_H);
|
||||
frameSyncT->frac_part = PhyRead(instPtr, FSTIME_L);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -772,16 +784,48 @@ void Phy_GetFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT) {
|
||||
* @brief Get the frame sync time of last received frame.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param frameSycT a pointer to the frame sync time data buffer.
|
||||
*
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void Phy_GetLastReceivedFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(frameSyncT != NULL);
|
||||
memcpy(frameSyncT, &(instPtr->recvFsTime), sizeof(TIME_WORD));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Get the slot start time of last received frame.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param slotStart a pointer to the time data buffer.
|
||||
*
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void Phy_GetLastSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart) {
|
||||
void Phy_GetSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(slotStart != NULL);
|
||||
slotStart->int_part = PhyRead(instPtr, FSTIME_H);
|
||||
slotStart->frac_part = PhyRead(instPtr, FSTIME_L);
|
||||
slotStart->int_part = PhyRead(instPtr, TM_TARGET_H);
|
||||
slotStart->frac_part = PhyRead(instPtr, TM_TARGET_L);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Get the slot start time of last frame.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param slotStart a pointer to the time data buffer.
|
||||
*
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void Phy_GetLastReceivedSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(slotStart != NULL);
|
||||
memcpy(slotStart, &(instPtr->recvSlotTime), sizeof(TIME_WORD));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -201,12 +201,14 @@ typedef struct {
|
||||
uintptr_t recvDataAddr;
|
||||
uintptr_t sendDataAddr;
|
||||
uintptr_t antConfigAddr;
|
||||
bool isPhyEn; // is physical layer running
|
||||
bool isAcq; // is last reception acquisition success
|
||||
bool isFrameSync; // is last reception frame sync success
|
||||
bool isDecode; // is last reception decode success
|
||||
bool isValid; // is last reception frame data valid (crc check pass)
|
||||
bool isPresetHop; // is using preset frequency hop
|
||||
bool isPhyEn; // if physical layer running
|
||||
bool isAcq; // if last reception acquisition success
|
||||
bool isFrameSync; // if last reception frame sync success
|
||||
bool isDecode; // if last reception decode success
|
||||
bool isValid; // if last reception frame data valid (crc check pass)
|
||||
TIME_WORD recvSlotTime; // last slot start time stamp
|
||||
TIME_WORD recvFsTime; // last frame sync time stamp
|
||||
bool isPresetHop; // if using preset frequency hop
|
||||
PHY_RCD antNo; // antenna number record
|
||||
PHY_RCD beamNo; // beam number record
|
||||
PHY_RCD beamWd; // beam width record
|
||||
@@ -265,5 +267,7 @@ int32_t Phy_SetTimeWord(PHY_INST* instPtr, const TIME_WORD* tmWord, PHY_TIME_WOR
|
||||
|
||||
double Phy_GetCoarseFreqEst(PHY_INST* instPtr);
|
||||
void Phy_GetFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT);
|
||||
void Phy_GetLastSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart);
|
||||
void Phy_GetLastReceivedFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT);
|
||||
void Phy_GetSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart);
|
||||
void Phy_GetLastReceivedSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart);
|
||||
#endif /* PHY_CTRL_H_ */
|
||||
|
||||
Reference in New Issue
Block a user