MV_STATUS my_mvSysCesaInit(int numOfSession, int queueDepth, void *osHandle) { MV_CESA_HAL_DATA halData; MV_UNIT_WIN_INFO addrWinMap[MAX_TARGETS + 1]; MV_STATUS status; MV_U8 chan; status = mvCtrlAddrWinMapBuild(addrWinMap, MAX_TARGETS + 1); if (status == MV_OK) { for (chan = 0; chan < MV_CESA_CHANNELS; chan++) { status = mvCesaTdmaWinInit(chan, addrWinMap); if (status != MV_OK) { mvOsPrintf("Error, unable to initialize CESA windows for channel(%d)\n", chan); break; } halData.sramPhysBase[chan] = (MV_ULONG)mv_crypto_virt_base_get(chan); halData.sramVirtBase[chan] = (MV_U8 *)mv_crypto_virt_base_get(chan); halData.sramOffset[chan] = 0; } if (status == MV_OK) { halData.ctrlModel = mvCtrlModelGet(); halData.ctrlRev = mvCtrlRevGet(); status = mvCesaHalInit(numOfSession, queueDepth, osHandle, &halData); } } return status; }
MV_STATUS mvCesaIfHalInit(int numOfSession, int queueDepth, void *osHandle, MV_CESA_HAL_DATA *halData) { /* Init globals */ memset(chanWeight, 0, (MV_CESA_CHANNELS * sizeof(MV_U64))); memset(chanFlowType, 0, (MV_CESA_CHANNELS * sizeof(MV_CESA_FLOW_TYPE))); currCesaPolicy = CESA_NULL_POLICY; splitChanId = 0; if(MV_CESA_CHANNELS > 1) { currReqId = 0; gReqId = 0; reqEmpty = 0; resQueueDepth = ((MV_CESA_CHANNELS * queueDepth * 2)); /* Allocate reordered results queue */ pResQueue = (MV_CESA_RESULT**)mvOsMalloc(resQueueDepth * sizeof(MV_CESA_RESULT*)); if(pResQueue == NULL) { mvOsPrintf("%s: Error, pResQueue malloc failed\n", __func__); return MV_ERROR; } resQueue = (MV_CESA_RESULT*)mvOsMalloc(resQueueDepth * sizeof(MV_CESA_RESULT)); if(resQueue == NULL) { mvOsPrintf("%s: Error, resQueue malloc failed\n", __func__); return MV_ERROR; } memset(pResQueue, 0, (resQueueDepth * sizeof(MV_CESA_RESULT*))); memset(resQueue, 0, (resQueueDepth * sizeof(MV_CESA_RESULT))); memset(readyStatus, MV_TRUE, (MV_CESA_CHANNELS * sizeof(MV_STATUS))); } return mvCesaHalInit(numOfSession, queueDepth, osHandle, halData); }