diff --git a/doc/comtool-plugin-hsjl.py b/doc/comtool-plugin-hsjl.py index 2a313fd..b66cf04 100644 --- a/doc/comtool-plugin-hsjl.py +++ b/doc/comtool-plugin-hsjl.py @@ -39,10 +39,10 @@ class Plugin(Plugin_Base): "data": "5A 54 E1 EE 00 CF 02 5A FE" }, { - "caption": "数据发送测试 - 40 Byte", + "caption": "数据发送测试(节点01)", "icon": "fa5.play-circle", "data": ( - "5A 54 E4 EE 00 00 00 00 02 00 28 " + "5A 54 E4 EE 01 00 00 00 01 28 00 " "00 01 02 03 04 05 06 07 " "08 09 0A 0B 0C 0D 0E 0F " "10 11 12 13 14 15 16 17 " @@ -51,11 +51,32 @@ class Plugin(Plugin_Base): "00 08 31 5A FE" ) }, - # { - # "caption": "数据发送测试 - 2", - # "icon": "fa5.play-circle", - # "data": "" - # }, + { + "caption": "数据发送测试(节点02)", + "icon": "fa5.play-circle", + "data": ( + "5A 54 E4 EE 02 00 00 00 02 28 00 " + "00 01 02 03 04 05 06 07 " + "08 09 0A 0B 0C 0D 0E 0F " + "10 11 12 13 14 15 16 17 " + "18 19 1A 1B 1C 1D 1E 1F " + "20 21 22 23 24 25 26 27 " + "00 0A 31 5A FE" + ) + }, + { + "caption": "数据发送测试(节点03)", + "icon": "fa5.play-circle", + "data": ( + "5A 54 E4 EE 03 00 00 00 03 28 00 " + "00 01 02 03 04 05 06 07 " + "08 09 0A 0B 0C 0D 0E 0F " + "10 11 12 13 14 15 16 17 " + "18 19 1A 1B 1C 1D 1E 1F " + "20 21 22 23 24 25 26 27 " + "00 0C 31 5A FE" + ) + }, { "caption": "装订 - 【主 - 0x01】128 kbps,时隙表 0", "icon": "fa5.play-circle", diff --git a/src/systembus/systembus.c b/src/systembus/systembus.c index 103d099..d5130f5 100644 --- a/src/systembus/systembus.c +++ b/src/systembus/systembus.c @@ -762,24 +762,27 @@ int32_t SysMonitor_Init(SYSMON_CONFIG *config) } memcpy(&(sysMonitorInst->config), config, sizeof(SYSMON_CONFIG)); - sysMonitorInst->sendQueue[1] = NULL; - sysMonitorInst->recvQueue[1] = NULL; memset(&(sysMonitorInst->sysInfoCtrl), BUFF_NONE, sizeof(PINGPONG)); memset(&(sysMonitorInst->linkLogCtrl), BUFF_NONE, sizeof(PINGPONG)); memset(&(sysMonitorInst->phyLogCtrl), BUFF_NONE, sizeof(PINGPONG)); memset(&(sysMonitorInst->hwStateCtrl), BUFF_NONE, sizeof(PINGPONG)); - if (CircQueueCreate(&(sysMonitorInst->sendQueue), - sysMonitorInst->config.sendQueueMax) == false) + for (uint8_t ii = 0; ii < L2_NET_SCALE; ii++) { - SysMonitor_Destroy(); - return ENOMEM; - } - if (CircQueueCreate(&(sysMonitorInst->recvQueue), - sysMonitorInst->config.recvQueueMax) == false) - { - SysMonitor_Destroy(); - return ENOMEM; + sysMonitorInst->sendQueue[ii] = NULL; + sysMonitorInst->recvQueue[ii] = NULL; + if (CircQueueCreate(&(sysMonitorInst->sendQueue[ii]), + sysMonitorInst->config.sendQueueMax) == false) + { + SysMonitor_Destroy(); + return ENOMEM; + } + if (CircQueueCreate(&(sysMonitorInst->recvQueue[ii]), + sysMonitorInst->config.recvQueueMax) == false) + { + SysMonitor_Destroy(); + return ENOMEM; + } } return SUCCESS; @@ -870,7 +873,8 @@ int32_t SysMonitor_UpdateSendPayload(SYSBUS_SVC_PLD *payload) return ENOMEM; } memcpy(payloadCopy, payload, sizeof(SYSBUS_SVC_PLD)); - if (CircQueuePush(sysMonitorInst->sendQueue[payload->nodeId], (void *)payloadCopy) == false) + // valid id starts from 0x01 + if (CircQueuePush(sysMonitorInst->sendQueue[payload->nodeId-1], (void *)payloadCopy) == false) { DBG_WARNING("SystemMonitor::SEND Queue overflowed!\n"); free(payloadCopy); @@ -890,7 +894,8 @@ void SysMonitor_GetSendPayload(SYSBUS_SVC_PLD **payload, uint8_t dstId) ASSERT(sysMonitorInst != NULL); ASSERT(payload != NULL); - if (CircQueuePop(sysMonitorInst->sendQueue[dstId], (void **)payload) == false) + // valid id starts from 0x01 + if (CircQueuePop(sysMonitorInst->sendQueue[dstId-1], (void **)payload) == false) { *payload = NULL; DBG_INFO("SystemMonitor::Empty sendQueue, nothing need sent.\n"); @@ -904,8 +909,7 @@ void SysMonitor_GetSendPayload(SYSBUS_SVC_PLD **payload, uint8_t dstId) */ int32_t SysMonitor_GenRecvRsp(SYSBUS_SVC_PLD *payload) { - ASSERT(sysMonitorInst != NULL); - ASSERT(sysbusDescPtr != NULL); + ASSERT(payload != NULL); int32_t Status; if (payload->dataId == DATA_ID_NONE || payload->dataLen > SYSBUS_PLD_MAX) diff --git a/src/systembus/systembus.h b/src/systembus/systembus.h index c12dc10..5f11401 100644 --- a/src/systembus/systembus.h +++ b/src/systembus/systembus.h @@ -109,7 +109,7 @@ typedef struct * @struct SYSBUS_SVC_PLD * @brief Payload struct that holds the service payload */ -typedef struct +typedef struct __attribute__((packed)) { uint32_t dataId; ///< data identifier uint8_t nodeId; ///< destination ID for tx, source ID for rx