Compare commits
11
Commits
5c5a50e4ad
...
5cb5ffff59
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cb5ffff59 | ||
|
|
10fbdc78a6 | ||
|
|
7071b5bf33 | ||
|
|
28e4428468 | ||
|
|
9dabdf0984 | ||
|
|
7b3be7bc77 | ||
|
|
d6002b961b | ||
|
|
25ac8b0784 | ||
|
|
81a26ea3b3 | ||
|
|
5dd9695a77 | ||
|
|
2588564be2 |
@@ -281,17 +281,6 @@ inline void L2_RcdShift(L2_RCD* rcd, int32_t netxVal) {
|
||||
* @return NONE.
|
||||
*
|
||||
******************************************************************************/
|
||||
// FIXME: Only for test
|
||||
int w2AcqRecvCnt = 0;
|
||||
int w2AcqRecvSuccessCnt = 0;
|
||||
int mgmtRecvCnt = 0;
|
||||
int mgmtRecvSuccessCnt = 0;
|
||||
int tsyncRecvCnt = 0;
|
||||
int tsyncRecvSuccessCnt = 0;
|
||||
int svcRecvCnt = 0;
|
||||
int svcRecvSuccessCnt = 0;
|
||||
int recvCnt = 0;
|
||||
int frameLen = 0;
|
||||
void L2_FrameStateUpdate(L2_INST* instPtr) {
|
||||
ASSERT(instPtr != NULL);
|
||||
PHY_INST* phyRef = instPtr->config.phyInstPtr;
|
||||
@@ -304,58 +293,51 @@ void L2_FrameStateUpdate(L2_INST* instPtr) {
|
||||
DBG_INFO("A frame received, checking data validation...\n");
|
||||
DBG_INFO("Last frame type is: %u.\n", instPtr->frame.last);
|
||||
Phy_RetrieveRecvData(phyRef, instPtr->recvPktData);
|
||||
instPtr->log.frameRecv++;
|
||||
|
||||
switch (instPtr->frame.last) {
|
||||
case L2_INTRA_SCAN_FRAME:
|
||||
// INTRA_BM_FRAME could be received if current frame type is INTRA_BM_FRAME
|
||||
case L2_INTRA_BM_FRAME:
|
||||
instPtr->log.bmRecvCnt++;
|
||||
if (L2_CrcCheck(instPtr->recvPktData, BM_MSG_CRC_OFFSET / 8,
|
||||
BM_MSG_CRC_OFFSET / 8, L2_CRC8_31) == true) {
|
||||
L2_DataAvailUpdate(instPtr, true);
|
||||
instPtr->log.bmCorrectCnt++;
|
||||
}
|
||||
else {
|
||||
L2_DataAvailUpdate(instPtr, false);
|
||||
}
|
||||
break;
|
||||
case L2_INTRA_W2_ACQ_FRAME:
|
||||
// FIXME: Only for test
|
||||
w2AcqRecvCnt++;
|
||||
instPtr->log.mgmtRecvCnt++;
|
||||
if (L2_CrcCheck(instPtr->recvPktData,
|
||||
W2ACQ_FRAME_CRC_DLEN, W2ACQ_FRAME_CRC_POS,
|
||||
L2_CRC16_8005) == true) {
|
||||
L2_DataAvailUpdate(instPtr, true);
|
||||
// FIXME: Only for test
|
||||
w2AcqRecvSuccessCnt++;
|
||||
instPtr->log.mgmtCorrectCnt++;
|
||||
}
|
||||
else {
|
||||
L2_DataAvailUpdate(instPtr, false);
|
||||
}
|
||||
break;
|
||||
case L2_INTRA_MGMT_FRAME:
|
||||
// FIXME: Only for test
|
||||
mgmtRecvCnt++;
|
||||
recvCnt ++ ;
|
||||
instPtr->log.mgmtRecvCnt++;
|
||||
L2_DataAvailUpdate(instPtr, true);
|
||||
// FIXME: Only for test
|
||||
mgmtRecvSuccessCnt ++;
|
||||
instPtr->log.mgmtCorrectCnt++;
|
||||
break;
|
||||
case L2_INTRA_TSYNC_FRAME:
|
||||
// FIXME: Only for test
|
||||
tsyncRecvCnt++;
|
||||
recvCnt ++ ;
|
||||
instPtr->log.tsyncRecvCnt++;
|
||||
L2_DataAvailUpdate(instPtr, true);
|
||||
// FIXME: Only for test
|
||||
tsyncRecvSuccessCnt ++;
|
||||
instPtr->log.tsyncCorrectCnt++;
|
||||
break;
|
||||
case L2_INTRA_SVC_FRAME:
|
||||
// FIXME: Only for test
|
||||
svcRecvCnt++;
|
||||
recvCnt ++ ;
|
||||
instPtr->log.svcRecvCnt++;
|
||||
if (L2_CrcCheck(instPtr->recvPktData,
|
||||
PDUH0_HEADER_CRC_OFFSET/8, PDUH0_HEADER_CRC_OFFSET/8,
|
||||
L2_CRC8_31) == true) {
|
||||
L2_DataAvailUpdate(instPtr, true);
|
||||
// FIXME: Only for test
|
||||
svcRecvSuccessCnt++;
|
||||
instPtr->log.svcCorrectCnt++;
|
||||
}
|
||||
else {
|
||||
L2_DataAvailUpdate(instPtr, false);
|
||||
@@ -365,6 +347,9 @@ void L2_FrameStateUpdate(L2_INST* instPtr) {
|
||||
L2_DataAvailUpdate(instPtr, false);
|
||||
break;
|
||||
}
|
||||
if(L2_isDataAvail(instPtr)) {
|
||||
instPtr->log.frameCorrect++;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -386,6 +371,55 @@ int32_t L2_SetupNextSlot(L2_INST* instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
|
||||
if (frameType < L2_INTER_SCAN_FRAME || frameType > L2_INTRA_SVC_FRAME) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// logging
|
||||
if(txrxMode == L2_TOR_TX) {
|
||||
instPtr->log.frameTx++;
|
||||
switch(frameType){
|
||||
case L2_INTRA_BM_FRAME:
|
||||
instPtr->log.bmTxCnt++;
|
||||
break;
|
||||
case L2_INTRA_W2_ACQ_FRAME:
|
||||
instPtr->log.w2acqTxCnt++;
|
||||
break;
|
||||
case L2_INTRA_MGMT_FRAME:
|
||||
instPtr->log.mgmtTxCnt++;
|
||||
break;
|
||||
case L2_INTRA_TSYNC_FRAME:
|
||||
instPtr->log.tsyncTxCnt++;
|
||||
break;
|
||||
case L2_INTRA_SVC_FRAME:
|
||||
instPtr->log.svcTxCnt++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else if (txrxMode == L2_TOR_RX)
|
||||
{
|
||||
instPtr->log.frameRx++;
|
||||
switch(frameType){
|
||||
case L2_INTRA_BM_FRAME:
|
||||
instPtr->log.bmRxCnt++;
|
||||
break;
|
||||
case L2_INTRA_W2_ACQ_FRAME:
|
||||
instPtr->log.w2acqRxCnt++;
|
||||
break;
|
||||
case L2_INTRA_MGMT_FRAME:
|
||||
instPtr->log.mgmtRxCnt++;
|
||||
break;
|
||||
case L2_INTRA_TSYNC_FRAME:
|
||||
instPtr->log.tsyncRxCnt++;
|
||||
break;
|
||||
case L2_INTRA_SVC_FRAME:
|
||||
instPtr->log.svcRxCnt++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if _814_DEBUG_LEVEL >= 3
|
||||
char* torStr = NULL;
|
||||
char* frameStr = NULL;
|
||||
@@ -504,7 +538,7 @@ uint32_t L2_GetFrameLen(L2_FRAME_TYPE l2FrameType) {
|
||||
* @return L1 frame type.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifdef TEST_200KBPS
|
||||
#ifndef TEST_200KBPS
|
||||
L1_FRAME_TYPE L2_L2frame2L1frame(L2_FRAME_TYPE l2Frame) {
|
||||
switch (l2Frame) {
|
||||
case L2_INTER_SCAN_FRAME:
|
||||
@@ -735,6 +769,7 @@ int32_t Linklayer_Reconfig(L2_INST* instPtr, const L2_CONFIG *config) {
|
||||
memcpy(&(instPtr->config), config, sizeof(L2_CONFIG));
|
||||
|
||||
// Reset basic info
|
||||
memset(&(instPtr->log), 0x00, sizeof(L2_LOG));
|
||||
instPtr->netStartTime = UINT32_MAX;
|
||||
instPtr->rtneConfig.last = NULL;
|
||||
instPtr->rtneConfig.curr = NULL;
|
||||
@@ -963,7 +998,6 @@ int32_t Linklayer_PktHandler(L2_INST* instPtr, L2_FRAME_TYPE frameType) {
|
||||
case L2_INTRA_MGMT_FRAME:
|
||||
case L2_INTER_TSYNC_FRAME:
|
||||
case L2_INTRA_TSYNC_FRAME:
|
||||
// TODO:
|
||||
if(frameType == L2_INTRA_MGMT_FRAME){
|
||||
if (instPtr->buffSwitch == 0) {
|
||||
memcpy(instPtr->mgmtMsgRecvBuff0 + (size_t)(instPtr->mgmtMsgRecvCnt0*(MGMT_MSG_LEN*ARRAY_SIZE(intraMgmtFrameMsgs)/8)),
|
||||
@@ -981,7 +1015,6 @@ int32_t Linklayer_PktHandler(L2_INST* instPtr, L2_FRAME_TYPE frameType) {
|
||||
break;
|
||||
case L2_INTER_SVC_FRAME:
|
||||
case L2_INTRA_SVC_FRAME:
|
||||
// TODO:
|
||||
if(frameType == L2_INTRA_SVC_FRAME){
|
||||
if (instPtr->buffSwitch == 0) {
|
||||
memcpy(instPtr->svcMsgRecvBuff0 + (size_t) (instPtr->svcMsgRecvCnt0 * (INTRA_SVC_FRAME_LENGTH_MAX)),
|
||||
|
||||
@@ -55,6 +55,38 @@ typedef struct {
|
||||
TIMECTRL_INST* tmcInstPtr;
|
||||
} L2_CONFIG;
|
||||
|
||||
typedef struct {
|
||||
uint32_t frameRx;
|
||||
uint32_t frameTx;
|
||||
uint32_t frameRecv;
|
||||
uint32_t frameCorrect;
|
||||
|
||||
uint32_t bmRxCnt;
|
||||
uint32_t bmTxCnt;
|
||||
uint32_t bmRecvCnt;
|
||||
uint32_t bmCorrectCnt;
|
||||
|
||||
uint32_t w2acqRxCnt;
|
||||
uint32_t w2acqTxCnt;
|
||||
uint32_t w2acqRecvCnt;
|
||||
uint32_t w2acqCorrectCnt;
|
||||
|
||||
uint32_t mgmtRxCnt;
|
||||
uint32_t mgmtTxCnt;
|
||||
uint32_t mgmtRecvCnt;
|
||||
uint32_t mgmtCorrectCnt;
|
||||
|
||||
uint32_t tsyncRxCnt;
|
||||
uint32_t tsyncTxCnt;
|
||||
uint32_t tsyncRecvCnt;
|
||||
uint32_t tsyncCorrectCnt;
|
||||
|
||||
uint32_t svcRxCnt;
|
||||
uint32_t svcTxCnt;
|
||||
uint32_t svcRecvCnt;
|
||||
uint32_t svcCorrectCnt;
|
||||
} L2_LOG;
|
||||
|
||||
typedef struct {
|
||||
L2_CONFIG config;
|
||||
L2_NODE_INFO myInfo;
|
||||
@@ -77,6 +109,7 @@ typedef struct {
|
||||
L2_RTT_FSM* rttFSM; // FSM for RTT (time sync algorithm)
|
||||
uint8_t* sendPktData;
|
||||
uint8_t* recvPktData;
|
||||
L2_LOG log;
|
||||
// for MPC
|
||||
uint8_t buffSwitch;
|
||||
uint8_t mgmtMsgRecvCnt0;
|
||||
|
||||
@@ -81,8 +81,6 @@ static int32_t MgmtMsg_Packing(L2_INST* instPtr, BIT_ARRAY* bitarr, L2_MSG_TYPE
|
||||
return EPARAM;
|
||||
}
|
||||
}
|
||||
|
||||
memset(bitarr->words, 0x99, (size_t) (MGMT_MSG_LEN / 8));
|
||||
switch (msgType) {
|
||||
case L2_MSG_TK_INIT:
|
||||
// Series tag
|
||||
@@ -706,7 +704,6 @@ int32_t MgmtNet_PktHandler(L2_INST* instPtr) {
|
||||
// Member Node update state with received message
|
||||
if(L2_GetNodeId(instPtr) != L2_NODE_HEAD && mgmtMsgLog->isValid == true ){
|
||||
L2_NODE_STATE newState = L2_NONE_STATE;
|
||||
// FIXME :
|
||||
switch (mgmtMsgLog->nextNetState) {
|
||||
case NET_INI_STAGE:
|
||||
newState = L2_INIT_STATE;
|
||||
@@ -918,9 +915,6 @@ int32_t MgmtNet_Routine(L2_INST* instPtr, const L2_RTNE_TABLE_ENTRY* rtneEntry){
|
||||
}
|
||||
|
||||
// Update RTT FSM if needed.
|
||||
if (L2_GetLastFrameType(instPtr) == L2_INTRA_TSYNC_FRAME && L2_GetLastTor(instPtr) == L2_TOR_RX) {
|
||||
RTT_FsmUpdate(instPtr, L2_TOR_RX);
|
||||
}
|
||||
if (rtneEntry->slotType == L2_SLOT_INTRA_TSYNC) {
|
||||
if(torState == L2_TOR_TX) {
|
||||
RTT_FsmUpdate(instPtr, L2_TOR_TX);
|
||||
@@ -942,7 +936,7 @@ int32_t MgmtNet_Routine(L2_INST* instPtr, const L2_RTNE_TABLE_ENTRY* rtneEntry){
|
||||
L2_SetupNextSlot(instPtr, torState, L2_INTER_MGMT_FRAME);
|
||||
break;
|
||||
case L2_SLOT_INTRA_MGMT:
|
||||
memset(instPtr->sendPktData, 0xAA, INTRA_MGMT_FRAME_LENGTH_MAX);
|
||||
memset(instPtr->sendPktData, 0xAA, L2_PACKET_LEN_MAX);
|
||||
if (torState == L2_TOR_TX) {
|
||||
if(MgmtPkt_Packing(instPtr, MGMTPKT_INTRA_MGMT) != SUCCESS) {
|
||||
Status = FAILURE;
|
||||
@@ -957,7 +951,7 @@ int32_t MgmtNet_Routine(L2_INST* instPtr, const L2_RTNE_TABLE_ENTRY* rtneEntry){
|
||||
break;
|
||||
case L2_SLOT_INTRA_TSYNC:
|
||||
if (torState == L2_TOR_TX) {
|
||||
memset(instPtr->sendPktData, 0xAA, INTRA_RTT_FRAME_LENGTH_MAX);
|
||||
memset(instPtr->sendPktData, 0xAA, L2_PACKET_LEN_MAX);
|
||||
if(L2_GetNodeType(instPtr) == L2_NODE_HEAD){
|
||||
if(MgmtPkt_Packing(instPtr, MGMTPKT_INTRA_RTTREQ) != SUCCESS) {
|
||||
Status = FAILURE;
|
||||
|
||||
@@ -141,7 +141,6 @@ static int32_t ScanMsg_Packing(L2_INST* instPtr, BIT_ARRAY* bitarr, L2_MSG_TYPE
|
||||
return (EPARAM);
|
||||
}
|
||||
uint64_t dataChunk = 0;
|
||||
memset(bitarr->words, 0xAA, (size_t)(bitarr->num_of_bits / 8));
|
||||
switch (msgType) {
|
||||
case L2_MSG_BM:
|
||||
if (bitarr->num_of_bits < BM_MSG_LEN) {
|
||||
@@ -171,7 +170,7 @@ static int32_t ScanMsg_Packing(L2_INST* instPtr, BIT_ARRAY* bitarr, L2_MSG_TYPE
|
||||
dataChunk = L2_GetNextSlotNum(instPtr) % L2_SLOTS_PER_SUBFRAME;
|
||||
FrameInsertChunk(bitarr, BM_MSG_TSLOT_NUM_OFFSET, BM_MSG_TSLOT_NUM_LEN, dataChunk);
|
||||
|
||||
/* FIXME : Only for test */
|
||||
/* FIXME: dummy data, only for test */
|
||||
/* longitude. */
|
||||
dataChunk = 203;
|
||||
FrameInsertChunk(bitarr, BM_MSG_LONGITUDE_OFFSET, BM_MSG_LONGITUDE_LEN, dataChunk);
|
||||
@@ -553,6 +552,9 @@ static int32_t Scan_2WAcqHandler (L2_INST* instPtr){
|
||||
else {
|
||||
scanFsmPtr->w2acqTimeout++; // increase counter.
|
||||
}
|
||||
// using pull mode to receive 2wacq frame
|
||||
// since first time sync procedure is accomplished in BM stage.
|
||||
Phy_SetMode(instPtr->config.phyInstPtr, PHY_MODE_PULL);
|
||||
L2_SetupNextSlot(instPtr, L2_TOR_RX, frameType);
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -647,7 +649,7 @@ int32_t ScanNet_PktHandler(L2_INST* instPtr) {
|
||||
|
||||
if ( L2_isCxn2Net(instPtr) == false ) {
|
||||
// TODO: Check
|
||||
L2_TimeAlign(instPtr, scanFsmPtr->BMrcvLog.frameNum, scanFsmPtr->BMrcvLog.slotNum, false);
|
||||
L2_TimeAlign(instPtr, scanFsmPtr->BMrcvLog.frameNum, scanFsmPtr->BMrcvLog.slotNum, true);
|
||||
}
|
||||
// trigger flag
|
||||
BmrecvStateUpdate(scanFsmPtr, true);
|
||||
@@ -836,7 +838,6 @@ void ScanNet_Reset(L2_SCAN_FSM* scanFSMPtr) {
|
||||
scanFSMPtr->w2acqTimeout = 0;
|
||||
scanFSMPtr->scanStage = L2_SCAN_NONE_STAGE;
|
||||
scanFSMPtr->scanMode = L2_SCAN_INTRA_MODE;
|
||||
// FIXME: Only for test
|
||||
scanFSMPtr->BMrcvLog.Height = 0;
|
||||
scanFSMPtr->BMrcvLog.Latitude = 0;
|
||||
scanFSMPtr->BMrcvLog.Longitude = 0;
|
||||
@@ -979,7 +980,7 @@ int32_t ScanNet_Routine(L2_INST* instPtr, const L2_RTNE_TABLE_ENTRY* rtneEntry)
|
||||
Status = FAILURE;
|
||||
goto routine_err;
|
||||
}
|
||||
memset(instPtr->sendPktData, 0xAA, INTRA_BM_FRAME_LENGTH_MAX);
|
||||
memset(instPtr->sendPktData, 0xAA, L2_PACKET_LEN_MAX);
|
||||
if(ScanPkt_Packing(instPtr, SCANPKT_INTRA_BM) != SUCCESS) {
|
||||
Status = FAILURE;
|
||||
goto routine_err;
|
||||
@@ -995,12 +996,11 @@ int32_t ScanNet_Routine(L2_INST* instPtr, const L2_RTNE_TABLE_ENTRY* rtneEntry)
|
||||
case L2_SLOT_INTRA_SCAN_2W:
|
||||
if (torState == L2_TOR_TX) {
|
||||
if(L2_GetNodeType(instPtr) != L2_NODE_HEAD && L2_isDataAvail(instPtr) == false) {
|
||||
/* Antenna setting (reserved.) */
|
||||
L2_SetupNextSlot(instPtr, L2_TOR_SUSPEND, L2_INTRA_W2_ACQ_FRAME);
|
||||
// skip...
|
||||
break;
|
||||
}
|
||||
/* Prepare Request/ACK data. */
|
||||
memset(instPtr->sendPktData, 0xAA, (size_t) INTRA_W2ACQ_FRAME_LENGTH_MAX);
|
||||
memset(instPtr->sendPktData, 0xAA, L2_PACKET_LEN_MAX);
|
||||
/* Pack message words */
|
||||
if(ScanPkt_Packing(instPtr, SCANPKT_INTRA_2WACQ) != SUCCESS) {
|
||||
Status = FAILURE;
|
||||
|
||||
@@ -65,7 +65,6 @@ static int UduHeader_Packing(L2_INST* instPtr, BIT_ARRAY* bitarr, uint8_t dst, u
|
||||
return EPARAM;
|
||||
}
|
||||
uint64_t dataChunk = 0;
|
||||
memset(bitarr->words, 0xF0, (size_t)(UDUH_LEN/8));
|
||||
// priority
|
||||
dataChunk = 1;
|
||||
FrameInsertChunk(bitarr, UDUH_PRI_OFFSET, UDUH_PRI_LEN, dataChunk);
|
||||
@@ -118,7 +117,6 @@ static int PduHeader_Packing(L2_INST* instPtr, BIT_ARRAY* bitarr, L2_PDU_HEADER_
|
||||
if(bitarr->num_of_bits < PDUH0_LEN){
|
||||
return EPARAM;
|
||||
}
|
||||
memset(bitarr->words, 0xF0, (size_t)(PDUH0_LEN/8));
|
||||
// PDU type
|
||||
dataChunk = 0;
|
||||
FrameInsertChunk(bitarr, PDUH0_TYPE_OFFSET, PDUH0_TYPE_LEN, dataChunk);
|
||||
@@ -141,7 +139,6 @@ static int PduHeader_Packing(L2_INST* instPtr, BIT_ARRAY* bitarr, L2_PDU_HEADER_
|
||||
if(bitarr->num_of_bits < PDUH1_LEN){
|
||||
return EPARAM;
|
||||
}
|
||||
memset(bitarr->words, 0xF0, (size_t)(PDUH1_LEN/8));
|
||||
// PDU type
|
||||
dataChunk = 1;
|
||||
FrameInsertChunk(bitarr, PDUH1_TYPE_OFFSET, PDUH1_TYPE_LEN, dataChunk);
|
||||
@@ -246,7 +243,6 @@ int32_t ServiceNet_Routine(L2_INST* instPtr, const L2_RTNE_TABLE_ENTRY* rtneEntr
|
||||
DBG_ERROR("Failed to allocate memory for svcMsg.\n");
|
||||
return FAILURE;
|
||||
}
|
||||
memset(instPtr->sendPktData, 0xCC, (size_t)(INTRA_SVC_FRAME_LENGTH_MAX));
|
||||
switch(rtneEntry->slotType){
|
||||
case L2_SLOT_INTER_SVC:
|
||||
L2_SetupNextSlot(instPtr, torState, L2_INTER_SVC_FRAME);
|
||||
@@ -254,7 +250,7 @@ int32_t ServiceNet_Routine(L2_INST* instPtr, const L2_RTNE_TABLE_ENTRY* rtneEntr
|
||||
case L2_SLOT_INTRA_SVC:
|
||||
if(torState == L2_TOR_TX){
|
||||
//TODO:
|
||||
memset(instPtr->sendPktData, 0x00, INTRA_SVC_FRAME_LENGTH_MAX);
|
||||
memset(instPtr->sendPktData, 0xAA, L2_PACKET_LEN_MAX);
|
||||
// Pack PDU header
|
||||
if(PduHeader_Packing(instPtr, svcMsg, L2_PDU_HEADER_0, rtneEntry->dst0) != SUCCESS){
|
||||
DBG_ERROR("Failed to packing PduHeader.\n");
|
||||
|
||||
@@ -323,9 +323,8 @@ void L2_EventPoolHandler(L2_INST* instPtr){
|
||||
DBG_ERROR("Failed to initialize schedule event pool iteration.\n");
|
||||
return;
|
||||
}
|
||||
while (iter->next != NULL)
|
||||
while ((node = list_iterator_next(iter)))
|
||||
{
|
||||
node = list_iterator_next(iter);
|
||||
event = (L2_SCHD_EVENT*)node->val;
|
||||
if(L2_isEventScheduled(event)){
|
||||
if(event->schdFrame == L2_GetCurrentFrameNum(instPtr)
|
||||
|
||||
@@ -75,7 +75,7 @@ int32_t L2_TimeAlign(L2_INST* instPtr, uint32_t frameNum, uint32_t slotNum, bool
|
||||
expctTime += (uint64_t)instPtr->netStartTime * L2_SLOTS_PER_FRAME * TIME_FRAC_MAX;
|
||||
}
|
||||
|
||||
Phy_GetFrameSyncTimeStamp(instPtr->config.phyInstPtr, &timeStamp);
|
||||
Phy_GetLastReceivedFrameSyncTimeStamp(instPtr->config.phyInstPtr, &timeStamp);
|
||||
currTime = (uint64_t)timeStamp.frac_part;
|
||||
currTime += ((uint64_t)timeStamp.int_part) * TIME_FRAC_MAX;
|
||||
|
||||
@@ -166,10 +166,10 @@ void RTT_GetFrameStart(L2_INST* instPtr, TIME_WORD *tmStamp, L2_TOR_TYPE torType
|
||||
PHY_INST* phyRef = instPtr->config.phyInstPtr;
|
||||
TIME_WORD timeStamp;
|
||||
int64_t timeDiff;
|
||||
Phy_GetFrameSyncTimeStamp(phyRef, &timeStamp);
|
||||
Phy_GetLastReceivedFrameSyncTimeStamp(phyRef, &timeStamp);
|
||||
timeDiff = (uint64_t) timeStamp.frac_part;
|
||||
timeDiff += ((uint64_t)timeStamp.int_part) * TIME_FRAC_MAX;
|
||||
Phy_GetLastSlotStartTimeStamp(phyRef, tmStamp);
|
||||
Phy_GetLastReceivedSlotStartTimeStamp(phyRef, tmStamp);
|
||||
timeDiff -= ((uint64_t) tmStamp->int_part) * TIME_FRAC_MAX;
|
||||
timeDiff -= (uint64_t) tmStamp->frac_part;
|
||||
timeDiff = (int64_t)Phy_GetTimeComp(L2_L2frame2L1frame(L2_GetLastFrameType(instPtr))) - timeDiff;
|
||||
|
||||
@@ -161,8 +161,6 @@ int MPC_Init(MPC_INST** instPtr, MPC_CONFIG* configPtr){
|
||||
goto init_failed;
|
||||
}
|
||||
|
||||
memset(mpcRecord, 0x00, sizeof(MPC_RECORD));
|
||||
|
||||
mpcTxMsgBuff = bit_array_create(STATE_STROAGE_BUFF_MAX*8);
|
||||
if(mpcTxMsgBuff == NULL){
|
||||
goto init_failed;
|
||||
@@ -173,6 +171,10 @@ int MPC_Init(MPC_INST** instPtr, MPC_CONFIG* configPtr){
|
||||
}
|
||||
return Status;
|
||||
|
||||
memset(mpcRecord, 0x00, sizeof(MPC_RECORD));
|
||||
memset(mpcTxMsgBuff, 0x00, sizeof(STATE_STROAGE_BUFF_MAX*8));
|
||||
memset(mpcRxMsgBuff, 0x00, sizeof(MPC_MSG_LEN_MAX));
|
||||
|
||||
init_failed:
|
||||
free(*instPtr);
|
||||
free(mpcRecord);
|
||||
@@ -204,7 +206,7 @@ int MPC_MsgHandler(MPC_INST* instPtr){
|
||||
MPC_GetChunk(mpcRxMsgBuff, TEST_REQ_CMD_OFFSET, TEST_REQ_CMD_LEN, &dataChunk);
|
||||
if((uint8_t)dataChunk == TEST_REQ_CMD_START){
|
||||
MPC_GetChunk(mpcRxMsgBuff, TEST_MODE_SET_OFFSET, TEST_MODE_SET_LEN, &dataChunk);
|
||||
// FIXME
|
||||
// TODO: check.
|
||||
if((uint8_t)dataChunk == TEST_MODE_HEAD){
|
||||
l2Config.myType = L2_NODE_HEAD;
|
||||
l2Config.myId = 1;
|
||||
|
||||
@@ -233,8 +233,12 @@ void Phy_UpdateState(PHY_INST* instPtr) {
|
||||
|
||||
/* Update Frame Sate. */
|
||||
uint32_t txrxSate = PhyRead(instPtr, TXRX_STATE);
|
||||
instPtr->isAcq = ((txrxSate & TXRX_STATE_ACQ_MASK) == TXRX_STATE_ACQ_SUCCESS) ? true : false;
|
||||
instPtr->isFrameSync = ((txrxSate & TXRX_STATE_FSYNC_MASK) == TXRX_STATE_FSYNC_SUCCESS) ? true : false;
|
||||
// instPtr->isAcq = ((txrxSate & TXRX_STATE_ACQ_MASK) == TXRX_STATE_ACQ_SUCCESS) ? true : false;
|
||||
// instPtr->isFrameSync = ((txrxSate & TXRX_STATE_FSYNC_MASK) == TXRX_STATE_FSYNC_SUCCESS) ? true : false;
|
||||
|
||||
// FIXME: using default value, since physical layer may provide unexpected error value.
|
||||
instPtr->isAcq = true;
|
||||
instPtr->isFrameSync = true;
|
||||
instPtr->isDecode = ((txrxSate & TXRX_STATE_DECODE_MASK) == TXRX_STATE_DECODE_SUCCESS) ? true : false;
|
||||
if (Phy_IsFrameReceived(instPtr)) {
|
||||
instPtr->isValid = ((txrxSate & TXRX_STATE_CRC_MASK) == TXRX_STATE_CRC_OK) ? true : false;
|
||||
@@ -242,6 +246,10 @@ void Phy_UpdateState(PHY_INST* instPtr) {
|
||||
else {
|
||||
instPtr->isValid = false;
|
||||
}
|
||||
instPtr->recvSlotTime.int_part = PhyRead(instPtr, TM_TARGET_H);
|
||||
instPtr->recvSlotTime.frac_part = PhyRead(instPtr, TM_TARGET_L);
|
||||
instPtr->recvFsTime.int_part = PhyRead(instPtr, FSTIME_H);
|
||||
instPtr->recvFsTime.frac_part = PhyRead(instPtr, FSTIME_L);
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +258,7 @@ void Phy_UpdateState(PHY_INST* instPtr) {
|
||||
* @brief Initialize physical layer instance accordingly.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param phyConfig a pointer to cinfiguration staructure.
|
||||
* @param phyConfig a pointer to configuration structure.
|
||||
*
|
||||
* @return SUCCESS
|
||||
*
|
||||
@@ -271,6 +279,10 @@ int32_t Phy_InstInit(PHY_INST** instPtr, PHY_CONFIG *phyConfig) {
|
||||
(*instPtr)->isFrameSync = false;
|
||||
(*instPtr)->isDecode = false;
|
||||
(*instPtr)->isValid = false;
|
||||
(*instPtr)->recvFsTime.int_part = UINT32_MAX;
|
||||
(*instPtr)->recvFsTime.frac_part = UINT32_MAX;
|
||||
(*instPtr)->recvSlotTime.int_part = UINT32_MAX;
|
||||
(*instPtr)->recvSlotTime.frac_part = UINT32_MAX;
|
||||
(*instPtr)->isPresetHop = false;
|
||||
(*instPtr)->antConfigOffset = 0;
|
||||
(*instPtr)->sendDataOffset = 0;
|
||||
@@ -600,7 +612,6 @@ int32_t Phy_SetupNextSlot(PHY_INST* instPtr, PHY_TOR_TYPE txrxMode,
|
||||
* @return frequency estimation
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
double Phy_GetCoarseFreqEst(PHY_INST* instPtr) {
|
||||
ASSERT(instPtr != NULL);
|
||||
uint32_t regValue;
|
||||
@@ -752,7 +763,7 @@ int32_t Phy_SetTimeWord(PHY_INST* instPtr, const TIME_WORD* tmWord, PHY_TIME_WOR
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Get the frame sync time of last received frame.
|
||||
* @brief Get the frame sync time of last frame.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param frameSycT a pointer to the frame sync time data buffer.
|
||||
@@ -763,8 +774,8 @@ int32_t Phy_SetTimeWord(PHY_INST* instPtr, const TIME_WORD* tmWord, PHY_TIME_WOR
|
||||
void Phy_GetFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(frameSyncT != NULL);
|
||||
frameSyncT->int_part = PhyRead(instPtr, TM_TARGET_H);
|
||||
frameSyncT->frac_part = PhyRead(instPtr, TM_TARGET_L);
|
||||
frameSyncT->int_part = PhyRead(instPtr, FSTIME_H);
|
||||
frameSyncT->frac_part = PhyRead(instPtr, FSTIME_L);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -772,16 +783,48 @@ void Phy_GetFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT) {
|
||||
* @brief Get the frame sync time of last received frame.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param frameSycT a pointer to the frame sync time data buffer.
|
||||
*
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void Phy_GetLastReceivedFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(frameSyncT != NULL);
|
||||
memcpy(frameSyncT, &(instPtr->recvFsTime), sizeof(TIME_WORD));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Get the slot start time of last received frame.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param slotStart a pointer to the time data buffer.
|
||||
*
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void Phy_GetLastSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart) {
|
||||
void Phy_GetSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(slotStart != NULL);
|
||||
slotStart->int_part = PhyRead(instPtr, FSTIME_H);
|
||||
slotStart->frac_part = PhyRead(instPtr, FSTIME_L);
|
||||
slotStart->int_part = PhyRead(instPtr, TM_TARGET_H);
|
||||
slotStart->frac_part = PhyRead(instPtr, TM_TARGET_L);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Get the slot start time of last frame.
|
||||
*
|
||||
* @param instPtr a pointer to physical instance
|
||||
* @param slotStart a pointer to the time data buffer.
|
||||
*
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void Phy_GetLastReceivedSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(slotStart != NULL);
|
||||
memcpy(slotStart, &(instPtr->recvSlotTime), sizeof(TIME_WORD));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -201,12 +201,14 @@ typedef struct {
|
||||
uintptr_t recvDataAddr;
|
||||
uintptr_t sendDataAddr;
|
||||
uintptr_t antConfigAddr;
|
||||
bool isPhyEn; // is physical layer running
|
||||
bool isAcq; // is last reception acquisition success
|
||||
bool isFrameSync; // is last reception frame sync success
|
||||
bool isDecode; // is last reception decode success
|
||||
bool isValid; // is last reception frame data valid (crc check pass)
|
||||
bool isPresetHop; // is using preset frequency hop
|
||||
bool isPhyEn; // if physical layer running
|
||||
bool isAcq; // if last reception acquisition success
|
||||
bool isFrameSync; // if last reception frame sync success
|
||||
bool isDecode; // if last reception decode success
|
||||
bool isValid; // if last reception frame data valid (crc check pass)
|
||||
TIME_WORD recvSlotTime; // last slot start time stamp
|
||||
TIME_WORD recvFsTime; // last frame sync time stamp
|
||||
bool isPresetHop; // if using preset frequency hop
|
||||
PHY_RCD antNo; // antenna number record
|
||||
PHY_RCD beamNo; // beam number record
|
||||
PHY_RCD beamWd; // beam width record
|
||||
@@ -265,5 +267,7 @@ int32_t Phy_SetTimeWord(PHY_INST* instPtr, const TIME_WORD* tmWord, PHY_TIME_WOR
|
||||
|
||||
double Phy_GetCoarseFreqEst(PHY_INST* instPtr);
|
||||
void Phy_GetFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT);
|
||||
void Phy_GetLastSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart);
|
||||
void Phy_GetLastReceivedFrameSyncTimeStamp(PHY_INST* instPtr, TIME_WORD* frameSyncT);
|
||||
void Phy_GetSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart);
|
||||
void Phy_GetLastReceivedSlotStartTimeStamp(PHY_INST* instPtr, TIME_WORD* slotStart);
|
||||
#endif /* PHY_CTRL_H_ */
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
* Description: Time sync implementation file.
|
||||
*
|
||||
* Author: Author's name
|
||||
* Date: 2021-12-04 16:32
|
||||
* Date: 2023-12-20 16:32
|
||||
* LastEditors: FanHao
|
||||
* LastEditTime: 2022-07-10 20:43
|
||||
* LastEditTime: 2023-12-22 20:43
|
||||
* Revisions: Rev 0.0
|
||||
* History:
|
||||
* [2022-07-10]: New branch for Dijian.
|
||||
* [2021-12-04]: Initial version.
|
||||
* [2023-12-20]: Initial version.
|
||||
*
|
||||
* Copyright(c) 2021 Beijing Institute of Technology.
|
||||
* Lab of Communication and Networking
|
||||
@@ -32,8 +31,9 @@
|
||||
#define PRESET_LOW 0x00000018
|
||||
#define TIME_ADJ_INT 0x0000001C
|
||||
#define TIME_ADJ_FRAC 0x00000020
|
||||
#define TIME_ADJ_TRIG 0x00000024
|
||||
#define CNTSTEP_OPT 0x00000028
|
||||
#define TIME_ADJ_MODE 0x00000024
|
||||
#define TIME_ADJ_TRIG 0x00000028
|
||||
#define CNTSTEP_OPT 0x0000002c
|
||||
|
||||
#define TM_RESET_CODE 0x5253542E
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
@@ -202,6 +202,7 @@ void TimeCtrl_TimeAdjust(TIMECTRL_INST *instPtr, const TIME_WORD* tmWord, TIMECT
|
||||
}
|
||||
TMC_Write(instPtr, TIME_ADJ_FRAC, tmWord->frac_part);
|
||||
TMC_Write(instPtr, TIME_ADJ_INT, tmWord->int_part);
|
||||
TMC_Write(instPtr, TIME_ADJ_MODE, type);
|
||||
TMC_Write(instPtr, TIME_ADJ_TRIG, type);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
/**
|
||||
* Description: A simplified version of timesync for datalink 814 (Dijian)
|
||||
*
|
||||
* Date: 2021-12-04 16:32
|
||||
* Date: 2023-12-20-04 16:32
|
||||
* LastEditors: Fan Hao
|
||||
* LastEditTime: 2022-07-06 16:32
|
||||
* LastEditTime: 2023-12-20 16:32
|
||||
* Revisions: Rev 0.0
|
||||
* History:
|
||||
* [2022-07-06]: Initial version.
|
||||
* [2021-12-04]: Initial version.
|
||||
* [2023-12-20]: Initial version.
|
||||
*
|
||||
* Copyright(c) 2021 Beijing Institute of Technology.
|
||||
* Lab of Communication and Networking
|
||||
|
||||
@@ -50,34 +50,15 @@
|
||||
|
||||
// Pair by regex
|
||||
// Regex: (([0-9]+, ){8})
|
||||
uint16_t hopRxPattern_Config[L1_FRAME_MAX_HOPS] = {
|
||||
0
|
||||
};
|
||||
uint16_t hopTxPattern_Config[L1_FRAME_MAX_HOPS] = {
|
||||
uint16_t hopPattern_Config[L1_FRAME_MAX_HOPS] = {
|
||||
0
|
||||
};
|
||||
|
||||
uint16_t hopTxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] = {
|
||||
1500
|
||||
};
|
||||
uint16_t hopRxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] = {
|
||||
uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] = {
|
||||
1500
|
||||
};
|
||||
|
||||
//uint16_t hopTxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
|
||||
// 0, 44, 88, 131, 175, 219, 263, 306,
|
||||
// 350, 394, 438, 481, 525, 569, 613, 656,
|
||||
// 700, 744, 788, 831, 875, 919, 963, 1006,
|
||||
// 1050, 1094, 1138, 1181, 1225, 1269, 1313, 1356,
|
||||
// 1400, 1444, 1488, 1531, 1575, 1619, 1663, 1706,
|
||||
// 1750, 1794, 1838, 1881, 1925, 1969, 2013, 2056,
|
||||
// 2100, 2144, 2188, 2231, 2275, 2319, 2363, 2406,
|
||||
// 2450, 2494, 2538, 2581, 2625, 2669, 2713, 2756,
|
||||
// 2800, 2844, 2888, 2931, 2975, 3019, 3063, 3106,
|
||||
// 3150, 3194, 3238, 3281, 3325, 3369, 3413, 3456,
|
||||
// 3500
|
||||
//};
|
||||
//uint16_t hopRxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
|
||||
//uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
|
||||
// 0, 44, 88, 131, 175, 219, 263, 306,
|
||||
// 350, 394, 438, 481, 525, 569, 613, 656,
|
||||
// 700, 744, 788, 831, 875, 919, 963, 1006,
|
||||
@@ -91,70 +72,39 @@ uint16_t hopRxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] = {
|
||||
// 3500
|
||||
//};
|
||||
|
||||
uint16_t hopTxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
|
||||
1500
|
||||
};
|
||||
uint16_t hopRxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
|
||||
uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
|
||||
1500
|
||||
};
|
||||
|
||||
uint16_t hopTxPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] = {
|
||||
1500
|
||||
};
|
||||
uint16_t hopRxPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] = {
|
||||
uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] = {
|
||||
1500
|
||||
};
|
||||
|
||||
uint16_t hopTxPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] = {
|
||||
1500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
|
||||
1700, 1800, 1900
|
||||
};
|
||||
uint16_t hopRxPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] = {
|
||||
uint16_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] = {
|
||||
1500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
|
||||
1700, 1800, 1900
|
||||
};
|
||||
|
||||
uint16_t hopTxPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] = {
|
||||
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
|
||||
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
|
||||
2400, 2400, 2400
|
||||
};
|
||||
uint16_t hopRxPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] = {
|
||||
uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] = {
|
||||
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
|
||||
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
|
||||
2400, 2400, 2400
|
||||
};
|
||||
|
||||
uint16_t hopTxPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] = {
|
||||
uint16_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] = {
|
||||
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
|
||||
2400
|
||||
};
|
||||
uint16_t hopRxPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] = {
|
||||
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
|
||||
2400
|
||||
};
|
||||
|
||||
uint16_t hopTxPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] ={
|
||||
uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] ={
|
||||
500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
|
||||
1700, 1800, 1900, 2000, 1500, 1600, 1700, 1800,
|
||||
1900, 2000, 1500, 1500
|
||||
};
|
||||
uint16_t hopRxPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] = {
|
||||
1500, 1900, 2000, 1500, 1600, 1700, 1800, 1900,
|
||||
2000, 1500, 1600, 1700, 1800, 1900, 2000, 1500,
|
||||
1500, 1500, 1700, 1800
|
||||
};
|
||||
|
||||
uint16_t hopTxPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] = {
|
||||
uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] = {
|
||||
500, 600, 700, 800, 900, 1000, 500, 600,
|
||||
700, 800, 900, 1000, 500, 600, 700, 800,
|
||||
900, 1000, 500, 500
|
||||
};
|
||||
uint16_t hopRxPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] = {
|
||||
500, 600, 700, 800, 900, 1000, 500, 600,
|
||||
700, 800, 900, 1000, 500, 600, 700, 800,
|
||||
900, 1000, 500, 500
|
||||
};
|
||||
|
||||
// Pair by regex
|
||||
// Regex: ((\{\.oaxis = [0-9]+[ ,]+\.raxis = [0-9]+[ ]*\}, ){2})
|
||||
|
||||
@@ -49,16 +49,6 @@
|
||||
#define L1_FRAME_200KBPS_5MS_LEN (2048/8)// byte
|
||||
#define L1_FRAME_1M2BPS_5MS_LEN (8184/8)// byte
|
||||
|
||||
//#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns
|
||||
//#define L1_FRAME_2KBPS_20MS_COMP 282900 // *10ns
|
||||
//#define L1_FRAME_2KBPS_100MS_COMP 282900 // *10ns
|
||||
//#define L1_FRAME_10KBPS_10MS_COMP 282900 // *10ns
|
||||
//#define L1_FRAME_10KBPS_20MS_COMP 282900 // *10ns
|
||||
//#define L1_FRAME_40KBPS_20MS_COMP 282900 // *10ns
|
||||
//#define L1_FRAME_40KBPS_10MS_COMP 282900 // *10ns
|
||||
//#define L1_FRAME_200KBPS_5MS_COMP 17067 // *10ns
|
||||
//#define L1_FRAME_1M2BPS_5MS_COMP 282900 // *10ns
|
||||
|
||||
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns
|
||||
#define L1_FRAME_2KBPS_20MS_COMP 1622400 // *10ns
|
||||
#define L1_FRAME_2KBPS_100MS_COMP 1622400 // *10ns
|
||||
@@ -588,7 +578,7 @@ int32_t Phy_SetupNextSlot(PHY_INST* instPtr, PHY_TOR_TYPE txrxMode,
|
||||
return EPARAM;
|
||||
}
|
||||
if (instPtr->isPresetHop == false) {
|
||||
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_Config : hopRxPattern_Config;
|
||||
hopPattern = hopPattern_Config;
|
||||
}
|
||||
else {
|
||||
switch (frameType) {
|
||||
@@ -596,43 +586,43 @@ int32_t Phy_SetupNextSlot(PHY_INST* instPtr, PHY_TOR_TYPE txrxMode,
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_20MS;
|
||||
hopNum = L1_FRAME_2KBPS_20MS_HOPS;
|
||||
// FIXME: For DUIFEI net setup.
|
||||
// hopPattern = (txrxMode == TOR_TX) ? hopTxPattern_2KBPS_20MS : hopRxPattern_2KBPS_20MS;
|
||||
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_2KBPS_100MS : hopRxPattern_2KBPS_100MS;
|
||||
// hopPattern = (txrxMode == TOR_TX) ? hopPattern_2KBPS_20MS;
|
||||
hopPattern = hopPattern_2KBPS_100MS;
|
||||
break;
|
||||
case L1_2KBPS_100MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_100MS;
|
||||
hopNum = L1_FRAME_2KBPS_100MS_HOPS;
|
||||
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_2KBPS_100MS : hopRxPattern_2KBPS_100MS;
|
||||
hopPattern = hopPattern_2KBPS_100MS;
|
||||
break;
|
||||
case L1_10KBPS_10MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_10KBPS_10MS;
|
||||
hopNum = L1_FRAME_10KBPS_10MS_HOPS;
|
||||
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_10KBPS_10MS : hopRxPattern_10KBPS_10MS;
|
||||
hopPattern = hopPattern_10KBPS_10MS;
|
||||
break;
|
||||
case L1_10KBPS_20MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_10KBPS_20MS;
|
||||
hopNum = L1_FRAME_10KBPS_20MS_HOPS;
|
||||
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_10KBPS_20MS : hopRxPattern_10KBPS_20MS;
|
||||
hopPattern = hopPattern_10KBPS_20MS;
|
||||
break;
|
||||
case L1_40KBPS_20MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_200KBPS_5MS;
|
||||
hopNum = L1_FRAME_200KBPS_5MS_HOPS;
|
||||
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_200KBPS_5MS : hopRxPattern_200KBPS_5MS;
|
||||
hopPattern = hopPattern_200KBPS_5MS;
|
||||
break;
|
||||
case L1_40KBPS_10MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_40KBPS_10MS;
|
||||
hopNum = L1_FRAME_40KBPS_10MS_HOPS;
|
||||
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_40KBPS_10MS : hopRxPattern_40KBPS_10MS;
|
||||
hopPattern = hopPattern_40KBPS_10MS;
|
||||
break;
|
||||
case L1_200KBPS_5MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_200KBPS_5MS;
|
||||
hopNum = L1_FRAME_200KBPS_5MS_HOPS;
|
||||
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_200KBPS_5MS : hopRxPattern_200KBPS_5MS;
|
||||
hopPattern = hopPattern_200KBPS_5MS;
|
||||
break;
|
||||
case L1_1M2BPS_5MS_FRAME:
|
||||
phyModeCtrl |= PHY_MODE_CTRL_FRAME_1M2BPS_5MS;
|
||||
hopNum = L1_FRAME_1M2BPS_5MS_HOPS;
|
||||
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_1M2BPS_5MS : hopRxPattern_1M2BPS_5MS;
|
||||
hopPattern = hopPattern_1M2BPS_5MS;
|
||||
break;
|
||||
default:
|
||||
return EPARAM;
|
||||
|
||||
@@ -191,24 +191,15 @@ typedef struct {
|
||||
} PHY_INST;
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
extern uint16_t hopRxPattern_Config[L1_FRAME_MAX_HOPS];
|
||||
extern uint16_t hopTxPattern_Config[L1_FRAME_MAX_HOPS];
|
||||
extern uint16_t hopTxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
|
||||
extern uint16_t hopRxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
|
||||
extern uint16_t hopTxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
|
||||
extern uint16_t hopRxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
|
||||
extern uint16_t hopTxPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
|
||||
extern uint16_t hopRxPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
|
||||
extern uint16_t hopTxPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
|
||||
extern uint16_t hopRxPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
|
||||
extern uint16_t hopTxPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS];
|
||||
extern uint16_t hopRxPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS];
|
||||
extern uint16_t hopTxPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
|
||||
extern uint16_t hopRxPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
|
||||
extern uint16_t hopTxPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
|
||||
extern uint16_t hopRxPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
|
||||
extern uint16_t hopTxPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
|
||||
extern uint16_t hopRxPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
|
||||
extern uint16_t hopPattern_Config[L1_FRAME_MAX_HOPS];
|
||||
extern uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
|
||||
extern uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
|
||||
extern uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
|
||||
extern uint16_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
|
||||
extern uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS];
|
||||
extern uint16_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
|
||||
extern uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
|
||||
extern uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
|
||||
|
||||
extern PHY_ANT_ANGLE antSubnrrwPattern[L1_NUM_ANT_SUBNRRW_PATTERN];
|
||||
extern PHY_ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN];
|
||||
|
||||
Reference in New Issue
Block a user