/** * \fn twIf_PendRestratTimeout * \brief Pending restart process timeout handler * * Called if timer expires upon fail to complete the last bus transaction that was * pending during restart process. * Calls the recovery callback to continue the restart process. * * \note * \param hTwIf - The module's object * \return void * \sa */ static void twIf_PendRestratTimeout (TI_HANDLE hTwIf, TI_BOOL bTwdInitOccured) { TTwIfObj *pTwIf = (TTwIfObj*)hTwIf; pTwIf->bPendRestartTimerRunning = TI_FALSE; /* Clear the Txn queues since TxnDone wasn't called so it wasn't done by the TxnQ module */ txnQ_ClearQueues (pTwIf->hTxnQ, TXN_FUNC_ID_WLAN); /* Call the recovery callback to continue the restart process */ pTwIf->fRecoveryCb(pTwIf->hRecoveryCb); }
/** * \fn twIf_HandleTxnDone * \brief Completed transactions handler * * The completed transactions handler, called upon TxnDone event, either from the context engine * or directly from twIf_TxnDoneCb() if we are already in the WLAN driver's context. * Dequeue all completed transactions in critical section, and call their callbacks if available. * If awake is not required and no pending transactions in TxnQ, issue Sleep event to SM. * * \note * \param hTwIf - The module's object * \return void * \sa */ static void twIf_HandleTxnDone(TI_HANDLE hTwIf) { TTwIfObj *pTwIf = (TTwIfObj *) hTwIf; TTxnStruct *pTxn; /* In case of recovery, call the recovery callback and exit */ if (pTwIf->bTxnDoneInRecovery) { TRACE0(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_HandleTxnDone: call RecoveryCb\n"); pTwIf->bTxnDoneInRecovery = TI_FALSE; if (pTwIf->bPendRestartTimerRunning) { tmr_StopTimer(pTwIf->hPendRestartTimer); pTwIf->bPendRestartTimerRunning = TI_FALSE; } pTwIf->fRecoveryCb(pTwIf->hRecoveryCb); return; } /* Loop while there are completed transactions to handle */ while (1) { /* In critical section, dequeue completed transaction from the TxnDoneQ. */ context_EnterCriticalSection(pTwIf->hContext); pTxn = (TTxnStruct *) que_Dequeue(pTwIf->hTxnDoneQueue); context_LeaveCriticalSection(pTwIf->hContext); /* If no more transactions to handle, exit */ if (pTxn != NULL) { context_EnterCriticalSection(pTwIf->hContext); /* Decrement pending Txn counter */ if (pTwIf->uPendingTxnCount > 0) { /* in case of callback on recovery after restart */ pTwIf->uPendingTxnCount--; } context_LeaveCriticalSection(pTwIf->hContext); TRACE4(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_HandleTxnDone: Completed-Txn: Params=0x%x, HwAddr=0x%x, Len0=%d, fTxnDoneCb=0x%x\n", pTxn->uTxnParams, pTxn->uHwAddr, pTxn->aLen[0], pTxn->fTxnDoneCb); /* If Txn failed and error CB available, call it to initiate recovery */ if (TXN_PARAM_GET_STATUS(pTxn) == TXN_PARAM_STATUS_ERROR) { TRACE6(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_HandleTxnDone: Txn failed!! Params=0x%x, HwAddr=0x%x, Len0=%d, Len1=%d, Len2=%d, Len3=%d\n", pTxn->uTxnParams, pTxn->uHwAddr, pTxn->aLen[0], pTxn->aLen[1], pTxn->aLen[2], pTxn->aLen[3]); if (pTwIf->fErrCb) { pTwIf->fErrCb(pTwIf->hErrCb, BUS_FAILURE); } /* in error do not continue */ return; } /* If Txn specific CB available, call it (may free Txn resources and issue new Txns) */ if (pTxn->fTxnDoneCb != NULL) { ((TTxnDoneCb) (pTxn->fTxnDoneCb)) (pTxn-> hCbHandle, pTxn); } } /*If uPendingTxnCount == 0 and awake not required, issue Sleep event to SM */ if ((pTwIf->uAwakeReqCount == 0) && (pTwIf->uPendingTxnCount == 0)) { twIf_HandleSmEvent(pTwIf, SM_EVENT_SLEEP); } if (pTxn == NULL) { return; } } }