From 89ecdc476ff3cb0d28c5391858ae60b64b486242 Mon Sep 17 00:00:00 2001 From: Gatsby Van Date: Wed, 25 Dec 2024 15:52:26 +0800 Subject: [PATCH] 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 --- src/ge_app.c | 28 +++++----------------------- src/ge_config/app_config.h | 2 ++ src/node_app.c | 26 ++++++++------------------ src/node_config/app_config.h | 2 ++ 4 files changed, 17 insertions(+), 41 deletions(-) diff --git a/src/ge_app.c b/src/ge_app.c index b6088cd..96800e0 100644 --- a/src/ge_app.c +++ b/src/ge_app.c @@ -84,6 +84,7 @@ struct callback_desc scutm_callback_desc = .ctx = NULL }; +#ifdef _GE_APP_ L2_CONFIG linkConfig = { .myType = L2_NODE_HEAD, .clustId = 1U, @@ -95,18 +96,9 @@ L2_CONFIG linkConfig = { .pushUpHandle = LinklayerPush2Up, .popUpHandle = LinklayerPopFromUp }; - -// L2_CONFIG linkConfig = { -// .myType = L2_NODE_MEMBER, -// .clustId = 1U, -// .myId = 2U, -// .headId = 1U, -// .netScale = 2U, -// .phyInstPtr = NULL, // physical layer reference -// .tmcInstPtr = NULL, -// .pushUpHandle = LinklayerPush2Up, -// .popUpHandle = LinklayerPopFromUp -// }; +#else +#error No application type is specified. +#endif static PHY_CONFIG phyConfig = { @@ -284,7 +276,7 @@ static int32_t SetupInterruptSystem(struct irq_ctrl_desc *descPtr) irq_enable(descPtr, PERIODIC_5MS_INTR_ID); irq_enable(descPtr, MPC_RX_INTR_ID); irq_enable(descPtr, MPC_TX_INTR_ID); -// irq_enable(descPtr, SCUTIMER_INTR_ID); + irq_enable(descPtr, SCUTIMER_INTR_ID); // Enable Exceptions Status = irq_global_enable(descPtr); @@ -546,15 +538,5 @@ int main(void) 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 diff --git a/src/ge_config/app_config.h b/src/ge_config/app_config.h index 1b980da..c5d1c3c 100644 --- a/src/ge_config/app_config.h +++ b/src/ge_config/app_config.h @@ -29,6 +29,8 @@ #define _APP_VER_MINOR ((_APP_VER & 0x00FF0000) >> 16) #define _APP_VER_PATCH (_APP_VER & 0x0000FFFF) +#define _GE_APP_ + /*********** Debug Info Level ************/ // #define _DEBUG_LEVEL 1 // 3 - print all debug info diff --git a/src/node_app.c b/src/node_app.c index b7162f2..bdb42c2 100644 --- a/src/node_app.c +++ b/src/node_app.c @@ -66,10 +66,11 @@ struct callback_desc scutm_callback_desc = { .ctx = NULL }; +#ifdef _NODE_APP_ L2_CONFIG linkConfig = { - .myType = L2_NODE_HEAD, + .myType = L2_NODE_MEMBER, .clustId = 1U, - .myId = 1U, + .myId = 2U, .headId = 1U, .netScale = 2U, .phyInstPtr = NULL, // physical layer reference @@ -77,18 +78,9 @@ L2_CONFIG linkConfig = { .pushUpHandle = LinklayerPush2Up, .popUpHandle = LinklayerPopFromUp }; - -// L2_CONFIG linkConfig = { -// .myType = L2_NODE_MEMBER, -// .clustId = 1U, -// .myId = 2U, -// .headId = 1U, -// .netScale = 2U, -// .phyInstPtr = NULL, // physical layer reference -// .tmcInstPtr = NULL, -// .pushUpHandle = LinklayerPush2Up, -// .popUpHandle = LinklayerPopFromUp -// }; +#else +#error No application type is specified. +#endif static PHY_CONFIG phyConfig = { .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, PERIODIC_5MS_INTR_ID); irq_enable(descPtr, SYSBUS_INTR_ID); - irq_enable(descPtr, SCUTIMER_INTR_ID); +// irq_enable(descPtr, SCUTIMER_INTR_ID); // Enable Exceptions Status = irq_global_enable(descPtr); @@ -428,9 +420,7 @@ int main(void) DBG_PRINT("Physical started...\n"); Phy_Start(phyInstPtr); - - - // Linklayer_Start(linkInstPtr); + Linklayer_Start(linkInstPtr); while (true) { diff --git a/src/node_config/app_config.h b/src/node_config/app_config.h index 893ca4d..1e94cc0 100644 --- a/src/node_config/app_config.h +++ b/src/node_config/app_config.h @@ -29,6 +29,8 @@ #define _APP_VER_MINOR ((_APP_VER & 0x00FF0000) >> 16) #define _APP_VER_PATCH (_APP_VER & 0x0000FFFF) +#define _NODE_APP_ + /*********** Debug Info Level ************/ // #define _DEBUG_LEVEL 1 // 3 - print all debug info