Compare commits
4
Commits
347c0c1f74
...
2ba32bf8db
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ba32bf8db | ||
|
|
fa2623130e | ||
|
|
6462daabdf | ||
|
|
85117688e1 |
@@ -52,7 +52,7 @@
|
|||||||
#define SCUTIMER_INTR_ID XPAR_SCUTIMER_INTR
|
#define SCUTIMER_INTR_ID XPAR_SCUTIMER_INTR
|
||||||
|
|
||||||
// Physical Layer Configs
|
// Physical Layer Configs
|
||||||
#define PHY_DEVICE_ID 0X00
|
#define PHY_DEVICE_ID 0
|
||||||
#define PHY_BASEADDR XPAR_PHYC_BASEADDR
|
#define PHY_BASEADDR XPAR_PHYC_BASEADDR
|
||||||
#define PHY_BEAM_FORMING_ENABLE
|
#define PHY_BEAM_FORMING_ENABLE
|
||||||
// -- Antenna Bram Configs
|
// -- Antenna Bram Configs
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ int main(void)
|
|||||||
DBG_PRINT("Physical started...\n");
|
DBG_PRINT("Physical started...\n");
|
||||||
Phy_Start(phyInstPtr);
|
Phy_Start(phyInstPtr);
|
||||||
|
|
||||||
// Linklayer_Start(linkInstPtr);
|
Linklayer_Start(linkInstPtr);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#define L2_PACK_LEN_MAX 512 // bytes
|
#define L2_PACK_LEN_MAX 512 // bytes
|
||||||
|
|
||||||
#define L2_ADV_PACK_LEN 28 // 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
|
#define L2_SVC_PACK_LEN 268 // bytes
|
||||||
|
|
||||||
// Common structure:
|
// Common structure:
|
||||||
|
|||||||
@@ -261,26 +261,54 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
#else
|
#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
|
// Calculate time deviation
|
||||||
Status = L2_GetTimeDeviation(instPtr, L2_GetLastFrameNum(instPtr), L2_GetLastSlotNum(instPtr), true, &(instPtr->log.timeDev));
|
uint32_t frameNum = L2_GetCurrentFrameNum(instPtr);
|
||||||
if (Status != SUCCESS)
|
uint32_t slotNum = L2_GetCurrentSlotNum(instPtr);
|
||||||
{
|
|
||||||
DBG_ERROR("Failed to compute time deviation.\n")
|
// //NOTE: Service frame length is 20ms with 5ms idle
|
||||||
return Status;
|
// if(slotNum < 5)
|
||||||
}
|
// {
|
||||||
// Implement a auto time sync.
|
// slotNum = L2_SLOTS_PER_FRAME - 5;
|
||||||
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
// frameNum = frameNum - 1;
|
||||||
{
|
// }
|
||||||
// Time sync.
|
// else
|
||||||
L2_TimeAdjust(instPtr, &(instPtr->log.timeDev));
|
// {
|
||||||
}
|
// 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;
|
return SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool L2_Service_PktCheck(L2_INST *instPtr, uint8_t *msg)
|
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;
|
uint32_t errorBits = 0;
|
||||||
for (int i = 0; i < packLen; i++)
|
for (int i = 0; i < packLen; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user