adapted to new time control api.
This commit is contained in:
@@ -41,7 +41,6 @@ const TIME_WORD RTT_TIME_NONE = {
|
||||
|
||||
static void RTT_StageUpdate(L2_RTT_FSM* rttFsmPtr, L2_RTT_STGE newStage);
|
||||
static void RTT_GetFrameStart(L2_INST* instPtr, TIME_WORD *tmStamp, L2_TOR_TYPE torType);
|
||||
void RTT_CalculateTimeGap(const TIME_WORD *tmA, const TIME_WORD *tmB, TIME_WORD *tRound);
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -183,31 +182,6 @@ void RTT_GetFrameStart(L2_INST* instPtr, TIME_WORD *tmStamp, L2_TOR_TYPE torType
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Calculate tmA - tmA.
|
||||
*
|
||||
* @param tmA time stamp A
|
||||
* @param tmA time stamp B
|
||||
* @param tRound t round
|
||||
*
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void RTT_CalculateTimeGap(const TIME_WORD *tmA, const TIME_WORD *tmB, TIME_WORD *tRound){
|
||||
ASSERT(tmA != NULL);
|
||||
ASSERT(tmB != NULL);
|
||||
ASSERT(tRound != NULL);
|
||||
uint64_t timeDiff;
|
||||
timeDiff = (uint64_t) tmB->frac_part;
|
||||
timeDiff += ((uint64_t)tmB->int_part) * COUNTE_FRAC_MAX;
|
||||
timeDiff -= ((uint64_t)tmA->int_part) * COUNTE_FRAC_MAX;
|
||||
timeDiff -= (uint64_t) tmA->frac_part;
|
||||
tRound->frac_part = (TIME_FRAC)(timeDiff % COUNTE_FRAC_MAX);
|
||||
tRound->frac_part = (TIME_INT)(timeDiff / COUNTE_FRAC_MAX);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Initialize RTT FSM, allocate memory for FSM instance.
|
||||
@@ -278,7 +252,7 @@ int32_t RTT_FsmUpdate(L2_INST* instPtr, L2_TOR_TYPE torType) {
|
||||
// Update Tr2
|
||||
RTT_GetFrameStart(instPtr, &(rttRecord->Tr2), torType);
|
||||
// Calculate TroundA
|
||||
RTT_CalculateTimeGap(&(rttRecord->Tt1), &(rttRecord->Tr2), &(rttRecord->TroundA));
|
||||
TimeCtrl_CalculateTimeGap(&(rttRecord->Tt1), &(rttRecord->Tr2), &(rttRecord->TroundA));
|
||||
}
|
||||
else{
|
||||
DBG_WARNING("RTT RSP-1 had not been received [Stage: %d].\n", rttFsmPtr->rttStage);
|
||||
@@ -307,7 +281,7 @@ int32_t RTT_FsmUpdate(L2_INST* instPtr, L2_TOR_TYPE torType) {
|
||||
|
||||
if ( rttFsmPtr->isR2Valid ) {
|
||||
// Calculate reply A
|
||||
RTT_CalculateTimeGap(&(rttRecord->Tt3), &(rttRecord->Tr2), &(rttRecord->TreplyA));
|
||||
TimeCtrl_CalculateTimeGap(&(rttRecord->Tt3), &(rttRecord->Tr2), &(rttRecord->TreplyA));
|
||||
}
|
||||
else {
|
||||
DBG_WARNING("RTT RSP-1 have not been received [Stage: %d].\n", rttFsmPtr->rttStage);
|
||||
@@ -339,7 +313,7 @@ int32_t RTT_FsmUpdate(L2_INST* instPtr, L2_TOR_TYPE torType) {
|
||||
// Update Tr4
|
||||
RTT_GetFrameStart(instPtr, &(rttRecord->Tr4), torType);
|
||||
// Calculate TroundA
|
||||
RTT_CalculateTimeGap(&(rttRecord->Tt3), &(rttRecord->Tr4), &(rttRecord->TroundA));
|
||||
TimeCtrl_CalculateTimeGap(&(rttRecord->Tt3), &(rttRecord->Tr4), &(rttRecord->TroundA));
|
||||
}
|
||||
else{
|
||||
DBG_WARNING("RTT RSP-1 have not been received [Stage: %d].\n", rttFsmPtr->rttStage);
|
||||
@@ -403,7 +377,7 @@ int32_t RTT_FsmUpdate(L2_INST* instPtr, L2_TOR_TYPE torType) {
|
||||
RTT_GetFrameStart(instPtr, &(rttRecord->Tt2), torType);
|
||||
if ( rttFsmPtr->isR1Valid ) {
|
||||
// Calculate reply B
|
||||
RTT_CalculateTimeGap(&(rttRecord->Tr1), &(rttRecord->Tt2), &(rttRecord->TreplyB));
|
||||
TimeCtrl_CalculateTimeGap(&(rttRecord->Tr1), &(rttRecord->Tt2), &(rttRecord->TreplyB));
|
||||
}
|
||||
else {
|
||||
rttRecord->TreplyB = RTT_TIME_NONE;
|
||||
@@ -435,7 +409,7 @@ int32_t RTT_FsmUpdate(L2_INST* instPtr, L2_TOR_TYPE torType) {
|
||||
// Update Tr3
|
||||
RTT_GetFrameStart(instPtr, &(rttRecord->Tr3), torType);
|
||||
// Calculate TroundB
|
||||
RTT_CalculateTimeGap(&(rttRecord->Tt2), &(rttRecord->Tr3), &(rttRecord->TroundB));
|
||||
TimeCtrl_CalculateTimeGap(&(rttRecord->Tt2), &(rttRecord->Tr3), &(rttRecord->TroundB));
|
||||
}
|
||||
else{
|
||||
DBG_WARNING("RTT REQ-2 have not been received [Stage: %d].\n", rttFsmPtr->rttStage);
|
||||
@@ -462,7 +436,7 @@ int32_t RTT_FsmUpdate(L2_INST* instPtr, L2_TOR_TYPE torType) {
|
||||
RTT_GetFrameStart(instPtr, &(rttRecord->Tt4), torType);
|
||||
if ( rttFsmPtr->isR3Valid ) {
|
||||
// Calculate reply B
|
||||
RTT_CalculateTimeGap(&(rttRecord->Tr3), &(rttRecord->Tt4), &(rttRecord->TreplyB));
|
||||
TimeCtrl_CalculateTimeGap(&(rttRecord->Tr3), &(rttRecord->Tt4), &(rttRecord->TreplyB));
|
||||
// TODO: implement a time adjustment.
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user