miscellaneous update, enhance code coherence.

This commit is contained in:
Gatsby Van
2024-01-19 16:54:28 +08:00
parent 789560d1b5
commit 22f7822499
7 changed files with 97 additions and 67 deletions
+11 -11
View File
@@ -113,7 +113,7 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
PHY_INST* phyRef = instPtr->phyInstPtr;
L1_FRAME_TYPE frameType = L1_NONE_FRAME;
PHY_TOR_TYPE torState = PHY_TOR_SUSPEND;
PHY_ANT_BEAM_WIDTH beamWidth = ANT_BEAM_NONE;
PHY_ANT_BEAM_WIDTH beamWidth = PHY_ANT_BEAM_NONE;
uint32_t beamNo = 0;
uint16_t msg_Recv = 0;
@@ -199,13 +199,13 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
}
}
if(msgPtr[INTER_MSG_CTRL_BEAM_MODE_OFFSET] == BEAM_MODE_WIDE){
beamWidth = ANT_BEAM_120;
beamWidth = PHY_ANT_BEAM_120;
}
else if(msgPtr[INTER_MSG_CTRL_BEAM_MODE_OFFSET] == BEAM_MODE_SUBNRW){
beamWidth = ANT_BEAM_25;
beamWidth = PHY_ANT_BEAM_25;
}
else if(msgPtr[INTER_MSG_CTRL_BEAM_MODE_OFFSET] == BEAM_MODE_NRW){
beamWidth = ANT_BEAM_8;
beamWidth = PHY_ANT_BEAM_8;
}
else{
DBG_ERROR("[PHY Control] Beam Width Configure cannot be recognized...\n\r");
@@ -217,9 +217,9 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
return Status;
}
beamNo = (uint32_t)msgPtr[INTER_MSG_CTRL_BEAM_NO_OFFSET];
if((beamNo<NUM_ANT_SUBNRRW_PATTERN && beamWidth == ANT_BEAM_25)
||(beamNo<NUM_ANT_NRRW_PATTERN && beamWidth == ANT_BEAM_8)
|| (beamNo == 0 && beamWidth == ANT_BEAM_120)){
if((beamNo<NUM_ANT_SUBNRRW_PATTERN && beamWidth == PHY_ANT_BEAM_25)
||(beamNo<NUM_ANT_NRRW_PATTERN && beamWidth == PHY_ANT_BEAM_8)
|| (beamNo == 0 && beamWidth == PHY_ANT_BEAM_120)){
Phy_SetBeamNo(phyRef, beamNo);
}
else{
@@ -245,7 +245,7 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
TIME_WORD tmWord = {0};
tmWord.int_part = (uint32_t)(instPtr->lastCtrlTimeTag >> 32);
tmWord.frac_part = (uint32_t)(instPtr->lastCtrlTimeTag);
Status = Phy_SetTimeWord(phyRef, &tmWord, TIME_WORD_POLL);
Status = Phy_SetTimeWord(phyRef, &tmWord, PHY_TIME_WORD_POLL);
Status = Phy_SetMode(phyRef, PHY_MODE_PULL);
Status = Phy_SetupNextSlot(phyRef, torState, frameType, instPtr->phySendBuff);
@@ -508,7 +508,7 @@ int32_t InterComm_MsgHandler(INTER_COMM_INST* instPtr){
timeTemp = GetTimeWord(msgRecvPtr + MODESW_START_TIME_OFFSET);
tmWord.int_part = (uint32_t)(timeTemp>>32);;
tmWord.frac_part = (uint32_t)(timeTemp);
Status = Phy_SetTimeWord(instPtr->phyInstPtr, &tmWord, TIME_WORD_POLL);
Status = Phy_SetTimeWord(instPtr->phyInstPtr, &tmWord, PHY_TIME_WORD_POLL);
if(Status != SUCCESS){
return EPARAM;
}
@@ -516,7 +516,7 @@ int32_t InterComm_MsgHandler(INTER_COMM_INST* instPtr){
if(timeTemp == 0){
tmWord.frac_part = 0;
tmWord.int_part = 0;
Status = Phy_SetTimeWord(instPtr->phyInstPtr, &tmWord, TIME_WORD_LISTEN_TIMEOUT);
Status = Phy_SetTimeWord(instPtr->phyInstPtr, &tmWord, PHY_TIME_WORD_LISTEN_TIMEOUT);
if(Status != SUCCESS){
return EPARAM;
}
@@ -526,7 +526,7 @@ int32_t InterComm_MsgHandler(INTER_COMM_INST* instPtr){
tmWord.int_part += (uint32_t)(timeTemp>>32);
tmWord.int_part = (tmWord.frac_part >= TMWORD_FRAC_MAX) ? tmWord.int_part + 1:tmWord.int_part;
tmWord.frac_part %= TMWORD_FRAC_MAX;
Status = Phy_SetTimeWord(instPtr->phyInstPtr, &tmWord, TIME_WORD_LISTEN_TIMEOUT);
Status = Phy_SetTimeWord(instPtr->phyInstPtr, &tmWord, PHY_TIME_WORD_LISTEN_TIMEOUT);
if(Status != SUCCESS){
return EPARAM;
}