bugfix: should use the next slot number to compute routine index.

This commit is contained in:
Gatsby Van
2023-12-20 20:01:21 +08:00
parent f083920416
commit 1b69f68298
+6 -6
View File
@@ -1263,16 +1263,16 @@ static int32_t Linklayer_Routine (L2_INST* instPtr) {
uint32_t tableIndx, entryIndx; uint32_t tableIndx, entryIndx;
// FIXME: Consider time wrapping. // FIXME: Consider time wrapping.
uint32_t currTime = TimeCtrl_GetIntCnt(instPtr->config.tmcInstPtr)/L2_SLOTS_PER_FRAME; uint32_t nextTimeUnit = (TimeCtrl_GetIntCnt(instPtr->config.tmcInstPtr) + 1)/L2_SLOTS_PER_FRAME;
if(currTime < instPtr->netStartTime) { if(nextTimeUnit < instPtr->netStartTime) {
DBG_WARNING("Linklayer not start yet, current time unit: %u, start time unit: %u.\n", DBG_WARNING("Linklayer not start yet, next time unit: %u, start time unit: %u.\n",
currTime, instPtr->netStartTime); nextTimeUnit, instPtr->netStartTime);
return EIGNORE; return EIGNORE;
} }
// Determine which routine entry is going to be performed. // Determine which routine entry is going to be performed.
tableIndx = L2_GetCurrentFrameNum(instPtr) % instPtr->rtneConfig.rtnePrd; tableIndx = L2_GetNextFrameNum(instPtr) % instPtr->rtneConfig.rtnePrd;
entryIndx = L2_GetCurrentSlotNum(instPtr); entryIndx = L2_GetNextSlotNum(instPtr);
L2_RTNE_TABLE_ENTRY rtneEntry = {0}; L2_RTNE_TABLE_ENTRY rtneEntry = {0};
// Shift routine entry record. // Shift routine entry record.