/** * \fn tmr_Destroy * \brief Destroy the module. * * Free the module's queues and object. * * \note This is NOT a specific timer destruction! (see tmr_DestroyTimer) * \param hTimerModule - The module object * \return TI_OK on success or TI_NOK on failure * \sa tmr_Create */ TI_STATUS tmr_Destroy (TI_HANDLE hTimerModule) { TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; if (!pTimerModule) { WLAN_OS_REPORT (("tmr_Destroy(): ERROR - NULL timer!\n")); return TI_NOK; } /* Alert if there are still timers that were not destroyed */ if (pTimerModule->uTimersCount) { WLAN_OS_REPORT (("tmr_Destroy(): ERROR - Destroying Timer module but not all timers were destroyed!!\n")); } /* Destroy the module's queues (protect in critical section)) */ context_EnterCriticalSection (pTimerModule->hContext); que_Destroy (pTimerModule->hInitQueue); que_Destroy (pTimerModule->hOperQueue); context_LeaveCriticalSection (pTimerModule->hContext); /* free module object */ os_memoryFree (pTimerModule->hOs, pTimerModule, sizeof(TTimerModule)); return TI_OK; }
/** * \fn txDataQ_Destroy * \brief Destroy the module and its queues * * Clear and destroy the queues and then destroy the module object. * * \note * \param hTxDataQ - The object * \return TI_OK - Unload succesfull, TI_NOK - Unload unsuccesfull * \sa */ TI_STATUS txDataQ_Destroy (TI_HANDLE hTxDataQ) { TTxDataQ *pTxDataQ = (TTxDataQ *)hTxDataQ; TI_STATUS status = TI_OK; TI_UINT32 uQueId; TDataLinkQ *pLinkQ; TI_UINT32 uHlid; /* Dequeue and free all queued packets */ txDataQ_ClearQueues (hTxDataQ); /* * init all queues in all links */ for (uHlid = 0; uHlid < WLANLINKS_MAX_LINKS; uHlid++) { pLinkQ = &pTxDataQ->aDataLinkQ[uHlid]; /* Link queues */ /* Free Data queues */ for (uQueId = 0 ; uQueId < pTxDataQ->uNumQueues ; uQueId++) { if (que_Destroy(pLinkQ->aQueues[uQueId]) != TI_OK) { status = TI_NOK; } } } /* free timer */ if (pTxDataQ->hTxSendPaceTimer) { tmr_DestroyTimer (pTxDataQ->hTxSendPaceTimer); } /* Free Tx Data Queue Module */ os_memoryFree (pTxDataQ->hOs, pTxDataQ, sizeof(TTxDataQ)); return status; }
/** * \fn txDataQ_Destroy * \brief Destroy the module and its queues * * Clear and destroy the queues and then destroy the module object. * * \note * \param hTxDataQ - The object * \return TI_OK - Unload succesfull, TI_NOK - Unload unsuccesfull * \sa */ TI_STATUS txDataQ_Destroy (TI_HANDLE hTxDataQ) { TTxDataQ *pTxDataQ = (TTxDataQ *)hTxDataQ; TI_STATUS status = TI_OK; TI_UINT32 uQueId; /* Free Data queues */ for (uQueId = 0 ; uQueId < pTxDataQ->uNumQueues ; uQueId++) { if (que_Destroy(pTxDataQ->aQueues[uQueId]) != TI_OK) { TRACE1(pTxDataQ->hReport, REPORT_SEVERITY_ERROR, "txDataQueue_unLoad: fail to free Data Queue number: %d\n",uQueId); status = TI_NOK; } } /* free timer */ if (pTxDataQ->hTxSendPaceTimer) { tmr_DestroyTimer (pTxDataQ->hTxSendPaceTimer); } /* Free Tx Data Queue Module */ os_memoryFree (pTxDataQ->hOs, pTxDataQ, sizeof(TTxDataQ)); return status; }
/** * \fn txMgmtQ_Destroy * \brief Destroy the module and its queues * * Clear and destroy the queues and then destroy the module object. * * \note * \param hTxMgmtQ - The module's object * \return TI_OK - Unload succesfull, TI_NOK - Unload unsuccesfull * \sa */ TI_STATUS txMgmtQ_Destroy (TI_HANDLE hTxMgmtQ) { TTxMgmtQ *pTxMgmtQ = (TTxMgmtQ *)hTxMgmtQ; TI_STATUS eStatus = TI_OK; int uQueId; TMgmtLinkQ *pLinkQ; TI_UINT32 uHlid; /* Dequeue and free all queued packets */ txMgmtQ_ClearQueues (hTxMgmtQ); /* * init all queues in all links */ for (uHlid = 0; uHlid < WLANLINKS_MAX_LINKS; uHlid++) { pLinkQ = &pTxMgmtQ->aMgmtLinkQ[uHlid]; /* Link queues */ for (uQueId = 0 ; uQueId < NUM_OF_MGMT_QUEUES ; uQueId++) { if (que_Destroy(pLinkQ->aQueues[uQueId]) != TI_OK) { TRACE2(pTxMgmtQ->hReport, REPORT_SEVERITY_ERROR, "txMgmtQueue_unLoad: fail to free Mgmt Queue number: %d in link %d\n",uQueId, uHlid); eStatus = TI_NOK; } } } /* free Tx Mgmt Queue Module */ os_memoryFree (pTxMgmtQ->hOs, pTxMgmtQ, sizeof(TTxMgmtQ)); return eStatus; }
void txnQ_Close (TI_HANDLE hTxnQ, TI_UINT32 uFuncId) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; TI_UINT32 i; context_EnterCriticalSection (pTxnQ->hContext); /* Destroy the functional driver's queues */ for (i = 0; i < pTxnQ->aFuncInfo[uFuncId].uNumPrios; i++) { que_Destroy (pTxnQ->aTxnQueues[uFuncId][i]); } /* Clear functional driver info */ pTxnQ->aFuncInfo[uFuncId].uNumPrios = 0; pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb = NULL; pTxnQ->aFuncInfo[uFuncId].hCbHandle = NULL; pTxnQ->aFuncInfo[uFuncId].eState = FUNC_STATE_NONE; /* Update functions actual range (to optimize Txn selection loops - see txnQ_SelectTxn) */ pTxnQ->uMinFuncId = MAX_FUNCTIONS; pTxnQ->uMaxFuncId = 0; for (i = 0; i < MAX_FUNCTIONS; i++) { if (pTxnQ->aFuncInfo[i].eState != FUNC_STATE_NONE) { if (i < pTxnQ->uMinFuncId) { pTxnQ->uMinFuncId = i; } if (i > pTxnQ->uMaxFuncId) { pTxnQ->uMaxFuncId = i; } } } context_LeaveCriticalSection (pTxnQ->hContext); }
/** * \fn tmr_Destroy * \brief Destroy the module. * * Free the module's queues and object. * * \note This is NOT a specific timer destruction! (see tmr_DestroyTimer) * \param hTimerModule - The module object * \return TI_OK on success or TI_NOK on failure * \sa tmr_Create */ TI_STATUS tmr_Destroy (TI_HANDLE hTimerModule) { TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* Alert if there are still timers that were not destroyed */ if (pTimerModule->uTimersCount) { } /* Clear queues (critical section is used inside these functions) */ // tmr_ClearInitQueue (hTimerModule); // tmr_ClearOperQueue (hTimerModule); /* Destroy the module's queues (protect in critical section)) */ context_EnterCriticalSection (pTimerModule->hContext); que_Destroy (pTimerModule->hInitQueue); que_Destroy (pTimerModule->hOperQueue); context_LeaveCriticalSection (pTimerModule->hContext); /* free module object */ os_memoryFree (pTimerModule->hOs, pTimerModule, sizeof(TTimerModule)); return TI_OK; }
TI_STATUS txnQ_Destroy (TI_HANDLE hTxnQ) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; if (pTxnQ) { if (pTxnQ->hBusDrv) { busDrv_Destroy (pTxnQ->hBusDrv); } if (pTxnQ->hTxnDoneQueue) { que_Destroy (pTxnQ->hTxnDoneQueue); } os_memoryFree (pTxnQ->hOs, pTxnQ, sizeof(TTxnQObj)); } return TI_OK; }
/** * \fn twIf_Destroy * \brief Destroy the module. * * Unregister from TxnQ and free the TxnDone-queue and the module's object. * * \note * \param The module's object * \return TI_OK on success or TI_NOK on failure * \sa twIf_Create */ TI_STATUS twIf_Destroy(TI_HANDLE hTwIf) { TTwIfObj *pTwIf = (TTwIfObj *) hTwIf; if (pTwIf) { txnQ_Close(pTwIf->hTxnQ, TXN_FUNC_ID_WLAN); if (pTwIf->hTxnDoneQueue) { que_Destroy(pTwIf->hTxnDoneQueue); } if (pTwIf->hPendRestartTimer) { tmr_DestroyTimer(pTwIf->hPendRestartTimer); } os_memoryFree(pTwIf->hOs, pTwIf, sizeof(TTwIfObj)); } return TI_OK; }
/** * \fn cmdHndlr_Destroy * \brief Destroy the module object * * Destroy the module object. * * \note * \param hCmdHndlr - The object * \return TI_OK * \sa */ TI_STATUS cmdHndlr_Destroy (TI_HANDLE hCmdHndlr, TI_HANDLE hEvHandler) { TCmdHndlrObj *pCmdHndlr = (TCmdHndlrObj *)hCmdHndlr; if (pCmdHndlr->hCmdInterpret) { cmdInterpret_Destroy (pCmdHndlr->hCmdInterpret, hEvHandler); } if (pCmdHndlr->hCmdQueue) { que_Destroy (pCmdHndlr->hCmdQueue); } os_memoryFree (pCmdHndlr->hOs, hCmdHndlr, sizeof(TCmdHndlrObj)); return TI_OK; }
/** * \fn txnQ_Destroy * \brief Destroy the module. * * Destroy bus driver and free the module's object. * * \note * \param The module's object * \return RES_OK on success or RES_ERROR on failure * \sa txnQ_Create */ EMcpfRes txnQ_Destroy (handle_t hTxnQ) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; if (pTxnQ) { if (pTxnQ->hBusDrv) { busDrv_Destroy (pTxnQ->hBusDrv); } if (pTxnQ->hTxnDoneQueue) { que_Destroy (pTxnQ->hTxnDoneQueue); } mcpf_mem_free (pTxnQ->hMcpf, pTxnQ); } return RES_OK; }
/** * \fn txnQ_Close * \brief Unregister functional driver from TxnQ * * Called by registered functional driver that uses the TxnQ to unregister. * Clear the function's data and destroy its queues. * Perform in critical section to prevent preemption from TxnDone. * * \note * \param hTxnQ - The module's object * \param uFuncId - The calling functional driver * \return void * \sa txnQ_Open */ void txnQ_Close (handle_t hTxnQ, const McpU32 uFuncId) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; McpU32 i; MCPF_ENTER_CRIT_SEC (pTxnQ->hMcpf); /* Destroy the functional driver's queues. TODO(954): empty the queues first??. */ for (i = 0; i < pTxnQ->aFuncInfo[uFuncId].uNumPrios; i++) { que_Destroy (pTxnQ->aTxnQueues[uFuncId][i]); } /* Clear functional driver info */ pTxnQ->aFuncInfo[uFuncId].uNumPrios = 0; pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb = NULL; pTxnQ->aFuncInfo[uFuncId].hCbHandle = NULL; pTxnQ->aFuncInfo[uFuncId].eState = FUNC_STATE_NONE; /* Update functions actual range (to optimize Txn selection loops - see txnQ_SelectTxn) */ pTxnQ->uMinFuncId = TXN_MAX_FUNCTIONS; pTxnQ->uMaxFuncId = 0; for (i = 0; i < TXN_MAX_FUNCTIONS; i++) { if (pTxnQ->aFuncInfo[i].eState != FUNC_STATE_NONE) { if (i < pTxnQ->uMinFuncId) { pTxnQ->uMinFuncId = i; } if (i > pTxnQ->uMaxFuncId) { pTxnQ->uMaxFuncId = i; } } } MCPF_EXIT_CRIT_SEC (pTxnQ->hMcpf); MCPF_REPORT_INFORMATION(pTxnQ->hMcpf, QUEUE_MODULE_LOG, ("%s: Function %d Unregistered\n", __FUNCTION__, uFuncId)); }
/** * \fn txMgmtQ_Destroy * \brief Destroy the module and its queues * * Clear and destroy the queues and then destroy the module object. * * \note * \param hTxMgmtQ - The module's object * \return TI_OK - Unload succesfull, TI_NOK - Unload unsuccesfull * \sa */ TI_STATUS txMgmtQ_Destroy (TI_HANDLE hTxMgmtQ) { TTxMgmtQ *pTxMgmtQ = (TTxMgmtQ *)hTxMgmtQ; TI_STATUS eStatus = TI_OK; int uQueId; /* free Mgmt queues */ for (uQueId = 0 ; uQueId < NUM_OF_MGMT_QUEUES ; uQueId++) { if (que_Destroy(pTxMgmtQ->aQueues[uQueId]) != TI_OK) { TRACE1(pTxMgmtQ->hReport, REPORT_SEVERITY_ERROR, "txMgmtQueue_unLoad: fail to free Mgmt Queue number: %d\n",uQueId); eStatus = TI_NOK; } } /* free Tx Mgmt Queue Module */ os_memoryFree (pTxMgmtQ->hOs, pTxMgmtQ, sizeof(TTxMgmtQ)); return eStatus; }