From 12d754a18612383f03b960dfad4dbcaba72df370 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Fri, 22 May 2009 10:32:21 -0700 Subject: Add Wifi control abstraction layer, Fix driver removal crash --- wilink_6_1/stad/src/Connection_Managment/conn.c | 27 +++--- wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c | 30 +++---- wilink_6_1/stad/src/Data_link/rx.c | 32 +++---- wilink_6_1/stad/src/Data_link/txCtrl.c | 106 ++++++++++++------------ wilink_6_1/stad/src/Sta_Management/assocSM.c | 30 +++---- wilink_6_1/stad/src/Sta_Management/authSm.c | 15 ++-- 6 files changed, 123 insertions(+), 117 deletions(-) (limited to 'wilink_6_1/stad') diff --git a/wilink_6_1/stad/src/Connection_Managment/conn.c b/wilink_6_1/stad/src/Connection_Managment/conn.c index 765b0e9..2cfe02e 100644 --- a/wilink_6_1/stad/src/Connection_Managment/conn.c +++ b/wilink_6_1/stad/src/Connection_Managment/conn.c @@ -92,18 +92,19 @@ RETURN: Handle to the connection module on success, NULL otherwise ************************************************************************/ TI_HANDLE conn_create(TI_HANDLE hOs) { - conn_t *pConn; + conn_t *pConn; fsm_stateMachine_t *pFsm; TI_STATUS status; pConn = os_memoryAlloc(hOs, sizeof(conn_t)); if (pConn == NULL) - { + { return NULL; - } + } + os_memoryZero(hOs, (void *)pConn, sizeof(conn_t)); /* Creating connection Ibss SM */ - status = fsm_Create(hOs, &pFsm, CONN_IBSS_NUM_STATES, CONN_IBSS_NUM_EVENTS); + status = fsm_Create(hOs, &pFsm, CONN_IBSS_NUM_STATES, CONN_IBSS_NUM_EVENTS); if (status != TI_OK) { release_module(pConn); @@ -111,7 +112,7 @@ TI_HANDLE conn_create(TI_HANDLE hOs) } pConn->ibss_pFsm = pFsm; - /* Creating connection Infra SM */ + /* Creating connection Infra SM */ status = fsm_Create(hOs, &pFsm, CONN_INFRA_NUM_STATES, CONN_INFRA_NUM_EVENTS); if (status != TI_OK) { @@ -652,19 +653,19 @@ RETURN: void static void release_module(conn_t *pConn) { if (pConn->ibss_pFsm) - { + { fsm_Unload (pConn->hOs, pConn->ibss_pFsm); - } + } - if (pConn->infra_pFsm) - { + if (pConn->infra_pFsm) + { fsm_Unload (pConn->hOs, pConn->infra_pFsm); - } + } if (pConn->hConnTimer) - { + { tmr_DestroyTimer (pConn->hConnTimer); - } + } os_memoryFree(pConn->hOs, pConn, sizeof(conn_t)); } @@ -682,7 +683,7 @@ static void conn_DisconnectComplete (conn_t *pConn, TI_UINT8 *data, TI_UINT8 case CONNECTION_INFRA: connInfra_DisconnectComplete(pConn, data, dataLength); - default: + default: TRACE1(pConn->hReport, REPORT_SEVERITY_ERROR, "conn_DisconnectComplete, invalid type %d\n\n", pConn->currentConnType); } diff --git a/wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c b/wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c index d6d1de7..54335a3 100644 --- a/wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c +++ b/wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c @@ -1028,28 +1028,28 @@ static void drvMain_GetFileCb (TI_HANDLE hDrvMain) */ static void drvMain_InitLocals (TDrvMain *pDrvMain) { - /* Initialize the module's local varniables to default values */ - pDrvMain->tFileInfo.eFileType = FILE_TYPE_INI; - pDrvMain->tFileInfo.fCbFunc = drvMain_GetFileCb; - pDrvMain->tFileInfo.hCbHndl = (TI_HANDLE)pDrvMain; - pDrvMain->eSmState = SM_STATE_IDLE; - pDrvMain->uPendingEventsCount = 0; - pDrvMain->bRecovery = TI_FALSE; - pDrvMain->eAction = ACTION_TYPE_NONE; - - /* Register the Action callback to the context engine and get the client ID */ - pDrvMain->uContextId = context_RegisterClient (pDrvMain->tStadHandles.hContext, + /* Initialize the module's local varniables to default values */ + pDrvMain->tFileInfo.eFileType = FILE_TYPE_INI; + pDrvMain->tFileInfo.fCbFunc = drvMain_GetFileCb; + pDrvMain->tFileInfo.hCbHndl = (TI_HANDLE)pDrvMain; + pDrvMain->eSmState = SM_STATE_IDLE; + pDrvMain->uPendingEventsCount = 0; + pDrvMain->bRecovery = TI_FALSE; + pDrvMain->eAction = ACTION_TYPE_NONE; + + /* Register the Action callback to the context engine and get the client ID */ + pDrvMain->uContextId = context_RegisterClient (pDrvMain->tStadHandles.hContext, drvMain_InvokeAction, (TI_HANDLE)pDrvMain, TI_TRUE, "ACTION", sizeof("ACTION")); - /* Platform specific HW preparations */ - hPlatform_Wlan_Hardware_Init (); + /* Platform specific HW preparations */ + hPlatform_Wlan_Hardware_Init(pDrvMain->tStadHandles.hOs); - /* Insure that device power is off (expected to be) */ - hPlatform_DevicePowerOff (); + /* Insure that device power is off (expected to be) */ + hPlatform_DevicePowerOff(); } diff --git a/wilink_6_1/stad/src/Data_link/rx.c b/wilink_6_1/stad/src/Data_link/rx.c index 794ea22..870864f 100644 --- a/wilink_6_1/stad/src/Data_link/rx.c +++ b/wilink_6_1/stad/src/Data_link/rx.c @@ -250,7 +250,7 @@ TI_STATUS rxData_SetDefaults (TI_HANDLE hRxData, rxDataInitParams_t * rxDataInit } } - #ifdef TI_DBG +#ifdef TI_DBG /* reset counters */ rxData_resetCounters(pRxData); rxData_resetDbgCounters(pRxData); @@ -263,7 +263,7 @@ TI_STATUS rxData_SetDefaults (TI_HANDLE hRxData, rxDataInitParams_t * rxDataInit return TI_NOK; } pRxData->rxThroughputTimerEnable = TI_FALSE; - #endif +#endif TRACE0(pRxData->hReport, REPORT_SEVERITY_INIT, ".....Rx Data configured successfully\n"); @@ -285,26 +285,26 @@ TI_STATUS rxData_SetDefaults (TI_HANDLE hRxData, rxDataInitParams_t * rxDataInit ***************************************************************************/ TI_STATUS rxData_unLoad(TI_HANDLE hRxData) { - rxData_t *pRxData = (rxData_t *)hRxData; + rxData_t *pRxData = (rxData_t *)hRxData; - /* check parameters validity */ - if (pRxData == NULL) - { - TRACE0(pRxData->hReport, REPORT_SEVERITY_ERROR, " rxData_unLoad() : Illegal value for hRxData\n"); - return TI_NOK; - } + /* check parameters validity */ + if (pRxData == NULL) + { + TRACE0(pRxData->hReport, REPORT_SEVERITY_ERROR, " rxData_unLoad() : Illegal value for hRxData\n"); + return TI_NOK; + } - DistributorMgr_Destroy(pRxData->RxEventDistributor); + DistributorMgr_Destroy(pRxData->RxEventDistributor); #ifdef TI_DBG - /* destroy periodic rx throughput timer */ - tmr_DestroyTimer (pRxData->hThroughputTimer); - #endif + /* destroy periodic rx throughput timer */ + tmr_DestroyTimer (pRxData->hThroughputTimer); +#endif - /* free Rx Data controll block */ - os_memoryFree(pRxData->hOs, pRxData, sizeof(rxData_t)); + /* free Rx Data controll block */ + os_memoryFree(pRxData->hOs, pRxData, sizeof(rxData_t)); - return TI_OK; + return TI_OK; } diff --git a/wilink_6_1/stad/src/Data_link/txCtrl.c b/wilink_6_1/stad/src/Data_link/txCtrl.c index 43dc209..0cf2911 100644 --- a/wilink_6_1/stad/src/Data_link/txCtrl.c +++ b/wilink_6_1/stad/src/Data_link/txCtrl.c @@ -163,22 +163,22 @@ static inline void txCtrl_TranslateTimeToFw (txCtrl_t *pTxCtrl, TTxCtrlBlk *pPkt *************************************************************************/ TI_HANDLE txCtrl_Create (TI_HANDLE hOs) { - txCtrl_t *pTxCtrl; + txCtrl_t *pTxCtrl; - /* allocate Tx module control block */ - pTxCtrl = os_memoryAlloc(hOs, (sizeof(txCtrl_t))); + /* allocate Tx module control block */ + pTxCtrl = os_memoryAlloc(hOs, (sizeof(txCtrl_t))); - if (!pTxCtrl) - return NULL; + if (!pTxCtrl) + return NULL; - /* reset tx control object */ - os_memoryZero(hOs, pTxCtrl, (sizeof(txCtrl_t))); + /* reset tx control object */ + os_memoryZero(hOs, pTxCtrl, (sizeof(txCtrl_t))); - pTxCtrl->TxEventDistributor = DistributorMgr_Create(hOs, MAX_TX_NOTIF_REQ_ELMENTS); + pTxCtrl->TxEventDistributor = DistributorMgr_Create(hOs, MAX_TX_NOTIF_REQ_ELMENTS); - pTxCtrl->hOs = hOs; + pTxCtrl->hOs = hOs; - return pTxCtrl; + return pTxCtrl; } @@ -189,30 +189,30 @@ TI_HANDLE txCtrl_Create (TI_HANDLE hOs) ***************************************************************************/ void txCtrl_Init (TStadHandlesList *pStadHandles) { - txCtrl_t *pTxCtrl = (txCtrl_t *)(pStadHandles->hTxCtrl); + txCtrl_t *pTxCtrl = (txCtrl_t *)(pStadHandles->hTxCtrl); TI_UINT32 ac; - /* Save other modules handles */ + /* Save other modules handles */ pTxCtrl->hOs = pStadHandles->hOs; pTxCtrl->hReport = pStadHandles->hReport; pTxCtrl->hCtrlData = pStadHandles->hCtrlData; pTxCtrl->hTWD = pStadHandles->hTWD; - pTxCtrl->hTxDataQ = pStadHandles->hTxDataQ; - pTxCtrl->hTxMgmtQ = pStadHandles->hTxMgmtQ; - pTxCtrl->hEvHandler = pStadHandles->hEvHandler; + pTxCtrl->hTxDataQ = pStadHandles->hTxDataQ; + pTxCtrl->hTxMgmtQ = pStadHandles->hTxMgmtQ; + pTxCtrl->hEvHandler = pStadHandles->hEvHandler; pTxCtrl->hHealthMonitor = pStadHandles->hHealthMonitor; pTxCtrl->hTimer = pStadHandles->hTimer; - pTxCtrl->hStaCap = pStadHandles->hStaCap; - pTxCtrl->hXCCMngr = pStadHandles->hXCCMngr; - pTxCtrl->hQosMngr = pStadHandles->hQosMngr; - - /* Set Tx parameters to defaults */ - pTxCtrl->headerConverMode = HDR_CONVERT_NONE; - pTxCtrl->currentPrivacyInvokedMode = DEF_CURRENT_PRIVACY_MODE; - pTxCtrl->eapolEncryptionStatus = DEF_EAPOL_ENCRYPTION_STATUS; - pTxCtrl->encryptionFieldSize = 0; - pTxCtrl->currBssType = BSS_INFRASTRUCTURE; - pTxCtrl->busyAcBitmap = 0; + pTxCtrl->hStaCap = pStadHandles->hStaCap; + pTxCtrl->hXCCMngr = pStadHandles->hXCCMngr; + pTxCtrl->hQosMngr = pStadHandles->hQosMngr; + + /* Set Tx parameters to defaults */ + pTxCtrl->headerConverMode = HDR_CONVERT_NONE; + pTxCtrl->currentPrivacyInvokedMode = DEF_CURRENT_PRIVACY_MODE; + pTxCtrl->eapolEncryptionStatus = DEF_EAPOL_ENCRYPTION_STATUS; + pTxCtrl->encryptionFieldSize = 0; + pTxCtrl->currBssType = BSS_INFRASTRUCTURE; + pTxCtrl->busyAcBitmap = 0; pTxCtrl->dbgPktSeqNum = 0; pTxCtrl->bCreditCalcTimerRunning = TI_FALSE; @@ -228,26 +228,26 @@ void txCtrl_Init (TStadHandlesList *pStadHandles) pTxCtrl->credit[ac] = 0; } - /* Reset counters */ - txCtrlParams_resetCounters (pStadHandles->hTxCtrl); + /* Reset counters */ + txCtrlParams_resetCounters (pStadHandles->hTxCtrl); #ifdef TI_DBG - txCtrlParams_resetDbgCounters (pStadHandles->hTxCtrl); + txCtrlParams_resetDbgCounters (pStadHandles->hTxCtrl); #endif - /* Register the Tx-Complete callback function. */ + /* Register the Tx-Complete callback function. */ TWD_RegisterCb (pTxCtrl->hTWD, - TWD_EVENT_TX_RESULT_SEND_PKT_COMPLETE, - (void*)txCtrl_TxCompleteCb, - pStadHandles->hTxCtrl); + TWD_EVENT_TX_RESULT_SEND_PKT_COMPLETE, + (void*)txCtrl_TxCompleteCb, + pStadHandles->hTxCtrl); /* Register the Update-Busy-Map callback function. */ TWD_RegisterCb (pTxCtrl->hTWD, - TWD_EVENT_TX_HW_QUEUE_UPDATE_BUSY_MAP, - (void *)txCtrl_UpdateBackpressure, - pStadHandles->hTxCtrl); + TWD_EVENT_TX_HW_QUEUE_UPDATE_BUSY_MAP, + (void *)txCtrl_UpdateBackpressure, + pStadHandles->hTxCtrl); - TRACE0(pTxCtrl->hReport, REPORT_SEVERITY_INIT, ".....Tx Data configured successfully\n"); + TRACE0(pTxCtrl->hReport, REPORT_SEVERITY_INIT, ".....Tx Data configured successfully\n"); } @@ -265,23 +265,23 @@ void txCtrl_Init (TStadHandlesList *pStadHandles) *************************************************************************/ TI_STATUS txCtrl_SetDefaults (TI_HANDLE hTxCtrl, txDataInitParams_t *txDataInitParams) { - txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; + txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; - pTxCtrl->creditCalculationTimeout = txDataInitParams->creditCalculationTimeout; + pTxCtrl->creditCalculationTimeout = txDataInitParams->creditCalculationTimeout; pTxCtrl->bCreditCalcTimerEnabled = txDataInitParams->bCreditCalcTimerEnabled; - /* Update queues mapping (AC/TID/Backpressure) after module init. */ + /* Update queues mapping (AC/TID/Backpressure) after module init. */ txCtrl_UpdateQueuesMapping (hTxCtrl); - /* allocate timer for credit calculation */ - pTxCtrl->hCreditTimer = tmr_CreateTimer (pTxCtrl->hTimer); + /* allocate timer for credit calculation */ + pTxCtrl->hCreditTimer = tmr_CreateTimer (pTxCtrl->hTimer); if (pTxCtrl->hCreditTimer == NULL) { - TRACE0(pTxCtrl->hReport, REPORT_SEVERITY_ERROR, "txCtrl_SetDefaults(): Failed to create hCreditTimer!\n"); + TRACE0(pTxCtrl->hReport, REPORT_SEVERITY_ERROR, "txCtrl_SetDefaults(): Failed to create hCreditTimer!\n"); return TI_NOK; } - return TI_OK; + return TI_OK; } @@ -293,21 +293,21 @@ TI_STATUS txCtrl_SetDefaults (TI_HANDLE hTxCtrl, txDataInitParams_t *txDataInitP ***************************************************************************/ TI_STATUS txCtrl_Unload (TI_HANDLE hTxCtrl) { - txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; + txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; - if (pTxCtrl == NULL) - { - return TI_NOK; - } + if (pTxCtrl == NULL) + { + return TI_NOK; + } - DistributorMgr_Destroy (pTxCtrl->TxEventDistributor); + DistributorMgr_Destroy (pTxCtrl->TxEventDistributor); tmr_DestroyTimer (pTxCtrl->hCreditTimer); - /* free Tx Data control block */ - os_memoryFree (pTxCtrl->hOs, pTxCtrl, sizeof(txCtrl_t)); + /* free Tx Data control block */ + os_memoryFree (pTxCtrl->hOs, pTxCtrl, sizeof(txCtrl_t)); - return TI_OK; + return TI_OK; } diff --git a/wilink_6_1/stad/src/Sta_Management/assocSM.c b/wilink_6_1/stad/src/Sta_Management/assocSM.c index 22b406e..f0b9bfd 100644 --- a/wilink_6_1/stad/src/Sta_Management/assocSM.c +++ b/wilink_6_1/stad/src/Sta_Management/assocSM.c @@ -195,23 +195,25 @@ TI_HANDLE assoc_create(TI_HANDLE hOs) */ TI_STATUS assoc_unload(TI_HANDLE hAssoc) { - TI_STATUS status; - assoc_t *pHandle; + TI_STATUS status; + assoc_t *pHandle; - pHandle = (assoc_t*)hAssoc; + pHandle = (assoc_t *)hAssoc; + if (!pHandle) + return TI_NOK; - status = fsm_Unload(pHandle->hOs, pHandle->pAssocSm); - if (status != TI_OK) - { - /* report failure but don't stop... */ - TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "ASSOC_SM: Error releasing FSM memory \n"); - } - - tmr_DestroyTimer (pHandle->hAssocSmTimer); - - os_memoryFree(pHandle->hOs, hAssoc, sizeof(assoc_t)); + status = fsm_Unload(pHandle->hOs, pHandle->pAssocSm); + if (status != TI_OK) + { + /* report failure but don't stop... */ + TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "ASSOC_SM: Error releasing FSM memory \n"); + } - return TI_OK; + tmr_DestroyTimer (pHandle->hAssocSmTimer); + + os_memoryFree(pHandle->hOs, hAssoc, sizeof(assoc_t)); + + return TI_OK; } /** diff --git a/wilink_6_1/stad/src/Sta_Management/authSm.c b/wilink_6_1/stad/src/Sta_Management/authSm.c index 99b8a25..73c8901 100644 --- a/wilink_6_1/stad/src/Sta_Management/authSm.c +++ b/wilink_6_1/stad/src/Sta_Management/authSm.c @@ -152,16 +152,19 @@ TI_HANDLE auth_create(TI_HANDLE hOs) */ TI_STATUS auth_unload(TI_HANDLE hAuth) { - TI_STATUS status; - auth_t *pHandle; + TI_STATUS status; + auth_t *pHandle; pHandle = (auth_t*)hAuth; + if (!pHandle) + return TI_NOK; + status = fsm_Unload(pHandle->hOs, pHandle->pAuthSm); - if (status != TI_OK) + if (status != TI_OK) { /* report failure but don't stop... */ -TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "AUTH_SM: Error releasing FSM memory \n"); + TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "AUTH_SM: Error releasing FSM memory \n"); } tmr_DestroyTimer (pHandle->hAuthSmTimer); @@ -192,12 +195,12 @@ TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "AUTH_SM: Error releasing FSM me void auth_init (TStadHandlesList *pStadHandles) { auth_t *pHandle = (auth_t*)(pStadHandles->hAuth); - + pHandle->hMlme = pStadHandles->hMlmeSm; pHandle->hRsn = pStadHandles->hRsn; pHandle->hReport = pStadHandles->hReport; pHandle->hOs = pStadHandles->hOs; - pHandle->hTimer = pStadHandles->hTimer; + pHandle->hTimer = pStadHandles->hTimer; } -- cgit v1.2.3