/** * @fn ixEthAccQMgrQueueSetup(void) * * @brief Setup one queue and its event, and register the callback required * by this component to the QMgr * * @internal */ IX_ETH_ACC_PRIVATE IxEthAccStatus ixEthAccQMgrQueueSetup(IxEthAccQregInfo *qInfoDes) { /* * Configure each Q. */ if ( ixQMgrQConfig( qInfoDes->qName, qInfoDes->qId, qInfoDes->qSize, qInfoDes->qWords) != IX_SUCCESS) { return IX_ETH_ACC_FAIL; } if ( ixQMgrWatermarkSet( qInfoDes->qId, qInfoDes->AlmostEmptyThreshold, qInfoDes->AlmostFullThreshold ) != IX_SUCCESS) { return IX_ETH_ACC_FAIL; } /* * Set dispatcher priority. */ if ( ixQMgrDispatcherPrioritySet( qInfoDes->qId, IX_ETH_ACC_QM_QUEUE_DISPATCH_PRIORITY) != IX_SUCCESS) { return IX_ETH_ACC_FAIL; } /* * Register callbacks for each Q. */ if ( ixQMgrNotificationCallbackSet(qInfoDes->qId, qInfoDes->qCallback, qInfoDes->callbackTag) != IX_SUCCESS ) { return IX_ETH_ACC_FAIL; } /* * Set notification condition for Q */ if ( qInfoDes->qNotificationEnableAtStartup == TRUE ) { if ( ixQMgrNotificationEnable(qInfoDes->qId, qInfoDes->qConditionSource) != IX_SUCCESS ) { return IX_ETH_ACC_FAIL; } } return(IX_ETH_ACC_SUCCESS); }
/** * @fn ixCryptoQAccessInit * @brief Queue configuration and callback registration function * */ IxCryptoAccStatus ixCryptoQAccessInit (IxCryptoAccCfg compCfg) { UINT32 i; if (initDone) /* If the module has been initialized */ { return IX_CRYPTO_ACC_STATUS_FAIL; } /* end of if (initDone) */ /* Initialize all the member in the ixCryptoStats struct */ ixCryptoStats.cryptoSuccessCounter = 0; ixCryptoStats.cryptoFailCounter = 0; ixCryptoStats.qOverflowCounter = 0; ixCryptoStats.qUnderflowCounter = 0; ixCryptoStats.qDescAddrInvalidCounter = 0; ixCryptoStats.wepNpeSuccessCounter = 0; ixCryptoStats.wepNpeFailCounter = 0; ixCryptoStats.wepNpeQOverflowCounter = 0; ixCryptoStats.wepNpeQUnderflowCounter = 0; ixCryptoStats.wepNpeQDescAddrInvalidCounter = 0; ixCryptoStats.wepXScaleSuccessCounter = 0; ixCryptoStats.wepXScaleFailCounter = 0; /* Check component configuration to determine which queues should be * initialized */ switch (compCfg) { /* XScale WEP engine only, no hw queues need to be initialized, * thus the function is forced return here */ case IX_CRYPTO_ACC_CFG_WEP_XSCALE_ACC_EN: /* Set flag to indicate this module has been initializaed */ initDone = TRUE; return IX_CRYPTO_ACC_STATUS_SUCCESS; /* Crypto NPE engine only */ case IX_CRYPTO_ACC_CFG_CRYPTO_NPE_ACC_EN: startQueueIndex = IX_CRYPTO_HW_ACCEL_QUEUE_START_INDEX; endQueueIndex = IX_CRYPTO_HW_ACCEL_QUEUE_END_INDEX; break; /* WEP NPE engine only */ case IX_CRYPTO_ACC_CFG_WEP_NPE_ACC_EN: startQueueIndex = IX_CRYPTO_WEP_QUEUE_START_INDEX; endQueueIndex = IX_CRYPTO_WEP_QUEUE_END_INDEX; break; /* CRYPTO NPE and WEP NPE engine only */ case IX_CRYPTO_ACC_CFG_CRYPTO_WEP_NPE_ACC_EN: startQueueIndex = IX_CRYPTO_HW_ACCEL_QUEUE_START_INDEX; endQueueIndex = IX_CRYPTO_WEP_QUEUE_END_INDEX; break; /* Invalid configuration */ default: return IX_CRYPTO_ACC_STATUS_FAIL; } for (i = startQueueIndex; i < endQueueIndex; i++) { /* Configure each Q */ if (IX_SUCCESS != (ixQMgrQConfig ( queueInfo[i].qName, queueInfo[i].qId, queueInfo[i].qSize, queueInfo[i].qWords))) { /* configuration failed */ return IX_CRYPTO_ACC_STATUS_FAIL; } /* end of if (ixQMgrQConfig) */ /* Set notification condition for Q */ if (queueInfo[i].qNotificationEnableAtStartup) { /* Set Q watermarks for each Q */ if (IX_SUCCESS != ixQMgrWatermarkSet ( queueInfo[i].qId, queueInfo[i].AlmostEmptyThreshold, queueInfo[i].AlmostFullThreshold)) { /* configuration failed */ return IX_CRYPTO_ACC_STATUS_FAIL; } /* end of if (ixQMgrWatermarkSet) */ /* Set dispatcher priority for the Q */ if (IX_SUCCESS != ixQMgrDispatcherPrioritySet ( queueInfo[i].qId, IX_CRYPTO_ACC_QM_QUEUE_DISPATCH_PRIORITY)) { /* configuration failed */ return IX_CRYPTO_ACC_STATUS_FAIL; } /* end of if (ixQMgrDispatcherPrioritySet) */ /* Register callbacks for each Q */ if (IX_SUCCESS != ixQMgrNotificationCallbackSet ( queueInfo[i].qId, queueInfo[i].qCallback, queueInfo[i].callbackTag)) { /* callback registration failed */ return IX_CRYPTO_ACC_STATUS_FAIL; } /* end of if (ixQMgrNotificationCallbackSet) */ if (IX_SUCCESS != ixQMgrNotificationEnable ( queueInfo[i].qId, queueInfo[i].qConditionSource)) { /* configuration failed */ return IX_CRYPTO_ACC_STATUS_FAIL; } /* end of if (ixQMgrNotificationEnable) */ } /* end of if (queueInfo[i].qNotificationEnableAtStartup) */ } /* end of for (i) */ /* Set flag to indicate this module has been initializaed */ initDone = TRUE; return IX_CRYPTO_ACC_STATUS_SUCCESS; } /* end of ixCryptoQAccessInit () function */