better debug print.

This commit is contained in:
Gatsby Van
2023-12-22 13:14:37 +08:00
parent 26a912dcc0
commit 633be421b1
3 changed files with 15 additions and 7 deletions
+8 -5
View File
@@ -296,11 +296,11 @@ static int32_t MgmtMsg_Packing(L2_INST* instPtr, BIT_ARRAY* bitarr, L2_MSG_TYPE
dataChunk = 2; dataChunk = 2;
FrameInsertChunk(bitarr, RTT_REQ_MSG_OFFSET, RTT_REQ_MSG_LEN, dataChunk); FrameInsertChunk(bitarr, RTT_REQ_MSG_OFFSET, RTT_REQ_MSG_LEN, dataChunk);
// source node address length. // source node address.
dataChunk = (L2_GetNodeId(instPtr) & 0x1F) | (((uint16_t)(L2_GetClusterId(instPtr) & 0x1F)) << 5); dataChunk = (L2_GetNodeId(instPtr) & 0x1F) | (((uint16_t)(L2_GetClusterId(instPtr) & 0x1F)) << 5);
FrameInsertChunk(bitarr, RTT_REQ_SRC_ADDR_OFFSET, RTT_REQ_SRC_ADDR_LEN, dataChunk); FrameInsertChunk(bitarr, RTT_REQ_SRC_ADDR_OFFSET, RTT_REQ_SRC_ADDR_LEN, dataChunk);
// destination node address length. // destination node address.
dataChunk = (0x02) | (((uint16_t) (L2_GetClusterId(instPtr) & 0x1F)) << 5); dataChunk = (0x02) | (((uint16_t) (L2_GetClusterId(instPtr) & 0x1F)) << 5);
FrameInsertChunk(bitarr, RTT_REQ_DST_ADDR_OFFSET, RTT_REQ_DST_ADDR_LEN, dataChunk); FrameInsertChunk(bitarr, RTT_REQ_DST_ADDR_OFFSET, RTT_REQ_DST_ADDR_LEN, dataChunk);
break; break;
@@ -347,11 +347,11 @@ static int32_t MgmtMsg_Packing(L2_INST* instPtr, BIT_ARRAY* bitarr, L2_MSG_TYPE
dataChunk = 2; dataChunk = 2;
FrameInsertChunk(bitarr, RTT_RSP_MSG_OFFSET, RTT_RSP_MSG_LEN, dataChunk); FrameInsertChunk(bitarr, RTT_RSP_MSG_OFFSET, RTT_RSP_MSG_LEN, dataChunk);
// source node address length. // source node address.
dataChunk = (L2_GetNodeId(instPtr) & 0x1F) | (((uint16_t)(L2_GetClusterId(instPtr) & 0x1F)) << 5); dataChunk = (L2_GetNodeId(instPtr) & 0x1F) | (((uint16_t)(L2_GetClusterId(instPtr) & 0x1F)) << 5);
FrameInsertChunk(bitarr, RTT_RSP_SRC_ADDR_OFFSET, RTT_RSP_SRC_ADDR_LEN, dataChunk); FrameInsertChunk(bitarr, RTT_RSP_SRC_ADDR_OFFSET, RTT_RSP_SRC_ADDR_LEN, dataChunk);
// destination node address length. // destination node address.
dataChunk = (0x01) | (((uint16_t) (L2_GetClusterId(instPtr) & 0x1F)) << 5); dataChunk = (0x01) | (((uint16_t) (L2_GetClusterId(instPtr) & 0x1F)) << 5);
FrameInsertChunk(bitarr, RTT_RSP_DST_ADDR_OFFSET, RTT_RSP_DST_ADDR_LEN, dataChunk); FrameInsertChunk(bitarr, RTT_RSP_DST_ADDR_OFFSET, RTT_RSP_DST_ADDR_LEN, dataChunk);
break; break;
@@ -607,9 +607,11 @@ int32_t MgmtNet_PktHandler(L2_INST* instPtr) {
L2_RTT_MSG_RECORD *rttMsgRspLog = &(instPtr->mgmtNetFSM->rttMsgRspLog); L2_RTT_MSG_RECORD *rttMsgRspLog = &(instPtr->mgmtNetFSM->rttMsgRspLog);
L2_RTT_MSG_RECORD *rttMsgReqLog = &(instPtr->mgmtNetFSM->rttMsgReqLog); L2_RTT_MSG_RECORD *rttMsgReqLog = &(instPtr->mgmtNetFSM->rttMsgReqLog);
DBG_INFO("Management net handling packet...\n");
BIT_ARRAY* mgmtMsg = bit_array_create(L2_MSG_MAX); BIT_ARRAY* mgmtMsg = bit_array_create(L2_MSG_MAX);
if (mgmtMsg == NULL) { if (mgmtMsg == NULL) {
free(mgmtMsg); DBG_INFO("Failed to start handling process...\n");
return EALLOC; return EALLOC;
} }
switch (L2_GetLastFrameType(instPtr)) { switch (L2_GetLastFrameType(instPtr)) {
@@ -929,6 +931,7 @@ int32_t MgmtNet_Routine(L2_INST* instPtr, const L2_RTNE_TABLE_ENTRY* rtneEntry){
if(rttRxEvent == NULL) { if(rttRxEvent == NULL) {
DBG_ERROR("Failed to initialize rtt event.\n"); DBG_ERROR("Failed to initialize rtt event.\n");
} }
// Schedule rtt update after receive process end.
Status = L2_ScheduleEventAfter(instPtr, rttRxEvent, INTRA_TSYNC_SLOTS + 1); Status = L2_ScheduleEventAfter(instPtr, rttRxEvent, INTRA_TSYNC_SLOTS + 1);
} }
} }
+4 -1
View File
@@ -573,9 +573,12 @@ int32_t ScanNet_PktHandler(L2_INST* instPtr) {
uint32_t Status; uint32_t Status;
L2_SCAN_FSM* scanFsmPtr = instPtr->scanNetFSM; L2_SCAN_FSM* scanFsmPtr = instPtr->scanNetFSM;
uint64_t dataChunk; uint64_t dataChunk;
DBG_INFO("Scan net handling packet...\n");
BIT_ARRAY* scanMsg = bit_array_create(L2_MSG_MAX); BIT_ARRAY* scanMsg = bit_array_create(L2_MSG_MAX);
if (scanMsg == NULL) { if (scanMsg == NULL) {
free(scanMsg); DBG_INFO("Failed to start handling process...\n");
return EALLOC; return EALLOC;
} }
switch (L2_GetLastFrameType(instPtr)) { switch (L2_GetLastFrameType(instPtr)) {
+3 -1
View File
@@ -205,6 +205,8 @@ void ServiceNet_Destroy(L2_SVC_FSM* serviceFSM){
******************************************************************************/ ******************************************************************************/
int32_t ServiceNet_PktHandler(L2_INST* instPtr) { int32_t ServiceNet_PktHandler(L2_INST* instPtr) {
// TODO: // TODO:
DBG_INFO("Scan net handling packet...\n");
return SUCCESS; return SUCCESS;
} }
@@ -252,7 +254,7 @@ int32_t ServiceNet_Routine(L2_INST* instPtr, const L2_RTNE_TABLE_ENTRY* rtneEntr
case L2_SLOT_INTRA_SVC: case L2_SLOT_INTRA_SVC:
if(torState == L2_TOR_TX){ if(torState == L2_TOR_TX){
//TODO: //TODO:
memset(instPtr->sendPktData, 0xAA, INTRA_SVC_FRAME_LENGTH_MAX); memset(instPtr->sendPktData, 0x00, INTRA_SVC_FRAME_LENGTH_MAX);
// Pack PDU header // Pack PDU header
if(PduHeader_Packing(instPtr, svcMsg, L2_PDU_HEADER_0, rtneEntry->dst0) != SUCCESS){ if(PduHeader_Packing(instPtr, svcMsg, L2_PDU_HEADER_0, rtneEntry->dst0) != SUCCESS){
DBG_ERROR("Failed to packing PduHeader.\n"); DBG_ERROR("Failed to packing PduHeader.\n");