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
This commit is contained in:
Gatsby Van
2024-12-25 15:52:26 +08:00
parent c66c3fe18e
commit 89ecdc476f
4 changed files with 17 additions and 41 deletions
+5 -23
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 =
{ {
@@ -284,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);
@@ -546,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
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
+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