chore: merge GE program
* merge GE code * update fold structure * enable to build two types of projects separately
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
#include "link_layer.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Insert a data chunk to a bit array.
|
||||
@@ -42,7 +41,7 @@
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void L2_FrameInsertChunk(uint8_t *frame, size_t offset, size_t bytes, const void *chunk)
|
||||
inline void L2_FrameInsertChunk(uint8_t *frame, size_t offset, size_t bytes, const void *chunk)
|
||||
{
|
||||
ASSERT(frame != NULL);
|
||||
ASSERT(chunk != NULL);
|
||||
@@ -61,13 +60,33 @@ void L2_FrameInsertChunk(uint8_t *frame, size_t offset, size_t bytes, const void
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void L2_FrameGetChunk(uint8_t *frame, size_t offset, size_t bytes, void *chunk)
|
||||
inline void L2_FrameGetChunk(uint8_t *frame, size_t offset, size_t bytes, void *chunk)
|
||||
{
|
||||
ASSERT(frame != NULL);
|
||||
ASSERT(chunk != NULL);
|
||||
memcpy(chunk, frame + offset, bytes);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Insert a integer to a bit array.
|
||||
*
|
||||
* @param frame pointer to target bit array.
|
||||
* @param offset offset of insert start position.
|
||||
* @param bytes the number of bytes of integer
|
||||
* @param val data value
|
||||
*
|
||||
* @return NONE
|
||||
*
|
||||
******************************************************************************/
|
||||
void L2_FrameInsertInteger(uint8_t *frame, size_t offset, size_t bytes, uint64_t val)
|
||||
{
|
||||
ASSERT(bytes <= 4 && bytes > 0);
|
||||
uint64_t _val = val;
|
||||
L2_FrameInsertChunk(frame, offset, bytes, &_val);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Generate crc of specified data.
|
||||
|
||||
@@ -27,10 +27,7 @@
|
||||
#include "common.h"
|
||||
#include "util.h"
|
||||
#include "circ_queue.h"
|
||||
#include "../time_ctrl/time_ctrl.h"
|
||||
#ifndef EMULATION
|
||||
#include "../config/app_config.h"
|
||||
#endif
|
||||
#include "time_ctrl/time_ctrl.h"
|
||||
/************************** Constant Definitions *****************************/
|
||||
#define NET_START_TIME_INFTY UINT32_MAX
|
||||
#define LINK_BROCK_THRESHOLD L2_SLOTS_PER_FRAME // 0.5 secods
|
||||
@@ -159,12 +156,18 @@ static void L2_FrameStateUpdate(L2_INST *instPtr)
|
||||
instPtr->log.cfmRecvCnt++;
|
||||
instPtr->log.cfmCorrectCnt = isValid ? instPtr->log.cfmCorrectCnt + 1 : instPtr->log.cfmCorrectCnt;
|
||||
break;
|
||||
case L2_SVC_FRAME:
|
||||
#ifndef DATALINK_ENABLE_BERTEST
|
||||
isValid = L2_CrcCheck(instPtr->recvPktData, L2_SVC_PACK_LEN, L2_CRC16_1021);
|
||||
#else
|
||||
isValid = true;
|
||||
#endif
|
||||
case L2_SVC_2K_FRAME:
|
||||
isValid = L2_CrcCheck(instPtr->recvPktData, L2_SVC_PACK_2K_LEN, L2_CRC16_1021);
|
||||
instPtr->log.svcRecvCnt++;
|
||||
instPtr->log.svcCorrectCnt = isValid ? instPtr->log.svcCorrectCnt + 1 : instPtr->log.svcCorrectCnt;
|
||||
break;
|
||||
case L2_SVC_128K_FRAME:
|
||||
isValid = L2_CrcCheck(instPtr->recvPktData, L2_SVC_PACK_128K_LEN, L2_CRC16_1021);
|
||||
instPtr->log.svcRecvCnt++;
|
||||
instPtr->log.svcCorrectCnt = isValid ? instPtr->log.svcCorrectCnt + 1 : instPtr->log.svcCorrectCnt;
|
||||
break;
|
||||
case L2_SVC_256K_FRAME:
|
||||
isValid = L2_CrcCheck(instPtr->recvPktData, L2_SVC_PACK_256K_LEN, L2_CRC16_1021);
|
||||
instPtr->log.svcRecvCnt++;
|
||||
instPtr->log.svcCorrectCnt = isValid ? instPtr->log.svcCorrectCnt + 1 : instPtr->log.svcCorrectCnt;
|
||||
break;
|
||||
@@ -333,6 +336,15 @@ inline L2_FRAME_TYPE L2_GetCurrentFrameType(L2_INST *instPtr)
|
||||
return instPtr->frame.curr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current working speed mode.
|
||||
*/
|
||||
inline L2_SPEED_MODE L2_GetCurrentSpeedMode(L2_INST *instPtr)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
return instPtr->speedMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the tx/rx state of current slot.
|
||||
*/
|
||||
@@ -422,8 +434,12 @@ L1_FRAME_TYPE L2_L2frame2L1frame(L2_FRAME_TYPE l2Frame)
|
||||
case L2_ADV_FRAME:
|
||||
return L1_10KBPS_20MS_FRAME;
|
||||
case L2_CFM_FRAME:
|
||||
case L2_SVC_FRAME:
|
||||
case L2_SVC_2K_FRAME:
|
||||
return L1_40KBPS_20MS_FRAME;
|
||||
case L2_SVC_128K_FRAME:
|
||||
return L1_200KBPS_5MS_FRAME;
|
||||
case L2_SVC_256K_FRAME:
|
||||
return L1_1M2BPS_5MS_FRAME;
|
||||
default:
|
||||
return L1_NONE_FRAME;
|
||||
}
|
||||
@@ -471,6 +487,7 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
|
||||
|
||||
// Clear random content
|
||||
memset(*instPtr, 0x00, sizeof(L2_INST));
|
||||
(*instPtr)->speedMode = config->speedMode;
|
||||
(*instPtr)->sendPktData = NULL;
|
||||
(*instPtr)->recvPktData = NULL;
|
||||
(*instPtr)->schdEventPool = NULL;
|
||||
@@ -802,8 +819,25 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
|
||||
else if (instPtr->nextState == L2_NORMAL_STATE)
|
||||
{
|
||||
UpdateMainSate(instPtr, L2_NORMAL_STATE);
|
||||
instPtr->rtneConfig.rtneTable = normalTable;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable);
|
||||
switch(L2_GetCurrentSpeedMode(instPtr)){
|
||||
case L2_SPEED_NONE :
|
||||
DBG_WARNING("Speed mode not configured, fallback to 2Kbps mode.\n");
|
||||
case L2_SPEED_2KBPS :
|
||||
instPtr->rtneConfig.rtneTable = normalTable2K;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable2K);
|
||||
break;
|
||||
case L2_SPEED_128KBPS :
|
||||
instPtr->rtneConfig.rtneTable = normalTable128K;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable128K);
|
||||
break;
|
||||
case L2_SPEED_256KBPS :
|
||||
instPtr->rtneConfig.rtneTable = normalTable256K;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable256K);
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("Unknown speed mode %d.\n", instPtr->speedMode);
|
||||
ASSERT(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -856,7 +890,9 @@ int32_t Linklayer_PktHandler(L2_INST *instPtr, L2_FRAME_TYPE frameType)
|
||||
case L2_CFM_FRAME:
|
||||
Status = L2_Scan_PktHandler(instPtr, instPtr->recvPktData);
|
||||
break;
|
||||
case L2_SVC_FRAME:
|
||||
case L2_SVC_2K_FRAME:
|
||||
case L2_SVC_128K_FRAME:
|
||||
case L2_SVC_256K_FRAME:
|
||||
Status = L2_Service_PktHandler(instPtr, instPtr->recvPktData);
|
||||
break;
|
||||
default:
|
||||
@@ -880,7 +916,6 @@ static int32_t IntcNodeTTL(NODE_ENTRY *node, const void *param)
|
||||
/**
|
||||
* @brief Utility function to check connection to node is still valid.
|
||||
*/
|
||||
#ifdef DATALINK_ENABLE_AUTORECONNECT
|
||||
static bool IsNodeConnected(NODE_ENTRY *node)
|
||||
{
|
||||
ASSERT(node != NULL);
|
||||
@@ -895,7 +930,6 @@ static bool IsNodeConnected(NODE_ENTRY *node)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
@@ -937,7 +971,9 @@ static int32_t Linklayer_Routine(L2_INST *instPtr)
|
||||
case L2_SLOT_CONFIRM:
|
||||
Status = L2_Scan_Routine(instPtr, &rtneEntry);
|
||||
break;
|
||||
case L2_SLOT_SERVICE:
|
||||
case L2_SLOT_SERVICE_2K:
|
||||
case L2_SLOT_SERVICE_128K:
|
||||
case L2_SLOT_SERVICE_256K:
|
||||
Status = L2_Service_Routine(instPtr, &rtneEntry);
|
||||
break;
|
||||
default:
|
||||
@@ -956,7 +992,7 @@ static int32_t Linklayer_Routine(L2_INST *instPtr)
|
||||
uint32_t increment = 1;
|
||||
L2_IterEditNode(instPtr->nodeList, &increment, IntcNodeTTL);
|
||||
|
||||
#ifdef DATALINK_ENABLE_AUTORECONNECT
|
||||
//#ifdef DATALINK_ENABLE_AUTORECONNECT
|
||||
if (L2_GetMainState(instPtr) != L2_INIT_STATE)
|
||||
{
|
||||
L2_IterDeleteNode(instPtr->nodeList, IsNodeConnected);
|
||||
@@ -970,7 +1006,7 @@ static int32_t Linklayer_Routine(L2_INST *instPtr)
|
||||
AssertL2Event(instPtr, &l2Event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -1165,7 +1201,7 @@ int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
|
||||
ASSERT(instPtr != NULL);
|
||||
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||
int32_t Status;
|
||||
if (frameType < L2_SCAN_FRAME || frameType > L2_SVC_FRAME)
|
||||
if (frameType < L2_SCAN_FRAME || frameType > L2_SVC_256K_FRAME)
|
||||
{
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -1182,7 +1218,9 @@ int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
|
||||
case L2_CFM_FRAME:
|
||||
instPtr->log.cfmTxCnt++;
|
||||
break;
|
||||
case L2_SVC_FRAME:
|
||||
case L2_SVC_2K_FRAME:
|
||||
case L2_SVC_128K_FRAME:
|
||||
case L2_SVC_256K_FRAME:
|
||||
instPtr->log.svcTxCnt++;
|
||||
break;
|
||||
default:
|
||||
@@ -1200,7 +1238,9 @@ int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
|
||||
case L2_CFM_FRAME:
|
||||
instPtr->log.cfmRxCnt++;
|
||||
break;
|
||||
case L2_SVC_FRAME:
|
||||
case L2_SVC_2K_FRAME:
|
||||
case L2_SVC_128K_FRAME:
|
||||
case L2_SVC_256K_FRAME:
|
||||
instPtr->log.svcRxCnt++;
|
||||
break;
|
||||
default:
|
||||
@@ -1284,5 +1324,16 @@ int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
int32_t Linklayer_UpdateSpeedMode(L2_INST *instPtr, L2_SPEED_MODE mode) {
|
||||
ASSERT(instPtr != NULL);
|
||||
if(mode < L2_SPEED_2KBPS || mode > L2_SPEED_256KBPS){
|
||||
DBG_ERROR("Unsurpport speed mode, %d.\n", mode);
|
||||
return EIGNORE;
|
||||
}
|
||||
instPtr->speedMode = mode;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/** @} LinkLayer_Main*/
|
||||
/** @} LinkLayer*/
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "schdevent.h"
|
||||
#include "node_list.h"
|
||||
#include "circ_queue.h"
|
||||
#include "../phy_layer/phy_layer.h"
|
||||
#include "../../system_monitor.h"
|
||||
#include "networking/phy_layer/phy_layer.h"
|
||||
#include "system_monitor.h"
|
||||
/************************** Constant Definitions *****************************/
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
#define AssertL2Event(instPtr, event) (Linklayer_EventHandler((instPtr), (event)))
|
||||
@@ -45,6 +45,9 @@ typedef struct
|
||||
uint8_t netScale; ///< net scale
|
||||
PHY_INST *phyInstPtr; ///< pointer to system physical layer instance
|
||||
TMC_INST *tmcInstPtr; ///< pointer to system timer controller layer instance
|
||||
L2_SPEED_MODE speedMode;///< service speed mode
|
||||
PUSHUP_HANDLE pushUpHandle;
|
||||
POPUP_HANDLE popUpHandle;
|
||||
} L2_CONFIG;
|
||||
|
||||
/**
|
||||
@@ -104,6 +107,7 @@ typedef struct
|
||||
L2_RTNE_CONFIG rtneConfig; ///< current routine table configuration and status.
|
||||
L2_SCAN_FSM *scanFSM; ///< FSM of scan net (link set up)
|
||||
L2_SVC_FSM *serviceFSM; ///< FSM of service net (data service)
|
||||
L2_SPEED_MODE speedMode;
|
||||
uint8_t *sendPktData; ///< send data buffer
|
||||
uint8_t *recvPktData; ///< received data buffer
|
||||
L2_LOG log; ///< Linklayer operating log
|
||||
@@ -114,7 +118,9 @@ typedef struct
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
extern L2_RTNE_TABLE_ENTRY *initTable[L2_INIT_RTNE_PERIOD];
|
||||
extern L2_RTNE_TABLE_ENTRY *normalTable[L2_NORMAL_RTNE_PERIOD];
|
||||
extern L2_RTNE_TABLE_ENTRY *normalTable2K[L2_NORMAL_RTNE_PERIOD];
|
||||
extern L2_RTNE_TABLE_ENTRY *normalTable128K[L2_NORMAL_RTNE_PERIOD];
|
||||
extern L2_RTNE_TABLE_ENTRY *normalTable256K[L2_NORMAL_RTNE_PERIOD];
|
||||
/************************** Function Prototypes ******************************/
|
||||
/**
|
||||
* @defgroup LinkLayer_Main
|
||||
@@ -130,6 +136,7 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event);
|
||||
int32_t Linklayer_PktHandler(L2_INST *instPtr, L2_FRAME_TYPE frameType);
|
||||
int32_t L2_SteerBeam2Node(L2_INST *instPtr, uint8_t nodeId);
|
||||
int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE frameType);
|
||||
int32_t Linklayer_UpdateSpeedMode(L2_INST *instPtr, L2_SPEED_MODE mode);
|
||||
/** @} LinkLayer_Main*/
|
||||
|
||||
/**
|
||||
@@ -138,6 +145,7 @@ int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE f
|
||||
*/
|
||||
void L2_FrameInsertChunk(uint8_t *frame, size_t offset, size_t bytes, const void *chunk);
|
||||
void L2_FrameGetChunk(uint8_t *frame, size_t offset, size_t bytes, void *chunk);
|
||||
void L2_FrameInsertInteger(uint8_t *frame, size_t offset, size_t bytes, uint64_t val);
|
||||
int32_t L2_CrcAppend(uint8_t *dataBuff, uint32_t dataLen, uint32_t crcPos, L2_CRC_TYPE crcType);
|
||||
bool L2_CrcCheck(uint8_t *dataBuff, uint32_t dataLen, L2_CRC_TYPE crcType);
|
||||
/** @} LinkLayer_Framing*/
|
||||
@@ -174,7 +182,6 @@ int32_t L2_Service_Init(L2_SVC_FSM **svcFSMPtr);
|
||||
void L2_Service_Reset(L2_SVC_FSM *svcFSMPtr);
|
||||
void L2_Service_Destroy(L2_SVC_FSM *svcFSMPtr);
|
||||
int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg);
|
||||
int32_t L2_Service_Proc(L2_INST *instPtr);
|
||||
int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *schedEntry);
|
||||
/** @} LinkLayer_Service*/
|
||||
|
||||
@@ -206,6 +213,7 @@ L2_TOR_TYPE L2_GetLastTor(L2_INST *instPtr);
|
||||
uint32_t L2_GetCurrentFrameNum(L2_INST *instPtr);
|
||||
uint32_t L2_GetCurrentSlotNum(L2_INST *instPtr);
|
||||
L2_FRAME_TYPE L2_GetCurrentFrameType(L2_INST *instPtr);
|
||||
L2_SPEED_MODE L2_GetCurrentSpeedMode(L2_INST *instPtr);
|
||||
L2_TOR_TYPE L2_GetCurrentTor(L2_INST *instPtr);
|
||||
uint32_t L2_GetNextFrameNum(L2_INST *instPtr);
|
||||
uint32_t L2_GetNextSlotNum(L2_INST *instPtr);
|
||||
@@ -213,8 +221,9 @@ L2_FRAME_TYPE L2_GetNextFrameType(L2_INST *instPtr);
|
||||
L2_TOR_TYPE L2_GetNextTor(L2_INST *instPtr);
|
||||
L2_FRAME_TYPE L2_GetLastOptFrameType(L2_INST *instPtr);
|
||||
L1_FRAME_TYPE L2_L2frame2L1frame(L2_FRAME_TYPE l2Frame);
|
||||
|
||||
/** @} LinkLayer_Utility*/
|
||||
|
||||
#endif /* __LINK_LAYER_H_ */
|
||||
|
||||
/** @} LinkLayer*/
|
||||
/** @} LinkLayer*/
|
||||
|
||||
@@ -21,12 +21,10 @@
|
||||
/***************************** Include Files *********************************/
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "ring_buffer.h"
|
||||
#include "geometry/coord.h"
|
||||
#include "geometry/quaternion.h"
|
||||
#include "../phy_layer/phy_layer.h"
|
||||
#ifndef EMULATION
|
||||
#include "../config/app_config.h"
|
||||
#endif
|
||||
#include "networking/phy_layer/phy_layer.h"
|
||||
/************************** Constant Definitions *****************************/
|
||||
/**
|
||||
* @name Linklayer_Common_Constants
|
||||
@@ -158,7 +156,9 @@ typedef enum
|
||||
L2_SLOT_SCAN = 2,
|
||||
L2_SLOT_ADVERTISE = 3,
|
||||
L2_SLOT_CONFIRM = 4,
|
||||
L2_SLOT_SERVICE = 5,
|
||||
L2_SLOT_SERVICE_2K = 5,
|
||||
L2_SLOT_SERVICE_128K = 6,
|
||||
L2_SLOT_SERVICE_256K = 7,
|
||||
} L2_SLOT_TYPE;
|
||||
|
||||
/**
|
||||
@@ -170,9 +170,22 @@ typedef enum
|
||||
L2_SCAN_FRAME = 1,
|
||||
L2_ADV_FRAME = 2,
|
||||
L2_CFM_FRAME = 3,
|
||||
L2_SVC_FRAME = 4
|
||||
L2_SVC_2K_FRAME = 4,
|
||||
L2_SVC_128K_FRAME = 5,
|
||||
L2_SVC_256K_FRAME = 6
|
||||
} L2_FRAME_TYPE;
|
||||
|
||||
/**
|
||||
* @enum L2_SPEED_MODE
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
L2_SPEED_NONE = 0,
|
||||
L2_SPEED_2KBPS = 1,
|
||||
L2_SPEED_128KBPS = 2,
|
||||
L2_SPEED_256KBPS = 3,
|
||||
} L2_SPEED_MODE;
|
||||
|
||||
/**
|
||||
* @enum L2_CRC_TYPE
|
||||
*/
|
||||
@@ -234,12 +247,10 @@ typedef struct
|
||||
uint32_t txCnt; ///< tx frame count
|
||||
uint32_t rxCnt; ///< rx frame count
|
||||
uint32_t rxdCnt; ///< received frame count
|
||||
#ifdef DATALINK_ENABLE_BERTEST
|
||||
uint32_t bitTotal; ///< received bits count
|
||||
uint32_t bitError; ///< error bits count
|
||||
double lossRate; ///< packet loss rate
|
||||
double errorRate; ///< bit error rate
|
||||
#endif
|
||||
uint8_t currTxSeq; ///< seqid of current tx frame sub-packet
|
||||
uint8_t currRxSeq; ///< seqid of current rx frame sub-packet
|
||||
RING_BUFFER *currTxBuff; ///< a ring buffer to store data to be sent
|
||||
RING_BUFFER *currRxBuff; ///< a ring buffer to store data received
|
||||
} L2_SVC_FSM;
|
||||
|
||||
/**
|
||||
@@ -255,8 +266,12 @@ typedef struct
|
||||
L2_RTNE_TABLE_ENTRY *next; ///< next routine entry
|
||||
} L2_RTNE_CONFIG;
|
||||
|
||||
|
||||
typedef bool (*PUSHUP_HANDLE) (RING_BUFFER *buff);
|
||||
typedef bool (*POPUP_HANDLE) (RING_BUFFER **buff);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
#endif /* __LINK_LAYER_DEF_H_ */
|
||||
|
||||
/** @} LinkLayer*/
|
||||
/** @} LinkLayer*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @file msg_def.c
|
||||
* @file msg_def.h
|
||||
* @author FanHao ([email protected])
|
||||
* @brief DF Linklayer message definition constants.
|
||||
* @version 0.0
|
||||
@@ -20,14 +20,34 @@
|
||||
* @name LinkLayer_MSG_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __L2_MSG_DEF_H_
|
||||
#define __L2_MSG_DEF_H_
|
||||
|
||||
#include "link_layer.h"
|
||||
|
||||
#define L2_PACK_LEN_MAX 512 // bytes
|
||||
|
||||
#define L2_ADV_PACK_LEN 28 // bytes
|
||||
#define L2_CMF_PACK_LEN 268 // bytes
|
||||
#define L2_SVC_PACK_LEN 268 // bytes
|
||||
#define L2_SVC_PACK_2K_LEN 30 // bytes: 16(128b) payload + 12 head + 2 crc
|
||||
#define L2_SVC_PACK_128K_LEN 174 // bytes: 160(1280b) payload + 12 head + 2 crc
|
||||
#define L2_SVC_PACK_256K_LEN 334 // bytes: 320(2560b) payload + 12 head + 2 crc
|
||||
|
||||
#define L2_ASSEMBLE_INTEGER(buff, offset, val) { \
|
||||
L2_FrameInsertInteger(buff, offset, offset##_LEN, val); \
|
||||
}
|
||||
#define L2_ASSEMBLE_FLOAT(buff, offset, ptr) { \
|
||||
L2_FrameInsertChunk(buff, offset, sizeof(float), ptr); \
|
||||
}
|
||||
#define L2_ASSEMBLE_DOUBLE(buff, offset, ptr) { \
|
||||
L2_FrameInsertChunk(buff, offset, sizeof(double), ptr); \
|
||||
}
|
||||
|
||||
#define L2_DEASSEMBLE(buff, offset, ptr) { \
|
||||
L2_FrameGetChunk(buff, offset, offset##_LEN, ptr); \
|
||||
}
|
||||
|
||||
// Common structure:
|
||||
// [bytes] [name]
|
||||
@@ -96,35 +116,20 @@
|
||||
|
||||
// service payload structure:
|
||||
// [bytes] [name]
|
||||
// 4 position x
|
||||
// 4 position y
|
||||
// 4 position z
|
||||
// 4 speed x
|
||||
// 4 speed y
|
||||
// 4 speed z
|
||||
// 234 payload
|
||||
// 2 crc
|
||||
#define L2_MSG_SVC_SRC_POSX 8
|
||||
#define L2_MSG_SVC_SRC_POSX_LEN 4
|
||||
#define L2_MSG_SVC_SRC_POSY 12
|
||||
#define L2_MSG_SVC_SRC_POSY_LEN 4
|
||||
#define L2_MSG_SVC_SRC_POSZ 16
|
||||
#define L2_MSG_SVC_SRC_POSZ_LEN 4
|
||||
#define L2_MSG_SVC_SRC_SPEEDX 20
|
||||
#define L2_MSG_SVC_SRC_SPEEDX_LEN 4
|
||||
#define L2_MSG_SVC_SRC_SPEEDY 24
|
||||
#define L2_MSG_SVC_SRC_SPEEDY_LEN 4
|
||||
#define L2_MSG_SVC_SRC_SPEEDZ 28
|
||||
#define L2_MSG_SVC_SRC_SPEEDZ_LEN 4
|
||||
#define L2_MSG_SVC_PAYLOAD_ID 32
|
||||
#define L2_MSG_SVC_PAYLOAD_ID_LEN 4
|
||||
#define L2_MSG_SVC_PAYLOAD 36
|
||||
#define L2_MSG_SVC_PAYLOAD_LEN 230
|
||||
#define L2_MSG_SVC_CRC 266
|
||||
// 1 packet flag
|
||||
// 1 packet id
|
||||
// 2 data length
|
||||
#define L2_MSG_SVC_PKTFLG 8 // 0-no subpacket, 1-subpacket 2-last subpacket
|
||||
#define L2_MSG_SVC_PKTFLG_LEN 1
|
||||
#define L2_MSG_SVC_PKTID 9
|
||||
#define L2_MSG_SVC_PKTID_LEN 1
|
||||
#define L2_MSG_SVC_DLEN 10
|
||||
#define L2_MSG_SVC_DLEN_LEN 2
|
||||
#define L2_MSG_SVC_PAYLOAD 12
|
||||
#define L2_MSG_SVC_CRC_LEN 2
|
||||
|
||||
#endif //__L2_MSG_DEF_H_
|
||||
|
||||
/** @} LinkLayer_MSG_Constants*/
|
||||
|
||||
/** @} LinkLayer*/
|
||||
/** @} LinkLayer*/
|
||||
|
||||
@@ -137,127 +137,362 @@ L2_RTNE_TABLE_ENTRY intraScanSubT[L2_SLOTS_PER_FRAME] = {
|
||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
||||
};
|
||||
|
||||
L2_RTNE_TABLE_ENTRY normalSub[L2_SLOTS_PER_FRAME] = {
|
||||
L2_RTNE_TABLE_ENTRY normalSub2K[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_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x03, 0x02, 0x01},
|
||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
||||
|
||||
// SubFrame 1
|
||||
{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_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x03, 0x02, 0x01},
|
||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
||||
|
||||
// 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_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x03, 0x02, 0x01},
|
||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
||||
|
||||
// SubFrame 3
|
||||
{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_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x03, 0x02, 0x01},
|
||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
||||
|
||||
// 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_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_2K, 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_SERVICE_2K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x01, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x02, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_2K, 0x03, 0x02, 0x01},
|
||||
{L2_SLOT_IDLE, 0x00, 0x00, 0x00},
|
||||
};
|
||||
|
||||
|
||||
L2_RTNE_TABLE_ENTRY normalSub128K[L2_SLOTS_PER_FRAME] = {
|
||||
// SubFrame 0
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
|
||||
// SubFrame 1
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
|
||||
// SubFrame 2
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
|
||||
// SubFrame 3
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
|
||||
// SubFrame 4
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_128K, 0x00, 0x02, 0x01},
|
||||
};
|
||||
|
||||
L2_RTNE_TABLE_ENTRY normalSub256K[L2_SLOTS_PER_FRAME] = {
|
||||
// SubFrame 0
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
|
||||
// SubFrame 1
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
|
||||
// SubFrame 2
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
|
||||
// SubFrame 3
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
|
||||
// SubFrame 4
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x01, 0x02},
|
||||
{L2_SLOT_SERVICE_256K, 0x00, 0x02, 0x01},
|
||||
};
|
||||
|
||||
L2_RTNE_TABLE_ENTRY *initTable[L2_INIT_RTNE_PERIOD] =
|
||||
{
|
||||
intraScanSubT
|
||||
};
|
||||
|
||||
L2_RTNE_TABLE_ENTRY *normalTable[L2_NORMAL_RTNE_PERIOD] =
|
||||
L2_RTNE_TABLE_ENTRY *normalTable2K[L2_NORMAL_RTNE_PERIOD] =
|
||||
{
|
||||
normalSub
|
||||
normalSub2K
|
||||
};
|
||||
|
||||
L2_RTNE_TABLE_ENTRY *normalTable128K[L2_NORMAL_RTNE_PERIOD] =
|
||||
{
|
||||
normalSub128K
|
||||
};
|
||||
|
||||
L2_RTNE_TABLE_ENTRY *normalTable256K[L2_NORMAL_RTNE_PERIOD] =
|
||||
{
|
||||
normalSub256K
|
||||
};
|
||||
|
||||
/** @} RoutineTable*/
|
||||
/** @} LinkLayer*/
|
||||
/** @} LinkLayer*/
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "node_list.h"
|
||||
#include "error.h"
|
||||
#include "common.h"
|
||||
#include "../phy_layer/phy_layer.h"
|
||||
#include "networking/phy_layer/phy_layer.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
#define ADV_LISTEN_TIMEOUT 40
|
||||
@@ -357,7 +357,6 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
int32_t Status;
|
||||
uint32_t dataChunk;
|
||||
uint8_t *buff = instPtr->sendPktData;
|
||||
if ((type < L2_ADV_FRAME) || (type > L2_CFM_FRAME))
|
||||
{
|
||||
@@ -366,70 +365,49 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
||||
}
|
||||
|
||||
// Common section of link layer package
|
||||
dataChunk = L2_GetNextFrameNum(instPtr);
|
||||
L2_FrameInsertChunk(buff, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &dataChunk);
|
||||
dataChunk = L2_GetNextSlotNum(instPtr);
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SLOT_NUM, L2_MSG_SLOT_NUM_LEN, &dataChunk);
|
||||
dataChunk = L2_GetNodeId(instPtr);
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SRC_ID, L2_MSG_SRC_ID_LEN, &dataChunk);
|
||||
dataChunk = dstId;
|
||||
L2_FrameInsertChunk(buff, L2_MSG_DST_ID, L2_MSG_DST_ID_LEN, &dataChunk);
|
||||
L2_ASSEMBLE_INTEGER(buff, L2_MSG_FRAME_NUM, L2_GetNextFrameNum(instPtr));
|
||||
L2_ASSEMBLE_INTEGER(buff, L2_MSG_SLOT_NUM, L2_GetNextSlotNum(instPtr));
|
||||
L2_ASSEMBLE_INTEGER(buff, L2_MSG_SRC_ID, L2_GetNodeId(instPtr));
|
||||
L2_ASSEMBLE_INTEGER(buff, L2_MSG_DST_ID, dstId);
|
||||
switch (type)
|
||||
{
|
||||
case L2_ADV_FRAME:
|
||||
{
|
||||
dataChunk = L2_ADV_FRAME;
|
||||
L2_FrameInsertChunk(buff, L2_MSG_TYPE, L2_MSG_TYPE_LEN, &dataChunk);
|
||||
L2_ASSEMBLE_INTEGER(buff, L2_MSG_TYPE, L2_ADV_FRAME);
|
||||
|
||||
SysMonitor_GetSysinfo(&(instPtr->sysInfo));
|
||||
// insert position and speed info
|
||||
L2_FrameInsertChunk(buff, L2_MSG_ADV_SRC_POSX, L2_MSG_ADV_SRC_POSX_LEN, &(instPtr->sysInfo.posX));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_ADV_SRC_POSY, L2_MSG_ADV_SRC_POSY_LEN, &(instPtr->sysInfo.posY));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_ADV_SRC_POSZ, L2_MSG_ADV_SRC_POSZ_LEN, &(instPtr->sysInfo.posZ));
|
||||
L2_ASSEMBLE_FLOAT(buff, L2_MSG_ADV_SRC_POSX, &(instPtr->sysInfo.posX));
|
||||
L2_ASSEMBLE_FLOAT(buff, L2_MSG_ADV_SRC_POSY, &(instPtr->sysInfo.posY));
|
||||
L2_ASSEMBLE_FLOAT(buff, L2_MSG_ADV_SRC_POSZ, &(instPtr->sysInfo.posZ));
|
||||
|
||||
// Insert net start time
|
||||
L2_FrameInsertChunk(buff, L2_MSG_ADV_SRC_NETSTART_TIME, L2_MSG_ADV_SRC_NETSTART_TIME_LEN, &(instPtr->netStartTime));
|
||||
L2_ASSEMBLE_INTEGER(buff, L2_MSG_ADV_SRC_NETSTART_TIME, instPtr->netStartTime);
|
||||
|
||||
// Append CRC
|
||||
Status = L2_CrcAppend(buff, L2_ADV_PACK_LEN - L2_MSG_ADV_SVC_CRC_LEN, L2_MSG_ADV_SVC_CRC, L2_CRC16_1021);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
|
||||
return Status;
|
||||
ASSERT(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case L2_CFM_FRAME:
|
||||
{
|
||||
dataChunk = L2_CFM_FRAME;
|
||||
L2_FrameInsertChunk(buff, L2_MSG_TYPE, L2_MSG_TYPE_LEN, &dataChunk);
|
||||
L2_ASSEMBLE_INTEGER(buff, L2_MSG_TYPE, L2_CFM_FRAME);
|
||||
|
||||
SysMonitor_GetSysinfo(&(instPtr->sysInfo));
|
||||
// insert position and speed info
|
||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_POSX, L2_MSG_CFM_SRC_POSX_LEN, &(instPtr->sysInfo.posX));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_POSY, L2_MSG_CFM_SRC_POSY_LEN, &(instPtr->sysInfo.posY));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_POSZ, L2_MSG_CFM_SRC_POSZ_LEN, &(instPtr->sysInfo.posZ));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_SPEEDX, L2_MSG_CFM_SRC_SPEEDX_LEN, &(instPtr->sysInfo.vX));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_SPEEDY, L2_MSG_CFM_SRC_SPEEDY_LEN, &(instPtr->sysInfo.vY));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_SPEEDZ, L2_MSG_CFM_SRC_SPEEDZ_LEN, &(instPtr->sysInfo.vZ));
|
||||
L2_ASSEMBLE_FLOAT(buff, L2_MSG_CFM_SRC_POSX, &(instPtr->sysInfo.posX));
|
||||
L2_ASSEMBLE_FLOAT(buff, L2_MSG_CFM_SRC_POSY, &(instPtr->sysInfo.posY));
|
||||
L2_ASSEMBLE_FLOAT(buff, L2_MSG_CFM_SRC_POSZ, &(instPtr->sysInfo.posZ));
|
||||
L2_ASSEMBLE_FLOAT(buff, L2_MSG_CFM_SRC_SPEEDX, &(instPtr->sysInfo.vX));
|
||||
L2_ASSEMBLE_FLOAT(buff, L2_MSG_CFM_SRC_SPEEDY, &(instPtr->sysInfo.vY));
|
||||
L2_ASSEMBLE_FLOAT(buff, L2_MSG_CFM_SRC_SPEEDZ, &(instPtr->sysInfo.vZ));
|
||||
|
||||
// Packing extra payload
|
||||
uint32_t dataId;
|
||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||
{
|
||||
SysMonitor_GetSendPayload(buff + L2_MSG_CFM_PAYLOAD, &dataId, PAYLOAD_LEN_FLJ_TX);
|
||||
}
|
||||
else
|
||||
{
|
||||
SysMonitor_GetSendPayload(buff + L2_MSG_CFM_PAYLOAD, &dataId, PAYLOAD_LEN_LJ_TX);
|
||||
}
|
||||
|
||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_PAYLOAD_ID, L2_MSG_CFM_PAYLOAD_ID_LEN, &dataId);
|
||||
if (dataId == DATA_ID_NONE)
|
||||
{
|
||||
memset(buff + L2_MSG_CFM_PAYLOAD, 0xAA, L2_MSG_CFM_PAYLOAD_LEN);
|
||||
}
|
||||
|
||||
memset(buff + L2_MSG_CFM_PAYLOAD, 0xAA, L2_MSG_CFM_PAYLOAD_LEN);
|
||||
// Append CRC
|
||||
Status = L2_CrcAppend(buff, L2_CMF_PACK_LEN - L2_MSG_CFM_CRC_LEN, L2_MSG_CFM_CRC, L2_CRC16_1021);
|
||||
if (Status != SUCCESS)
|
||||
@@ -437,10 +415,6 @@ 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);
|
||||
return Status;
|
||||
}
|
||||
|
||||
// Logging...
|
||||
memcpy(instPtr->log.txLog.data, buff, L2_CMF_PACK_LEN);
|
||||
instPtr->log.txLog.dataId = dataId;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -469,7 +443,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
int32_t Status;
|
||||
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
||||
L2_FRAME_TYPE frameType = L2_NONE_FRAME;
|
||||
L2_FrameGetChunk(msg, L2_MSG_TYPE, L2_MSG_TYPE_LEN, &frameType);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_TYPE, &frameType);
|
||||
switch (frameType)
|
||||
{
|
||||
case L2_SCAN_FRAME:
|
||||
@@ -487,7 +461,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
break;
|
||||
}
|
||||
uint8_t nodeId;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SRC_ID, L2_MSG_SRC_ID_LEN, &nodeId);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_SRC_ID, &nodeId);
|
||||
NODE_ENTRY *node;
|
||||
node = L2_GetNodeById(instPtr->nodeList, nodeId);
|
||||
if (node == NULL)
|
||||
@@ -502,11 +476,11 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
}
|
||||
// Update node info.
|
||||
float nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_ADV_SRC_POSX, L2_MSG_ADV_SRC_POSX_LEN, &nodePos);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_ADV_SRC_POSX, &nodePos);
|
||||
node->nodeInfo.pos.x = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_ADV_SRC_POSY, L2_MSG_ADV_SRC_POSY_LEN, &nodePos);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_ADV_SRC_POSY, &nodePos);
|
||||
node->nodeInfo.pos.y = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_ADV_SRC_POSZ, L2_MSG_ADV_SRC_POSZ_LEN, &nodePos);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_ADV_SRC_POSZ, &nodePos);
|
||||
node->nodeInfo.pos.z = (double)nodePos;
|
||||
node->nodeInfo.beamNo = Phy_LastScanBeamNo(instPtr->config.phyInstPtr);
|
||||
|
||||
@@ -515,7 +489,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
|
||||
uint32_t netstartTime;
|
||||
// Update net start time.
|
||||
L2_FrameGetChunk(msg, L2_MSG_ADV_SRC_NETSTART_TIME, L2_MSG_ADV_SRC_NETSTART_TIME_LEN, &netstartTime);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_ADV_SRC_NETSTART_TIME, &netstartTime);
|
||||
L2_EVENT netSetupDoneEvent = {
|
||||
.event = L2_EV_NET_ADV_UPDATE,
|
||||
.msg = &netstartTime};
|
||||
@@ -523,8 +497,8 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
|
||||
// Calculate time deviation
|
||||
uint32_t frameNum, slotNum = 0;
|
||||
L2_FrameGetChunk(msg, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &frameNum);
|
||||
L2_FrameGetChunk(msg, L2_MSG_SLOT_NUM, L2_MSG_SLOT_NUM_LEN, &slotNum);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_FRAME_NUM, &frameNum);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_SLOT_NUM, &slotNum);
|
||||
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
@@ -543,7 +517,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
case L2_CFM_FRAME:
|
||||
{
|
||||
uint8_t nodeId;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SRC_ID, L2_MSG_SRC_ID_LEN, &nodeId);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_SRC_ID, &nodeId);
|
||||
NODE_ENTRY *node;
|
||||
node = L2_GetNodeById(instPtr->nodeList, nodeId);
|
||||
if (node == NULL)
|
||||
@@ -558,18 +532,18 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
}
|
||||
// Update node info.
|
||||
float nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_POSX, L2_MSG_CFM_SRC_POSX_LEN, &nodePos);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_CFM_SRC_POSX, &nodePos);
|
||||
node->nodeInfo.pos.x = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_POSY, L2_MSG_CFM_SRC_POSY_LEN, &nodePos);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_CFM_SRC_POSY, &nodePos);
|
||||
node->nodeInfo.pos.y = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_POSZ, L2_MSG_CFM_SRC_POSZ_LEN, &nodePos);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_CFM_SRC_POSZ, &nodePos);
|
||||
node->nodeInfo.pos.z = (double)nodePos;
|
||||
float nodeSpeed;
|
||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_SPEEDX, L2_MSG_CFM_SRC_SPEEDX_LEN, &nodeSpeed);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_CFM_SRC_SPEEDX, &nodeSpeed);
|
||||
node->nodeInfo.speed.x = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_SPEEDY, L2_MSG_CFM_SRC_SPEEDY_LEN, &nodeSpeed);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_CFM_SRC_SPEEDY, &nodeSpeed);
|
||||
node->nodeInfo.speed.y = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_SPEEDZ, L2_MSG_CFM_SRC_SPEEDZ_LEN, &nodeSpeed);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_CFM_SRC_SPEEDZ, &nodeSpeed);
|
||||
node->nodeInfo.speed.z = (double)nodePos;
|
||||
|
||||
// Reset node ttl
|
||||
@@ -577,8 +551,8 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
|
||||
// Calculate time deviation
|
||||
uint32_t frameNum, slotNum = 0;
|
||||
L2_FrameGetChunk(msg, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &frameNum);
|
||||
L2_FrameGetChunk(msg, L2_MSG_SLOT_NUM, L2_MSG_SLOT_NUM_LEN, &slotNum);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_FRAME_NUM, &frameNum);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_SLOT_NUM, &slotNum);
|
||||
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
@@ -625,24 +599,6 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
(void)AssertL2Event(instPtr, &l2Event);
|
||||
}
|
||||
}
|
||||
|
||||
// Get data payload
|
||||
uint32_t dataId;
|
||||
L2_FrameGetChunk(msg, L2_MSG_CFM_PAYLOAD_ID, L2_MSG_CFM_PAYLOAD_ID_LEN, &dataId);
|
||||
|
||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||
{
|
||||
SysMonitor_UpdateRecvPayload(msg + L2_MSG_CFM_PAYLOAD, dataId, PAYLOAD_LEN_FLJ_RX);
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
||||
+235
-221
@@ -28,51 +28,69 @@
|
||||
#include "error.h"
|
||||
#include "common.h"
|
||||
#include "circ_queue.h"
|
||||
#ifndef EMULATION
|
||||
#include "../config/app_config.h"
|
||||
#endif
|
||||
/************************** Constant Definitions *****************************/
|
||||
#define SERVICE_MAX 1024
|
||||
#define PAYLOAD_LEN_2K (128/8) //Byte
|
||||
#define PAYLOAD_LEN_128K (1280/8) //Byte
|
||||
#define PAYLOAD_LEN_256K (2560/8) //Byte
|
||||
#define PACKET_TYPE_NONE 0
|
||||
#define PACKET_TYPE_SINGLE 1
|
||||
#define PACKET_TYPE_SUBPKT 2
|
||||
#define PACKET_TYPE_LASTPKT 3
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
/**************************** Type Definitions *******************************/
|
||||
/************************** Function Prototypes ******************************/
|
||||
static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dstId);
|
||||
static inline bool prepareCurrRx(L2_INST *instPtr);
|
||||
static inline void resetCurrRx(L2_INST *instPtr);
|
||||
static inline bool uploadCurrRx(L2_INST *instPtr);
|
||||
static inline bool updateCurrTx(L2_INST *instPtr);
|
||||
/************************** Variable Definitions *****************************/
|
||||
static inline bool prepareCurrRx(L2_INST *instPtr) {
|
||||
ASSERT(instPtr != NULL);
|
||||
if(instPtr->serviceFSM->currRxBuff != NULL) {
|
||||
return true;
|
||||
}
|
||||
instPtr->serviceFSM->currRxBuff = RingBuff_Create(SERVICE_MAX);
|
||||
if(instPtr->serviceFSM->currRxBuff == NULL)
|
||||
{
|
||||
DBG_ERROR("Not enough space to initialize serviceFSM->currRxBuff ring buffer...\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint8_t testData[L2_PACK_LEN_MAX] =
|
||||
{
|
||||
0x39, 0x85, 0x02, 0xF0, 0xC7, 0x6A, 0xE8, 0xB4, 0xE7, 0xAB, 0xC9, 0xDC, 0x0B, 0x41, 0x42, 0xE0,
|
||||
0xED, 0x21, 0x07, 0x62, 0x4E, 0x80, 0xA0, 0xE1, 0xAC, 0x77, 0x9B, 0x1F, 0x48, 0x0B, 0x58, 0xB9,
|
||||
0x45, 0xA5, 0x24, 0xEF, 0xF3, 0x71, 0x2E, 0x84, 0x6C, 0x22, 0xB3, 0x05, 0xEB, 0x75, 0xF2, 0x0B,
|
||||
0x45, 0x73, 0x01, 0xA8, 0x1E, 0x00, 0x21, 0x3E, 0x03, 0x86, 0x55, 0x59, 0x98, 0x5C, 0x61, 0xA2,
|
||||
0xE8, 0x20, 0x0E, 0x7A, 0xD5, 0x72, 0xAF, 0xF4, 0xBC, 0xB3, 0x6F, 0xFE, 0xB3, 0x78, 0x6A, 0x59,
|
||||
0x73, 0xBD, 0x97, 0xBE, 0x44, 0xA4, 0x9B, 0x71, 0x11, 0x45, 0x37, 0xFE, 0xB3, 0x71, 0xEF, 0x1E,
|
||||
0x3A, 0x2B, 0x58, 0x07, 0xF6, 0x01, 0x1C, 0x73, 0x28, 0x11, 0xA8, 0x15, 0xA2, 0x58, 0x32, 0x2E,
|
||||
0x7D, 0x35, 0x9C, 0xE4, 0x98, 0x7F, 0x9C, 0x81, 0x32, 0xAA, 0xC4, 0x87, 0x16, 0x26, 0x23, 0x95,
|
||||
0x57, 0xC9, 0xD4, 0x34, 0xCE, 0x63, 0x78, 0x7E, 0xD4, 0x3C, 0x16, 0x1D, 0x80, 0xC0, 0x55, 0xBF,
|
||||
0xB5, 0xD6, 0x0C, 0xA5, 0xB9, 0x0A, 0x14, 0x5B, 0x4D, 0x52, 0xF2, 0xA9, 0x7A, 0x08, 0x67, 0x8E,
|
||||
0xEB, 0x67, 0x34, 0x7F, 0x7A, 0x35, 0xAF, 0xD9, 0x07, 0x52, 0x30, 0x38, 0x70, 0xC9, 0x41, 0xF8,
|
||||
0x36, 0x61, 0x32, 0x72, 0xA4, 0x7A, 0xEA, 0x21, 0xB4, 0xBF, 0xAA, 0xCF, 0x93, 0x4F, 0xE1, 0x5C,
|
||||
0xA0, 0xFB, 0xD0, 0x2B, 0xA3, 0x82, 0x2E, 0x69, 0x7D, 0xB7, 0x76, 0x88, 0xF7, 0x5C, 0xF3, 0x82,
|
||||
0xC6, 0x6D, 0x49, 0x92, 0x64, 0x88, 0x9A, 0x43, 0xEE, 0xE9, 0x93, 0xC3, 0x70, 0x50, 0x22, 0xF1,
|
||||
0xD3, 0x2B, 0xCF, 0xA9, 0xE5, 0x69, 0x22, 0xF9, 0xBF, 0x78, 0x9A, 0xA4, 0x5A, 0x3D, 0x2E, 0x2A,
|
||||
0x23, 0xE3, 0x51, 0x8F, 0x1A, 0xC1, 0xAF, 0x47, 0x9C, 0x14, 0xCE, 0xB9, 0xCD, 0xD0, 0x02, 0xB7,
|
||||
0xB8, 0x81, 0xCC, 0x44, 0xE7, 0xA2, 0x6F, 0x32, 0x8C, 0x78, 0x79, 0x10, 0xF3, 0xE1, 0xB0, 0x7C,
|
||||
0xAB, 0x40, 0xDB, 0xF9, 0x99, 0xE7, 0x27, 0x30, 0x53, 0x67, 0x00, 0xE8, 0x33, 0x6D, 0xFC, 0x4D,
|
||||
0xDC, 0xB0, 0xFC, 0x3D, 0xEF, 0x8D, 0x43, 0xAF, 0x7E, 0x41, 0x69, 0xDA, 0xFD, 0xDF, 0x2F, 0xF8,
|
||||
0xEC, 0xFB, 0x6A, 0x65, 0xE7, 0xEC, 0xC7, 0x53, 0x1B, 0x14, 0xDF, 0xBD, 0x0C, 0x54, 0x57, 0xD2,
|
||||
0x56, 0x15, 0xF4, 0x34, 0xE2, 0xFB, 0x12, 0xA0, 0xA2, 0xDE, 0x82, 0xF5, 0x04, 0x81, 0x9B, 0x08,
|
||||
0xB6, 0x8C, 0x7B, 0xE0, 0xAA, 0xDF, 0xC9, 0x92, 0x9D, 0x5F, 0x2D, 0xF7, 0x4A, 0x0B, 0xFF, 0xA5,
|
||||
0xAA, 0xDC, 0xD6, 0x3F, 0x56, 0xB2, 0x6A, 0x3C, 0x6F, 0xAA, 0xAC, 0x84, 0xAC, 0x3F, 0x3D, 0x05,
|
||||
0x96, 0x12, 0x44, 0x39, 0x1C, 0xD1, 0xFA, 0xBE, 0x6B, 0x1A, 0xCD, 0x31, 0x29, 0x41, 0x31, 0xA3,
|
||||
0xA8, 0x0D, 0x87, 0xEB, 0x96, 0x21, 0x39, 0xD6, 0x3B, 0x11, 0x50, 0xB5, 0xFE, 0x44, 0x0E, 0x74,
|
||||
0x31, 0x12, 0xA1, 0x66, 0x49, 0xFD, 0x2D, 0x75, 0x72, 0xF9, 0xC8, 0xD9, 0x6C, 0xC9, 0x11, 0x74,
|
||||
0x2E, 0xEB, 0x20, 0x33, 0x3D, 0x2C, 0x5E, 0xEA, 0x39, 0x31, 0x88, 0xC7, 0xD1, 0x93, 0x95, 0xD8,
|
||||
0x9E, 0x87, 0x93, 0xBC, 0x09, 0x17, 0xC9, 0xA2, 0x59, 0x18, 0x51, 0x8F, 0xBF, 0x55, 0x45, 0x81,
|
||||
0x8D, 0xFD, 0xAF, 0xB2, 0x21, 0xB7, 0xD8, 0xA8, 0x00, 0x2E, 0x70, 0x73, 0x2F, 0x74, 0xBC, 0x61,
|
||||
0x0A, 0x8E, 0xE3, 0x0A, 0x92, 0x82, 0xD2, 0x82, 0xBA, 0xE4, 0x3E, 0x8E, 0xBB, 0xC7, 0xA2, 0x8F,
|
||||
0x68, 0xE1, 0x29, 0x34, 0x7C, 0xB4, 0x22, 0xCF, 0x36, 0x8F, 0x9D, 0x63, 0x9D, 0x04, 0x8F, 0x4A,
|
||||
0xFB, 0x84, 0xBB, 0x6B, 0x97, 0x2C, 0x15, 0xC9, 0x37, 0x4F, 0x40, 0xD7, 0x47, 0x50, 0x39, 0x97
|
||||
};
|
||||
static inline void resetCurrRx(L2_INST *instPtr) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(instPtr->serviceFSM->currRxBuff != NULL);
|
||||
RingBuff_Flush(instPtr->serviceFSM->currRxBuff);
|
||||
instPtr->serviceFSM->currRxSeq = 0;
|
||||
}
|
||||
|
||||
static inline bool uploadCurrRx(L2_INST *instPtr) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(instPtr->config.pushUpHandle != NULL);
|
||||
bool ret = instPtr->config.pushUpHandle(instPtr->serviceFSM->currRxBuff);
|
||||
instPtr->serviceFSM->currRxBuff = NULL;
|
||||
instPtr->serviceFSM->currRxSeq = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline bool updateCurrTx(L2_INST *instPtr) {
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(instPtr->config.popUpHandle != NULL);
|
||||
if(instPtr->serviceFSM->currTxBuff == NULL) {
|
||||
instPtr->serviceFSM->currTxSeq = 0;
|
||||
return (instPtr->config.popUpHandle(&(instPtr->serviceFSM->currTxBuff)));
|
||||
}
|
||||
if(RingBuff_Size(instPtr->serviceFSM->currTxBuff) == 0) {
|
||||
free(instPtr->serviceFSM->currTxBuff);
|
||||
instPtr->serviceFSM->currTxSeq = 0;
|
||||
return (instPtr->config.popUpHandle(&(instPtr->serviceFSM->currTxBuff)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
@@ -88,76 +106,83 @@ static uint8_t testData[L2_PACK_LEN_MAX] =
|
||||
******************************************************************************/
|
||||
static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dstId)
|
||||
{
|
||||
#ifndef DATALINK_ENABLE_BERTEST
|
||||
ASSERT(instPtr != NULL);
|
||||
int32_t Status;
|
||||
uint32_t dataChunk;
|
||||
uint8_t *buff = instPtr->sendPktData;
|
||||
|
||||
// Common section of link layer package
|
||||
dataChunk = L2_GetNextFrameNum(instPtr);
|
||||
L2_FrameInsertChunk(buff, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &dataChunk);
|
||||
dataChunk = L2_GetNextSlotNum(instPtr);
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SLOT_NUM, L2_MSG_SLOT_NUM_LEN, &dataChunk);
|
||||
dataChunk = L2_GetNodeId(instPtr);
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SRC_ID, L2_MSG_SRC_ID_LEN, &dataChunk);
|
||||
dataChunk = dstId;
|
||||
L2_FrameInsertChunk(buff, L2_MSG_DST_ID, L2_MSG_DST_ID_LEN, &dataChunk);
|
||||
uint8_t *sendBuff = instPtr->sendPktData;
|
||||
size_t payloadMax, packetLen;
|
||||
switch (type)
|
||||
{
|
||||
case L2_SVC_FRAME:
|
||||
{
|
||||
dataChunk = L2_SVC_FRAME;
|
||||
L2_FrameInsertChunk(buff, L2_MSG_TYPE, L2_MSG_TYPE_LEN, &dataChunk);
|
||||
|
||||
SysMonitor_GetSysinfo(&(instPtr->sysInfo));
|
||||
// insert position and speed info
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_SRC_POSX, L2_MSG_SVC_SRC_POSX_LEN, &(instPtr->sysInfo.posX));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_SRC_POSY, L2_MSG_SVC_SRC_POSY_LEN, &(instPtr->sysInfo.posY));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_SRC_POSZ, L2_MSG_SVC_SRC_POSZ_LEN, &(instPtr->sysInfo.posZ));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_SRC_SPEEDX, L2_MSG_SVC_SRC_SPEEDX_LEN, &(instPtr->sysInfo.vX));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_SRC_SPEEDY, L2_MSG_SVC_SRC_SPEEDY_LEN, &(instPtr->sysInfo.vY));
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_SRC_SPEEDZ, L2_MSG_SVC_SRC_SPEEDZ_LEN, &(instPtr->sysInfo.vZ));
|
||||
|
||||
uint32_t dataId;
|
||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||
{
|
||||
SysMonitor_GetSendPayload(buff + L2_MSG_SVC_PAYLOAD, &dataId, PAYLOAD_LEN_FLJ_TX);
|
||||
}
|
||||
else
|
||||
{
|
||||
SysMonitor_GetSendPayload(buff + L2_MSG_SVC_PAYLOAD, &dataId, PAYLOAD_LEN_LJ_TX);
|
||||
}
|
||||
|
||||
L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD_ID, L2_MSG_SVC_PAYLOAD_ID_LEN, &dataId);
|
||||
if (dataId == DATA_ID_NONE)
|
||||
{
|
||||
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);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Fail to append CRC...\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
memcpy(instPtr->log.txLog.data, buff, L2_SVC_PACK_LEN);
|
||||
instPtr->log.txLog.dataId = dataId;
|
||||
case L2_SVC_2K_FRAME:
|
||||
packetLen = L2_SVC_PACK_2K_LEN;
|
||||
payloadMax = PAYLOAD_LEN_2K;
|
||||
break;
|
||||
case L2_SVC_128K_FRAME:
|
||||
packetLen = L2_SVC_PACK_128K_LEN;
|
||||
payloadMax = PAYLOAD_LEN_128K;
|
||||
break;
|
||||
case L2_SVC_256K_FRAME:
|
||||
packetLen = L2_SVC_PACK_256K_LEN;
|
||||
payloadMax = PAYLOAD_LEN_256K;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DBG_ERROR("Unexpected frame type: %" PRIu8 ".\n", type);
|
||||
return EPARAM;
|
||||
break;
|
||||
}
|
||||
// Common section of link layer package
|
||||
L2_ASSEMBLE_INTEGER(sendBuff, L2_MSG_FRAME_NUM, L2_GetNextFrameNum(instPtr));
|
||||
L2_ASSEMBLE_INTEGER(sendBuff, L2_MSG_SLOT_NUM, L2_GetNextSlotNum(instPtr));
|
||||
L2_ASSEMBLE_INTEGER(sendBuff, L2_MSG_SRC_ID, L2_GetNodeId(instPtr));
|
||||
L2_ASSEMBLE_INTEGER(sendBuff, L2_MSG_DST_ID, dstId);
|
||||
L2_ASSEMBLE_INTEGER(sendBuff, L2_MSG_TYPE, type);
|
||||
|
||||
// TODO: check
|
||||
// If no data need to be sent, send dummy data
|
||||
if(updateCurrTx(instPtr) == false) {
|
||||
L2_ASSEMBLE_INTEGER(sendBuff, L2_MSG_SVC_PKTFLG, PACKET_TYPE_NONE);
|
||||
Status = L2_CrcAppend(sendBuff, packetLen - L2_MSG_SVC_CRC_LEN, L2_MSG_SVC_PAYLOAD + payloadMax, L2_CRC16_1021);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
|
||||
ASSERT(true);
|
||||
}
|
||||
return EIGNORE;
|
||||
}
|
||||
RING_BUFFER *svcData = instPtr->serviceFSM->currTxBuff;
|
||||
|
||||
size_t sentLen = RingBuff_Pop(svcData, sendBuff + L2_MSG_SVC_PAYLOAD, packetLen);
|
||||
L2_ASSEMBLE_INTEGER(sendBuff, L2_MSG_SVC_DLEN, sentLen);
|
||||
|
||||
// Packet type
|
||||
uint32_t pktType = PACKET_TYPE_NONE;
|
||||
if(RingBuff_Size(svcData) == 0)
|
||||
{
|
||||
if(instPtr->serviceFSM->currTxSeq == 0)
|
||||
{
|
||||
pktType = PACKET_TYPE_SINGLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pktType = PACKET_TYPE_LASTPKT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pktType = PACKET_TYPE_SUBPKT;
|
||||
}
|
||||
L2_ASSEMBLE_INTEGER(sendBuff, L2_MSG_SVC_PKTFLG, pktType);
|
||||
L2_ASSEMBLE_INTEGER(sendBuff, L2_MSG_SVC_PKTID, instPtr->serviceFSM->currTxSeq);
|
||||
|
||||
Status = L2_CrcAppend(sendBuff, packetLen - L2_MSG_SVC_CRC_LEN, L2_MSG_SVC_PAYLOAD + payloadMax, L2_CRC16_1021);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
|
||||
ASSERT(true);
|
||||
}
|
||||
instPtr->serviceFSM->currTxSeq++;
|
||||
memcpy(instPtr->log.txLog.data, sendBuff, packetLen);
|
||||
instPtr->log.txLog.dataId = instPtr->serviceFSM->rxdCnt;
|
||||
return SUCCESS;
|
||||
#else
|
||||
DBG_ERROR("Unexpected call of Service_Packing in BER test mode.\n");
|
||||
return EUNEXP;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -175,118 +200,109 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
||||
ASSERT(instPtr != NULL);
|
||||
ASSERT(msg != NULL);
|
||||
int32_t Status;
|
||||
#ifndef DATALINK_ENABLE_BERTEST
|
||||
L2_FRAME_TYPE frameType = L2_NONE_FRAME;
|
||||
L2_FrameGetChunk(msg, L2_MSG_TYPE, L2_MSG_TYPE_LEN, &frameType);
|
||||
size_t packetLen;
|
||||
switch (frameType)
|
||||
{
|
||||
case L2_SVC_FRAME:
|
||||
case L2_SVC_2K_FRAME:
|
||||
packetLen = L2_SVC_PACK_2K_LEN;
|
||||
break;
|
||||
case L2_SVC_128K_FRAME:
|
||||
packetLen = L2_SVC_PACK_128K_LEN;
|
||||
break;
|
||||
case L2_SVC_256K_FRAME:
|
||||
packetLen = L2_SVC_PACK_256K_LEN;
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("Unexpected frame type: %" PRIu8 ".\n", type);
|
||||
return EPARAM;
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t nodeId;
|
||||
L2_DEASSEMBLE(msg, L2_MSG_DST_ID, &nodeId);
|
||||
if(nodeId != L2_GetNodeId(instPtr)) {
|
||||
DBG_ERROR("Packet not addressed to me, dropping...\n");
|
||||
return EIGNORE;
|
||||
}
|
||||
NODE_ENTRY *node;
|
||||
node = L2_GetNodeById(instPtr->nodeList, nodeId);
|
||||
if (node == NULL)
|
||||
{
|
||||
uint8_t nodeId;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SRC_ID, L2_MSG_SRC_ID_LEN, &nodeId);
|
||||
NODE_ENTRY *node;
|
||||
node = L2_GetNodeById(instPtr->nodeList, nodeId);
|
||||
node = L2_AppendNode(instPtr->nodeList, nodeId, L2_NODE_MEMBER);
|
||||
if (node == NULL)
|
||||
{
|
||||
node = L2_AppendNode(instPtr->nodeList, nodeId, L2_NODE_MEMBER);
|
||||
if (node == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to append new node [id: %" PRIu8 "]", nodeId);
|
||||
Status = ENOMEM;
|
||||
break;
|
||||
}
|
||||
DBG_ERROR("Failed to append new node [id: %" PRIu8 "]", nodeId);
|
||||
ASSERT(true);
|
||||
}
|
||||
|
||||
// Update node info.
|
||||
float nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SVC_SRC_POSX, L2_MSG_SVC_SRC_POSX_LEN, &nodePos);
|
||||
node->nodeInfo.pos.x = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SVC_SRC_POSY, L2_MSG_SVC_SRC_POSY_LEN, &nodePos);
|
||||
node->nodeInfo.pos.y = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SVC_SRC_POSZ, L2_MSG_SVC_SRC_POSZ_LEN, &nodePos);
|
||||
node->nodeInfo.pos.z = (double)nodePos;
|
||||
float nodeSpeed;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SVC_SRC_SPEEDX, L2_MSG_SVC_SRC_SPEEDX_LEN, &nodeSpeed);
|
||||
node->nodeInfo.speed.x = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SVC_SRC_SPEEDY, L2_MSG_SVC_SRC_SPEEDY_LEN, &nodeSpeed);
|
||||
node->nodeInfo.speed.y = (double)nodePos;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SVC_SRC_SPEEDZ, L2_MSG_SVC_SRC_SPEEDZ_LEN, &nodeSpeed);
|
||||
node->nodeInfo.speed.z = (double)nodePos;
|
||||
|
||||
// Reset node ttl
|
||||
node->ttlCnt = 0;
|
||||
|
||||
// Calculate time deviation
|
||||
uint32_t frameNum, slotNum = 0;
|
||||
L2_FrameGetChunk(msg, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &frameNum);
|
||||
L2_FrameGetChunk(msg, L2_MSG_SLOT_NUM, L2_MSG_SLOT_NUM_LEN, &slotNum);
|
||||
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Failed to compute time deviation.\n")
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t dataId;
|
||||
L2_FrameGetChunk(msg, L2_MSG_SVC_PAYLOAD_ID, L2_MSG_SVC_PAYLOAD_ID_LEN, &dataId);
|
||||
|
||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
||||
{
|
||||
SysMonitor_UpdateRecvPayload(msg + L2_MSG_SVC_PAYLOAD, dataId, PAYLOAD_LEN_FLJ_RX);
|
||||
}
|
||||
else
|
||||
{
|
||||
SysMonitor_UpdateRecvPayload(msg + L2_MSG_SVC_PAYLOAD, dataId, PAYLOAD_LEN_LJ_RX);
|
||||
}
|
||||
|
||||
// Logging
|
||||
memcpy(instPtr->log.rxLog.data, msg, L2_SVC_PACK_LEN);
|
||||
instPtr->log.rxLog.dataId = dataId;
|
||||
instPtr->serviceFSM->rxdCnt++;
|
||||
|
||||
#ifdef DATALINK_ENABLE_AUTOTIMESYNC
|
||||
// Implement a auto time sync.
|
||||
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
||||
{
|
||||
// Time sync.
|
||||
L2_TimeAdjust(instPtr, &(instPtr->log.timeDev));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DBG_ERROR("Unsupported frame type: %" PRIu8 ".\n", frameType);
|
||||
break;
|
||||
}
|
||||
return Status;
|
||||
#else
|
||||
uint32_t errorBits = 0;
|
||||
for (int i = 0; i < L2_SVC_PACK_LEN; i++)
|
||||
{
|
||||
errorBits += count_ones(msg[i] ^ testData[i]);
|
||||
}
|
||||
|
||||
instPtr->serviceFSM->bitError += errorBits;
|
||||
instPtr->serviceFSM->bitTotal += L2_SVC_PACK_LEN * 8;
|
||||
// Reset node ttl
|
||||
node->ttlCnt = 0;
|
||||
|
||||
// Calculate time deviation
|
||||
uint32_t frameNum, slotNum = 0;
|
||||
L2_FrameGetChunk(msg, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &frameNum);
|
||||
L2_FrameGetChunk(msg, L2_MSG_SLOT_NUM, L2_MSG_SLOT_NUM_LEN, &slotNum);
|
||||
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
|
||||
uint32_t frameNum = 0;
|
||||
uint32_t slotNum = 0;
|
||||
int64_t timeDev = 0;
|
||||
L2_DEASSEMBLE(msg, L2_MSG_FRAME_NUM, &frameNum);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_SLOT_NUM, &slotNum);
|
||||
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &timeDev);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
DBG_ERROR("Failed to compute time deviation.\n")
|
||||
return Status;
|
||||
ASSERT(true);
|
||||
}
|
||||
instPtr->log.timeDev = timeDev;
|
||||
|
||||
// Implement a auto time sync.
|
||||
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
||||
{
|
||||
// Time sync.
|
||||
L2_TimeAdjust(instPtr, &(instPtr->log.timeDev));
|
||||
L2_TimeAdjust(instPtr, &timeDev);
|
||||
}
|
||||
return SUCCESS;
|
||||
#endif
|
||||
|
||||
// TODO: check
|
||||
uint8_t pktType, pktId;
|
||||
L2_DEASSEMBLE(msg, L2_MSG_SVC_PKTFLG, &pktType);
|
||||
L2_DEASSEMBLE(msg, L2_MSG_SVC_PKTID, &pktId);
|
||||
|
||||
if(pktType != PACKET_TYPE_SINGLE && pktType != PACKET_TYPE_SUBPKT && pktType != PACKET_TYPE_LASTPKT)
|
||||
{
|
||||
DBG_INFO("Dummy packet, discard...\n");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if(prepareCurrRx(instPtr) == false) {
|
||||
DBG_ERROR("Failed to prepare prepareCurrRx.\n");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
if(pktId != instPtr->serviceFSM->currRxSeq)
|
||||
{
|
||||
DBG_ERROR("Packet loss occurred discard all...\n");
|
||||
resetCurrRx(instPtr);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
size_t pushLen, dlen = 0;
|
||||
RING_BUFFER *svcData = instPtr->serviceFSM->currRxBuff;
|
||||
L2_DEASSEMBLE(msg, L2_MSG_SVC_DLEN, &dlen);
|
||||
pushLen = RingBuff_Push(svcData, msg + L2_MSG_SVC_PAYLOAD, dlen);
|
||||
if(pushLen < dlen) {
|
||||
DBG_ERROR("Receiving ring buffer overflowed.\n")
|
||||
ASSERT(true);
|
||||
}
|
||||
instPtr->serviceFSM->currRxSeq++;
|
||||
|
||||
if(pktType == PACKET_TYPE_SINGLE || pktType == PACKET_TYPE_LASTPKT)
|
||||
{
|
||||
uploadCurrRx(instPtr);
|
||||
}
|
||||
|
||||
instPtr->serviceFSM->rxdCnt++;
|
||||
memcpy(instPtr->log.rxLog.data, msg, packetLen);
|
||||
instPtr->log.rxLog.dataId = instPtr->serviceFSM->rxdCnt;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -326,12 +342,10 @@ void L2_Service_Reset(L2_SVC_FSM *svcFSMPtr)
|
||||
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
|
||||
svcFSMPtr->currTxSeq = 0;
|
||||
svcFSMPtr->currRxSeq = 0;
|
||||
svcFSMPtr->currTxBuff = NULL;
|
||||
svcFSMPtr->currRxBuff = NULL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -399,40 +413,40 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
|
||||
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_120);
|
||||
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_120;
|
||||
}
|
||||
|
||||
L2_FRAME_TYPE frameType = L2_NONE_FRAME;
|
||||
switch (rtneEntry->slotType)
|
||||
{
|
||||
case L2_SLOT_SERVICE:
|
||||
if (torState == L2_TOR_TX)
|
||||
{
|
||||
svcFSMPtr->txCnt++;
|
||||
#ifndef DATALINK_ENABLE_BERTEST
|
||||
// Packing service data
|
||||
Service_Packing(instPtr, L2_SVC_FRAME, rtneEntry->dst);
|
||||
#else
|
||||
memcpy(instPtr->sendPktData, testData, L2_SVC_PACK_LEN);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
svcFSMPtr->rxCnt++;
|
||||
}
|
||||
L2_SetupNextSlot(instPtr, torState, L2_SVC_FRAME);
|
||||
case L2_SLOT_SERVICE_2K:
|
||||
frameType = L2_SVC_2K_FRAME;
|
||||
break;
|
||||
case L2_SLOT_SERVICE_128K:
|
||||
frameType = L2_SVC_128K_FRAME;
|
||||
break;
|
||||
case L2_SLOT_SERVICE_256K:
|
||||
frameType = L2_SVC_256K_FRAME;
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("UNKNOWN slot type [%" PRIu8 "].\n", rtneEntry->slotType);
|
||||
return FAILURE;
|
||||
}
|
||||
#ifdef DATALINK_ENABLE_BERTEST
|
||||
uint32_t pktLoss;
|
||||
pktLoss = svcFSMPtr->rxCnt - svcFSMPtr->rxdCnt;
|
||||
svcFSMPtr->lossRate = (svcFSMPtr->rxCnt == 0) ? 0 : (double)pktLoss / (double)svcFSMPtr->rxCnt;
|
||||
svcFSMPtr->errorRate = (svcFSMPtr->bitTotal == 0) ? 0 : (double)svcFSMPtr->bitError / (double)svcFSMPtr->bitTotal;
|
||||
DBG_PRINT("Packet Loss Rate -- Total: %lu, Loss: %lu.\n", instPtr->log.svcRxCnt, pktLoss);
|
||||
DBG_PRINT("Bit Error Rate -- Total:%lu, Error:%lu.\n", svcFSMPtr->bitTotal, svcFSMPtr->bitError);
|
||||
#endif
|
||||
if (torState == L2_TOR_TX)
|
||||
{
|
||||
if(Service_Packing(instPtr, frameType, rtneEntry->dst) == SUCCESS)
|
||||
{
|
||||
svcFSMPtr->txCnt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
torState = L2_TOR_SUSPEND;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
svcFSMPtr->rxCnt++;
|
||||
}
|
||||
L2_SetupNextSlot(instPtr, torState, frameType);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/** @} LinkLayer_Service*/
|
||||
/** @} LinkLayer*/
|
||||
/** @} LinkLayer*/
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "link_layer.h"
|
||||
#include "../phy_layer/phy_layer.h"
|
||||
#include "networking/phy_layer/phy_layer.h"
|
||||
#include "error.h"
|
||||
#include "common.h"
|
||||
|
||||
@@ -102,4 +102,4 @@ void L2_TimeAdjust(L2_INST *instPtr, const int64_t *timeDev)
|
||||
|
||||
/** @} LinkLayer_TimeSync*/
|
||||
|
||||
/** @} LinkLayer*/
|
||||
/** @} LinkLayer*/
|
||||
|
||||
@@ -321,7 +321,7 @@ uint32_t Phy_GetTimeComp(L1_FRAME_TYPE frameType)
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Get frame type of the frame in receive data buffer (Base on PL Record).
|
||||
* @brief Get frame type of the frame in receive data buffer (Base on PL Record).
|
||||
*
|
||||
* @param instPtr A pointer to physical layer control instance.
|
||||
*
|
||||
@@ -1390,4 +1390,4 @@ void Phy_GetLastReceivedSlotStartTimeStamp(PHY_INST *instPtr, TIME_WORD *slotSta
|
||||
|
||||
/** @} PhysicalLayer_Receive_Estimations*/
|
||||
|
||||
/** @} PhysicalLayer*/
|
||||
/** @} PhysicalLayer*/
|
||||
|
||||
@@ -25,10 +25,9 @@
|
||||
#ifndef EMULATION
|
||||
#include "xbram.h"
|
||||
#include "xadcps.h"
|
||||
#include "../config/app_config.h"
|
||||
#endif
|
||||
#include "../../system_monitor.h"
|
||||
#include "../../time_ctrl/time_ctrl.h"
|
||||
#include "system_monitor.h"
|
||||
#include "time_ctrl/time_ctrl.h"
|
||||
/************************** Constant Definitions *****************************/
|
||||
/**
|
||||
* @name PhysicalLayer_Common_Constant
|
||||
@@ -312,4 +311,4 @@ int32_t Phy_SetBeamAngle(PHY_INST *phyInstPtr, double offAx, double rndAx);
|
||||
|
||||
#endif // PHY_CTRL_H_
|
||||
|
||||
/** @} PhysicalLayer*/
|
||||
/** @} PhysicalLayer*/
|
||||
|
||||
Reference in New Issue
Block a user