feat: 增加上位机消息发送队列

This commit is contained in:
2025-08-19 10:23:00 +08:00
parent 76b49097c1
commit 3a90bc329b
9 changed files with 106 additions and 99 deletions
+10 -6
View File
@@ -77,8 +77,10 @@ struct callback_desc apptimer_callback_desc = {
// .myType = L2_NODE_HEAD, // .myType = L2_NODE_HEAD,
// .clustId = 1U, // .clustId = 1U,
// .myId = 1U, // .myId = 1U,
// .headId = 1U, // .headId = L2_HEAD_ID,
// .netScale = 10U, // .netScale = L2_NET_SCALE,
// .initTable = initRoutTable,
// .normalTable = normalRoutTable0,
// .serviceRate = L2_SVC_512K, // .serviceRate = L2_SVC_512K,
// .phyInstPtr = NULL, // physical layer reference // .phyInstPtr = NULL, // physical layer reference
// .tmcInstPtr = NULL // .tmcInstPtr = NULL
@@ -88,8 +90,10 @@ L2_CONFIG linkConfig = {
.myType = L2_NODE_MEMBER, .myType = L2_NODE_MEMBER,
.clustId = 1U, .clustId = 1U,
.myId = 2U, .myId = 2U,
.headId = 1U, .headId = L2_HEAD_ID,
.netScale = 10U, .netScale = L2_NET_SCALE,
.initTable = initRoutTable,
.normalTable = normalRoutTable0,
.serviceRate = L2_SVC_512K, .serviceRate = L2_SVC_512K,
.phyInstPtr = NULL, // physical layer reference .phyInstPtr = NULL, // physical layer reference
.tmcInstPtr = NULL .tmcInstPtr = NULL
@@ -128,8 +132,8 @@ static SYSBUS_CONFIG sysbusConfig = {
}; };
static SYSMON_CONFIG sysmonConfig = { static SYSMON_CONFIG sysmonConfig = {
.sendQueueMax = 32U, .sendQueueMax = 16U,
.recvQueueMax = 32U .recvQueueMax = 16U
}; };
/*********************** Driver Instance Definitions **************************/ /*********************** Driver Instance Definitions **************************/
+8 -8
View File
@@ -601,8 +601,8 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
(*instPtr)->tor.last = L2_TOR_SUSPEND; (*instPtr)->tor.last = L2_TOR_SUSPEND;
(*instPtr)->tor.curr = L2_TOR_SUSPEND; (*instPtr)->tor.curr = L2_TOR_SUSPEND;
(*instPtr)->tor.next = L2_TOR_SUSPEND; (*instPtr)->tor.next = L2_TOR_SUSPEND;
(*instPtr)->rtneConfig.rtneTable = initTable; (*instPtr)->rtneConfig.rtneTable = (*instPtr)->config.initTable;
(*instPtr)->rtneConfig.rtnePrd = ARRAY_SIZE(initTable); (*instPtr)->rtneConfig.rtnePrd = ARRAY_SIZE(initRoutTable);
(*instPtr)->mainState = L2_INIT_STATE; (*instPtr)->mainState = L2_INIT_STATE;
(*instPtr)->nextState = L2_INIT_STATE; (*instPtr)->nextState = L2_INIT_STATE;
(*instPtr)->myInfo.nodeId = config->myId; (*instPtr)->myInfo.nodeId = config->myId;
@@ -698,8 +698,8 @@ int32_t Linklayer_Reconfig(L2_INST *instPtr, const L2_CONFIG *config)
instPtr->tor.last = L2_TOR_SUSPEND; instPtr->tor.last = L2_TOR_SUSPEND;
instPtr->tor.curr = L2_TOR_SUSPEND; instPtr->tor.curr = L2_TOR_SUSPEND;
instPtr->tor.next = L2_TOR_SUSPEND; instPtr->tor.next = L2_TOR_SUSPEND;
instPtr->rtneConfig.rtneTable = initTable; instPtr->rtneConfig.rtneTable = instPtr->config.initTable;
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(initTable); instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(initRoutTable);
instPtr->mainState = L2_INIT_STATE; instPtr->mainState = L2_INIT_STATE;
instPtr->nextState = L2_INIT_STATE; instPtr->nextState = L2_INIT_STATE;
instPtr->myInfo.nodeId = config->myId; instPtr->myInfo.nodeId = config->myId;
@@ -883,14 +883,14 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
// Reset scan net FMS for next scan process. // Reset scan net FMS for next scan process.
L2_Scan_Reset(instPtr->scanFSM); L2_Scan_Reset(instPtr->scanFSM);
UpdateMainSate(instPtr, L2_INIT_STATE); UpdateMainSate(instPtr, L2_INIT_STATE);
// instPtr->rtneConfig.rtneTable = initTable; instPtr->rtneConfig.rtneTable = instPtr->config.initTable;
// instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(initTable); instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(initRoutTable);
} }
else if (instPtr->nextState == L2_NORMAL_STATE) else if (instPtr->nextState == L2_NORMAL_STATE)
{ {
UpdateMainSate(instPtr, L2_NORMAL_STATE); UpdateMainSate(instPtr, L2_NORMAL_STATE);
// instPtr->rtneConfig.rtneTable = normalTable0; instPtr->rtneConfig.rtneTable = instPtr->config.normalTable;
// instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable0); instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalRoutTable0);
} }
else else
{ {
+6 -4
View File
@@ -45,6 +45,8 @@ typedef struct
uint8_t headId; ///< head node id uint8_t headId; ///< head node id
uint8_t netScale; ///< net scale uint8_t netScale; ///< net scale
L2_SVC_RATE serviceRate; ///< service data rate L2_SVC_RATE serviceRate; ///< service data rate
L2_RTNE_TABLE_ENTRY **initTable;
L2_RTNE_TABLE_ENTRY **normalTable;
PHY_INST *phyInstPtr; ///< pointer to system physical layer instance PHY_INST *phyInstPtr; ///< pointer to system physical layer instance
TMC_INST *tmcInstPtr; ///< pointer to system timer controller layer instance TMC_INST *tmcInstPtr; ///< pointer to system timer controller layer instance
} L2_CONFIG; } L2_CONFIG;
@@ -129,10 +131,10 @@ typedef struct
} L2_INST; } L2_INST;
/************************** Variable Definitions *****************************/ /************************** Variable Definitions *****************************/
extern L2_RTNE_TABLE_ENTRY *initTable[L2_INIT_RTNE_PERIOD]; extern L2_RTNE_TABLE_ENTRY *initRoutTable[L2_INIT_RTNE_PERIOD];
extern L2_RTNE_TABLE_ENTRY *normalTable0[L2_INIT_RTNE_PERIOD]; extern L2_RTNE_TABLE_ENTRY *normalRoutTable0[L2_INIT_RTNE_PERIOD];
extern L2_RTNE_TABLE_ENTRY *normalTable1[L2_INIT_RTNE_PERIOD]; extern L2_RTNE_TABLE_ENTRY *normalRoutTable1[L2_INIT_RTNE_PERIOD];
extern L2_RTNE_TABLE_ENTRY *normalTable2[L2_INIT_RTNE_PERIOD]; extern L2_RTNE_TABLE_ENTRY *normalRoutTable2[L2_INIT_RTNE_PERIOD];
/************************** Function Prototypes ******************************/ /************************** Function Prototypes ******************************/
/** /**
* @defgroup LinkLayer_Main * @defgroup LinkLayer_Main
+3 -2
View File
@@ -37,8 +37,9 @@
#define L2_BROADCAST_ID2 0xF2 #define L2_BROADCAST_ID2 0xF2
#define L2_BROADCAST_ID3 0xF4 #define L2_BROADCAST_ID3 0xF4
#define L2_UNICAST_ID 0xF0 #define L2_UNICAST_ID 0xF0
#define L2_NONE_ID 0 #define L2_NONE_ID 0U
#define L2_HEAD_ID 0x01 #define L2_HEAD_ID 1U
#define L2_NET_SCALE 10U
// Routine configure // Routine configure
#define L2_INIT_RTNE_PERIOD 1 #define L2_INIT_RTNE_PERIOD 1
+4 -4
View File
@@ -853,22 +853,22 @@ L2_RTNE_TABLE_ENTRY tab3Mng3Svc[L2_SLOTS_PER_FRAME] =
{L2_SLOT_IDLE, 0x00, 0x00, 0x00} {L2_SLOT_IDLE, 0x00, 0x00, 0x00}
}; };
L2_RTNE_TABLE_ENTRY *initTable[L2_INIT_RTNE_PERIOD] = L2_RTNE_TABLE_ENTRY *initRoutTable[L2_INIT_RTNE_PERIOD] =
{ {
tab10Mng10Svc tab10Mng10Svc
}; };
L2_RTNE_TABLE_ENTRY *normalTable0[L2_INIT_RTNE_PERIOD] = L2_RTNE_TABLE_ENTRY *normalRoutTable0[L2_INIT_RTNE_PERIOD] =
{ {
tab10Mng10Svc tab10Mng10Svc
}; };
L2_RTNE_TABLE_ENTRY *normalTable1[L2_INIT_RTNE_PERIOD] = L2_RTNE_TABLE_ENTRY *normalRoutTable1[L2_INIT_RTNE_PERIOD] =
{ {
tab10Mng3Svc tab10Mng3Svc
}; };
L2_RTNE_TABLE_ENTRY *normalTable2[L2_INIT_RTNE_PERIOD] = L2_RTNE_TABLE_ENTRY *normalRoutTable2[L2_INIT_RTNE_PERIOD] =
{ {
tab3Mng3Svc tab3Mng3Svc
}; };
+17 -7
View File
@@ -256,6 +256,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
recvPayload->dataLen = message->dataLen; recvPayload->dataLen = message->dataLen;
memcpy(recvPayload->data, message->data, message->dataLen); memcpy(recvPayload->data, message->data, message->dataLen);
SysMonitor_GenRecvRsp(recvPayload); SysMonitor_GenRecvRsp(recvPayload);
free(recvPayload);
} }
// Logging... // Logging...
@@ -276,7 +277,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
L2_MSG_ACK *message = (L2_MSG_ACK *)msg; L2_MSG_ACK *message = (L2_MSG_ACK *)msg;
size_t msgLen = sizeof(L2_MSG_ACK); size_t msgLen = sizeof(L2_MSG_ACK);
size_t dataLen = L2_PAYLOAD_LEN_ACK; size_t maxDataLen = L2_PAYLOAD_LEN_ACK;
// Update node status. // Update node status.
uint8_t nodeId = message->common.src; uint8_t nodeId = message->common.src;
@@ -326,12 +327,21 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
} }
// Get data payload & upload // Get data payload & upload
SYSBUS_SVC_PLD recvPayload; if (message->dataId != DATA_ID_NONE)
recvPayload.dataId = message->dataId; {
recvPayload.nodeId = message->common.src; if (message->dataLen > maxDataLen)
recvPayload.dataLen = message->dataLen; {
memcpy(recvPayload.data, message->data, dataLen); DBG_ERROR("Payload length" PRIu16 " out of range.\n", message->dataLen);
SysMonitor_GenRecvRsp(&recvPayload); return EIGNORE;
}
SYSBUS_SVC_PLD *recvPayload = calloc(1, sizeof(SYSBUS_SVC_PLD));
recvPayload->dataId = message->dataId;
recvPayload->nodeId = message->common.src;
recvPayload->dataLen = message->dataLen;
memcpy(recvPayload->data, message->data, message->dataLen);
SysMonitor_GenRecvRsp(recvPayload);
free(recvPayload);
}
// Logging... // Logging...
instPtr->log.rxLog.dataId = message->dataId; instPtr->log.rxLog.dataId = message->dataId;
+9 -6
View File
@@ -201,7 +201,7 @@ static int32_t Service_Packing128K(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t
{ {
// Packing extra payload // Packing extra payload
SYSBUS_SVC_PLD *sendPayload; SYSBUS_SVC_PLD *sendPayload;
SysMonitor_GetSendPayload(&sendPayload); SysMonitor_GetSendPayload(&sendPayload, dstId);
if(sendPayload == NULL) if(sendPayload == NULL)
{ {
message->common.dst = L2_NONE_ID; message->common.dst = L2_NONE_ID;
@@ -211,7 +211,7 @@ static int32_t Service_Packing128K(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t
} }
else else
{ {
// message->common.dst = sendPayload->nodeId; // message->common.dst = sendPayload->nodeId;
message->dataId = sendPayload->dataId; message->dataId = sendPayload->dataId;
message->dataLen = sendPayload->dataLen; message->dataLen = sendPayload->dataLen;
memset(message->data, 0xAA, maxDataLen); memset(message->data, 0xAA, maxDataLen);
@@ -279,7 +279,7 @@ static int32_t Service_Packing512K(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t
// Pack extra payload // Pack extra payload
SYSBUS_SVC_PLD *sendPayload; SYSBUS_SVC_PLD *sendPayload;
SysMonitor_GetSendPayload(&sendPayload); SysMonitor_GetSendPayload(&sendPayload, dstId);
if(sendPayload == NULL) if(sendPayload == NULL)
{ {
message->common.dst = L2_NONE_ID; message->common.dst = L2_NONE_ID;
@@ -289,7 +289,7 @@ static int32_t Service_Packing512K(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t
} }
else else
{ {
// message->common.dst = sendPayload->nodeId; // message->common.dst = sendPayload->nodeId;
message->dataId = sendPayload->dataId; message->dataId = sendPayload->dataId;
message->dataLen = sendPayload->dataLen; message->dataLen = sendPayload->dataLen;
memset(message->data, 0xAA, maxDataLen); memset(message->data, 0xAA, maxDataLen);
@@ -349,7 +349,7 @@ static int32_t Service_Packing2M(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t d
// Packing extra payload // Packing extra payload
SYSBUS_SVC_PLD *sendPayload; SYSBUS_SVC_PLD *sendPayload;
SysMonitor_GetSendPayload(&sendPayload); SysMonitor_GetSendPayload(&sendPayload, dstId);
if(sendPayload == NULL) if(sendPayload == NULL)
{ {
message->common.dst = L2_NONE_ID; message->common.dst = L2_NONE_ID;
@@ -359,7 +359,7 @@ static int32_t Service_Packing2M(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t d
} }
else else
{ {
// message->common.dst = sendPayload->nodeId; // message->common.dst = sendPayload->nodeId;
message->dataId = sendPayload->dataId; message->dataId = sendPayload->dataId;
message->dataLen = sendPayload->dataLen; message->dataLen = sendPayload->dataLen;
memset(message->data, 0xAA, maxDataLen); memset(message->data, 0xAA, maxDataLen);
@@ -541,6 +541,7 @@ static int32_t Service_PktHandler128K(L2_INST *instPtr, uint8_t *msg)
recvPayload->dataLen = message->dataLen; recvPayload->dataLen = message->dataLen;
memcpy(recvPayload->data, message->data, message->dataLen); memcpy(recvPayload->data, message->data, message->dataLen);
SysMonitor_GenRecvRsp(recvPayload); SysMonitor_GenRecvRsp(recvPayload);
free(recvPayload);
} }
// Logging... // Logging...
@@ -629,6 +630,7 @@ static int32_t Service_PktHandler512K(L2_INST *instPtr, uint8_t *msg)
recvPayload->dataLen = message->dataLen; recvPayload->dataLen = message->dataLen;
memcpy(recvPayload->data, message->data, message->dataLen); memcpy(recvPayload->data, message->data, message->dataLen);
SysMonitor_GenRecvRsp(recvPayload); SysMonitor_GenRecvRsp(recvPayload);
free(recvPayload);
} }
// Logging... // Logging...
@@ -717,6 +719,7 @@ static int32_t Service_PktHandler2M(L2_INST *instPtr, uint8_t *msg)
recvPayload->dataLen = message->dataLen; recvPayload->dataLen = message->dataLen;
memcpy(recvPayload->data, message->data, message->dataLen); memcpy(recvPayload->data, message->data, message->dataLen);
SysMonitor_GenRecvRsp(recvPayload); SysMonitor_GenRecvRsp(recvPayload);
free(recvPayload);
} }
// Logging... // Logging...
+48 -61
View File
@@ -27,6 +27,9 @@
#include "common.h" #include "common.h"
#include "error.h" #include "error.h"
#include "circ_queue.h" #include "circ_queue.h"
// TODO: better approach?
#include "../networking/link_layer/link_layer.h"
#include "../networking/phy_layer/phy_layer.h"
/** /**
* @addtogroup SystemBus_Protocol_Routine * @addtogroup SystemBus_Protocol_Routine
@@ -175,8 +178,8 @@ typedef struct
typedef struct typedef struct
{ {
SYSMON_CONFIG config; ///< system monitor initialization parameters SYSMON_CONFIG config; ///< system monitor initialization parameters
CIRC_QUEUE *sendQueue; ///< send queue CIRC_QUEUE *sendQueue[L2_NET_SCALE]; ///< send queue
CIRC_QUEUE *recvQueue; ///< receive queue CIRC_QUEUE *recvQueue[L2_NET_SCALE]; ///< receive queue
PINGPONG sysInfoCtrl; PINGPONG sysInfoCtrl;
SYSINFO sysInfo[2]; SYSINFO sysInfo[2];
PINGPONG linkLogCtrl; PINGPONG linkLogCtrl;
@@ -196,8 +199,6 @@ static int32_t SystemBus_GenRemoteTestRsp(SYSBUS *instPtr, uint8_t *msg);
/**************************** Type Definitions *******************************/ /**************************** Type Definitions *******************************/
/************************** Variable Definitions *****************************/ /************************** Variable Definitions *****************************/
// TODO: better approach? // TODO: better approach?
#include "../networking/link_layer/link_layer.h"
#include "../networking/phy_layer/phy_layer.h"
extern L2_INST *linkInstPtr; extern L2_INST *linkInstPtr;
extern L2_CONFIG linkConfig; extern L2_CONFIG linkConfig;
extern SYSBUS *sysbusDescPtr; extern SYSBUS *sysbusDescPtr;
@@ -339,6 +340,39 @@ static int32_t SystemBus_SystemConfig(SYSBUS *instPtr, uint8_t *msg)
} }
} }
// Routing table selection
if (msg[WD_RTNE_CMD] != instPtr->sysbusLog.lastConfig[3])
{
switch (msg[WD_RTNE_CMD])
{
case 0:
{
reconfig |= (linkConfig.normalTable != normalRoutTable0);
linkConfig.normalTable = normalRoutTable0;
break;
}
case 1:
{
reconfig |= (linkConfig.normalTable != normalRoutTable1);
linkConfig.normalTable = normalRoutTable1;
break;
}
case 2:
{
reconfig |= (linkConfig.normalTable != normalRoutTable2);
linkConfig.normalTable = normalRoutTable2;
break;
}
default:
{
// Ignore current command
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
WD_RTNE_CMD, msg[WD_RTNE_CMD]);
return EIGNORE;
}
}
}
// Enable control // Enable control
if (msg[WD_EN_CMD] == EN_CMD_ENABLE) if (msg[WD_EN_CMD] == EN_CMD_ENABLE)
{ {
@@ -368,58 +402,6 @@ static int32_t SystemBus_SystemConfig(SYSBUS *instPtr, uint8_t *msg)
return EIGNORE; return EIGNORE;
} }
// Routing table selection
if (msg[WD_RTNE_CMD] != instPtr->sysbusLog.lastConfig[3])
{
L2_RTNE_CONFIG newRtneConfig;
switch (msg[WD_RTNE_CMD])
{
case 0:
{
newRtneConfig.rtneTable = normalTable0;
newRtneConfig.rtnePrd = ARRAY_SIZE(normalTable0);
L2_EVENT l2Event =
{
.event = L2_ROUTINE_UPDATE,
.msg = &newRtneConfig
};
AssertL2Event(linkInstPtr, &l2Event);
break;
}
case 1:
{
newRtneConfig.rtneTable = normalTable1;
newRtneConfig.rtnePrd = ARRAY_SIZE(normalTable1);
L2_EVENT l2Event =
{
.event = L2_ROUTINE_UPDATE,
.msg = &newRtneConfig
};
AssertL2Event(linkInstPtr, &l2Event);
break;
}
case 2:
{
newRtneConfig.rtneTable = normalTable2;
newRtneConfig.rtnePrd = ARRAY_SIZE(normalTable2);
L2_EVENT l2Event =
{
.event = L2_ROUTINE_UPDATE,
.msg = &newRtneConfig
};
AssertL2Event(linkInstPtr, &l2Event);
break;
}
default:
{
// Ignore current command
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
WD_RTNE_CMD, msg[WD_RTNE_CMD]);
return EIGNORE;
}
}
}
instPtr->sysbusLog.lastConfig[0] = msg[WD_EN_CMD]; instPtr->sysbusLog.lastConfig[0] = msg[WD_EN_CMD];
instPtr->sysbusLog.lastConfig[1] = msg[WD_ID_CMD]; instPtr->sysbusLog.lastConfig[1] = msg[WD_ID_CMD];
instPtr->sysbusLog.lastConfig[2] = msg[WD_RATE_CMD]; instPtr->sysbusLog.lastConfig[2] = msg[WD_RATE_CMD];
@@ -780,8 +762,8 @@ int32_t SysMonitor_Init(SYSMON_CONFIG *config)
} }
memcpy(&(sysMonitorInst->config), config, sizeof(SYSMON_CONFIG)); memcpy(&(sysMonitorInst->config), config, sizeof(SYSMON_CONFIG));
sysMonitorInst->sendQueue = NULL; sysMonitorInst->sendQueue[1] = NULL;
sysMonitorInst->recvQueue = NULL; sysMonitorInst->recvQueue[1] = NULL;
memset(&(sysMonitorInst->sysInfoCtrl), BUFF_NONE, sizeof(PINGPONG)); memset(&(sysMonitorInst->sysInfoCtrl), BUFF_NONE, sizeof(PINGPONG));
memset(&(sysMonitorInst->linkLogCtrl), BUFF_NONE, sizeof(PINGPONG)); memset(&(sysMonitorInst->linkLogCtrl), BUFF_NONE, sizeof(PINGPONG));
memset(&(sysMonitorInst->phyLogCtrl), BUFF_NONE, sizeof(PINGPONG)); memset(&(sysMonitorInst->phyLogCtrl), BUFF_NONE, sizeof(PINGPONG));
@@ -874,6 +856,11 @@ int32_t SysMonitor_UpdateSendPayload(SYSBUS_SVC_PLD *payload)
DBG_ERROR("Payload length %d exceeds valid range.", payload->dataLen); DBG_ERROR("Payload length %d exceeds valid range.", payload->dataLen);
return EPARAM; return EPARAM;
} }
if (payload->nodeId < L2_NODE_NONE || payload->nodeId > L2_NET_SCALE)
{
DBG_ERROR("Node ID %d exceeds valid range.", payload->nodeId);
return EPARAM;
}
// push message into send queue // push message into send queue
SYSBUS_SVC_PLD *payloadCopy = malloc(sizeof(SYSBUS_SVC_PLD)); SYSBUS_SVC_PLD *payloadCopy = malloc(sizeof(SYSBUS_SVC_PLD));
@@ -883,7 +870,7 @@ int32_t SysMonitor_UpdateSendPayload(SYSBUS_SVC_PLD *payload)
return ENOMEM; return ENOMEM;
} }
memcpy(payloadCopy, payload, sizeof(SYSBUS_SVC_PLD)); memcpy(payloadCopy, payload, sizeof(SYSBUS_SVC_PLD));
if (CircQueuePush(sysMonitorInst->sendQueue, (void *)payloadCopy) == false) if (CircQueuePush(sysMonitorInst->sendQueue[payload->nodeId], (void *)payloadCopy) == false)
{ {
DBG_WARNING("SystemMonitor::SEND Queue overflowed!\n"); DBG_WARNING("SystemMonitor::SEND Queue overflowed!\n");
free(payloadCopy); free(payloadCopy);
@@ -898,12 +885,12 @@ int32_t SysMonitor_UpdateSendPayload(SYSBUS_SVC_PLD *payload)
* *
* @param payload * @param payload
*/ */
void SysMonitor_GetSendPayload(SYSBUS_SVC_PLD **payload) void SysMonitor_GetSendPayload(SYSBUS_SVC_PLD **payload, uint8_t dstId)
{ {
ASSERT(sysMonitorInst != NULL); ASSERT(sysMonitorInst != NULL);
ASSERT(payload != NULL); ASSERT(payload != NULL);
if (CircQueuePop(sysMonitorInst->sendQueue, (void **)payload) == false) if (CircQueuePop(sysMonitorInst->sendQueue[dstId], (void **)payload) == false)
{ {
*payload = NULL; *payload = NULL;
DBG_INFO("SystemMonitor::Empty sendQueue, nothing need sent.\n"); DBG_INFO("SystemMonitor::Empty sendQueue, nothing need sent.\n");
+1 -1
View File
@@ -313,7 +313,7 @@ void SysMonitor_UpdateSysinfo(const SYSINFO *info);
void SysMonitor_GetSysinfo(SYSINFO *info); void SysMonitor_GetSysinfo(SYSINFO *info);
int32_t SysMonitor_UpdateSendPayload(SYSBUS_SVC_PLD *payload); int32_t SysMonitor_UpdateSendPayload(SYSBUS_SVC_PLD *payload);
void SysMonitor_GetSendPayload(SYSBUS_SVC_PLD **payload); void SysMonitor_GetSendPayload(SYSBUS_SVC_PLD **payload, uint8_t dstId);
int32_t SysMonitor_GenRecvRsp(SYSBUS_SVC_PLD *payload); int32_t SysMonitor_GenRecvRsp(SYSBUS_SVC_PLD *payload);
void SysMonitor_UpdateLinklayerLog(const LINKLOG *log); void SysMonitor_UpdateLinklayerLog(const LINKLOG *log);