Compare commits
4
Commits
347c0c1f74
...
2ba32bf8db
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ba32bf8db | ||
|
|
fa2623130e | ||
|
|
6462daabdf | ||
|
|
85117688e1 |
@@ -52,7 +52,7 @@
|
||||
#define SCUTIMER_INTR_ID XPAR_SCUTIMER_INTR
|
||||
|
||||
// Physical Layer Configs
|
||||
#define PHY_DEVICE_ID 0X00
|
||||
#define PHY_DEVICE_ID 0
|
||||
#define PHY_BASEADDR XPAR_PHYC_BASEADDR
|
||||
#define PHY_BEAM_FORMING_ENABLE
|
||||
// -- Antenna Bram Configs
|
||||
|
||||
@@ -482,7 +482,7 @@ int main(void)
|
||||
DBG_PRINT("Physical started...\n");
|
||||
Phy_Start(phyInstPtr);
|
||||
|
||||
// Linklayer_Start(linkInstPtr);
|
||||
Linklayer_Start(linkInstPtr);
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define L2_PACK_LEN_MAX 512 // bytes
|
||||
|
||||
#define L2_ADV_PACK_LEN 28 // bytes
|
||||
#define L2_CMF_PACK_LEN 268 // bytes
|
||||
#define L2_CMF_PACK_LEN 28 // bytes
|
||||
#define L2_SVC_PACK_LEN 268 // bytes
|
||||
|
||||
// Common structure:
|
||||
@@ -117,4 +117,4 @@
|
||||
|
||||
/** @} LinkLayer_MSG_Constants*/
|
||||
|
||||
/** @} LinkLayer*/
|
||||
/** @} LinkLayer*/
|
||||
|
||||
@@ -261,26 +261,54 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
}
|
||||
return Status;
|
||||
#else
|
||||
NODE_ENTRY *node;
|
||||
uint8_t nodeId = (L2_GetNodeType(instPtr) == L2_NODE_HEAD) ? 0x02 : 0x01;
|
||||
node = L2_GetNodeById(instPtr->nodeList, nodeId);
|
||||
if (node == NULL)
|
||||
{
|
||||
node = L2_AppendNode(instPtr->nodeList, nodeId, L2_NODE_MEMBER);
|
||||
if (node == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to append new node [id: %" PRIu8 "]", nodeId);
|
||||
return ENOMEM;
|
||||
}
|
||||
}
|
||||
// Reset node ttl
|
||||
node->ttlCnt = 0;
|
||||
|
||||
// Calculate time deviation
|
||||
Status = L2_GetTimeDeviation(instPtr, L2_GetLastFrameNum(instPtr), L2_GetLastSlotNum(instPtr), true, &(instPtr->log.timeDev));
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Failed to compute time deviation.\n")
|
||||
return Status;
|
||||
}
|
||||
// Implement a auto time sync.
|
||||
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
||||
{
|
||||
// Time sync.
|
||||
L2_TimeAdjust(instPtr, &(instPtr->log.timeDev));
|
||||
}
|
||||
uint32_t frameNum = L2_GetCurrentFrameNum(instPtr);
|
||||
uint32_t slotNum = L2_GetCurrentSlotNum(instPtr);
|
||||
|
||||
// //NOTE: Service frame length is 20ms with 5ms idle
|
||||
// if(slotNum < 5)
|
||||
// {
|
||||
// slotNum = L2_SLOTS_PER_FRAME - 5;
|
||||
// frameNum = frameNum - 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// slotNum = slotNum / 5 * 5 - 5;
|
||||
// }
|
||||
// Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
|
||||
// if (Status != SUCCESS)
|
||||
// {
|
||||
// DBG_ERROR("Failed to compute time deviation.\n")
|
||||
// return Status;
|
||||
// }
|
||||
// // Implement a auto time sync.
|
||||
// if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
||||
// {
|
||||
// // Time sync.
|
||||
// L2_TimeAdjust(instPtr, &(instPtr->log.timeDev));
|
||||
// }
|
||||
return SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool L2_Service_PktCheck(L2_INST *instPtr, uint8_t *msg)
|
||||
{
|
||||
size_t packLen = Phy_GetFrameLen(L2_L2frame2L1frame(L2_SVC_FRAME));
|
||||
size_t packLen = Phy_GetFrameLen(L2_L2frame2L1frame(L2_SVC_FRAME)) & 0xFFFFFFFE;
|
||||
uint32_t errorBits = 0;
|
||||
for (int i = 0; i < packLen; i++)
|
||||
{
|
||||
@@ -433,4 +461,4 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
|
||||
}
|
||||
|
||||
/** @} LinkLayer_Service*/
|
||||
/** @} LinkLayer*/
|
||||
/** @} LinkLayer*/
|
||||
|
||||
Reference in New Issue
Block a user