add tx/rx mode record to L2_INST

This commit is contained in:
Gatsby Van
2023-12-20 19:49:48 +08:00
parent b986cb921b
commit a5acbdf05f
@@ -570,6 +570,7 @@ void L2_FrameStateUpdate(L2_INST* instPtr) {
// Frame types shift (last <- curr <- next)
L2_RcdShift(&(instPtr->frame), L2_NONE_FRAME);
L2_RcdShift(&(instPtr->tor), L2_TOR_SUSPEND);
// Update frame state.
if (Phy_IsFrameValid(phyRef) == false) {
@@ -721,6 +722,10 @@ int32_t L2_SetupNextSlot(L2_INST* instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
torStr, frameStr);
#endif
// Update frame and tx/rx mode record.
instPtr->frame.next = frameType;
instPtr->tor.next = txrxMode;
TIME_WORD pullTime = {0, 0};
pullTime.int_part = TimeCtrl_GetIntCnt(instPtr->config.tmcInstPtr) + 1;
Status = Phy_SetTimeWord(phyRef, &pullTime, TIME_WORD_POLL);
@@ -922,6 +927,9 @@ int32_t Linklayer_Init(L2_INST** instPtr, const L2_CONFIG *config) {
(*instPtr)->frame.last = L2_NONE_FRAME;
(*instPtr)->frame.curr = L2_NONE_FRAME;
(*instPtr)->frame.next = L2_NONE_FRAME;
(*instPtr)->tor.last = L2_TOR_SUSPEND;
(*instPtr)->tor.curr = L2_TOR_SUSPEND;
(*instPtr)->tor.next = L2_TOR_SUSPEND;
(*instPtr)->rtneConfig.rtneTable = initTable;
(*instPtr)->rtneConfig.rtnePrd = ARRAY_SIZE(initTable);
(*instPtr)->mainState = INIT_STATE;
@@ -1003,6 +1011,9 @@ int32_t Linklayer_Reconfig(L2_INST* instPtr, const L2_CONFIG *config) {
instPtr->frame.last = L2_NONE_FRAME;
instPtr->frame.curr = L2_NONE_FRAME;
instPtr->frame.next = L2_NONE_FRAME;
instPtr->tor.last = L2_TOR_SUSPEND;
instPtr->tor.curr = L2_TOR_SUSPEND;
instPtr->tor.next = L2_TOR_SUSPEND;
instPtr->rtneConfig.rtneTable = initTable;
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(initTable);
instPtr->mainState = INIT_STATE;