simplified function signature.

This commit is contained in:
Gatsby Van
2024-01-21 17:15:51 +08:00
parent b76f7bedb4
commit 9c335b0ff2
7 changed files with 258 additions and 126 deletions
+46 -38
View File
@@ -20,20 +20,20 @@
#include <string.h>
#include "linklayer814.h"
#include "linklayer814_types.h"
#include "node_list.h"
#include "msg_def.h"
#include "../error.h"
#include "../time_ctrl/time_ctrl.h"
#include "../util/util.h"
#include "../common.h"
#include "../util/util.h"
#include "../time_ctrl/time_ctrl.h"
/************************** Constant Definitions *****************************/
#define NET_START_TIME_INFTY UINT32_MAX
/************************** Variable Definitions *****************************/
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
static void L2_RcdShift(L2_RCD *rcd, int32_t netxVal);
static void UpdateMainSate(L2_INST *instPtr, L2_NODE_STATE newSate);
static void L2_SetSlotNum(L2_INST *instPtr, uint32_t newSlotNum);
static void L2_SetFrameNum(L2_INST *instPtr, uint32_t newFrameNum);
@@ -312,7 +312,7 @@ static L2_FRAME_TYPE L2_GetReceiveFrameType(L2_INST *instPtr)
return instPtr->frame.curr;
}
switch (instPtr->scanNetFSM->scanStage)
switch (instPtr->scanFSM->scanStage)
{
case L2_SCAN_INIT_STAGE:
case L2_SCAN_BMADVT_STAGE:
@@ -350,6 +350,7 @@ void L2_FrameStateUpdate(L2_INST *instPtr)
Phy_RetrieveRecvData(phyRef, instPtr->recvPktData);
instPtr->log.frameRecv++;
// Update frame state.
switch (L2_GetReceiveFrameType(instPtr))
{
case L2_INTRA_SCAN_FRAME:
@@ -606,7 +607,7 @@ uint32_t L2_GetFrameLen(L2_FRAME_TYPE l2FrameType)
/**
* @brief Convert L2 frame type to L1 frame type
*
* @param phyInstPtr A pointer to physical layer control instance.
* @param l2Frame
*
* @return L1 frame type.
*
@@ -818,24 +819,24 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
goto error;
}
Status = ScanNet_Init(&((*instPtr)->scanNetFSM));
Status = L2_Scan_Init(&((*instPtr)->scanFSM));
if (Status != SUCCESS)
{
DBG_ERROR("ScanNet_Init runs failed, with error code: %d.\n", Status);
DBG_ERROR("L2_Scan_Init runs failed, with error code: %d.\n", Status);
goto error;
}
Status = MgmtNet_Init(&((*instPtr)->mgmtNetFSM));
Status = L2_Mgmt_Init(&((*instPtr)->mgmtFSM));
if (Status != SUCCESS)
{
DBG_ERROR("MgmtNet_Init runs failed, with error code: %d.\n", Status);
DBG_ERROR("L2_Mgmt_Init runs failed, with error code: %d.\n", Status);
goto error;
}
Status = ServiceNet_Init(&((*instPtr)->serviceNetFSM));
Status = L2_Service_Init(&((*instPtr)->serviceFSM));
if (Status != SUCCESS)
{
DBG_ERROR("ServiceNet_Init runs failed, with error code: %d.\n", Status);
DBG_ERROR("L2_Service_Init runs failed, with error code: %d.\n", Status);
goto error;
}
@@ -923,9 +924,9 @@ int32_t Linklayer_Reconfig(L2_INST *instPtr, const L2_CONFIG *config)
// Reset according instance
L2_ClearSchedEventPool(instPtr->schdEventPool);
L2_NodeList_Clear(instPtr->nodeList);
ScanNet_Reset(instPtr->scanNetFSM);
MgmtNet_Reset(instPtr->mgmtNetFSM);
ServiceNet_Reset(instPtr->serviceNetFSM);
L2_Scan_Reset(instPtr->scanFSM);
L2_Mgmt_Reset(instPtr->mgmtFSM);
L2_Service_Reset(instPtr->serviceFSM);
RTT_Reset(instPtr->rttFSM);
return SUCCESS;
}
@@ -951,9 +952,9 @@ void Linklayer_Destroy(L2_INST *instPtr)
// Destroy FSMs and nodeList
L2_DestroySchedEventPool(instPtr->schdEventPool);
L2_NodeList_Destroy(instPtr->nodeList);
ScanNet_Destroy(instPtr->scanNetFSM);
MgmtNet_Destroy(instPtr->mgmtNetFSM);
ServiceNet_Destroy(instPtr->serviceNetFSM);
L2_Scan_Destroy(instPtr->scanFSM);
L2_Mgmt_Destroy(instPtr->mgmtFSM);
L2_Service_Destroy(instPtr->serviceFSM);
RTT_Destroy(instPtr->rttFSM);
free(instPtr);
}
@@ -1030,11 +1031,6 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
// TODO: Clear ACK
break;
}
case L2_EV_MGMT_PROC_DONE:
{
DBG_INFO("Event L2_EV_MGMT_PROC_DONE asserted....\n");
break;
}
case L2_EV_NET_SETUP_DONE:
{
DBG_INFO("Event L2_EV_NETSETUP_DONE asserted....\n");
@@ -1066,8 +1062,16 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
case L2_EV_LOST_CXN:
{
DBG_INFO("Event L2_EV_LOST_CXN asserted....\n");
if (instPtr->config.myType == L2_NODE_HEAD)
{
DBG_ERROR("Illegal event, only None_Head node can assert L2_EV_LOST_CXN.\n");
break;
}
DBG_WARNING("Lost connection with head node [%d].\n", L2_GetHeadId(instPtr));
L2_Scan_Reset(instPtr);
L2_Service_Reset(instPtr);
instPtr->cxn2Net = false;
UpdateMainSate(instPtr, L2_INIT_STATE);
break;
}
case L2_EV_LOST_NODE:
@@ -1081,8 +1085,8 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
if (instPtr->nextState == L2_INIT_STATE)
{
// Reset scan net FMS for next scan process.
ScanNet_Reset(instPtr->scanNetFSM);
UpdateMainSate(instPtr, L2_NORMAL_STATE);
L2_Scan_Reset(instPtr->scanFSM);
UpdateMainSate(instPtr, L2_INIT_STATE);
instPtr->rtneConfig.rtneTable = normalTable;
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable);
}
@@ -1106,6 +1110,10 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
instPtr->rtneConfig.rtneTable = interSeekTable;
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(interSeekTable);
}
else
{
DBG_WARNING("Unsupported routine state [%d], Continue withe previous routine table.\n", instPtr->nextState);
}
break;
}
case L2_ROUTINE_UPDATE:
@@ -1135,12 +1143,10 @@ int32_t Linklayer_EventHandler(L2_INST *instPtr, const L2_EVENT *l2Event)
* @return Status code.
*
******************************************************************************/
int mgmtFrameRecv = 0;
int svcFrameRecv = 0;
int32_t Linklayer_PktHandler(L2_INST *instPtr, L2_FRAME_TYPE frameType)
{
ASSERT(instPtr != NULL);
int32_t Status = SUCCESS;
int32_t Status;
if (instPtr->dataAvail == false)
{
@@ -1155,7 +1161,7 @@ int32_t Linklayer_PktHandler(L2_INST *instPtr, L2_FRAME_TYPE frameType)
case L2_INTRA_BM_FRAME:
case L2_INTER_W2_ACQ_FRAME:
case L2_INTRA_W2_ACQ_FRAME:
Status = ScanNet_PktHandler(instPtr);
Status = L2_Scan_PktHandler(instPtr);
break;
case L2_INTER_MGMT_FRAME:
case L2_INTRA_MGMT_FRAME:
@@ -1176,8 +1182,7 @@ int32_t Linklayer_PktHandler(L2_INST *instPtr, L2_FRAME_TYPE frameType)
instPtr->mgmtMsgRecvCnt1++;
}
}
mgmtFrameRecv++;
Status = MgmtNet_PktHandler(instPtr);
Status = L2_Mgmt_PktHandler(instPtr);
break;
case L2_INTER_SVC_FRAME:
case L2_INTRA_SVC_FRAME:
@@ -1196,8 +1201,7 @@ int32_t Linklayer_PktHandler(L2_INST *instPtr, L2_FRAME_TYPE frameType)
instPtr->svcMsgRecvCnt1++;
}
}
svcFrameRecv++;
Status = ServiceNet_PktHandler(instPtr);
Status = L2_Service_PktHandler(instPtr);
break;
default:
DBG_WARNING("L2FrameHandler: UNKNOWN L2-FrameType %d\n", frameType);
@@ -1257,17 +1261,17 @@ static int32_t Linklayer_Routine(L2_INST *instPtr)
case L2_SLOT_INTRA_SCAN_BM:
case L2_SLOT_INTER_SCAN_2W:
case L2_SLOT_INTRA_SCAN_2W:
Status = ScanNet_Routine(instPtr, &rtneEntry);
Status = L2_Scan_Routine(instPtr, &rtneEntry);
break;
case L2_SLOT_INTER_SVC:
case L2_SLOT_INTRA_SVC:
Status = ServiceNet_Routine(instPtr, &rtneEntry);
Status = L2_Service_Routine(instPtr, &rtneEntry);
break;
case L2_SLOT_INTER_MGMT:
case L2_SLOT_INTRA_MGMT:
case L2_SLOT_INTER_TSYNC:
case L2_SLOT_INTRA_TSYNC:
Status = MgmtNet_Routine(instPtr, &rtneEntry);
Status = L2_Mgmt_Routine(instPtr, &rtneEntry);
break;
default:
DBG_ERROR("UNKNOWN slot type [%d].\n", rtneEntry.slotType);
@@ -1325,7 +1329,10 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
// Handle frame received in last slot.
if (L2_isDataAvail(instPtr) == true)
{
Linklayer_PktHandler(instPtr, L2_GetLastFrameType(instPtr));
if (Linklayer_PktHandler(instPtr, L2_GetLastFrameType(instPtr)) != SUCCESS)
{
DBG_ERROR("Failed to handle last received frame: %ld.\n", instPtr->frame.last);
}
}
// Run Link layer routine, setup next slot procedure.
@@ -1344,9 +1351,10 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
else
{
Phy_SetMode(instPtr->config.phyInstPtr, PHY_MODE_LISTEN);
Status = ScanNet_Proc(instPtr);
Status = L2_Scan_Proc(instPtr);
}
}
// Check if previous runs has error occurred.
if (Status != SUCCESS)
{
+19 -19
View File
@@ -106,9 +106,9 @@ typedef struct
L2_NODE_STATE mainState; // the main state of link layer state
L2_NODE_STATE nextState; // next state of link layer state, which will be applied to mainState every second.
L2_RTNE_CONFIG rtneConfig; // current routine table configuration and status.
L2_SCAN_FSM *scanNetFSM; // FSM of scan net (link set up)
L2_MGMT_FSM *mgmtNetFSM; // FSM of management net (link management and time sync)
L2_SVC_FSM *serviceNetFSM; // FSM of service net (data service)
L2_SCAN_FSM *scanFSM; // FSM of scan net (link set up)
L2_MGMT_FSM *mgmtFSM; // FSM of management net (link management and time sync)
L2_SVC_FSM *serviceFSM; // FSM of service net (data service)
L2_RTT_FSM *rttFSM; // FSM for RTT (time sync algorithm)
uint8_t *sendPktData;
uint8_t *recvPktData;
@@ -160,26 +160,26 @@ int32_t L2_CrcAppend(uint8_t *dataBuff, uint32_t dataLen, uint32_t crcPos, L2_CR
bool L2_CrcCheck(uint8_t *dataBuff, uint32_t dataLen, uint32_t crcPos, L2_CRC_TYPE crcType);
// Scan Net
int32_t ScanNet_Init(L2_SCAN_FSM **scanFSMPtr);
void ScanNet_Reset(L2_SCAN_FSM *scanFSMPtr);
void ScanNet_Destroy(L2_SCAN_FSM *scanFSMPtr);
int32_t ScanNet_Proc(L2_INST *instPtr);
int32_t ScanNet_PktHandler(L2_INST *instPtr);
int32_t ScanNet_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry);
int32_t L2_Scan_Init(L2_SCAN_FSM **scanFSMPtr);
void L2_Scan_Reset(L2_SCAN_FSM *scanFSMPtr);
void L2_Scan_Destroy(L2_SCAN_FSM *scanFSMPtr);
int32_t L2_Scan_Proc(L2_INST *instPtr);
int32_t L2_Scan_PktHandler(L2_INST *instPtr);
int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry);
// Management Net
int32_t MgmtNet_Init(L2_MGMT_FSM **mgmtFSM);
void MgmtNet_Reset(L2_MGMT_FSM *mgmtFSM);
void MgmtNet_Destroy(L2_MGMT_FSM *mgmtFSM);
int32_t MgmtNet_PktHandler(L2_INST *instPtr);
int32_t MgmtNet_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry);
int32_t L2_Mgmt_Init(L2_MGMT_FSM **mgmtFSM);
void L2_Mgmt_Reset(L2_MGMT_FSM *mgmtFSM);
void L2_Mgmt_Destroy(L2_MGMT_FSM *mgmtFSM);
int32_t L2_Mgmt_PktHandler(L2_INST *instPtr);
int32_t L2_Mgmt_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry);
// Service net
int32_t ServiceNet_Init(L2_SVC_FSM **serviceFSM);
void ServiceNet_Reset(L2_SVC_FSM *serviceFSM);
void ServiceNet_Destroy(L2_SVC_FSM *serviceFSM);
int32_t ServiceNet_PktHandler(L2_INST *instPtr);
int32_t ServiceNet_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *schedEntry);
int32_t L2_Service_Init(L2_SVC_FSM **serviceFSM);
void L2_Service_Reset(L2_SVC_FSM *serviceFSM);
void L2_Service_Destroy(L2_SVC_FSM *serviceFSM);
int32_t L2_Service_PktHandler(L2_INST *instPtr);
int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *schedEntry);
// Miscellaneous
uint8_t L2_GetNodeId(L2_INST *instPtr);
@@ -115,18 +115,17 @@ typedef enum
{
L2_EV_NONE = 0,
L2_EV_SCAN_PROC_DONE = 1,
L2_EV_MGMT_PROC_DONE = 2,
L2_EV_NET_SETUP_DONE = 3,
L2_EV_TIME_SYNC = 4,
L2_EV_RTT_RECV_UPDATE = 5,
L2_EV_LINK_SET_REQ = 6,
L2_EV_LOST_CXN = 7,
L2_EV_LOST_NODE = 8,
L2_EV_SET_FRAME_NUM = 9,
L2_EV_SET_SLOT_NUM = 10,
L2_EV_MAIN_STATE_UPDATE = 11,
L2_ROUTINE_FINISH = 12,
L2_ROUTINE_UPDATE = 13
L2_EV_NET_SETUP_DONE = 2,
L2_EV_TIME_SYNC = 3,
L2_EV_RTT_RECV_UPDATE = 4,
L2_EV_LINK_SET_REQ = 5,
L2_EV_LOST_CXN = 6,
L2_EV_LOST_NODE = 7,
L2_EV_SET_FRAME_NUM = 8,
L2_EV_SET_SLOT_NUM = 9,
L2_EV_MAIN_STATE_UPDATE = 10,
L2_ROUTINE_FINISH = 11,
L2_ROUTINE_UPDATE = 12
} L2_EVENT_TYPE;
/** @name L2 event
+9 -9
View File
@@ -550,14 +550,14 @@ failed:
* EALLOC Memory allocation error.
*
******************************************************************************/
int32_t MgmtNet_Init(L2_MGMT_FSM **mgmtFSM)
int32_t L2_Mgmt_Init(L2_MGMT_FSM **mgmtFSM)
{
(*mgmtFSM) = (L2_MGMT_FSM *)malloc(sizeof(L2_MGMT_FSM));
if (*mgmtFSM == NULL)
{
return EALLOC;
}
MgmtNet_Reset(*mgmtFSM);
L2_Mgmt_Reset(*mgmtFSM);
return SUCCESS;
}
@@ -570,7 +570,7 @@ int32_t MgmtNet_Init(L2_MGMT_FSM **mgmtFSM)
* @return NONE
*
******************************************************************************/
void MgmtNet_Reset(L2_MGMT_FSM *mgmtFSM)
void L2_Mgmt_Reset(L2_MGMT_FSM *mgmtFSM)
{
mgmtFSM->isBisarProc = false;
mgmtFSM->isPendSlotAlloc = false;
@@ -607,7 +607,7 @@ void MgmtNet_Reset(L2_MGMT_FSM *mgmtFSM)
* @return NONE
*
******************************************************************************/
void MgmtNet_Destroy(L2_MGMT_FSM *mgmtFSM)
void L2_Mgmt_Destroy(L2_MGMT_FSM *mgmtFSM)
{
free(mgmtFSM);
}
@@ -623,15 +623,15 @@ void MgmtNet_Destroy(L2_MGMT_FSM *mgmtFSM)
* Other Packed was dumped(not addressed to me, unrecognized frame type)
*
******************************************************************************/
int32_t MgmtNet_PktHandler(L2_INST *instPtr)
int32_t L2_Mgmt_PktHandler(L2_INST *instPtr)
{
ASSERT(instPtr != NULL);
int32_t Status;
uint32_t filedSize = 0;
uint64_t dataChunk = 0;
L2_MGMT_MSG_RECORD *mgmtMsgLog = &(instPtr->mgmtNetFSM->mgmtMsgLog);
L2_RTT_MSG_RECORD *rttMsgRspLog = &(instPtr->mgmtNetFSM->rttMsgRspLog);
L2_RTT_MSG_RECORD *rttMsgReqLog = &(instPtr->mgmtNetFSM->rttMsgReqLog);
L2_MGMT_MSG_RECORD *mgmtMsgLog = &(instPtr->mgmtFSM->mgmtMsgLog);
L2_RTT_MSG_RECORD *rttMsgRspLog = &(instPtr->mgmtFSM->rttMsgRspLog);
L2_RTT_MSG_RECORD *rttMsgReqLog = &(instPtr->mgmtFSM->rttMsgReqLog);
DBG_INFO("Management net handling packet...\n");
@@ -936,7 +936,7 @@ static bool IsTTLValid(NODE_ENTRY *entry)
* @return Slot has be used.
*
******************************************************************************/
int32_t MgmtNet_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
int32_t L2_Mgmt_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
{
ASSERT(instPtr != NULL);
int32_t Status;
+16 -16
View File
@@ -440,7 +440,7 @@ failed:
static int32_t Scan_InitScanHandler(L2_INST *instPtr)
{
ASSERT(instPtr != NULL);
L2_SCAN_FSM *scanFsmPtr = instPtr->scanNetFSM;
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
DBG_INFO("** Netsetup - InitScan Procedure (Attempts: %u)**\n", scanFsmPtr->scanCnt);
if (scanFsmPtr->scanMode == L2_SCAN_INTRA_MODE)
@@ -494,7 +494,7 @@ static int32_t Scan_InitScanHandler(L2_INST *instPtr)
******************************************************************************/
static int32_t Scan_BmAdvtHandler(L2_INST *instPtr)
{
L2_SCAN_FSM *scanFsmPtr = instPtr->scanNetFSM;
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
DBG_INFO("** Netsetup - BmAdvt Procedure (Timeout: %u) **\n", scanFsmPtr->bmTimeout);
// if received a valid bm frame.
@@ -528,7 +528,7 @@ static int32_t Scan_BmAdvtHandler(L2_INST *instPtr)
return FAILURE;
}
DBG_WARNING("BM timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
ScanNet_Reset(scanFsmPtr);
L2_Scan_Reset(scanFsmPtr);
}
else
{
@@ -564,7 +564,7 @@ static int32_t Scan_BmAdvtHandler(L2_INST *instPtr)
******************************************************************************/
static int32_t Scan_2WAcqHandler(L2_INST *instPtr)
{
L2_SCAN_FSM *scanFsmPtr = instPtr->scanNetFSM;
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
DBG_INFO("** Netsetup - 2WAcq Procedure (Timeout: %u) **\n", scanFsmPtr->w2acqTimeout);
L2_FRAME_TYPE frameType = L2_NONE_FRAME;
@@ -586,7 +586,7 @@ static int32_t Scan_2WAcqHandler(L2_INST *instPtr)
if (scanFsmPtr->w2acqTimeout >= WAY2_ACQ_SLOT_MAX)
{
DBG_WARNING("2WAcq timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
ScanNet_Reset(scanFsmPtr);
L2_Scan_Reset(scanFsmPtr);
}
else
{
@@ -610,11 +610,11 @@ static int32_t Scan_2WAcqHandler(L2_INST *instPtr)
* error code
*
******************************************************************************/
int32_t ScanNet_PktHandler(L2_INST *instPtr)
int32_t L2_Scan_PktHandler(L2_INST *instPtr)
{
ASSERT(instPtr != NULL);
uint32_t Status;
L2_SCAN_FSM *scanFsmPtr = instPtr->scanNetFSM;
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
uint64_t dataChunk;
DBG_INFO("Scan net handling packet...\n");
@@ -865,7 +865,7 @@ failed:
* EMAC_MEMORY_ALLOC_ERROR Memory allocate error.
*
******************************************************************************/
int32_t ScanNet_Init(L2_SCAN_FSM **scanFSMPtr)
int32_t L2_Scan_Init(L2_SCAN_FSM **scanFSMPtr)
{
*scanFSMPtr = (L2_SCAN_FSM *)malloc(sizeof(L2_SCAN_FSM));
if (*scanFSMPtr == NULL)
@@ -873,7 +873,7 @@ int32_t ScanNet_Init(L2_SCAN_FSM **scanFSMPtr)
DBG_ERROR("Failed to allocate memory for scanFsmPtr.\n");
return EALLOC;
}
ScanNet_Reset(*scanFSMPtr);
L2_Scan_Reset(*scanFSMPtr);
return (SUCCESS);
}
@@ -886,7 +886,7 @@ int32_t ScanNet_Init(L2_SCAN_FSM **scanFSMPtr)
* @return NONE
*
******************************************************************************/
void ScanNet_Reset(L2_SCAN_FSM *scanFSMPtr)
void L2_Scan_Reset(L2_SCAN_FSM *scanFSMPtr)
{
ASSERT(scanFSMPtr != NULL);
scanFSMPtr->isLocked = false;
@@ -924,7 +924,7 @@ void ScanNet_Reset(L2_SCAN_FSM *scanFSMPtr)
* @return NONE
*
******************************************************************************/
void ScanNet_Destroy(L2_SCAN_FSM *scanFSMPtr)
void L2_Scan_Destroy(L2_SCAN_FSM *scanFSMPtr)
{
free(scanFSMPtr);
}
@@ -938,12 +938,12 @@ void ScanNet_Destroy(L2_SCAN_FSM *scanFSMPtr)
* @return used slot (5ms slot).
*
******************************************************************************/
int32_t ScanNet_Proc(L2_INST *instPtr)
int32_t L2_Scan_Proc(L2_INST *instPtr)
{
L2_SCAN_FSM *scanFsmPtr = instPtr->scanNetFSM;
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
{
DBG_ERROR("Only member node needs to execute ScanNet_Proc. \n");
DBG_ERROR("Only member node needs to execute L2_Scan_Proc. \n");
return FAILURE;
}
int32_t Status;
@@ -983,7 +983,7 @@ int32_t ScanNet_Proc(L2_INST *instPtr)
*
******************************************************************************/
int acqSend = 0;
int32_t ScanNet_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
{
ASSERT(instPtr != NULL);
L2_TOR_TYPE torState;
@@ -1087,7 +1087,7 @@ int32_t ScanNet_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
Status = FAILURE;
goto routine_err;
}
W2ackStateUpdate(instPtr->scanNetFSM, true);
W2ackStateUpdate(instPtr->scanFSM, true);
acqSend++;
}
/* Antenna setting (reserved.) */
+6 -6
View File
@@ -179,25 +179,25 @@ static int PduHeader_Packing(L2_INST *instPtr, BIT_ARRAY *bitarr, L2_PDU_HEADER_
* Other Initialize failed.
*
******************************************************************************/
int32_t ServiceNet_Init(L2_SVC_FSM **serviceFSM)
int32_t L2_Service_Init(L2_SVC_FSM **serviceFSM)
{
(*serviceFSM) = (L2_SVC_FSM *)malloc(sizeof(L2_SVC_FSM));
if (*serviceFSM == NULL)
{
return EALLOC;
}
ServiceNet_Reset(*serviceFSM);
L2_Service_Reset(*serviceFSM);
return SUCCESS;
}
void ServiceNet_Reset(L2_SVC_FSM *serviceFSM)
void L2_Service_Reset(L2_SVC_FSM *serviceFSM)
{
serviceFSM->isBisar = false;
serviceFSM->isBisarEven = false;
serviceFSM->bisarDst = L2_NONE_ID;
}
void ServiceNet_Destroy(L2_SVC_FSM *serviceFSM)
void L2_Service_Destroy(L2_SVC_FSM *serviceFSM)
{
free(serviceFSM);
}
@@ -211,7 +211,7 @@ void ServiceNet_Destroy(L2_SVC_FSM *serviceFSM)
* other error occurred.
*
******************************************************************************/
int32_t ServiceNet_PktHandler(L2_INST *instPtr)
int32_t L2_Service_PktHandler(L2_INST *instPtr)
{
// TODO:
DBG_INFO("Scan net handling packet...\n");
@@ -229,7 +229,7 @@ int32_t ServiceNet_PktHandler(L2_INST *instPtr)
* @return Slot has been used.
*
******************************************************************************/
int32_t ServiceNet_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
{
ASSERT(instPtr != NULL);
int32_t Status;