ETxnStatus txnQ_Transact (TI_HANDLE hTxnQ, TTxnStruct *pTxn) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; TI_UINT32 uFuncId = TXN_PARAM_GET_FUNC_ID(pTxn); ETxnStatus rc; if (TXN_PARAM_GET_SINGLE_STEP(pTxn)) { pTxnQ->aFuncInfo[uFuncId].pSingleStep = pTxn; TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Transact(): Single step Txn\n"); } else { TI_STATUS eStatus; TI_HANDLE hQueue = pTxnQ->aTxnQueues[uFuncId][TXN_PARAM_GET_PRIORITY(pTxn)]; context_EnterCriticalSection (pTxnQ->hContext); eStatus = que_Enqueue (hQueue, (TI_HANDLE)pTxn); context_LeaveCriticalSection (pTxnQ->hContext); if (eStatus != TI_OK) { TRACE3(pTxnQ->hReport, REPORT_SEVERITY_ERROR, "txnQ_Transact(): Enqueue failed, pTxn=0x%x, HwAddr=0x%x, Len0=%d\n", pTxn, pTxn->uHwAddr, pTxn->aLen[0]); return TXN_STATUS_ERROR; } TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Transact(): Regular Txn\n"); } /* Send queued transactions as possible */ rc = txnQ_RunScheduler (pTxnQ, pTxn); return rc; }
/** * \fn txnQ_TxnDoneCb * \brief Pending Transaction completion CB * * Called back by bus-driver upon pending transaction completion in TxnDone context (external!). * Enqueue completed transaction in TxnDone queue and call scheduler to send queued transactions. * * \note * \param hTxnQ - The module's object * \param pTxn - The completed transaction object * \return void * \sa */ static void txnQ_TxnDoneCb (TI_HANDLE hTxnQ, void *hTxn) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; TTxnStruct *pTxn = (TTxnStruct *)hTxn; TI_UINT32 uFuncId = TXN_PARAM_GET_FUNC_ID(pTxn); /* If the function of the completed Txn is waiting for restart */ if (pTxnQ->aFuncInfo[uFuncId].eState == FUNC_STATE_RESTART) { /* First, Clear the restarted function queues */ txnQ_ClearQueues (hTxnQ, uFuncId); /* Call function CB for current Txn with restart indication */ TXN_PARAM_SET_STATUS(pTxn, TXN_PARAM_STATUS_RECOVERY); pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb (pTxnQ->aFuncInfo[uFuncId].hCbHandle, pTxn); } /* In the normal case (no restart), enqueue completed transaction in TxnDone queue */ else { TI_STATUS eStatus; context_EnterCriticalSection (pTxnQ->hContext); eStatus = que_Enqueue (pTxnQ->hTxnDoneQueue, (TI_HANDLE)pTxn); context_LeaveCriticalSection (pTxnQ->hContext); } /* Indicate that no transaction is currently processed in the bus-driver */ pTxnQ->pCurrTxn = NULL; /* Send queued transactions as possible (TRUE indicates we are in external context) */ txnQ_RunScheduler (pTxnQ, NULL); }
/** * \fn txnQ_Transact * \brief Issue a new transaction * * Called by the functional driver to initiate a new transaction. * In critical section save transaction and call scheduler. * * \note * \param hTxnQ - The module's object * \param pTxn - The transaction object * \return COMPLETE if input pTxn completed in this context, PENDING if not, ERROR if failed * \sa */ ETxnStatus txnQ_Transact (handle_t hTxnQ, TTxnStruct *pTxn) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; McpU32 uFuncId = TXN_PARAM_GET_FUNC_ID(pTxn); ETxnStatus rc; MCPF_ENTER_CRIT_SEC (pTxnQ->hMcpf); if (TXN_PARAM_GET_SINGLE_STEP(pTxn)) { pTxnQ->aFuncInfo[uFuncId].pSingleStep = pTxn; } else { handle_t hQueue = pTxnQ->aTxnQueues[uFuncId][TXN_PARAM_GET_PRIORITY(pTxn)]; que_Enqueue (hQueue, (handle_t)pTxn); } /* Send queued transactions as possible */ rc = txnQ_RunScheduler (pTxnQ, pTxn, MCP_FALSE); MCPF_EXIT_CRIT_SEC (pTxnQ->hMcpf); return rc; }
void txnQ_Run (TI_HANDLE hTxnQ, TI_UINT32 uFuncId) { TTxnQObj *pTxnQ = (TTxnQObj*) hTxnQ; /* Enable function's queues */ pTxnQ->aFuncInfo[uFuncId].eState = FUNC_STATE_RUNNING; /* Send queued transactions as possible */ txnQ_RunScheduler (pTxnQ, NULL); }
/** * \fn txnQ_TxnDoneCb * \brief Pending Transaction completion CB * * Called back by bus-driver upon pending transaction completion in TxnDone context (external!). * Enqueue completed transaction in TxnDone queue and call scheduler to send queued transactions. * * \note * \param hTxnQ - The module's object * \param pTxn - The completed transaction object * \return void * \sa */ static void txnQ_TxnDoneCb (handle_t hTxnQ, void *hTxn) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; TTxnStruct *pTxn = (TTxnStruct *)hTxn; McpU32 uFuncId = TXN_PARAM_GET_FUNC_ID(pTxn); #ifdef TRAN_DBG if (pTxn != pTxnQ->pCurrTxn) { MCPF_REPORT_ERROR(pTxnQ->hMcpf, QUEUE_MODULE_LOG, ("%s: CB returned pTxn 0x%p while pCurrTxn is 0x%p !!\n", __FUNCTION__, pTxn, pTxnQ->pCurrTxn)); } #endif /* Enter critical section if configured to do so */ if (pTxnQ->bProtectTxnDone) { MCPF_ENTER_CRIT_SEC (pTxnQ->hMcpf); } /* If the function of the completed Txn is waiting for restart */ if (pTxnQ->aFuncInfo[uFuncId].eState == FUNC_STATE_RESTART) { /* Call function CB for current Txn with recovery indication */ TXN_PARAM_SET_STATUS(pTxn, TXN_STATUS_RECOVERY); pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb (pTxnQ->aFuncInfo[uFuncId].hCbHandle, pTxn, MCP_TRUE); /* Clear the restarted function queues (call function CB with status=RECOVERY) */ txnQ_ClearQueues (pTxnQ, uFuncId, MCP_TRUE); } /* In the normal case (no restart), enqueue completed transaction in TxnDone queue */ else { que_Enqueue (pTxnQ->hTxnDoneQueue, (handle_t)pTxn); } /* Indicate that no transaction is currently processed in the bus-driver */ pTxnQ->pCurrTxn = NULL; /* Send queued transactions as possible (TRUE indicates we are in external context) */ txnQ_RunScheduler (pTxnQ, NULL, MCP_TRUE); /* Leave critical section if configured to do so */ if (pTxnQ->bProtectTxnDone) { MCPF_EXIT_CRIT_SEC (pTxnQ->hMcpf); } }
/** * \fn txnQ_TxnDoneCb * \brief Pending Transaction completion CB * * Called back by bus-driver upon pending transaction completion in TxnDone context (external!). * Enqueue completed transaction in TxnDone queue and call scheduler to send queued transactions. * * \note * \param hTxnQ - The module's object * \param pTxn - The completed transaction object * \return void * \sa */ static void txnQ_TxnDoneCb (TI_HANDLE hTxnQ, void *hTxn) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; TTxnStruct *pTxn = (TTxnStruct *)hTxn; TI_UINT32 uFuncId = TXN_PARAM_GET_FUNC_ID(pTxn); #ifdef TI_DBG TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_TxnDoneCb()\n"); if (pTxn != pTxnQ->pCurrTxn) { TRACE2(pTxnQ->hReport, REPORT_SEVERITY_ERROR, "txnQ_TxnDoneCb(): CB returned pTxn 0x%x while pCurrTxn is 0x%x !!\n", pTxn, pTxnQ->pCurrTxn); } #endif /* If the function of the completed Txn is waiting for restart */ if (pTxnQ->aFuncInfo[uFuncId].eState == FUNC_STATE_RESTART) { TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_TxnDoneCb(): Handling restart\n"); /* First, Clear the restarted function queues */ txnQ_ClearQueues (hTxnQ, uFuncId); /* Call function CB for current Txn with restart indication */ TXN_PARAM_SET_STATUS(pTxn, TXN_PARAM_STATUS_RECOVERY); pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb (pTxnQ->aFuncInfo[uFuncId].hCbHandle, pTxn); } /* In the normal case (no restart), enqueue completed transaction in TxnDone queue */ else { TI_STATUS eStatus; context_EnterCriticalSection (pTxnQ->hContext); eStatus = que_Enqueue (pTxnQ->hTxnDoneQueue, (TI_HANDLE)pTxn); if (eStatus != TI_OK) { TRACE3(pTxnQ->hReport, REPORT_SEVERITY_ERROR, "txnQ_TxnDoneCb(): Enqueue failed, pTxn=0x%x, HwAddr=0x%x, Len0=%d\n", pTxn, pTxn->uHwAddr, pTxn->aLen[0]); } context_LeaveCriticalSection (pTxnQ->hContext); } /* Indicate that no transaction is currently processed in the bus-driver */ pTxnQ->pCurrTxn = NULL; /* Send queued transactions as possible (TRUE indicates we are in external context) */ txnQ_RunScheduler (pTxnQ, NULL); }
void txnQ_Run (TI_HANDLE hTxnQ, TI_UINT32 uFuncId) { TTxnQObj *pTxnQ = (TTxnQObj*) hTxnQ; #ifdef TI_DBG TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Run()\n"); if (pTxnQ->aFuncInfo[uFuncId].eState != FUNC_STATE_STOPPED) { TRACE2(pTxnQ->hReport, REPORT_SEVERITY_WARNING, "txnQ_Run(): Called while func %d state is %d!\n", uFuncId, pTxnQ->aFuncInfo[uFuncId].eState); } #endif /* Enable function's queues */ pTxnQ->aFuncInfo[uFuncId].eState = FUNC_STATE_RUNNING; /* Send queued transactions as possible */ txnQ_RunScheduler (pTxnQ, NULL); }
/** * \fn txnQ_Run * \brief Run caller's queues * * Enable TxnQ scheduler to process transactions from the calling function's queues. * Run scheduler to issue transactions as possible. * Run in critical section to protect from preemption by TxnDone. * * \note * \param hTxnQ - The module's object * \param uFuncId - The calling functional driver * \return void * \sa */ void txnQ_Run (handle_t hTxnQ, const McpU32 uFuncId) { TTxnQObj *pTxnQ = (TTxnQObj*) hTxnQ; #ifdef TRAN_DBG if (pTxnQ->aFuncInfo[uFuncId].eState != FUNC_STATE_STOPPED) { MCPF_REPORT_ERROR(pTxnQ->hMcpf, QUEUE_MODULE_LOG, ("%s: Called while func %d state is %d!\n", __FUNCTION__, uFuncId, pTxnQ->aFuncInfo[uFuncId].eState)); } #endif MCPF_ENTER_CRIT_SEC (pTxnQ->hMcpf); /* Enable function's queues */ pTxnQ->aFuncInfo[uFuncId].eState = FUNC_STATE_RUNNING; /* Send queued transactions as possible */ txnQ_RunScheduler (pTxnQ, NULL, MCP_FALSE); MCPF_EXIT_CRIT_SEC (pTxnQ->hMcpf); }
ETxnStatus txnQ_Transact (TI_HANDLE hTxnQ, TTxnStruct *pTxn) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; TI_UINT32 uFuncId = TXN_PARAM_GET_FUNC_ID(pTxn); ETxnStatus rc; if (TXN_PARAM_GET_SINGLE_STEP(pTxn)) { pTxnQ->aFuncInfo[uFuncId].pSingleStep = pTxn; } else { TI_STATUS eStatus; TI_HANDLE hQueue = pTxnQ->aTxnQueues[uFuncId][TXN_PARAM_GET_PRIORITY(pTxn)]; context_EnterCriticalSection (pTxnQ->hContext); eStatus = que_Enqueue (hQueue, (TI_HANDLE)pTxn); context_LeaveCriticalSection (pTxnQ->hContext); if (eStatus != TI_OK) { return TXN_STATUS_ERROR; } } /* Send queued transactions as possible */ rc = txnQ_RunScheduler (pTxnQ, pTxn); return rc; }