add beam steering

This commit is contained in:
Gatsby Van
2024-03-01 21:27:00 +08:00
parent f1e1ddf48f
commit 04a75154c5
2 changed files with 27 additions and 0 deletions
@@ -595,6 +595,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
ASSERT(instPtr != NULL); ASSERT(instPtr != NULL);
L2_TOR_TYPE torState; L2_TOR_TYPE torState;
int32_t Status; int32_t Status;
const NODE_ENTRY* commNode;
DBG_INFO("-------- Scan Routine --------\n"); DBG_INFO("-------- Scan Routine --------\n");
if (rtneEntry->slotSeq != 0) if (rtneEntry->slotSeq != 0)
@@ -607,15 +608,24 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
if (rtneEntry->dst == L2_GetNodeId(instPtr) || rtneEntry->dst == L2_BROADCAST_ID) if (rtneEntry->dst == L2_GetNodeId(instPtr) || rtneEntry->dst == L2_BROADCAST_ID)
{ {
torState = L2_TOR_RX; torState = L2_TOR_RX;
commNode = L2_GetNodeById(rtneEntry->dst);
} }
else if (rtneEntry->src == L2_GetNodeId(instPtr) || rtneEntry->src == L2_BROADCAST_ID) else if (rtneEntry->src == L2_GetNodeId(instPtr) || rtneEntry->src == L2_BROADCAST_ID)
{ {
torState = L2_TOR_TX; torState = L2_TOR_TX;
commNode = L2_GetNodeById(rtneEntry->src);
} }
else else
{ {
torState = L2_TOR_SUSPEND; torState = L2_TOR_SUSPEND;
} }
Phy_SetBeamWidth(instPtr->config.phyInstPtr, PHY_ANT_BEAM_25);
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_25;
if (commNode != NULL)
{
Phy_SetBeamNo(commNode->nodeInfo.beamNo);
}
} }
else else
{ {
@@ -631,6 +641,8 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
{ {
torState = L2_TOR_SUSPEND; torState = L2_TOR_SUSPEND;
} }
Phy_SetBeamWidth(instPtr->config.phyInstPtr, PHY_ANT_BEAM_120);
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_120;
} }
switch (rtneEntry->slotType) switch (rtneEntry->slotType)
@@ -369,19 +369,34 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
PHY_INST* phyRef = instPtr->config.phyInstPtr; PHY_INST* phyRef = instPtr->config.phyInstPtr;
L2_TOR_TYPE torState; L2_TOR_TYPE torState;
const NODE_ENTRY* commNode;
if (rtneEntry->src == L2_GetNodeId(instPtr)) if (rtneEntry->src == L2_GetNodeId(instPtr))
{ {
torState = L2_TOR_TX; torState = L2_TOR_TX;
commNode = L2_GetNodeById(rtneEntry->src);
} }
else if (rtneEntry->dst == L2_GetNodeId(instPtr)) else if (rtneEntry->dst == L2_GetNodeId(instPtr))
{ {
torState = L2_TOR_RX; torState = L2_TOR_RX;
commNode = L2_GetNodeById(rtneEntry->src);
} }
else else
{ {
torState = L2_TOR_SUSPEND; torState = L2_TOR_SUSPEND;
} }
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD && commNode != NULL)
{
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_25);
Phy_SetBeamNo(phyRef, commNode->nodeInfo.beamNo);
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_25;
}
else
{
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_120);
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_120;
}
switch (rtneEntry->slotType) switch (rtneEntry->slotType)
{ {
case L2_SLOT_SERVICE: case L2_SLOT_SERVICE: