Compare commits

...
11 Commits
Author SHA1 Message Date
Gatsby Van e71cb9c1ed chore: update build scripts 2024-12-25 16:15:02 +08:00
Gatsby Van 5753a86fb8 chore: update hardware files 2024-12-25 16:14:47 +08:00
Gatsby Van 3320e35cee chore(linklayer): misc cleanup 2024-12-25 16:05:29 +08:00
Gatsby Van 2a8eb64e61 fix(linklayer): set default value for variables to prevent unexpected behavior
Some variables had size mismatches with the data size defined in the frame segment. After deframing, this could leave residual bits as random and unknown values.
2024-12-25 16:05:02 +08:00
Gatsby Van 789e7fa30f fix(linklayer): extend max packet length to prevent memory leak. 2024-12-25 15:58:17 +08:00
Gatsby Van 3765e59b10 feat(linklayer): set 128Kbsp as default fallback seed mode. 2024-12-25 15:57:36 +08:00
Gatsby Van 9c1a30f1e1 refator(mpc): reset link layer log after reconfiguring 2024-12-25 15:54:39 +08:00
Gatsby Van 047446fd9b fix(ge_app): change frequency to 720MHz to match node application 2024-12-25 15:53:07 +08:00
Gatsby Van 89ecdc476f chore: enhance code coherence
* distinct link layer parameter for GE and node application
* disable remote test for node application
* auto start link layer for node application
2024-12-25 15:52:26 +08:00
Gatsby Van c66c3fe18e chore(ge_app): remove redundant code 2024-12-25 15:48:57 +08:00
Gatsby Van deb82441c6 chore: correct build script setting 2024-12-25 15:45:49 +08:00
17 changed files with 41760 additions and 133 deletions
-1
View File
@@ -7,7 +7,6 @@ ifeq ($(TARGET_PROJ), node)
BUILD_DIR := $(PROJECT)/build/node BUILD_DIR := $(PROJECT)/build/node
CONFIG_FILE := $(PROJECT)/config/node.json CONFIG_FILE := $(PROJECT)/config/node.json
else ifeq ($(TARGET_PROJ), ge) else ifeq ($(TARGET_PROJ), ge)
XILINX_VITIS_CLASSIC := y
BUILD_DIR := $(PROJECT)/build/ge BUILD_DIR := $(PROJECT)/build/ge
CONFIG_FILE := $(PROJECT)/config/ge.json CONFIG_FILE := $(PROJECT)/config/ge.json
else else
+3 -3
View File
@@ -5,7 +5,7 @@ set "tools_dir=%~dp0scripts\platform\%platform%"
:menu :menu
echo Please select the project needed to be built: echo Please select the project needed to be built:
echo 1. NODE Project (SDK 2019.1) echo 1. NODE Project (SDK 2019.1)
echo 2. GE Project (Vitis 2024.1) echo 2. GE Project (SDK 2019.1)
set /p choice="Choose a project (1 or 2): " set /p choice="Choose a project (1 or 2): "
if "%choice%"=="1" ( if "%choice%"=="1" (
@@ -15,8 +15,8 @@ if "%choice%"=="1" (
set "config=%~dp0config\node.json" set "config=%~dp0config\node.json"
goto end goto end
) else if "%choice%"=="2" ( ) else if "%choice%"=="2" (
echo Building GE Project ^(Vitis 2024.1^) echo Building GE Project ^(SDK 2019.1^)
set "platform_ver=2024.1" set "platform_ver=2019.1"
set "work_dir=%~dp0build\ge" set "work_dir=%~dp0build\ge"
set "config=%~dp0config\ge.json" set "config=%~dp0config\ge.json"
goto end goto end
Binary file not shown.
+21516
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+20197
View File
File diff suppressed because it is too large Load Diff
+1 -1
Submodule scripts updated: af260c1610...58ed5e4bda
+5 -73
View File
@@ -84,6 +84,7 @@ struct callback_desc scutm_callback_desc =
.ctx = NULL .ctx = NULL
}; };
#ifdef _GE_APP_
L2_CONFIG linkConfig = { L2_CONFIG linkConfig = {
.myType = L2_NODE_HEAD, .myType = L2_NODE_HEAD,
.clustId = 1U, .clustId = 1U,
@@ -95,18 +96,9 @@ L2_CONFIG linkConfig = {
.pushUpHandle = LinklayerPush2Up, .pushUpHandle = LinklayerPush2Up,
.popUpHandle = LinklayerPopFromUp .popUpHandle = LinklayerPopFromUp
}; };
#else
// L2_CONFIG linkConfig = { #error No application type is specified.
// .myType = L2_NODE_MEMBER, #endif
// .clustId = 1U,
// .myId = 2U,
// .headId = 1U,
// .netScale = 2U,
// .phyInstPtr = NULL, // physical layer reference
// .tmcInstPtr = NULL,
// .pushUpHandle = LinklayerPush2Up,
// .popUpHandle = LinklayerPopFromUp
// };
static PHY_CONFIG phyConfig = static PHY_CONFIG phyConfig =
{ {
@@ -136,46 +128,6 @@ static MPC_CONFIG mpcConfig = {
.rxQueueMax = 16 .rxQueueMax = 16
}; };
#ifdef APP_EMULATE_DATA
uint8_t testDataLj[] =
{
0xEA, 0xDF, 0x3F, 0x27, 0xCE, 0x9B, 0xE6, 0x3F,
0xB5, 0xA3, 0x38, 0x47, 0x1D, 0x1D, 0xFA, 0x3F,
0x39, 0xB4, 0xC8, 0x76, 0xBE, 0xAB, 0x8E, 0x40,
0xC9, 0xE8, 0x80, 0x24, 0xEC, 0xCB, 0x13, 0x40,
0x37, 0x38, 0x7F, 0x22, 0x72, 0x06, 0xF0, 0x01,
0x00, 0x00, 0xB8, 0xAA, 0x08, 0x47, 0x1E, 0xC6,
0xB0, 0x47, 0x54, 0xFD, 0xEB, 0x45, 0xA1, 0x8A,
0x86, 0x44, 0x43, 0xB6, 0xC8, 0x44, 0x4E, 0x19,
0xA8, 0x42
};
uint8_t testDataFlj[] =
{
0xFD, 0x1E, 0xA5, 0x22, 0x72, 0x02, 0x5A, 0x02,
0x00, 0x00, 0x81, 0x97, 0x39, 0x3F, 0xF1, 0xF4,
0xC0, 0x3F, 0x27, 0xF1, 0x65, 0x44, 0x53, 0x5C,
0xD3, 0x3F, 0xB5, 0x24, 0xA6, 0x22, 0x72, 0x02,
0x83, 0x01, 0x00, 0x00, 0xFC, 0xE0, 0x44, 0x47,
0xB7, 0x83, 0x35, 0x47, 0xA4, 0xBF, 0xE5, 0xC4,
0xE8, 0xDC, 0xD1, 0x44, 0x5D, 0x5D, 0xE7, 0x44,
0x7D, 0x1B, 0xE8, 0xC1, 0x60, 0x97, 0x57, 0x42,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5D, 0x86, 0xA6, 0x22, 0x72, 0x02, 0xA5, 0x02,
0x00, 0x00, 0x97, 0x4E, 0xB5, 0x47, 0xC4, 0x2A,
0xB0, 0x47, 0x2D, 0x00, 0x21, 0xC5, 0x8A, 0x85,
0xD1, 0x44, 0x23, 0xFD, 0xC8, 0x44, 0xA1, 0xC4,
0xEA, 0xC1, 0x91, 0x4E, 0x71, 0xC2, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0xAD,
0xA6, 0x22, 0x72, 0x02, 0xA5, 0x02, 0x00, 0x00,
0xCD, 0x07, 0xD6, 0x47, 0x1D, 0xA4, 0xCE, 0x47,
0x6E, 0x61, 0x33, 0xC5, 0x85, 0x55, 0xD1, 0x44,
0x9C, 0x16, 0xBD, 0x44, 0x36, 0xC0, 0xEB, 0xC1,
0xF0, 0xFF, 0x5B, 0x42, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x78, 0x25, 0x03, 0x00
};
#endif
/************************** Function Prototypes ******************************/ /************************** Function Prototypes ******************************/
static struct irq_ctrl_desc *intcDescPtr; // General interrupt controller descriptor static struct irq_ctrl_desc *intcDescPtr; // General interrupt controller descriptor
static struct timer_desc *logTmPtr; static struct timer_desc *logTmPtr;
@@ -324,7 +276,7 @@ static int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
irq_enable(descPtr, PERIODIC_5MS_INTR_ID); irq_enable(descPtr, PERIODIC_5MS_INTR_ID);
irq_enable(descPtr, MPC_RX_INTR_ID); irq_enable(descPtr, MPC_RX_INTR_ID);
irq_enable(descPtr, MPC_TX_INTR_ID); irq_enable(descPtr, MPC_TX_INTR_ID);
// irq_enable(descPtr, SCUTIMER_INTR_ID); irq_enable(descPtr, SCUTIMER_INTR_ID);
// Enable Exceptions // Enable Exceptions
Status = irq_global_enable(descPtr); Status = irq_global_enable(descPtr);
@@ -438,16 +390,6 @@ static void ScuTimer_IntrHandler(void *context)
{ {
DBG_ERROR("Failed to apply remote test.\n"); DBG_ERROR("Failed to apply remote test.\n");
} }
#ifdef APP_EMULATE_DATA
if (L2_GetNodeType(linkInstPtr) == L2_NODE_HEAD)
{
SysMonitor_UpdateSendPayload(testDataFlj, PAYLOAD_LEN_FLJ_TX);
}
else
{
SysMonitor_UpdateSendPayload(testDataLj, PAYLOAD_LEN_LJ_TX);
}
#endif
} }
XScuTimer_ClearInterruptStatus((XScuTimer *)xdesc->instance); XScuTimer_ClearInterruptStatus((XScuTimer *)xdesc->instance);
@@ -596,15 +538,5 @@ int main(void)
DBG_ERROR("Mpc_HandleCmd exit with ErrorCode: %" PRId32 ".\n", Status); DBG_ERROR("Mpc_HandleCmd exit with ErrorCode: %" PRId32 ".\n", Status);
} }
} }
if (Mpc_IsSvcDownPending(mpcDescPtr))
{
RING_BUFFER *msg = NULL;
Mpc_PopSvcFrame(mpcDescPtr, (void**)&msg);
Mpc_PushSvcFrame(mpcDescPtr, (void*)msg);
if (Status != SUCCESS)
{
DBG_ERROR("Mpc_HandleCmd exit with ErrorCode: %" PRId32 ".\n", Status);
}
}
} }
} // main } // main
+2 -18
View File
@@ -29,6 +29,8 @@
#define _APP_VER_MINOR ((_APP_VER & 0x00FF0000) >> 16) #define _APP_VER_MINOR ((_APP_VER & 0x00FF0000) >> 16)
#define _APP_VER_PATCH (_APP_VER & 0x0000FFFF) #define _APP_VER_PATCH (_APP_VER & 0x0000FFFF)
#define _GE_APP_
/*********** Debug Info Level ************/ /*********** Debug Info Level ************/
// #define _DEBUG_LEVEL 1 // #define _DEBUG_LEVEL 1
// 3 - print all debug info // 3 - print all debug info
@@ -36,12 +38,6 @@
// 1 - print only errors // 1 - print only errors
// other - print nothing // other - print nothing
#define APP_EMULATE_DATA
#define DATALINK_ENABLE_AUTORECONNECT
#define DATALINK_ENABLE_AUTOTIMESYNC
//#define DATALINK_ENABLE_BERTEST
/************ Hardware Configs ************/ /************ Hardware Configs ************/
#define CPU_CLK_HZ XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ #define CPU_CLK_HZ XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ
#define GLOBAL_TIMER_CLK_HZ (CPU_CLK_HZ/2) #define GLOBAL_TIMER_CLK_HZ (CPU_CLK_HZ/2)
@@ -86,16 +82,4 @@
// INTC configis // INTC configis
#define INTC_DEVICE_ID XPAR_SCUGIC_0_DEVICE_ID #define INTC_DEVICE_ID XPAR_SCUGIC_0_DEVICE_ID
// Configuration Check
#if defined(PHY_BEAM_SET_PRESET) && !defined(PHY_BEAM_FORMING_ENABLE)
#define PHY_BEAM_FORMING_ENABLE
#warning To impliment beam scan must enable beam forming...
#endif
#if defined(DATALINK_ENABLE_BERTEST)
#if !defined(DATALINK_ENABLE_AUTOTIMESYNC)
#warning To enbale bit error rate test, auto time-sync should be enabled...
#endif
#endif
#endif #endif
+4 -4
View File
@@ -56,10 +56,10 @@ int HARDWARE_initialize()
int Status; int Status;
// use configuration // use configuration
mykDevice.rx->rxPllLoFrequency_Hz = 2500000000u; mykDevice.rx->rxPllLoFrequency_Hz = 720000000u;
mykDevice.tx->txPllLoFrequency_Hz = 2500000000u; mykDevice.tx->txPllLoFrequency_Hz = 720000000u;
mykDevice.tx->tx1Atten_mdB = 20000; mykDevice.tx->tx1Atten_mdB = 10000;
mykDevice.tx->tx2Atten_mdB = 20000; mykDevice.tx->tx2Atten_mdB = 10000;
Status = HARDWARE_ad9371Config(); Status = HARDWARE_ad9371Config();
+2 -1
View File
@@ -255,7 +255,8 @@ static int32_t Mpc_SystemConfig(MPC *instPtr, uint8_t *msg)
WD_SPEED_CMD, msg[WD_SPEED_CMD]); WD_SPEED_CMD, msg[WD_SPEED_CMD]);
return EIGNORE; return EIGNORE;
} }
//NOTE: Clear previous log.
memset(&(linkInstPtr->log), 0x00, sizeof(L2_LOG));
if (msg[WD_EN_CMD] == EN_CMD_ON_HIGH_POWER) if (msg[WD_EN_CMD] == EN_CMD_ON_HIGH_POWER)
{ {
// high power config // high power config
+5 -5
View File
@@ -821,15 +821,15 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
UpdateMainSate(instPtr, L2_NORMAL_STATE); UpdateMainSate(instPtr, L2_NORMAL_STATE);
switch(L2_GetCurrentSpeedMode(instPtr)){ switch(L2_GetCurrentSpeedMode(instPtr)){
case L2_SPEED_NONE : case L2_SPEED_NONE :
DBG_WARNING("Speed mode not configured, fallback to 2Kbps mode.\n"); DBG_WARNING("Speed mode not configured, fallback to 128Kbps mode.\n");
case L2_SPEED_2KBPS :
instPtr->rtneConfig.rtneTable = normalTable2K;
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable2K);
break;
case L2_SPEED_128KBPS : case L2_SPEED_128KBPS :
instPtr->rtneConfig.rtneTable = normalTable128K; instPtr->rtneConfig.rtneTable = normalTable128K;
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable128K); instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable128K);
break; break;
case L2_SPEED_2KBPS :
instPtr->rtneConfig.rtneTable = normalTable2K;
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable2K);
break;
case L2_SPEED_256KBPS : case L2_SPEED_256KBPS :
instPtr->rtneConfig.rtneTable = normalTable256K; instPtr->rtneConfig.rtneTable = normalTable256K;
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable256K); instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable256K);
+1 -1
View File
@@ -27,7 +27,7 @@
#include "link_layer.h" #include "link_layer.h"
#define L2_PACK_LEN_MAX 512 // bytes #define L2_PACK_LEN_MAX 1024 // bytes
#define L2_ADV_PACK_LEN 28 // bytes #define L2_ADV_PACK_LEN 28 // bytes
#define L2_CMF_PACK_LEN 268 // bytes #define L2_CMF_PACK_LEN 268 // bytes
+12 -6
View File
@@ -487,7 +487,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
// Reset node ttl // Reset node ttl
node->ttlCnt = 0; node->ttlCnt = 0;
uint32_t netstartTime; uint32_t netstartTime = 0;
// Update net start time. // Update net start time.
L2_DEASSEMBLE(msg, L2_MSG_ADV_SRC_NETSTART_TIME, &netstartTime); L2_DEASSEMBLE(msg, L2_MSG_ADV_SRC_NETSTART_TIME, &netstartTime);
L2_EVENT netSetupDoneEvent = { L2_EVENT netSetupDoneEvent = {
@@ -496,10 +496,12 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
AssertL2Event(instPtr, &netSetupDoneEvent); AssertL2Event(instPtr, &netSetupDoneEvent);
// Calculate time deviation // Calculate time deviation
uint32_t frameNum, slotNum = 0; 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_FRAME_NUM, &frameNum);
L2_DEASSEMBLE(msg, L2_MSG_SLOT_NUM, &slotNum); L2_DEASSEMBLE(msg, L2_MSG_SLOT_NUM, &slotNum);
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev)); Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &timeDev);
if (Status != SUCCESS) if (Status != SUCCESS)
{ {
DBG_ERROR("Failed to compute time deviation.\n") DBG_ERROR("Failed to compute time deviation.\n")
@@ -507,7 +509,8 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
} }
// Time sync. // Time sync.
L2_TimeAdjust(instPtr, &(instPtr->log.timeDev)); L2_TimeAdjust(instPtr, &timeDev);
instPtr->log.timeDev = timeDev;
// trigger flag // trigger flag
AdvRecvStateUpdate(scanFsmPtr, true); AdvRecvStateUpdate(scanFsmPtr, true);
@@ -550,15 +553,18 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
node->ttlCnt = 0; node->ttlCnt = 0;
// Calculate time deviation // Calculate time deviation
uint32_t frameNum, slotNum = 0; 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_FRAME_NUM, &frameNum);
L2_DEASSEMBLE(msg, L2_MSG_SLOT_NUM, &slotNum); L2_DEASSEMBLE(msg, L2_MSG_SLOT_NUM, &slotNum);
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev)); Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &timeDev);
if (Status != SUCCESS) if (Status != SUCCESS)
{ {
DBG_ERROR("Failed to compute time deviation.\n") DBG_ERROR("Failed to compute time deviation.\n")
break; break;
} }
instPtr->log.timeDev = timeDev;
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD) if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
{ {
+1 -1
View File
@@ -146,7 +146,7 @@ static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status); DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
ASSERT(true); ASSERT(true);
} }
return EIGNORE; return SUCCESS;
} }
RING_BUFFER *svcData = instPtr->serviceFSM->currTxBuff; RING_BUFFER *svcData = instPtr->serviceFSM->currTxBuff;
+8 -18
View File
@@ -66,10 +66,11 @@ struct callback_desc scutm_callback_desc = {
.ctx = NULL .ctx = NULL
}; };
#ifdef _NODE_APP_
L2_CONFIG linkConfig = { L2_CONFIG linkConfig = {
.myType = L2_NODE_HEAD, .myType = L2_NODE_MEMBER,
.clustId = 1U, .clustId = 1U,
.myId = 1U, .myId = 2U,
.headId = 1U, .headId = 1U,
.netScale = 2U, .netScale = 2U,
.phyInstPtr = NULL, // physical layer reference .phyInstPtr = NULL, // physical layer reference
@@ -77,18 +78,9 @@ L2_CONFIG linkConfig = {
.pushUpHandle = LinklayerPush2Up, .pushUpHandle = LinklayerPush2Up,
.popUpHandle = LinklayerPopFromUp .popUpHandle = LinklayerPopFromUp
}; };
#else
// L2_CONFIG linkConfig = { #error No application type is specified.
// .myType = L2_NODE_MEMBER, #endif
// .clustId = 1U,
// .myId = 2U,
// .headId = 1U,
// .netScale = 2U,
// .phyInstPtr = NULL, // physical layer reference
// .tmcInstPtr = NULL,
// .pushUpHandle = LinklayerPush2Up,
// .popUpHandle = LinklayerPopFromUp
// };
static PHY_CONFIG phyConfig = { static PHY_CONFIG phyConfig = {
.devId = PHY_DEVICE_ID, .devId = PHY_DEVICE_ID,
@@ -232,7 +224,7 @@ static int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr)
irq_enable(descPtr, PHY_INTR_ID); irq_enable(descPtr, PHY_INTR_ID);
irq_enable(descPtr, PERIODIC_5MS_INTR_ID); irq_enable(descPtr, PERIODIC_5MS_INTR_ID);
irq_enable(descPtr, SYSBUS_INTR_ID); irq_enable(descPtr, SYSBUS_INTR_ID);
irq_enable(descPtr, SCUTIMER_INTR_ID); // irq_enable(descPtr, SCUTIMER_INTR_ID);
// Enable Exceptions // Enable Exceptions
Status = irq_global_enable(descPtr); Status = irq_global_enable(descPtr);
@@ -428,9 +420,7 @@ int main(void)
DBG_PRINT("Physical started...\n"); DBG_PRINT("Physical started...\n");
Phy_Start(phyInstPtr); Phy_Start(phyInstPtr);
Linklayer_Start(linkInstPtr);
// Linklayer_Start(linkInstPtr);
while (true) while (true)
{ {
+2
View File
@@ -29,6 +29,8 @@
#define _APP_VER_MINOR ((_APP_VER & 0x00FF0000) >> 16) #define _APP_VER_MINOR ((_APP_VER & 0x00FF0000) >> 16)
#define _APP_VER_PATCH (_APP_VER & 0x0000FFFF) #define _APP_VER_PATCH (_APP_VER & 0x0000FFFF)
#define _NODE_APP_
/*********** Debug Info Level ************/ /*********** Debug Info Level ************/
// #define _DEBUG_LEVEL 1 // #define _DEBUG_LEVEL 1
// 3 - print all debug info // 3 - print all debug info