Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
807b045b75 | ||
|
|
6f4774f6b8 | ||
|
|
de5759b392 | ||
|
|
2b18765563 | ||
|
|
03a6d86a3a | ||
|
|
729bbeb60e | ||
|
|
33545b63e1 | ||
|
|
6c64421336 | ||
|
|
dda9d09f2a | ||
|
|
14f2be3053 | ||
|
|
b7607a7a1b | ||
|
|
c07cd00f2f | ||
|
|
20da80f6c2 | ||
|
|
c7e3eb2800 | ||
|
|
9acdd0609a | ||
|
|
66529637a3 |
@@ -151,13 +151,14 @@ static int32_t Mpc_GenSelfTestRsp(MPC *instPtr)
|
|||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
MPC_HW_FRAME *mpcRsp;
|
MPC_HW_FRAME *mpcRsp;
|
||||||
uint8_t *msg;
|
uint8_t *msg;
|
||||||
if (instPtr->isEnable == false)
|
if (Mpc_IsEnable(instPtr) == false)
|
||||||
{
|
{
|
||||||
DBG_ERROR("System is not enabled!\n");
|
DBG_ERROR("System is not enabled!\n");
|
||||||
return EIGNORE;
|
return EIGNORE;
|
||||||
}
|
}
|
||||||
mpcRsp = malloc(sizeof(MPC_HW_FRAME));
|
mpcRsp = malloc(sizeof(MPC_HW_FRAME));
|
||||||
if (mpcRsp == NULL) {
|
if (mpcRsp == NULL)
|
||||||
|
{
|
||||||
DBG_ERROR("Failed to allocate memory for LJ REMOTE TEST Response!\n");
|
DBG_ERROR("Failed to allocate memory for LJ REMOTE TEST Response!\n");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -169,13 +170,13 @@ static int32_t Mpc_GenSelfTestRsp(MPC *instPtr)
|
|||||||
msg[WD_CMD] = CMD_SELF_TEST;
|
msg[WD_CMD] = CMD_SELF_TEST;
|
||||||
msg[WD_PRD] = MY_PRD_ID;
|
msg[WD_PRD] = MY_PRD_ID;
|
||||||
SysMonitor_GetHardwareStatus(hwStatsPtr);
|
SysMonitor_GetHardwareStatus(hwStatsPtr);
|
||||||
if (linkInstPtr->isEnable == false)
|
if (Mpc_IsEnable(instPtr))
|
||||||
{
|
{
|
||||||
msg[WD_ST_RET] = (hwStatsPtr->isSpOk) ? ST_RET_OK : ST_RET_ERROR;
|
msg[WD_ST_RET] = (hwStatsPtr->isSpOk && hwStatsPtr->isAntOk) ? ST_RET_OK : ST_RET_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg[WD_ST_RET] = (hwStatsPtr->isSpOk && hwStatsPtr->isAntOk) ? ST_RET_OK : ST_RET_ERROR;
|
msg[WD_ST_RET] = (hwStatsPtr->isSpOk) ? ST_RET_OK : ST_RET_ERROR;
|
||||||
}
|
}
|
||||||
// apply status and omit 2 bytes of overhead.
|
// apply status and omit 2 bytes of overhead.
|
||||||
memcpy(msg + WD_SP_FPGA_VOLT, &(hwStatsPtr->spFpgaVolt), ST_RET_INFO_LEN);
|
memcpy(msg + WD_SP_FPGA_VOLT, &(hwStatsPtr->spFpgaVolt), ST_RET_INFO_LEN);
|
||||||
@@ -201,44 +202,46 @@ static int32_t Mpc_SystemConfig(MPC *instPtr, uint8_t *msg)
|
|||||||
if (msg[WD_MODE_CMD] == MODE_CMD_HEAD)
|
if (msg[WD_MODE_CMD] == MODE_CMD_HEAD)
|
||||||
{
|
{
|
||||||
// omit unnecessary reconfiguration
|
// omit unnecessary reconfiguration
|
||||||
if (L2_GetNodeType(linkInstPtr) != L2_NODE_HEAD)
|
reconfig = (L2_NODE_HEAD != L2_GetNodeType(linkInstPtr));
|
||||||
{
|
|
||||||
// head node config
|
|
||||||
linkConfig.myType = L2_NODE_HEAD;
|
linkConfig.myType = L2_NODE_HEAD;
|
||||||
linkConfig.myId = 1;
|
linkConfig.myId = 2;
|
||||||
reconfig = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (msg[WD_MODE_CMD] == MODE_CMD_MEMBER)
|
else if (msg[WD_MODE_CMD] == MODE_CMD_MEMBER)
|
||||||
{
|
{
|
||||||
// omit unnecessary reconfiguration
|
// omit unnecessary reconfiguration
|
||||||
if (L2_GetNodeType(linkInstPtr) != L2_NODE_MEMBER)
|
reconfig = (L2_NODE_MEMBER != L2_GetNodeType(linkInstPtr));
|
||||||
{
|
|
||||||
// member node config
|
|
||||||
linkConfig.myType = L2_NODE_MEMBER;
|
linkConfig.myType = L2_NODE_MEMBER;
|
||||||
linkConfig.myId = 2;
|
linkConfig.myId = 2;
|
||||||
reconfig = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Ignore current command
|
// Ignore current command
|
||||||
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
|
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
|
||||||
WD_MODE_CMD, msg[WD_MODE_CMD]);
|
WD_MODE_CMD, msg[WD_MODE_CMD]);
|
||||||
return EPARAM;
|
return EIGNORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg[WD_EN_CMD] == EN_CMD_ON_HIGH_POWER)
|
if (msg[WD_EN_CMD] == EN_CMD_ON_HIGH_POWER)
|
||||||
{
|
{
|
||||||
// high power config
|
// high power config
|
||||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_FULL);
|
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_FULL);
|
||||||
|
if (reconfig == true || !Mpc_IsEnable(instPtr))
|
||||||
|
{
|
||||||
|
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||||
|
}
|
||||||
|
Linklayer_Start(linkInstPtr);
|
||||||
instPtr->isEnable = true;
|
instPtr->isEnable = true;
|
||||||
}
|
}
|
||||||
else if (msg[WD_EN_CMD] == EN_CMD_ON_LOW_POWER)
|
else if (msg[WD_EN_CMD] == EN_CMD_ON_LOW_POWER)
|
||||||
{
|
{
|
||||||
// low power config
|
// low power config
|
||||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_LOW);
|
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_LOW);
|
||||||
|
if (reconfig == true || !Mpc_IsEnable(instPtr))
|
||||||
|
{
|
||||||
|
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||||
|
}
|
||||||
|
Linklayer_Start(linkInstPtr);
|
||||||
instPtr->isEnable = true;
|
instPtr->isEnable = true;
|
||||||
}
|
}
|
||||||
else if (msg[WD_EN_CMD] == EN_CMD_SILENT)
|
else if (msg[WD_EN_CMD] == EN_CMD_SILENT)
|
||||||
@@ -256,20 +259,18 @@ static int32_t Mpc_SystemConfig(MPC *instPtr, uint8_t *msg)
|
|||||||
}
|
}
|
||||||
Phy_SetupNextSlot(phyRef, PHY_TOR_RX, L1_10KBPS_10MS_FRAME, NULL);
|
Phy_SetupNextSlot(phyRef, PHY_TOR_RX, L1_10KBPS_10MS_FRAME, NULL);
|
||||||
}
|
}
|
||||||
if (reconfig == true)
|
else
|
||||||
{
|
{
|
||||||
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
// Ignore current command
|
||||||
}
|
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
|
||||||
if (instPtr->isEnable == true)
|
WD_EN_CMD, msg[WD_EN_CMD]);
|
||||||
{
|
return EIGNORE;
|
||||||
Linklayer_Start(linkInstPtr);
|
|
||||||
}
|
}
|
||||||
instPtr->mpcLog.lastConfig[0] = msg[WD_MODE_CMD];
|
instPtr->mpcLog.lastConfig[0] = msg[WD_MODE_CMD];
|
||||||
instPtr->mpcLog.lastConfig[1] = msg[WD_EN_CMD];
|
instPtr->mpcLog.lastConfig[1] = msg[WD_EN_CMD];
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
* @brief Initialize MPC instance.
|
* @brief Initialize MPC instance.
|
||||||
@@ -371,13 +372,14 @@ int32_t Mpc_PendRemoteTest(MPC *instPtr)
|
|||||||
{
|
{
|
||||||
MPC_HW_FRAME *mpcRsp;
|
MPC_HW_FRAME *mpcRsp;
|
||||||
uint8_t *msg;
|
uint8_t *msg;
|
||||||
if (instPtr->isEnable == false)
|
if (!Mpc_IsEnable(instPtr))
|
||||||
{
|
{
|
||||||
DBG_ERROR("System is not enabled!\n");
|
DBG_ERROR("System is not enabled!\n");
|
||||||
return EIGNORE;
|
return EIGNORE;
|
||||||
}
|
}
|
||||||
mpcRsp = malloc(sizeof(MPC_HW_FRAME));
|
mpcRsp = malloc(sizeof(MPC_HW_FRAME));
|
||||||
if (mpcRsp == NULL) {
|
if (mpcRsp == NULL)
|
||||||
|
{
|
||||||
DBG_ERROR("Failed to allocate memory for LJ REMOTE TEST Response!\n");
|
DBG_ERROR("Failed to allocate memory for LJ REMOTE TEST Response!\n");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -407,7 +409,8 @@ int32_t Mpc_PendRemoteTest(MPC *instPtr)
|
|||||||
memcpy(msg + WD_PHY_LOG, &(instPtr->phyLog), WD_PHY_LOG_LEN);
|
memcpy(msg + WD_PHY_LOG, &(instPtr->phyLog), WD_PHY_LOG_LEN);
|
||||||
memcpy(msg + WD_HARDWARE_ST, &(instPtr->hwState.spFpgaVolt), WD_HARDWARE_ST_LEN);
|
memcpy(msg + WD_HARDWARE_ST, &(instPtr->hwState.spFpgaVolt), WD_HARDWARE_ST_LEN);
|
||||||
|
|
||||||
if (CircQueuePush(instPtr->txQueue, (void *)mpcRsp) == false){
|
if (CircQueuePush(instPtr->txQueue, (void *)mpcRsp) == false)
|
||||||
|
{
|
||||||
free(mpcRsp);
|
free(mpcRsp);
|
||||||
DBG_WARNING("SystemBus::TX Queue overflowed!\n");
|
DBG_WARNING("SystemBus::TX Queue overflowed!\n");
|
||||||
return EQUEUE;
|
return EQUEUE;
|
||||||
|
|||||||
@@ -697,7 +697,6 @@ int32_t spi_engine_write_and_read(struct spi_desc *desc,
|
|||||||
uint8_t *data,
|
uint8_t *data,
|
||||||
uint16_t bytes_number)
|
uint16_t bytes_number)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
|
||||||
uint8_t word_len;
|
uint8_t word_len;
|
||||||
uint8_t words_number;
|
uint8_t words_number;
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#endif
|
#endif
|
||||||
/************************** Constant Definitions *****************************/
|
/************************** Constant Definitions *****************************/
|
||||||
#define NET_START_TIME_INFTY UINT32_MAX
|
#define NET_START_TIME_INFTY UINT32_MAX
|
||||||
#define LINK_BROCK_THRESHOLD (3 * 200) // 3 secods
|
#define LINK_BROCK_THRESHOLD L2_SLOTS_PER_FRAME // 0.5 secods
|
||||||
|
|
||||||
/************************** Variable Definitions *****************************/
|
/************************** Variable Definitions *****************************/
|
||||||
/***************** Macros (Inline Functions) Definitions *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
@@ -147,6 +147,15 @@ inline L2_NODE_STATE L2_GetMainState(L2_INST *instPtr)
|
|||||||
return instPtr->mainState;
|
return instPtr->mainState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if there is a valid l2 frame.
|
||||||
|
*/
|
||||||
|
inline bool L2_isStarted(L2_INST *instPtr)
|
||||||
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
|
return instPtr->isEnable;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if there is a valid l2 frame.
|
* @brief Check if there is a valid l2 frame.
|
||||||
*/
|
*/
|
||||||
@@ -401,7 +410,6 @@ void L2_FrameStateUpdate(L2_INST *instPtr)
|
|||||||
int32_t L2_SteerBeam2Node(L2_INST *instPtr, uint8_t nodeId)
|
int32_t L2_SteerBeam2Node(L2_INST *instPtr, uint8_t nodeId)
|
||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
ASSERT(instPtr->config.phyInstPtr != NULL);
|
|
||||||
int32_t Status;
|
int32_t Status;
|
||||||
|
|
||||||
COORD myPos, dstPos, beamDir;
|
COORD myPos, dstPos, beamDir;
|
||||||
@@ -948,7 +956,7 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
|
|||||||
case L2_EV_LOST_CXN:
|
case L2_EV_LOST_CXN:
|
||||||
{
|
{
|
||||||
DBG_INFO("Event L2_EV_LOST_CXN asserted....\n");
|
DBG_INFO("Event L2_EV_LOST_CXN asserted....\n");
|
||||||
if (instPtr->config.myType == L2_NODE_HEAD)
|
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||||
{
|
{
|
||||||
DBG_ERROR("Illegal event, only None_Head node can assert L2_EV_LOST_CXN.\n");
|
DBG_ERROR("Illegal event, only None_Head node can assert L2_EV_LOST_CXN.\n");
|
||||||
break;
|
break;
|
||||||
@@ -1171,6 +1179,8 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
|
|||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
int32_t Status;
|
int32_t Status;
|
||||||
|
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||||
|
TMC_INST *tmcRef = instPtr->config.tmcInstPtr;
|
||||||
|
|
||||||
if (instPtr->isEnable == false)
|
if (instPtr->isEnable == false)
|
||||||
{
|
{
|
||||||
@@ -1179,7 +1189,7 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Consider time wrapping.
|
// FIXME: Consider time wrapping.
|
||||||
uint32_t nextTimeUnit = (TimeCtrl_GetIntCnt(instPtr->config.tmcInstPtr) + 1) / L2_SLOTS_PER_FRAME;
|
uint32_t nextTimeUnit = (TimeCtrl_GetIntCnt(tmcRef) + 1) / L2_SLOTS_PER_FRAME;
|
||||||
if (nextTimeUnit < instPtr->netStartTime)
|
if (nextTimeUnit < instPtr->netStartTime)
|
||||||
{
|
{
|
||||||
DBG_WARNING("Linklayer not start yet, next time unit: %" PRIu32 ", start time unit: %" PRIu32 ".\n",
|
DBG_WARNING("Linklayer not start yet, next time unit: %" PRIu32 ", start time unit: %" PRIu32 ".\n",
|
||||||
@@ -1211,19 +1221,19 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
|
|||||||
// Run Link layer routine, setup next slot procedure.
|
// Run Link layer routine, setup next slot procedure.
|
||||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||||
{
|
{
|
||||||
Phy_SetMode(instPtr->config.phyInstPtr, PHY_MODE_PULL);
|
Phy_SetMode(phyRef, PHY_MODE_PULL);
|
||||||
Status = Linklayer_Routine(instPtr);
|
Status = Linklayer_Routine(instPtr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // L2_NODE_MEMBER
|
{ // L2_NODE_MEMBER
|
||||||
if (L2_isCxn2Net(instPtr))
|
if (L2_isCxn2Net(instPtr))
|
||||||
{
|
{
|
||||||
Phy_SetMode(instPtr->config.phyInstPtr, PHY_MODE_PULL);
|
Phy_SetMode(phyRef, PHY_MODE_PULL);
|
||||||
Status = Linklayer_Routine(instPtr);
|
Status = Linklayer_Routine(instPtr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Phy_SetMode(instPtr->config.phyInstPtr, PHY_MODE_LISTEN);
|
Phy_SetMode(phyRef, PHY_MODE_LISTEN);
|
||||||
Status = L2_Scan_Proc(instPtr);
|
Status = L2_Scan_Proc(instPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1241,14 +1251,14 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
|
|||||||
instPtr->mainState = instPtr->nextState;
|
instPtr->mainState = instPtr->nextState;
|
||||||
instPtr->linkLog.tuNum = instPtr->frameNum.curr;
|
instPtr->linkLog.tuNum = instPtr->frameNum.curr;
|
||||||
instPtr->linkLog.slotNum = (uint8_t)instPtr->slotNum.curr;
|
instPtr->linkLog.slotNum = (uint8_t)instPtr->slotNum.curr;
|
||||||
instPtr->linkLog.nodeType = (instPtr->config.myType == L2_NODE_HEAD) ? 0xAA : 0xCC;
|
instPtr->linkLog.nodeType = (L2_GetNodeType(instPtr) == L2_NODE_HEAD) ? 0xAA : 0xCC;
|
||||||
instPtr->linkLog.cxnStatus = (instPtr->cxn2Net) ? 0x11 : 0x00;
|
instPtr->linkLog.cxnStatus = (instPtr->cxn2Net) ? 0x11 : 0x00;
|
||||||
instPtr->linkLog.linkStage = (instPtr->mainState == L2_INIT_STATE) ? 0x11 : 0x22;
|
instPtr->linkLog.linkStage = (instPtr->mainState == L2_INIT_STATE) ? 0x11 : 0x22;
|
||||||
instPtr->linkLog.recxnCnt = instPtr->log.reconnectCnt;
|
instPtr->linkLog.recxnCnt = instPtr->log.reconnectCnt;
|
||||||
instPtr->linkLog.beamNo = instPtr->scanFSM->beamNo;
|
instPtr->linkLog.beamNo = instPtr->scanFSM->beamNo;
|
||||||
instPtr->linkLog.beamWidth = instPtr->log.lastBeamWidth;
|
instPtr->linkLog.beamWidth = instPtr->log.lastBeamWidth;
|
||||||
instPtr->linkLog.beamAz = instPtr->config.phyInstPtr->antNrrwPattern[instPtr->scanFSM->beamNo].oaxis;
|
instPtr->linkLog.beamAz = phyRef->antNrrwPattern[instPtr->scanFSM->beamNo].oaxis;
|
||||||
instPtr->linkLog.beamEl = instPtr->config.phyInstPtr->antNrrwPattern[instPtr->scanFSM->beamNo].raxis;
|
instPtr->linkLog.beamEl = phyRef->antNrrwPattern[instPtr->scanFSM->beamNo].raxis;
|
||||||
instPtr->linkLog.advTxCnt = (uint16_t)instPtr->log.advTxCnt;
|
instPtr->linkLog.advTxCnt = (uint16_t)instPtr->log.advTxCnt;
|
||||||
instPtr->linkLog.advRecvCnt = (uint16_t)instPtr->log.advRecvCnt;
|
instPtr->linkLog.advRecvCnt = (uint16_t)instPtr->log.advRecvCnt;
|
||||||
instPtr->linkLog.advCorrectCnt = (uint16_t)instPtr->log.advCorrectCnt;
|
instPtr->linkLog.advCorrectCnt = (uint16_t)instPtr->log.advCorrectCnt;
|
||||||
@@ -1260,8 +1270,8 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
|
|||||||
instPtr->linkLog.svcCorrectCnt = instPtr->log.svcCorrectCnt;
|
instPtr->linkLog.svcCorrectCnt = instPtr->log.svcCorrectCnt;
|
||||||
instPtr->linkLog.timeDev = (instPtr->log.timeDev > INT32_MAX)
|
instPtr->linkLog.timeDev = (instPtr->log.timeDev > INT32_MAX)
|
||||||
? INT32_MAX : ((instPtr->log.timeDev < INT32_MIN) ? INT32_MIN : (int32_t)instPtr->log.timeDev);
|
? INT32_MAX : ((instPtr->log.timeDev < INT32_MIN) ? INT32_MIN : (int32_t)instPtr->log.timeDev);
|
||||||
instPtr->linkLog.sendId = instPtr->serviceFSM->txLog.dataId;
|
instPtr->linkLog.sendId = instPtr->log.txLog.dataId;
|
||||||
instPtr->linkLog.recvId = instPtr->serviceFSM->rxLog.dataId;
|
instPtr->linkLog.recvId = instPtr->log.rxLog.dataId;
|
||||||
|
|
||||||
SysMonitor_UpdateLinklayerLog(&(instPtr->linkLog));
|
SysMonitor_UpdateLinklayerLog(&(instPtr->linkLog));
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ typedef struct
|
|||||||
int64_t timeDev;
|
int64_t timeDev;
|
||||||
uint8_t lastBeamWidth;
|
uint8_t lastBeamWidth;
|
||||||
uint32_t reconnectCnt;
|
uint32_t reconnectCnt;
|
||||||
|
|
||||||
|
PAYLOAD rxLog;
|
||||||
|
PAYLOAD txLog;
|
||||||
} L2_LOG;
|
} L2_LOG;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -152,6 +155,7 @@ uint8_t L2_GetClusterId(L2_INST *instPtr);
|
|||||||
uint8_t L2_GetHeadId(L2_INST *instPtr);
|
uint8_t L2_GetHeadId(L2_INST *instPtr);
|
||||||
L2_NODE_TYPE L2_GetNodeType(L2_INST *instPtr);
|
L2_NODE_TYPE L2_GetNodeType(L2_INST *instPtr);
|
||||||
L2_NODE_STATE L2_GetMainState(L2_INST *instPtr);
|
L2_NODE_STATE L2_GetMainState(L2_INST *instPtr);
|
||||||
|
bool L2_isStarted(L2_INST *instPtr);
|
||||||
bool L2_isDataAvail(L2_INST *instPtr);
|
bool L2_isDataAvail(L2_INST *instPtr);
|
||||||
bool L2_isCxn2Net(L2_INST *instPtr);
|
bool L2_isCxn2Net(L2_INST *instPtr);
|
||||||
uint32_t L2_GetFrameLen(L2_FRAME_TYPE l2FrameType);
|
uint32_t L2_GetFrameLen(L2_FRAME_TYPE l2FrameType);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#define L2_FRAMENO_NONE 0
|
#define L2_FRAMENO_NONE 0
|
||||||
|
|
||||||
// Common number of slots definition
|
// Common number of slots definition
|
||||||
#define L2_SLOTS_PER_FRAME 200
|
#define L2_SLOTS_PER_FRAME 100
|
||||||
#define L2_SLOTS_PER_SUBFRAME 20
|
#define L2_SLOTS_PER_SUBFRAME 20
|
||||||
|
|
||||||
#define L2_NUM_SLOTS_NONE UINT32_MAX
|
#define L2_NUM_SLOTS_NONE UINT32_MAX
|
||||||
@@ -207,10 +207,9 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
PAYLOAD rxLog;
|
uint32_t txCnt;
|
||||||
PAYLOAD txLog;
|
uint32_t rxCnt;
|
||||||
uint32_t pktRecv;
|
uint32_t rxdCnt;
|
||||||
uint32_t pktCorrect;
|
|
||||||
#ifdef DATALINK_ENABLE_BERTEST
|
#ifdef DATALINK_ENABLE_BERTEST
|
||||||
uint32_t bitTotal;
|
uint32_t bitTotal;
|
||||||
uint32_t bitError;
|
uint32_t bitError;
|
||||||
|
|||||||
@@ -16,452 +16,6 @@
|
|||||||
#include "link_layer.h"
|
#include "link_layer.h"
|
||||||
#include "link_layer_types.h"
|
#include "link_layer_types.h"
|
||||||
|
|
||||||
#define LINKLAYER_INSERT_EXTRGAP
|
|
||||||
|
|
||||||
#ifndef LINKLAYER_INSERT_EXTRGAP
|
|
||||||
L2_RTNE_TABLE_ENTRY intraScanSubT[L2_SLOTS_PER_FRAME] = {
|
|
||||||
// SubFrame 0
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
|
|
||||||
// SubFrame 1
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
|
|
||||||
// SubFrame 2
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
|
|
||||||
// SubFrame 3
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_SCAN, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_ADVERTISE, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_ADVERTISE, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_ADVERTISE, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_ADVERTISE, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
// SubFrame 4
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
|
|
||||||
// SubFrame 5
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
|
|
||||||
// SubFrame 6
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
|
|
||||||
// SubFrame 7
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
|
|
||||||
// SubFrame 8
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
|
|
||||||
// SubFrame 9
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
};
|
|
||||||
|
|
||||||
L2_RTNE_TABLE_ENTRY normalSub[L2_SLOTS_PER_FRAME] = {
|
|
||||||
// SubFrame 0
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
|
|
||||||
// SubFrame 1
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
|
|
||||||
// SubFrame 2
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
|
|
||||||
// SubFrame 3
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
|
|
||||||
// SubFrame 4
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
|
|
||||||
// SubFrame 5
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
|
|
||||||
// SubFrame 6
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
|
|
||||||
// SubFrame 7
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
|
|
||||||
// SubFrame 8
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
|
|
||||||
// SubFrame 9
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
L2_RTNE_TABLE_ENTRY intraScanSubT[L2_SLOTS_PER_FRAME] = {
|
L2_RTNE_TABLE_ENTRY intraScanSubT[L2_SLOTS_PER_FRAME] = {
|
||||||
// SubFrame 0
|
// SubFrame 0
|
||||||
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
{L2_SLOT_SCAN, 0x00, 0x01, 0xFF},
|
||||||
@@ -572,116 +126,6 @@ L2_RTNE_TABLE_ENTRY intraScanSubT[L2_SLOTS_PER_FRAME] = {
|
|||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
||||||
|
|
||||||
// SubFrame 5
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
|
|
||||||
// SubFrame 6
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
|
|
||||||
// SubFrame 7
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
|
|
||||||
// SubFrame 8
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
|
|
||||||
// SubFrame 9
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0x01, 0xFF},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_CONFIRM, 0x00, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x01, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x02, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_CONFIRM, 0x03, 0xFF, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
L2_RTNE_TABLE_ENTRY normalSub[L2_SLOTS_PER_FRAME] = {
|
L2_RTNE_TABLE_ENTRY normalSub[L2_SLOTS_PER_FRAME] = {
|
||||||
@@ -794,118 +238,7 @@ L2_RTNE_TABLE_ENTRY normalSub[L2_SLOTS_PER_FRAME] = {
|
|||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
||||||
|
|
||||||
// SubFrame 5
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
|
|
||||||
// SubFrame 6
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
|
|
||||||
// SubFrame 7
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
|
|
||||||
// SubFrame 8
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
|
|
||||||
// SubFrame 9
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x01, 0x02},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x01, 0x02},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
{L2_SLOT_SERVICE, 0x00, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x01, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x02, 0x02, 0x01},
|
|
||||||
{L2_SLOT_SERVICE, 0x03, 0x02, 0x01},
|
|
||||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
L2_RTNE_TABLE_ENTRY *initTable[L2_INIT_RTNE_PERIOD] =
|
L2_RTNE_TABLE_ENTRY *initTable[L2_INIT_RTNE_PERIOD] =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
/************************** Constant Definitions *****************************/
|
/************************** Constant Definitions *****************************/
|
||||||
#define ADV_LISTEN_TIMEOUT 40
|
#define ADV_LISTEN_TIMEOUT 40
|
||||||
#define CFM_LISTEN_TIMEOUT 25
|
#define CFM_LISTEN_TIMEOUT 5
|
||||||
#define ADV_FRAME_SLOTS 4
|
#define ADV_FRAME_SLOTS 4
|
||||||
#define CFM_FRAME_SLOTS 5
|
#define CFM_FRAME_SLOTS 5
|
||||||
/***************** Macros (In-line Functions) Definitions *********************/
|
/***************** Macros (In-line Functions) Definitions *********************/
|
||||||
@@ -206,22 +206,26 @@ static int32_t Scan_InitScanHandler(L2_INST *instPtr)
|
|||||||
else if (Phy_IsFrameDetected(phyRef))
|
else if (Phy_IsFrameDetected(phyRef))
|
||||||
{
|
{
|
||||||
// last scan beam number
|
// last scan beam number
|
||||||
instPtr->scanFSM->beamNo = Phy_LastScanBeamNo(instPtr->config.phyInstPtr);
|
scanFsmPtr->beamNo = Phy_LastScanBeamNo(phyRef);
|
||||||
// Update scan beam table
|
// Update scan beam table
|
||||||
L2_Scan_RefreashScanTable(instPtr);
|
L2_Scan_RefreashScanTable(instPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scanFsmPtr->isLocked == true)
|
if (scanFsmPtr->isLocked == true)
|
||||||
{
|
{
|
||||||
StageUpdate(scanFsmPtr, L2_SCAN_ADV_STAGE);
|
scanFsmPtr->beamNo = Phy_LastScanBeamNo(phyRef);
|
||||||
/* Antenna setting (reserved.) */
|
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
||||||
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_ADV_FRAME);
|
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_ADV_FRAME);
|
||||||
|
StageUpdate(scanFsmPtr, L2_SCAN_ADV_STAGE);
|
||||||
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
} /* Otherwise remain L2_SCAN_INIT_STAGE */
|
} /* Otherwise remain L2_SCAN_INIT_STAGE */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Antenna setting (reserved.) */
|
/* Antenna steering (reserved, automatically accomplished by physical layer) */
|
||||||
|
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
||||||
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_SCAN_FRAME);
|
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_SCAN_FRAME);
|
||||||
scanFsmPtr->scanCnt++;
|
scanFsmPtr->scanCnt++;
|
||||||
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -239,19 +243,22 @@ static int32_t Scan_InitScanHandler(L2_INST *instPtr)
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static int32_t Scan_AdvHandler(L2_INST *instPtr)
|
static int32_t Scan_AdvHandler(L2_INST *instPtr)
|
||||||
{
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
||||||
|
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||||
DBG_INFO("** Net-Setup - Advertisement Procedure (Timeout: %" PRIu8 ") **\n", scanFsmPtr->advTimeout);
|
DBG_INFO("** Net-Setup - Advertisement Procedure (Timeout: %" PRIu8 ") **\n", scanFsmPtr->advTimeout);
|
||||||
|
|
||||||
// if received a valid bm frame.
|
// if received a valid bm frame.
|
||||||
if (scanFsmPtr->isAdvRecvd == true)
|
if (scanFsmPtr->isAdvRecvd == true)
|
||||||
{
|
{
|
||||||
// last scan beam number
|
// last scan beam number
|
||||||
instPtr->scanFSM->beamNo = Phy_LastScanBeamNo(instPtr->config.phyInstPtr);
|
scanFsmPtr->beamNo = Phy_LastScanBeamNo(phyRef);
|
||||||
|
// reset listen counter.
|
||||||
|
scanFsmPtr->advTimeout = 0;
|
||||||
|
|
||||||
scanFsmPtr->advTimeout = 0; /* reset listen counter. */
|
// Update scan stage
|
||||||
DBG_INFO("Received Adv frame, skipping 10ms for turn around...\n");
|
|
||||||
// TODO: check functionality.
|
|
||||||
StageUpdate(scanFsmPtr, L2_SCAN_CFM_STAGE);
|
StageUpdate(scanFsmPtr, L2_SCAN_CFM_STAGE);
|
||||||
|
DBG_INFO("Received Adv frame, skipping 10ms for turn around...\n");
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
// no valid bm frame was received.
|
// no valid bm frame was received.
|
||||||
@@ -260,16 +267,20 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
|
|||||||
/* if time out reached, go back to init scan stage. */
|
/* if time out reached, go back to init scan stage. */
|
||||||
if (scanFsmPtr->advTimeout > ADV_LISTEN_TIMEOUT)
|
if (scanFsmPtr->advTimeout > ADV_LISTEN_TIMEOUT)
|
||||||
{
|
{
|
||||||
/* Antenna setting (reserved.) */
|
/* Antenna steering (reserved, automatically accomplished by physical layer) */
|
||||||
|
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
||||||
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_SCAN_FRAME);
|
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_SCAN_FRAME);
|
||||||
DBG_WARNING("Adv timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
DBG_WARNING("Adv timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
||||||
L2_Scan_Reset(scanFsmPtr);
|
L2_Scan_Reset(scanFsmPtr);
|
||||||
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Antenna setting (reserved.) */
|
/* Antenna steering (reserved, automatically accomplished by physical layer) */
|
||||||
|
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
||||||
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_ADV_FRAME);
|
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_ADV_FRAME);
|
||||||
scanFsmPtr->advTimeout++;
|
scanFsmPtr->advTimeout++;
|
||||||
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -286,7 +297,9 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static int32_t Scan_CfmHandler(L2_INST *instPtr)
|
static int32_t Scan_CfmHandler(L2_INST *instPtr)
|
||||||
{
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
||||||
|
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||||
DBG_INFO("** Net-Setup - Confirm Procedure (Timeout: %" PRIu8 ") **\n", scanFsmPtr->cfmTimeout);
|
DBG_INFO("** Net-Setup - Confirm Procedure (Timeout: %" PRIu8 ") **\n", scanFsmPtr->cfmTimeout);
|
||||||
|
|
||||||
// 2 way acq failed, back to init stage.
|
// 2 way acq failed, back to init stage.
|
||||||
@@ -300,9 +313,9 @@ static int32_t Scan_CfmHandler(L2_INST *instPtr)
|
|||||||
{
|
{
|
||||||
// using pull mode to receive confirm frame
|
// using pull mode to receive confirm frame
|
||||||
// since first time sync procedure is accomplished in ADV stage.
|
// since first time sync procedure is accomplished in ADV stage.
|
||||||
Phy_SetBeamWidth(instPtr->config.phyInstPtr, PHY_ANT_BEAM_16);
|
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_16);
|
||||||
Phy_SetBeamNo(instPtr->config.phyInstPtr, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
||||||
Phy_SetMode(instPtr->config.phyInstPtr, PHY_MODE_PULL);
|
Phy_SetMode(phyRef, PHY_MODE_PULL);
|
||||||
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_CFM_FRAME);
|
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_CFM_FRAME);
|
||||||
scanFsmPtr->cfmTimeout++; // increase counter.
|
scanFsmPtr->cfmTimeout++; // increase counter.
|
||||||
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
@@ -333,6 +346,7 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
return EPARAM;
|
return EPARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Common section of link layer package
|
||||||
dataChunk = L2_GetNextFrameNum(instPtr);
|
dataChunk = L2_GetNextFrameNum(instPtr);
|
||||||
L2_FrameInsertChunk(buff, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &dataChunk);
|
L2_FrameInsertChunk(buff, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &dataChunk);
|
||||||
dataChunk = L2_GetNextSlotNum(instPtr);
|
dataChunk = L2_GetNextSlotNum(instPtr);
|
||||||
@@ -404,6 +418,10 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
|
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Logging...
|
||||||
|
memcpy(instPtr->log.txLog.data, buff, L2_CMF_PACK_LEN);
|
||||||
|
instPtr->log.txLog.dataId = dataId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -415,91 +433,6 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
|
||||||
* @brief Initialize scan FSM.
|
|
||||||
*
|
|
||||||
* @param instPtr
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
int32_t L2_Scan_Init(L2_SCAN_FSM **scanFSMPtr)
|
|
||||||
{
|
|
||||||
ASSERT(scanFSMPtr != NULL);
|
|
||||||
*scanFSMPtr = (L2_SCAN_FSM *)malloc(sizeof(L2_SCAN_FSM));
|
|
||||||
if (*scanFSMPtr == NULL)
|
|
||||||
{
|
|
||||||
DBG_ERROR("Failed to allocate memory for scanFsmPtr.\n");
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
L2_Scan_Reset(*scanFSMPtr);
|
|
||||||
(*scanFSMPtr)->beamNo = 0;
|
|
||||||
(*scanFSMPtr)->tableNo = 0;
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
|
||||||
* @brief Reset ScanNet FSM
|
|
||||||
*
|
|
||||||
* @param scanFsmPtr a pointer to scan net finite state machine
|
|
||||||
*
|
|
||||||
* @return NONE
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
void L2_Scan_Reset(L2_SCAN_FSM *scanFSMPtr)
|
|
||||||
{
|
|
||||||
ASSERT(scanFSMPtr != NULL);
|
|
||||||
scanFSMPtr->isLocked = false;
|
|
||||||
scanFSMPtr->isAdvRecvd = false;
|
|
||||||
scanFSMPtr->isAckPending = false;
|
|
||||||
scanFSMPtr->scanCnt = 0;
|
|
||||||
scanFSMPtr->advTimeout = 0;
|
|
||||||
scanFSMPtr->cfmTimeout = 0;
|
|
||||||
scanFSMPtr->scanStage = L2_SCAN_NONE_STAGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
|
||||||
* @brief Destroy ScanNet FSM, free memory
|
|
||||||
*
|
|
||||||
* @param scanFsmPtr a pointer to scan net finite state machine
|
|
||||||
*
|
|
||||||
* @return NONE
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
void L2_Scan_Destroy(L2_SCAN_FSM *scanFSMPtr)
|
|
||||||
{
|
|
||||||
free(scanFSMPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
|
||||||
* @brief Refresh scan beam table.
|
|
||||||
*
|
|
||||||
* @param instPtr a pointer to linklayer layer instance
|
|
||||||
*
|
|
||||||
* @return NONE
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
void L2_Scan_RefreashScanTable(L2_INST *instPtr)
|
|
||||||
{
|
|
||||||
ASSERT(instPtr != NULL);
|
|
||||||
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
|
||||||
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
|
||||||
if (scanFsmPtr->tableNo == 0)
|
|
||||||
{
|
|
||||||
Phy_SetBeamTable(phyRef, antNrrwPattern_0, scanFsmPtr->beamNo);
|
|
||||||
scanFsmPtr->tableNo = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Phy_SetBeamTable(phyRef, antNrrwPattern_1, scanFsmPtr->beamNo);
|
|
||||||
scanFsmPtr->tableNo = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
* @brief Scan net packet handler.
|
* @brief Scan net packet handler.
|
||||||
@@ -516,15 +449,19 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
ASSERT(msg != NULL);
|
ASSERT(msg != NULL);
|
||||||
int32_t Status;
|
int32_t Status;
|
||||||
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
||||||
L2_FRAME_TYPE frameType = L2_GetLastOptFrameType(instPtr);
|
L2_FRAME_TYPE frameType = L2_NONE_FRAME;
|
||||||
|
L2_FrameGetChunk(msg, L2_MSG_TYPE, L2_MSG_TYPE_LEN, &frameType);
|
||||||
switch (frameType)
|
switch (frameType)
|
||||||
{
|
{
|
||||||
case L2_SCAN_FRAME:
|
case L2_SCAN_FRAME:
|
||||||
LockStateUpdate(scanFsmPtr, true);
|
|
||||||
StageUpdate(scanFsmPtr, L2_SCAN_ADV_STAGE);
|
|
||||||
case L2_ADV_FRAME:
|
case L2_ADV_FRAME:
|
||||||
{
|
{
|
||||||
if (instPtr->config.myType == L2_NODE_HEAD)
|
if (L2_GetLastOptFrameType(instPtr) == L2_SCAN_FRAME)
|
||||||
|
{
|
||||||
|
LockStateUpdate(scanFsmPtr, true);
|
||||||
|
StageUpdate(scanFsmPtr, L2_SCAN_ADV_STAGE);
|
||||||
|
}
|
||||||
|
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||||
{
|
{
|
||||||
DBG_ERROR("Unexpected call from head node, only member Node can handle L2_SCAN_FRAME and L2_ADV_FRAME.\n");
|
DBG_ERROR("Unexpected call from head node, only member Node can handle L2_SCAN_FRAME and L2_ADV_FRAME.\n");
|
||||||
Status = EUNEXP;
|
Status = EUNEXP;
|
||||||
@@ -674,18 +611,19 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
uint32_t dataId;
|
uint32_t dataId;
|
||||||
L2_FrameGetChunk(msg, L2_MSG_CFM_PAYLOAD_ID, L2_MSG_CFM_PAYLOAD_ID_LEN, &dataId);
|
L2_FrameGetChunk(msg, L2_MSG_CFM_PAYLOAD_ID, L2_MSG_CFM_PAYLOAD_ID_LEN, &dataId);
|
||||||
|
|
||||||
if(dataId != DATA_ID_NONE)
|
|
||||||
{
|
|
||||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||||
{
|
{
|
||||||
SysMonitor_UpdateRecvPayload(msg+L2_MSG_CFM_PAYLOAD, PAYLOAD_LEN_FLJ_RX);
|
SysMonitor_UpdateRecvPayload(msg + L2_MSG_CFM_PAYLOAD, dataId, PAYLOAD_LEN_FLJ_RX);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SysMonitor_UpdateRecvPayload(msg+L2_MSG_CFM_PAYLOAD, PAYLOAD_LEN_LJ_RX);
|
SysMonitor_UpdateRecvPayload(msg + L2_MSG_CFM_PAYLOAD, dataId, PAYLOAD_LEN_LJ_RX);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Logging...
|
||||||
|
memcpy(instPtr->log.rxLog.data, msg, L2_CMF_PACK_LEN);
|
||||||
|
instPtr->log.rxLog.dataId = dataId;
|
||||||
|
|
||||||
Status = SUCCESS;
|
Status = SUCCESS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -697,6 +635,90 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief Initialize scan FSM.
|
||||||
|
*
|
||||||
|
* @param instPtr
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
int32_t L2_Scan_Init(L2_SCAN_FSM **scanFSMPtr)
|
||||||
|
{
|
||||||
|
ASSERT(scanFSMPtr != NULL);
|
||||||
|
*scanFSMPtr = (L2_SCAN_FSM *)malloc(sizeof(L2_SCAN_FSM));
|
||||||
|
if (*scanFSMPtr == NULL)
|
||||||
|
{
|
||||||
|
DBG_ERROR("Failed to allocate memory for scanFsmPtr.\n");
|
||||||
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
L2_Scan_Reset(*scanFSMPtr);
|
||||||
|
(*scanFSMPtr)->beamNo = 0;
|
||||||
|
(*scanFSMPtr)->tableNo = 0;
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief Reset ScanNet FSM
|
||||||
|
*
|
||||||
|
* @param scanFsmPtr a pointer to scan net finite state machine
|
||||||
|
*
|
||||||
|
* @return NONE
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
void L2_Scan_Reset(L2_SCAN_FSM *scanFSMPtr)
|
||||||
|
{
|
||||||
|
ASSERT(scanFSMPtr != NULL);
|
||||||
|
scanFSMPtr->isLocked = false;
|
||||||
|
scanFSMPtr->isAdvRecvd = false;
|
||||||
|
scanFSMPtr->isAckPending = false;
|
||||||
|
scanFSMPtr->scanCnt = 0;
|
||||||
|
scanFSMPtr->advTimeout = 0;
|
||||||
|
scanFSMPtr->cfmTimeout = 0;
|
||||||
|
scanFSMPtr->scanStage = L2_SCAN_NONE_STAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief Destroy ScanNet FSM, free memory
|
||||||
|
*
|
||||||
|
* @param scanFsmPtr a pointer to scan net finite state machine
|
||||||
|
*
|
||||||
|
* @return NONE
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
void L2_Scan_Destroy(L2_SCAN_FSM *scanFSMPtr)
|
||||||
|
{
|
||||||
|
free(scanFSMPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief Refresh scan beam table.
|
||||||
|
*
|
||||||
|
* @param instPtr a pointer to linklayer layer instance
|
||||||
|
*
|
||||||
|
* @return NONE
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
void L2_Scan_RefreashScanTable(L2_INST *instPtr)
|
||||||
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
|
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
||||||
|
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||||
|
if (scanFsmPtr->tableNo == 0)
|
||||||
|
{
|
||||||
|
Phy_SetBeamTable(phyRef, antNrrwPattern_0, scanFsmPtr->beamNo);
|
||||||
|
scanFsmPtr->tableNo = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Phy_SetBeamTable(phyRef, antNrrwPattern_1, scanFsmPtr->beamNo);
|
||||||
|
scanFsmPtr->tableNo = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
@@ -757,6 +779,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
|||||||
L2_TOR_TYPE torState;
|
L2_TOR_TYPE torState;
|
||||||
int32_t Status;
|
int32_t Status;
|
||||||
const NODE_ENTRY *commNode;
|
const NODE_ENTRY *commNode;
|
||||||
|
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||||
DBG_INFO("-------- Scan Routine --------\n");
|
DBG_INFO("-------- Scan Routine --------\n");
|
||||||
|
|
||||||
if (rtneEntry->slotSeq != 0)
|
if (rtneEntry->slotSeq != 0)
|
||||||
@@ -782,11 +805,11 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup antenna beam
|
// Setup antenna beam
|
||||||
Phy_SetBeamWidth(instPtr->config.phyInstPtr, PHY_ANT_BEAM_16);
|
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_16);
|
||||||
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
if (commNode != NULL)
|
if (commNode != NULL)
|
||||||
{
|
{
|
||||||
Phy_SetBeamNo(instPtr->config.phyInstPtr, commNode->nodeInfo.beamNo, PHY_ANT_BEAM_16);
|
Phy_SetBeamNo(phyRef, commNode->nodeInfo.beamNo, PHY_ANT_BEAM_16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -804,7 +827,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
|||||||
torState = L2_TOR_SUSPEND;
|
torState = L2_TOR_SUSPEND;
|
||||||
}
|
}
|
||||||
// Setup antenna beam
|
// Setup antenna beam
|
||||||
Phy_SetBeamWidth(instPtr->config.phyInstPtr, PHY_ANT_BEAM_120);
|
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_120);
|
||||||
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_120;
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_120;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
uint32_t dataChunk;
|
uint32_t dataChunk;
|
||||||
uint8_t *buff = instPtr->sendPktData;
|
uint8_t *buff = instPtr->sendPktData;
|
||||||
|
|
||||||
|
// Common section of link layer package
|
||||||
dataChunk = L2_GetNextFrameNum(instPtr);
|
dataChunk = L2_GetNextFrameNum(instPtr);
|
||||||
L2_FrameInsertChunk(buff, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &dataChunk);
|
L2_FrameInsertChunk(buff, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &dataChunk);
|
||||||
dataChunk = L2_GetNextSlotNum(instPtr);
|
dataChunk = L2_GetNextSlotNum(instPtr);
|
||||||
@@ -128,12 +129,6 @@ static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD, L2_MSG_SVC_PAYLOAD_LEN, testData);
|
L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD, L2_MSG_SVC_PAYLOAD_LEN, testData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// // packing payload
|
|
||||||
// uint32_t dataId;
|
|
||||||
// dataId = DATA_ID_TEST;
|
|
||||||
// L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD_ID, L2_MSG_SVC_PAYLOAD_ID_LEN, &dataId);
|
|
||||||
// L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD, L2_MSG_SVC_PAYLOAD_LEN, testData);
|
|
||||||
|
|
||||||
Status = L2_CrcAppend(buff, L2_SVC_PACK_LEN - L2_MSG_SVC_CRC_LEN, L2_MSG_SVC_CRC, L2_CRC16_1021);
|
Status = L2_CrcAppend(buff, L2_SVC_PACK_LEN - L2_MSG_SVC_CRC_LEN, L2_MSG_SVC_CRC, L2_CRC16_1021);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -141,8 +136,8 @@ static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(instPtr->serviceFSM->txLog.data, buff, L2_SVC_PACK_LEN);
|
memcpy(instPtr->log.txLog.data, buff, L2_SVC_PACK_LEN);
|
||||||
instPtr->serviceFSM->txLog.dataId = dataId;
|
instPtr->log.txLog.dataId = dataId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -159,62 +154,6 @@ static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
|
||||||
* @brief Initialize service net FSM
|
|
||||||
*
|
|
||||||
* @param serviceFSM A pointer to service FSM instance.
|
|
||||||
*
|
|
||||||
* @return SUCCESS Initialize successfully.
|
|
||||||
* Other Initialize failed.
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
int32_t L2_Service_Init(L2_SVC_FSM **svcFSMPtr)
|
|
||||||
{
|
|
||||||
ASSERT(svcFSMPtr != NULL);
|
|
||||||
*svcFSMPtr = (L2_SVC_FSM *)malloc(sizeof(L2_SVC_FSM));
|
|
||||||
if (*svcFSMPtr == NULL)
|
|
||||||
{
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
L2_Service_Reset(*svcFSMPtr);
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
|
||||||
* @brief Reset ServiceNet FSM
|
|
||||||
*
|
|
||||||
* @param scanFsmPtr a pointer to service net finite state machine
|
|
||||||
*
|
|
||||||
* @return NONE
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
void L2_Service_Reset(L2_SVC_FSM *svcFSMPtr)
|
|
||||||
{
|
|
||||||
ASSERT(svcFSMPtr != NULL);
|
|
||||||
memset((&svcFSMPtr->rxLog), 0x00, sizeof(PAYLOAD));
|
|
||||||
memset((&svcFSMPtr->txLog), 0x00, sizeof(PAYLOAD));
|
|
||||||
#ifdef DATALINK_ENABLE_BERTEST
|
|
||||||
svcFSMPtr->bitTotal = 0;
|
|
||||||
svcFSMPtr->bitError = 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
|
||||||
* @brief Destroy ServiceNet FSM, free memory
|
|
||||||
*
|
|
||||||
* @param scanFsmPtr a pointer to service net finite state machine
|
|
||||||
*
|
|
||||||
* @return NONE
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
void L2_Service_Destroy(L2_SVC_FSM *serviceFSM)
|
|
||||||
{
|
|
||||||
free(serviceFSM);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
* @brief Handle service received packet. Send data up to MPC
|
* @brief Handle service received packet. Send data up to MPC
|
||||||
@@ -231,7 +170,7 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
ASSERT(msg != NULL);
|
ASSERT(msg != NULL);
|
||||||
int32_t Status;
|
int32_t Status;
|
||||||
#ifndef DATALINK_ENABLE_BERTEST
|
#ifndef DATALINK_ENABLE_BERTEST
|
||||||
uint8_t frameType;
|
L2_FRAME_TYPE frameType = L2_NONE_FRAME;
|
||||||
L2_FrameGetChunk(msg, L2_MSG_TYPE, L2_MSG_TYPE_LEN, &frameType);
|
L2_FrameGetChunk(msg, L2_MSG_TYPE, L2_MSG_TYPE_LEN, &frameType);
|
||||||
switch (frameType)
|
switch (frameType)
|
||||||
{
|
{
|
||||||
@@ -285,21 +224,19 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
uint32_t dataId;
|
uint32_t dataId;
|
||||||
L2_FrameGetChunk(msg, L2_MSG_SVC_PAYLOAD_ID, L2_MSG_SVC_PAYLOAD_ID_LEN, &dataId);
|
L2_FrameGetChunk(msg, L2_MSG_SVC_PAYLOAD_ID, L2_MSG_SVC_PAYLOAD_ID_LEN, &dataId);
|
||||||
|
|
||||||
if(dataId != DATA_ID_NONE)
|
|
||||||
{
|
|
||||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||||
{
|
{
|
||||||
SysMonitor_UpdateRecvPayload(msg+L2_MSG_SVC_PAYLOAD, PAYLOAD_LEN_FLJ_RX);
|
SysMonitor_UpdateRecvPayload(msg + L2_MSG_SVC_PAYLOAD, dataId, PAYLOAD_LEN_FLJ_RX);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SysMonitor_UpdateRecvPayload(msg+L2_MSG_SVC_PAYLOAD, PAYLOAD_LEN_LJ_RX);
|
SysMonitor_UpdateRecvPayload(msg + L2_MSG_SVC_PAYLOAD, dataId, PAYLOAD_LEN_LJ_RX);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
memcpy(instPtr->serviceFSM->rxLog.data, msg, L2_SVC_PACK_LEN);
|
memcpy(instPtr->log.rxLog.data, msg, L2_SVC_PACK_LEN);
|
||||||
instPtr->serviceFSM->rxLog.dataId = dataId;
|
instPtr->log.rxLog.dataId = dataId;
|
||||||
|
instPtr->serviceFSM->rxdCnt++;
|
||||||
|
|
||||||
#ifdef DATALINK_ENABLE_AUTOTIMESYNC
|
#ifdef DATALINK_ENABLE_AUTOTIMESYNC
|
||||||
// Implement a auto time sync.
|
// Implement a auto time sync.
|
||||||
@@ -346,6 +283,65 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief Initialize service net FSM
|
||||||
|
*
|
||||||
|
* @param serviceFSM A pointer to service FSM instance.
|
||||||
|
*
|
||||||
|
* @return SUCCESS Initialize successfully.
|
||||||
|
* Other Initialize failed.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
int32_t L2_Service_Init(L2_SVC_FSM **svcFSMPtr)
|
||||||
|
{
|
||||||
|
ASSERT(svcFSMPtr != NULL);
|
||||||
|
*svcFSMPtr = (L2_SVC_FSM *)malloc(sizeof(L2_SVC_FSM));
|
||||||
|
if (*svcFSMPtr == NULL)
|
||||||
|
{
|
||||||
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
L2_Service_Reset(*svcFSMPtr);
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief Reset ServiceNet FSM
|
||||||
|
*
|
||||||
|
* @param scanFsmPtr a pointer to service net finite state machine
|
||||||
|
*
|
||||||
|
* @return NONE
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
void L2_Service_Reset(L2_SVC_FSM *svcFSMPtr)
|
||||||
|
{
|
||||||
|
ASSERT(svcFSMPtr != NULL);
|
||||||
|
svcFSMPtr->txCnt = 0;
|
||||||
|
svcFSMPtr->rxCnt = 0;
|
||||||
|
svcFSMPtr->rxdCnt = 0;
|
||||||
|
#ifdef DATALINK_ENABLE_BERTEST
|
||||||
|
svcFSMPtr->bitTotal = 0;
|
||||||
|
svcFSMPtr->bitError = 0;
|
||||||
|
svcFSMPtr->lossRate = 0;
|
||||||
|
svcFSMPtr->errorRate = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief Destroy ServiceNet FSM, free memory
|
||||||
|
*
|
||||||
|
* @param scanFsmPtr a pointer to service net finite state machine
|
||||||
|
*
|
||||||
|
* @return NONE
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
void L2_Service_Destroy(L2_SVC_FSM *serviceFSM)
|
||||||
|
{
|
||||||
|
free(serviceFSM);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
* @brief Service FSM Routine.
|
* @brief Service FSM Routine.
|
||||||
@@ -367,6 +363,7 @@ 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_SVC_FSM *svcFSMPtr = instPtr->serviceFSM;
|
||||||
L2_TOR_TYPE torState;
|
L2_TOR_TYPE torState;
|
||||||
const NODE_ENTRY *commNode;
|
const NODE_ENTRY *commNode;
|
||||||
if (rtneEntry->src == L2_GetNodeId(instPtr))
|
if (rtneEntry->src == L2_GetNodeId(instPtr))
|
||||||
@@ -402,6 +399,7 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
|
|||||||
case L2_SLOT_SERVICE:
|
case L2_SLOT_SERVICE:
|
||||||
if (torState == L2_TOR_TX)
|
if (torState == L2_TOR_TX)
|
||||||
{
|
{
|
||||||
|
svcFSMPtr->txCnt++;
|
||||||
#ifndef DATALINK_ENABLE_BERTEST
|
#ifndef DATALINK_ENABLE_BERTEST
|
||||||
// Packing service data
|
// Packing service data
|
||||||
Service_Packing(instPtr, L2_SVC_FRAME, rtneEntry->dst);
|
Service_Packing(instPtr, L2_SVC_FRAME, rtneEntry->dst);
|
||||||
@@ -409,6 +407,10 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
|
|||||||
memcpy(instPtr->sendPktData, testData, L2_SVC_PACK_LEN);
|
memcpy(instPtr->sendPktData, testData, L2_SVC_PACK_LEN);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
svcFSMPtr->rxCnt++;
|
||||||
|
}
|
||||||
L2_SetupNextSlot(instPtr, torState, L2_SVC_FRAME);
|
L2_SetupNextSlot(instPtr, torState, L2_SVC_FRAME);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -417,11 +419,11 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
|
|||||||
}
|
}
|
||||||
#ifdef DATALINK_ENABLE_BERTEST
|
#ifdef DATALINK_ENABLE_BERTEST
|
||||||
uint32_t pktLoss;
|
uint32_t pktLoss;
|
||||||
pktLoss = instPtr->log.svcRecvCnt - instPtr->log.svcCorrectCnt;
|
pktLoss = svcFSMPtr->rxCnt - svcFSMPtr->rxdCnt;
|
||||||
instPtr->serviceFSM->lossRate = (instPtr->log.svcRecvCnt == 0) ? 0 : (double)pktLoss / (double)instPtr->serviceFSM->pktRecv;
|
svcFSMPtr->lossRate = (svcFSMPtr->rxCnt == 0) ? 0 : (double)pktLoss / (double)svcFSMPtr->rxCnt;
|
||||||
instPtr->serviceFSM->errorRate = (instPtr->serviceFSM->bitTotal == 0) ? 0 : (double)instPtr->serviceFSM->bitError / (double)instPtr->serviceFSM->bitTotal;
|
svcFSMPtr->errorRate = (svcFSMPtr->bitTotal == 0) ? 0 : (double)svcFSMPtr->bitError / (double)svcFSMPtr->bitTotal;
|
||||||
DBG_PRINT("Packet Loss Rate -- Total: %lu, Loss: %lu.\n", instPtr->serviceFSM->pktRecv, pktLoss);
|
DBG_PRINT("Packet Loss Rate -- Total: %lu, Loss: %lu.\n", instPtr->log.svcRxCnt, pktLoss);
|
||||||
DBG_PRINT("Bit Error Rate -- Total:%lu, Error:%lu.\n", instPtr->serviceFSM->bitTotal, instPtr->serviceFSM->bitError);
|
DBG_PRINT("Bit Error Rate -- Total:%lu, Error:%lu.\n", svcFSMPtr->bitTotal, svcFSMPtr->bitError);
|
||||||
#endif
|
#endif
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ int32_t L2_GetTimeDeviation(L2_INST *instPtr, uint32_t frameNum, uint32_t slotNu
|
|||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
ASSERT(timeDev != NULL);
|
ASSERT(timeDev != NULL);
|
||||||
L1_FRAME_TYPE lastRecvdFrame;
|
L1_FRAME_TYPE lastRecvdFrame;
|
||||||
lastRecvdFrame = Phy_GetLastRecvFrameType(instPtr->config.phyInstPtr);
|
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||||
|
lastRecvdFrame = Phy_GetLastRecvFrameType(phyRef);
|
||||||
if (lastRecvdFrame == L1_NONE_FRAME)
|
if (lastRecvdFrame == L1_NONE_FRAME)
|
||||||
{
|
{
|
||||||
DBG_ERROR("Invalid TimeAlign operation, no frame was received.");
|
DBG_ERROR("Invalid TimeAlign operation, no frame was received.");
|
||||||
@@ -68,7 +69,7 @@ int32_t L2_GetTimeDeviation(L2_INST *instPtr, uint32_t frameNum, uint32_t slotNu
|
|||||||
expectTime += (uint64_t)instPtr->netStartTime * L2_SLOTS_PER_FRAME * TIME_FRAC_MAX;
|
expectTime += (uint64_t)instPtr->netStartTime * L2_SLOTS_PER_FRAME * TIME_FRAC_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
Phy_GetLastReceivedFrameSyncTimeStamp(instPtr->config.phyInstPtr, &timeStamp);
|
Phy_GetLastReceivedFrameSyncTimeStamp(phyRef, &timeStamp);
|
||||||
currTime = (uint64_t)timeStamp.frac_part;
|
currTime = (uint64_t)timeStamp.frac_part;
|
||||||
currTime += ((uint64_t)timeStamp.int_part) * TIME_FRAC_MAX;
|
currTime += ((uint64_t)timeStamp.int_part) * TIME_FRAC_MAX;
|
||||||
|
|
||||||
@@ -76,7 +77,6 @@ int32_t L2_GetTimeDeviation(L2_INST *instPtr, uint32_t frameNum, uint32_t slotNu
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
* @brief Implement time adjustment by applying time deviation.
|
* @brief Implement time adjustment by applying time deviation.
|
||||||
|
|||||||
@@ -224,6 +224,8 @@ void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
|
|||||||
}
|
}
|
||||||
instPtr->phyLog.antMode = mode;
|
instPtr->phyLog.antMode = mode;
|
||||||
instPtr->antConfig.antMode = config;
|
instPtr->antConfig.antMode = config;
|
||||||
|
// Sync logs to system monitor
|
||||||
|
SysMonitor_UpdatePhysicalLayerLog(&(instPtr->phyLog));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@@ -59,6 +59,16 @@
|
|||||||
|
|
||||||
#define ANT_COINFO_LEN 32 // bytes
|
#define ANT_COINFO_LEN 32 // bytes
|
||||||
|
|
||||||
|
#define ATTN_DEFAULT 0
|
||||||
|
#define ATTN_2KBPS_100MS ATTN_DEFAULT
|
||||||
|
#define ATTN_2KBPS_20MS ATTN_DEFAULT
|
||||||
|
#define ATTN_10KBPS_10MS 31
|
||||||
|
#define ATTN_10KBPS_20MS 31
|
||||||
|
#define ATTN_40KBPS_10MS 21
|
||||||
|
#define ATTN_40KBPS_20MS 21
|
||||||
|
#define ATTN_200KBPS_5MS ATTN_DEFAULT
|
||||||
|
#define ATTN_1M2BPS_5MS ATTN_DEFAULT
|
||||||
|
|
||||||
/***************** Macros (Inline Functions) Definitions *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
/************************** Function Prototypes ******************************/
|
/************************** Function Prototypes ******************************/
|
||||||
static void Phy_RcdShift(PHY_RCD *rcd, int32_t netxVal);
|
static void Phy_RcdShift(PHY_RCD *rcd, int32_t netxVal);
|
||||||
@@ -493,7 +503,7 @@ int32_t Phy_InstInit(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(*instPtr)->antInfoAddr = NULL;
|
(*instPtr)->antInfoAddr = (uintptr_t)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the XAdc driver. */
|
/* Initialize the XAdc driver. */
|
||||||
@@ -696,41 +706,49 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
|||||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_20MS;
|
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_20MS;
|
||||||
hopNum = L1_FRAME_2KBPS_20MS_HOPS;
|
hopNum = L1_FRAME_2KBPS_20MS_HOPS;
|
||||||
hopPattern = hopPattern_2KBPS_20MS;
|
hopPattern = hopPattern_2KBPS_20MS;
|
||||||
|
instPtr->antConfig.rfTxMgc = ATTN_2KBPS_20MS;
|
||||||
break;
|
break;
|
||||||
case L1_2KBPS_100MS_FRAME:
|
case L1_2KBPS_100MS_FRAME:
|
||||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_100MS;
|
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_100MS;
|
||||||
hopNum = L1_FRAME_2KBPS_100MS_HOPS;
|
hopNum = L1_FRAME_2KBPS_100MS_HOPS;
|
||||||
hopPattern = hopPattern_2KBPS_100MS;
|
hopPattern = hopPattern_2KBPS_100MS;
|
||||||
|
instPtr->antConfig.rfTxMgc = ATTN_2KBPS_100MS;
|
||||||
break;
|
break;
|
||||||
case L1_10KBPS_10MS_FRAME:
|
case L1_10KBPS_10MS_FRAME:
|
||||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_10KBPS_10MS;
|
phyModeCtrl |= PHY_MODE_CTRL_FRAME_10KBPS_10MS;
|
||||||
hopNum = L1_FRAME_10KBPS_20MS_HOPS;
|
hopNum = L1_FRAME_10KBPS_20MS_HOPS;
|
||||||
hopPattern = hopPattern_10KBPS_20MS;
|
hopPattern = hopPattern_10KBPS_20MS;
|
||||||
|
instPtr->antConfig.rfTxMgc = ATTN_10KBPS_10MS;
|
||||||
break;
|
break;
|
||||||
case L1_10KBPS_20MS_FRAME:
|
case L1_10KBPS_20MS_FRAME:
|
||||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_10KBPS_20MS;
|
phyModeCtrl |= PHY_MODE_CTRL_FRAME_10KBPS_20MS;
|
||||||
hopNum = L1_FRAME_10KBPS_20MS_HOPS;
|
hopNum = L1_FRAME_10KBPS_20MS_HOPS;
|
||||||
hopPattern = hopPattern_10KBPS_20MS;
|
hopPattern = hopPattern_10KBPS_20MS;
|
||||||
|
instPtr->antConfig.rfTxMgc = ATTN_10KBPS_20MS;
|
||||||
break;
|
break;
|
||||||
case L1_40KBPS_20MS_FRAME:
|
case L1_40KBPS_20MS_FRAME:
|
||||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_40KBPS_20MS;
|
phyModeCtrl |= PHY_MODE_CTRL_FRAME_40KBPS_20MS;
|
||||||
hopNum = L1_FRAME_40KBPS_20MS_HOPS;
|
hopNum = L1_FRAME_40KBPS_20MS_HOPS;
|
||||||
hopPattern = hopPattern_40KBPS_20MS;
|
hopPattern = hopPattern_40KBPS_20MS;
|
||||||
|
instPtr->antConfig.rfTxMgc = ATTN_40KBPS_20MS;
|
||||||
break;
|
break;
|
||||||
case L1_40KBPS_10MS_FRAME:
|
case L1_40KBPS_10MS_FRAME:
|
||||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_40KBPS_10MS;
|
phyModeCtrl |= PHY_MODE_CTRL_FRAME_40KBPS_10MS;
|
||||||
hopNum = L1_FRAME_40KBPS_10MS_HOPS;
|
hopNum = L1_FRAME_40KBPS_10MS_HOPS;
|
||||||
hopPattern = hopPattern_40KBPS_10MS;
|
hopPattern = hopPattern_40KBPS_10MS;
|
||||||
|
instPtr->antConfig.rfTxMgc = ATTN_40KBPS_10MS;
|
||||||
break;
|
break;
|
||||||
case L1_200KBPS_5MS_FRAME:
|
case L1_200KBPS_5MS_FRAME:
|
||||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_200KBPS_5MS;
|
phyModeCtrl |= PHY_MODE_CTRL_FRAME_200KBPS_5MS;
|
||||||
hopNum = L1_FRAME_200KBPS_5MS_HOPS;
|
hopNum = L1_FRAME_200KBPS_5MS_HOPS;
|
||||||
hopPattern = hopPattern_200KBPS_5MS;
|
hopPattern = hopPattern_200KBPS_5MS;
|
||||||
|
instPtr->antConfig.rfTxMgc = ATTN_200KBPS_5MS;
|
||||||
break;
|
break;
|
||||||
case L1_1M2BPS_5MS_FRAME:
|
case L1_1M2BPS_5MS_FRAME:
|
||||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_1M2BPS_5MS;
|
phyModeCtrl |= PHY_MODE_CTRL_FRAME_1M2BPS_5MS;
|
||||||
hopNum = L1_FRAME_1M2BPS_5MS_HOPS;
|
hopNum = L1_FRAME_1M2BPS_5MS_HOPS;
|
||||||
hopPattern = hopPattern_1M2BPS_5MS;
|
hopPattern = hopPattern_1M2BPS_5MS;
|
||||||
|
instPtr->antConfig.rfTxMgc = ATTN_1M2BPS_5MS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return EPARAM;
|
return EPARAM;
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
/***************************** Include Files *********************************/
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "system_monitor.h"
|
#include "system_monitor.h"
|
||||||
|
/************************** Constant Definitions *****************************/
|
||||||
#define BUFF_A 0x00
|
#define BUFF_A 0x00
|
||||||
#define BUFF_B 0x01
|
#define BUFF_B 0x01
|
||||||
#define BUFF_NONE 0xFF
|
#define BUFF_NONE 0xFF
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
#define PRTCLLOG_PACK_ELN 24 // bytes
|
#define PRTCLLOG_PACK_ELN 24 // bytes
|
||||||
#define HWSTATE_PACK_ELN 12 // bytes
|
#define HWSTATE_PACK_ELN 12 // bytes
|
||||||
|
|
||||||
|
/************************** Data Type Definitions ****************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t latest;
|
uint8_t latest;
|
||||||
@@ -37,12 +39,14 @@ typedef struct
|
|||||||
HWSTATE hwState[2];
|
HWSTATE hwState[2];
|
||||||
} SYSMONITOR;
|
} SYSMONITOR;
|
||||||
|
|
||||||
|
/************************** Function Prototypes ******************************/
|
||||||
|
static uint8_t GetWritable(PINGPONG ctrllor);
|
||||||
|
static uint8_t GetReadable(PINGPONG ctrllor);
|
||||||
|
/************************** Variable Definitions *****************************/
|
||||||
static SYSMONITOR *sysMonitorInst;
|
static SYSMONITOR *sysMonitorInst;
|
||||||
|
|
||||||
uint8_t GetWritable(PINGPONG ctrllor);
|
/*********************** Function Implementations ***************************/
|
||||||
uint8_t GetReadable(PINGPONG ctrllor);
|
inline static uint8_t GetWritable(PINGPONG ctrllor)
|
||||||
|
|
||||||
inline uint8_t GetWritable(PINGPONG ctrllor)
|
|
||||||
{
|
{
|
||||||
// Allow only one write.
|
// Allow only one write.
|
||||||
ASSERT(ctrllor.wBusy == BUFF_NONE);
|
ASSERT(ctrllor.wBusy == BUFF_NONE);
|
||||||
@@ -52,7 +56,7 @@ inline uint8_t GetWritable(PINGPONG ctrllor)
|
|||||||
return ((ctrllor.rBusy == BUFF_B) ? BUFF_A : BUFF_B);
|
return ((ctrllor.rBusy == BUFF_B) ? BUFF_A : BUFF_B);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t GetReadable(PINGPONG ctrllor)
|
inline static uint8_t GetReadable(PINGPONG ctrllor)
|
||||||
{
|
{
|
||||||
if (ctrllor.wBusy == BUFF_NONE || ctrllor.wBusy != ctrllor.latest)
|
if (ctrllor.wBusy == BUFF_NONE || ctrllor.wBusy != ctrllor.latest)
|
||||||
return ((ctrllor.latest == BUFF_NONE) ? BUFF_A : BUFF_B);
|
return ((ctrllor.latest == BUFF_NONE) ? BUFF_A : BUFF_B);
|
||||||
@@ -126,6 +130,10 @@ void SysMonitor_GetSysinfo(SYSINFO *info)
|
|||||||
void SysMonitor_UpdateSendPayload(const uint8_t *buff, size_t len)
|
void SysMonitor_UpdateSendPayload(const uint8_t *buff, size_t len)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
if (len > PAYLOAD_LEN_MAX)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->sendCtrl);
|
buffIndx = GetWritable(sysMonitorInst->sendCtrl);
|
||||||
sysMonitorInst->sendCtrl.wBusy = buffIndx;
|
sysMonitorInst->sendCtrl.wBusy = buffIndx;
|
||||||
@@ -141,6 +149,12 @@ void SysMonitor_UpdateSendPayload(const uint8_t *buff, size_t len)
|
|||||||
void SysMonitor_GetSendPayload(uint8_t *buff, uint32_t *id, size_t len)
|
void SysMonitor_GetSendPayload(uint8_t *buff, uint32_t *id, size_t len)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(buff != NULL);
|
||||||
|
ASSERT(id != NULL);
|
||||||
|
if (len > PAYLOAD_LEN_MAX)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->sendCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->sendCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
@@ -160,14 +174,19 @@ void SysMonitor_GetSendPayload(uint8_t *buff, uint32_t *id, size_t len)
|
|||||||
/**
|
/**
|
||||||
* Update receive payload.
|
* Update receive payload.
|
||||||
*/
|
*/
|
||||||
void SysMonitor_UpdateRecvPayload(const uint8_t *buff, size_t len)
|
void SysMonitor_UpdateRecvPayload(const uint8_t *buff, uint32_t id, size_t len)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(buff != NULL);
|
||||||
|
if (id == DATA_ID_NONE || len > PAYLOAD_LEN_MAX)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->recvCtrl);
|
buffIndx = GetWritable(sysMonitorInst->recvCtrl);
|
||||||
sysMonitorInst->recvCtrl.wBusy = buffIndx;
|
sysMonitorInst->recvCtrl.wBusy = buffIndx;
|
||||||
memcpy(sysMonitorInst->recv[buffIndx].data, buff, len);
|
memcpy(sysMonitorInst->recv[buffIndx].data, buff, len);
|
||||||
sysMonitorInst->recv[buffIndx].dataId++;
|
sysMonitorInst->recv[buffIndx].dataId = id;
|
||||||
sysMonitorInst->recvCtrl.latest = buffIndx;
|
sysMonitorInst->recvCtrl.latest = buffIndx;
|
||||||
sysMonitorInst->recvCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->recvCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
@@ -178,6 +197,12 @@ void SysMonitor_UpdateRecvPayload(const uint8_t *buff, size_t len)
|
|||||||
void SysMonitor_GetRecvPayload(uint8_t *buff, uint32_t *id, size_t len)
|
void SysMonitor_GetRecvPayload(uint8_t *buff, uint32_t *id, size_t len)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(buff != NULL);
|
||||||
|
ASSERT(id != NULL);
|
||||||
|
if(len > PAYLOAD_LEN_MAX)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->recvCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->recvCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
@@ -200,6 +225,7 @@ void SysMonitor_GetRecvPayload(uint8_t *buff, uint32_t *id, size_t len)
|
|||||||
void SysMonitor_UpdateLinklayerLog(const LINKLOG *log)
|
void SysMonitor_UpdateLinklayerLog(const LINKLOG *log)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(log != NULL);
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->linkLogCtrl);
|
buffIndx = GetWritable(sysMonitorInst->linkLogCtrl);
|
||||||
sysMonitorInst->linkLogCtrl.wBusy = buffIndx;
|
sysMonitorInst->linkLogCtrl.wBusy = buffIndx;
|
||||||
@@ -214,6 +240,7 @@ void SysMonitor_UpdateLinklayerLog(const LINKLOG *log)
|
|||||||
void SysMonitor_GetLinklayerLog(LINKLOG *log)
|
void SysMonitor_GetLinklayerLog(LINKLOG *log)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(log != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->linkLogCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->linkLogCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
@@ -232,6 +259,7 @@ void SysMonitor_GetLinklayerLog(LINKLOG *log)
|
|||||||
void SysMonitor_UpdatePhysicalLayerLog(const PHYLOG *log)
|
void SysMonitor_UpdatePhysicalLayerLog(const PHYLOG *log)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(log != NULL);
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->phyLogCtrl);
|
buffIndx = GetWritable(sysMonitorInst->phyLogCtrl);
|
||||||
sysMonitorInst->phyLogCtrl.wBusy = buffIndx;
|
sysMonitorInst->phyLogCtrl.wBusy = buffIndx;
|
||||||
@@ -246,6 +274,7 @@ void SysMonitor_UpdatePhysicalLayerLog(const PHYLOG *log)
|
|||||||
void SysMonitor_GetPhysicalLayerLog(PHYLOG *log)
|
void SysMonitor_GetPhysicalLayerLog(PHYLOG *log)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(log != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->phyLogCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->phyLogCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
@@ -257,7 +286,6 @@ void SysMonitor_GetPhysicalLayerLog(PHYLOG *log)
|
|||||||
sysMonitorInst->phyLogCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->phyLogCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Hardware state
|
// @Hardware state
|
||||||
/**
|
/**
|
||||||
* Log hardware running status.
|
* Log hardware running status.
|
||||||
@@ -265,6 +293,7 @@ void SysMonitor_GetPhysicalLayerLog(PHYLOG *log)
|
|||||||
void SysMonitor_UpdateHardwareStatus(const HWSTATE *state)
|
void SysMonitor_UpdateHardwareStatus(const HWSTATE *state)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(state != NULL);
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->hwStateCtrl);
|
buffIndx = GetWritable(sysMonitorInst->hwStateCtrl);
|
||||||
sysMonitorInst->hwStateCtrl.wBusy = buffIndx;
|
sysMonitorInst->hwStateCtrl.wBusy = buffIndx;
|
||||||
@@ -279,6 +308,7 @@ void SysMonitor_UpdateHardwareStatus(const HWSTATE *state)
|
|||||||
void SysMonitor_GetHardwareStatus(HWSTATE *state)
|
void SysMonitor_GetHardwareStatus(HWSTATE *state)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(state != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->hwStateCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->hwStateCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
#ifndef __SYSTEM_MONITOR_H_
|
#ifndef __SYSTEM_MONITOR_H_
|
||||||
#define __SYSTEM_MONITOR_H_
|
#define __SYSTEM_MONITOR_H_
|
||||||
|
|
||||||
|
/***************************** Include Files *********************************/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
/************************** Constant Definitions *****************************/
|
||||||
#define PAYLOAD_LEN_MAX 256
|
#define PAYLOAD_LEN_MAX 256
|
||||||
#define PAYLOAD_LEN_FLJ_RX 168
|
#define PAYLOAD_LEN_FLJ_RX 168
|
||||||
#define PAYLOAD_LEN_FLJ_TX 66
|
#define PAYLOAD_LEN_FLJ_TX 66
|
||||||
@@ -36,12 +38,19 @@
|
|||||||
#define VOLT_ANT_NIL_OK BIT(4)
|
#define VOLT_ANT_NIL_OK BIT(4)
|
||||||
#define ANT_STATE_OK BIT(6)
|
#define ANT_STATE_OK BIT(6)
|
||||||
|
|
||||||
|
// Xilinx Recommended
|
||||||
|
// #define IS_PS_VALID(x) (x <= 1.05 && x >= 0.95)
|
||||||
|
// #define IS_PSAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
||||||
|
// #define IS_DDR_VALID(x) (x <= 1.89 && x >= 1.14)
|
||||||
|
// #define IS_PL_VALID(x) (x <= 1.03 && x >= 0.97)
|
||||||
|
// #define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
||||||
|
// #define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.97)
|
||||||
#define IS_PS_VALID(x) (x <= 1.05 && x >= 0.95)
|
#define IS_PS_VALID(x) (x <= 1.05 && x >= 0.95)
|
||||||
#define IS_PSAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
#define IS_PSAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
||||||
#define IS_DDR_VALID(x) (x <= 1.89 && x >= 1.14)
|
#define IS_DDR_VALID(x) (x <= 1.89 && x >= 1.14)
|
||||||
#define IS_PL_VALID(x) (x <= 1.03 && x >= 0.97)
|
#define IS_PL_VALID(x) (x <= 1.03 && x >= 0.96)
|
||||||
#define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
#define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
||||||
#define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.97)
|
#define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.96)
|
||||||
|
|
||||||
#define CLK_SP_PLL0_LOCK BIT(0)
|
#define CLK_SP_PLL0_LOCK BIT(0)
|
||||||
#define CLK_SP_PLL1_LOCK BIT(2)
|
#define CLK_SP_PLL1_LOCK BIT(2)
|
||||||
@@ -59,6 +68,9 @@
|
|||||||
#define TEMPERATURE_MAX 127.0 // Celsius degree
|
#define TEMPERATURE_MAX 127.0 // Celsius degree
|
||||||
#define TEMPERATURE_MIN -128.0 // Celsius degree
|
#define TEMPERATURE_MIN -128.0 // Celsius degree
|
||||||
|
|
||||||
|
/************************** Data Type Definitions ****************************/
|
||||||
|
/** @name System Info
|
||||||
|
*/
|
||||||
typedef struct __attribute__((packed))
|
typedef struct __attribute__((packed))
|
||||||
{
|
{
|
||||||
// -- unit: ms, 0~604799999
|
// -- unit: ms, 0~604799999
|
||||||
@@ -98,6 +110,8 @@ typedef struct __attribute__((packed))
|
|||||||
float roll;
|
float roll;
|
||||||
} SYSINFO;
|
} SYSINFO;
|
||||||
|
|
||||||
|
/** @name System Bus Log
|
||||||
|
*/
|
||||||
typedef struct __attribute__((packed))
|
typedef struct __attribute__((packed))
|
||||||
{
|
{
|
||||||
// SystemBus log
|
// SystemBus log
|
||||||
@@ -110,6 +124,8 @@ typedef struct __attribute__((packed))
|
|||||||
uint32_t remoteCnt;
|
uint32_t remoteCnt;
|
||||||
} SYSBUSLOG;
|
} SYSBUSLOG;
|
||||||
|
|
||||||
|
/** @name Linklayer Log
|
||||||
|
*/
|
||||||
typedef struct __attribute__((packed))
|
typedef struct __attribute__((packed))
|
||||||
{
|
{
|
||||||
// Network log
|
// Network log
|
||||||
@@ -138,6 +154,8 @@ typedef struct __attribute__((packed))
|
|||||||
uint8_t reserve[4];
|
uint8_t reserve[4];
|
||||||
} LINKLOG;
|
} LINKLOG;
|
||||||
|
|
||||||
|
/** @name Physical layer Log
|
||||||
|
*/
|
||||||
typedef struct __attribute__((packed))
|
typedef struct __attribute__((packed))
|
||||||
{
|
{
|
||||||
uint32_t acqCnt;
|
uint32_t acqCnt;
|
||||||
@@ -156,6 +174,8 @@ typedef struct __attribute__((packed))
|
|||||||
uint8_t reserve[3];
|
uint8_t reserve[3];
|
||||||
} PHYLOG;
|
} PHYLOG;
|
||||||
|
|
||||||
|
/** @name Hardware Status Log
|
||||||
|
*/
|
||||||
typedef struct __attribute__((packed))
|
typedef struct __attribute__((packed))
|
||||||
{
|
{
|
||||||
// Hardware status
|
// Hardware status
|
||||||
@@ -177,12 +197,15 @@ typedef struct __attribute__((packed))
|
|||||||
uint8_t reserve[2];
|
uint8_t reserve[2];
|
||||||
} HWSTATE;
|
} HWSTATE;
|
||||||
|
|
||||||
|
/** @name Payload
|
||||||
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t dataId;
|
uint32_t dataId;
|
||||||
uint8_t data[PAYLOAD_LEN_MAX];
|
uint8_t data[PAYLOAD_LEN_MAX];
|
||||||
} PAYLOAD;
|
} PAYLOAD;
|
||||||
|
|
||||||
|
/************************** Function Prototypes ******************************/
|
||||||
int32_t SysMonitor_Init(void);
|
int32_t SysMonitor_Init(void);
|
||||||
void SysMonitor_Destroy(void);
|
void SysMonitor_Destroy(void);
|
||||||
|
|
||||||
@@ -190,7 +213,7 @@ void SysMonitor_UpdateSysinfo(const SYSINFO *info);
|
|||||||
void SysMonitor_GetSysinfo(SYSINFO *info);
|
void SysMonitor_GetSysinfo(SYSINFO *info);
|
||||||
|
|
||||||
void SysMonitor_UpdateSendPayload(const uint8_t *buff, size_t len);
|
void SysMonitor_UpdateSendPayload(const uint8_t *buff, size_t len);
|
||||||
void SysMonitor_UpdateRecvPayload(const uint8_t *buff, size_t len);
|
void SysMonitor_UpdateRecvPayload(const uint8_t *buff, uint32_t id, size_t len);
|
||||||
void SysMonitor_GetSendPayload(uint8_t *buff, uint32_t *id, size_t len);
|
void SysMonitor_GetSendPayload(uint8_t *buff, uint32_t *id, size_t len);
|
||||||
void SysMonitor_GetRecvPayload(uint8_t *buff, uint32_t *id, size_t len);
|
void SysMonitor_GetRecvPayload(uint8_t *buff, uint32_t *id, size_t len);
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,6 @@
|
|||||||
|
|
||||||
#define LJ_RM_TEST_RESP_LEN 158
|
#define LJ_RM_TEST_RESP_LEN 158
|
||||||
|
|
||||||
|
|
||||||
// My Production Type
|
// My Production Type
|
||||||
#define MY_PRD_ID PRD_DL_K
|
#define MY_PRD_ID PRD_DL_K
|
||||||
|
|
||||||
@@ -238,7 +237,8 @@ static int32_t SystemBus_GenSelfTestRsp(SYSBUS *instPtr)
|
|||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
SYSBUS_UART_FRAME *sysbusRsp = malloc(sizeof(SYSBUS_UART_FRAME));
|
SYSBUS_UART_FRAME *sysbusRsp = malloc(sizeof(SYSBUS_UART_FRAME));
|
||||||
if (sysbusRsp == NULL) {
|
if (sysbusRsp == NULL)
|
||||||
|
{
|
||||||
DBG_ERROR("Failed to allocate memory for SELF TEST Response!\n");
|
DBG_ERROR("Failed to allocate memory for SELF TEST Response!\n");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -248,13 +248,13 @@ static int32_t SystemBus_GenSelfTestRsp(SYSBUS *instPtr)
|
|||||||
sysbusRsp->data[WD_CMD] = CMD_SELF_TEST;
|
sysbusRsp->data[WD_CMD] = CMD_SELF_TEST;
|
||||||
sysbusRsp->data[WD_PRD] = MY_PRD_ID;
|
sysbusRsp->data[WD_PRD] = MY_PRD_ID;
|
||||||
SysMonitor_GetHardwareStatus(hwStatsPtr);
|
SysMonitor_GetHardwareStatus(hwStatsPtr);
|
||||||
if (linkInstPtr->isEnable == false)
|
if (L2_isStarted(linkInstPtr))
|
||||||
{
|
{
|
||||||
sysbusRsp->data[WD_ST_RET] = (hwStatsPtr->isSpOk) ? ST_RET_OK : ST_RET_ERROR;
|
sysbusRsp->data[WD_ST_RET] = (hwStatsPtr->isSpOk && hwStatsPtr->isAntOk) ? ST_RET_OK : ST_RET_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sysbusRsp->data[WD_ST_RET] = (hwStatsPtr->isSpOk && hwStatsPtr->isAntOk) ? ST_RET_OK : ST_RET_ERROR;
|
sysbusRsp->data[WD_ST_RET] = (hwStatsPtr->isSpOk) ? ST_RET_OK : ST_RET_ERROR;
|
||||||
}
|
}
|
||||||
// apply status and omit 2 bytes of overhead.
|
// apply status and omit 2 bytes of overhead.
|
||||||
memcpy(sysbusRsp->data + WD_SP_FPGA_VOLT, &(hwStatsPtr->spFpgaVolt), ST_RET_INFO_LEN);
|
memcpy(sysbusRsp->data + WD_SP_FPGA_VOLT, &(hwStatsPtr->spFpgaVolt), ST_RET_INFO_LEN);
|
||||||
@@ -278,30 +278,21 @@ static int32_t SystemBus_SystemConfig(SYSBUS *instPtr, uint8_t *msg)
|
|||||||
PHY_INST *phyRef = linkInstPtr->config.phyInstPtr;
|
PHY_INST *phyRef = linkInstPtr->config.phyInstPtr;
|
||||||
TMC_INST *tmcRef = linkInstPtr->config.tmcInstPtr;
|
TMC_INST *tmcRef = linkInstPtr->config.tmcInstPtr;
|
||||||
bool reconfig = false;
|
bool reconfig = false;
|
||||||
bool start = false;
|
|
||||||
|
|
||||||
if (msg[WD_MODE_CMD] == MODE_CMD_HEAD)
|
if (msg[WD_MODE_CMD] == MODE_CMD_HEAD)
|
||||||
{
|
|
||||||
// omit unnecessary reconfiguration
|
|
||||||
if (L2_GetNodeType(linkInstPtr) != L2_NODE_HEAD)
|
|
||||||
{
|
{
|
||||||
// head node config
|
// head node config
|
||||||
|
reconfig = (L2_NODE_HEAD != L2_GetNodeType(linkInstPtr));
|
||||||
linkConfig.myType = L2_NODE_HEAD;
|
linkConfig.myType = L2_NODE_HEAD;
|
||||||
linkConfig.myId = 1;
|
linkConfig.myId = 1;
|
||||||
reconfig = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (msg[WD_MODE_CMD] == MODE_CMD_MEMBER)
|
else if (msg[WD_MODE_CMD] == MODE_CMD_MEMBER)
|
||||||
{
|
|
||||||
// omit unnecessary reconfiguration
|
|
||||||
if (L2_GetNodeType(linkInstPtr) != L2_NODE_MEMBER)
|
|
||||||
{
|
{
|
||||||
// member node config
|
// member node config
|
||||||
|
reconfig = (L2_NODE_MEMBER != L2_GetNodeType(linkInstPtr));
|
||||||
linkConfig.myType = L2_NODE_MEMBER;
|
linkConfig.myType = L2_NODE_MEMBER;
|
||||||
linkConfig.myId = 2;
|
linkConfig.myId = 2;
|
||||||
reconfig = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -313,21 +304,28 @@ static int32_t SystemBus_SystemConfig(SYSBUS *instPtr, uint8_t *msg)
|
|||||||
|
|
||||||
if (msg[WD_EN_CMD] == EN_CMD_ON_HIGH_POWER)
|
if (msg[WD_EN_CMD] == EN_CMD_ON_HIGH_POWER)
|
||||||
{
|
{
|
||||||
// high power config
|
// full power config
|
||||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_FULL);
|
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_FULL);
|
||||||
start = true;
|
if (reconfig || !L2_isStarted(linkInstPtr))
|
||||||
|
{
|
||||||
|
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||||
|
}
|
||||||
|
Linklayer_Start(linkInstPtr);
|
||||||
}
|
}
|
||||||
else if (msg[WD_EN_CMD] == EN_CMD_ON_LOW_POWER)
|
else if (msg[WD_EN_CMD] == EN_CMD_ON_LOW_POWER)
|
||||||
{
|
{
|
||||||
// low power config
|
// low power config
|
||||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_LOW);
|
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_LOW);
|
||||||
start = true;
|
if (reconfig || !L2_isStarted(linkInstPtr))
|
||||||
|
{
|
||||||
|
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||||
|
}
|
||||||
|
Linklayer_Start(linkInstPtr);
|
||||||
}
|
}
|
||||||
else if (msg[WD_EN_CMD] == EN_CMD_SILENT)
|
else if (msg[WD_EN_CMD] == EN_CMD_SILENT)
|
||||||
{
|
{
|
||||||
// silence config
|
// silence config
|
||||||
// TODO: better approach?
|
// TODO: better approach?
|
||||||
start = false;
|
|
||||||
Linklayer_Halt(linkInstPtr);
|
Linklayer_Halt(linkInstPtr);
|
||||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_STANDBY);
|
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_STANDBY);
|
||||||
TIME_WORD pullTime = {0, 0};
|
TIME_WORD pullTime = {0, 0};
|
||||||
@@ -338,13 +336,12 @@ static int32_t SystemBus_SystemConfig(SYSBUS *instPtr, uint8_t *msg)
|
|||||||
}
|
}
|
||||||
Phy_SetupNextSlot(phyRef, PHY_TOR_RX, L1_10KBPS_10MS_FRAME, NULL);
|
Phy_SetupNextSlot(phyRef, PHY_TOR_RX, L1_10KBPS_10MS_FRAME, NULL);
|
||||||
}
|
}
|
||||||
if (reconfig == true)
|
else
|
||||||
{
|
{
|
||||||
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
// Ignore current command
|
||||||
}
|
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
|
||||||
if (start == true)
|
WD_EN_CMD, msg[WD_EN_CMD]);
|
||||||
{
|
return EIGNORE;
|
||||||
Linklayer_Start(linkInstPtr);
|
|
||||||
}
|
}
|
||||||
instPtr->sysbusLog.lastConfig[0] = msg[WD_MODE_CMD];
|
instPtr->sysbusLog.lastConfig[0] = msg[WD_MODE_CMD];
|
||||||
instPtr->sysbusLog.lastConfig[1] = msg[WD_EN_CMD];
|
instPtr->sysbusLog.lastConfig[1] = msg[WD_EN_CMD];
|
||||||
@@ -359,7 +356,8 @@ static int32_t SystemBus_Echo(SYSBUS *instPtr, SYSBUS_UART_FRAME *frame)
|
|||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
ASSERT(frame != NULL);
|
ASSERT(frame != NULL);
|
||||||
SYSBUS_UART_FRAME *sysbusRsp = malloc(sizeof(SYSBUS_UART_FRAME));
|
SYSBUS_UART_FRAME *sysbusRsp = malloc(sizeof(SYSBUS_UART_FRAME));
|
||||||
if (sysbusRsp == NULL) {
|
if (sysbusRsp == NULL)
|
||||||
|
{
|
||||||
DBG_ERROR("Failed to allocate memory for DATA TEST A Response!\n");
|
DBG_ERROR("Failed to allocate memory for DATA TEST A Response!\n");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -384,7 +382,8 @@ static int32_t SystemBus_GenPollRsp(SYSBUS *instPtr, uint8_t *msg)
|
|||||||
size_t dataLen;
|
size_t dataLen;
|
||||||
uint8_t *payload;
|
uint8_t *payload;
|
||||||
SYSBUS_UART_FRAME *sysbusRsp = malloc(sizeof(SYSBUS_UART_FRAME));
|
SYSBUS_UART_FRAME *sysbusRsp = malloc(sizeof(SYSBUS_UART_FRAME));
|
||||||
if (sysbusRsp == NULL) {
|
if (sysbusRsp == NULL)
|
||||||
|
{
|
||||||
DBG_ERROR("Failed to allocate memory for FLJ POLL Response!\n");
|
DBG_ERROR("Failed to allocate memory for FLJ POLL Response!\n");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -437,7 +436,8 @@ static int32_t SystemBus_GenRemoteTestRsp(SYSBUS *instPtr, uint8_t *msg)
|
|||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
ASSERT(msg != NULL);
|
ASSERT(msg != NULL);
|
||||||
SYSBUS_UART_FRAME *sysbusRsp = malloc(sizeof(SYSBUS_UART_FRAME));
|
SYSBUS_UART_FRAME *sysbusRsp = malloc(sizeof(SYSBUS_UART_FRAME));
|
||||||
if (sysbusRsp == NULL) {
|
if (sysbusRsp == NULL)
|
||||||
|
{
|
||||||
DBG_ERROR("Failed to allocate memory for LJ REMOTE TEST Response!\n");
|
DBG_ERROR("Failed to allocate memory for LJ REMOTE TEST Response!\n");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -485,7 +485,8 @@ static int32_t SystemBus_GenRemoteTestRsp(SYSBUS *instPtr, uint8_t *msg)
|
|||||||
return EUNEXP;
|
return EUNEXP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CircQueuePush(instPtr->txQueue, (void *)sysbusRsp) == false){
|
if (CircQueuePush(instPtr->txQueue, (void *)sysbusRsp) == false)
|
||||||
|
{
|
||||||
free(sysbusRsp);
|
free(sysbusRsp);
|
||||||
DBG_WARNING("SystemBus::TX Queue overflowed!\n");
|
DBG_WARNING("SystemBus::TX Queue overflowed!\n");
|
||||||
return EQUEUE;
|
return EQUEUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user