Int32 AlgLink_scdAlgCreate(AlgLink_ScdObj * pObj) { Int32 status; SCD_CreatePrm *pAlgCreatePrm; pAlgCreatePrm = &pObj->algCreatePrm; AlgLink_scdAlgResetStatistics(pObj); pObj->processFrameCount = 0; pObj->totalTime = 0; pAlgCreatePrm->maxWidth = pObj->scdCreateParams.maxWidth; pAlgCreatePrm->maxHeight = pObj->scdCreateParams.maxHeight; pAlgCreatePrm->maxPitch = pObj->scdCreateParams.maxStride; Vps_printf(" %d: SCD: Opening algorithm ... !!!\n", Utils_getCurTimeInMsec() ); status = SCD_open(&pObj->algObj, pAlgCreatePrm); UTILS_assert(status==FVID2_SOK); Vps_printf(" %d: SCD: Opening algorithm ... DONE !!!\n", Utils_getCurTimeInMsec() ); AlgLink_scdAlgAllocMem(pObj); AlgLink_scdAlgChCreate(pObj); return FVID2_SOK; }
Void System_initLinks() { Vps_printf(" %d: SYSTEM : Initializing Links !!! \r\n", Utils_getCurTimeInMsec()); System_memPrintHeapStatus(); CaptureLink_init(); NsfLink_init(); DeiLink_init(); DisplayLink_init(); NullLink_init(); NullSrcLink_init(); DupLink_init(); SclrLink_init(); SwMsLink_init(); MergeLink_init(); #ifdef SYSTEM_USE_VIDEO_DECODER System_videoResetVideoDevices(); #endif #if AVSYNC_COMP_ENABLE Vps_printf(" %d: SYSTEM : Initializing AVsync ********************** !!! \r\n", Utils_getCurTimeInMsec()); AVSYNC_M3_Init(); #endif Vps_printf(" %d: SYSTEM : Initializing Links ... DONE !!! \r\n", Utils_getCurTimeInMsec()); }
Int32 IpcFramesInLink_delete(IpcFramesInLink_Obj * pObj) { Int32 status; IPCFRAMESINLINK_INFO_LOG(pObj->tskId, "RECV:%d\tFREE:%d,DROPPED:%d,AVGLATENCY:%d", pObj->stats.recvCount, pObj->stats.freeCount, pObj->stats.droppedCount, UTILS_DIV(pObj->stats.totalRoundTrip , pObj->stats.freeCount)); #ifdef SYSTEM_DEBUG_IPC Vps_printf(" %d: IPC_FRAMES_IN : Delete in progress !!!\n", Utils_getCurTimeInMsec()); #endif status = System_ipcListMPClose(&pObj->listMPOutHndl, &pObj->listMPInHndl); UTILS_assert(status == FVID2_SOK); Utils_queDelete(&pObj->outFrameBufQue); IpcFramesInLink_deletePrdObj(pObj); #ifdef SYSTEM_DEBUG_IPC Vps_printf(" %d: IPC_FRAMES_IN : Delete Done !!!\n", Utils_getCurTimeInMsec()); #endif return IPC_FRAMES_IN_LINK_S_SUCCESS; }
Int32 System_ipcNotifyDeInit() { Int32 status; UInt32 i, procId; Vps_printf(" %d: SYSTEM: IPC Notify de-init in progress !!!\n", Utils_getCurTimeInMsec()); i = 0; while (gSystem_ipcEnableProcId[i] != SYSTEM_PROC_MAX) { procId = gSystem_ipcEnableProcId[i]; if ((procId != System_getSelfProcId()) && (procId != SYSTEM_PROC_INVALID)) { status = Notify_unregisterEvent(procId, SYSTEM_IPC_NOTIFY_LINE_ID, SYSTEM_IPC_NOTIFY_EVENT_ID, System_ipcNotifyHandler, NULL); UTILS_assert(status == Notify_S_SUCCESS); } i++; } Vps_printf(" %d: SYSTEM: IPC Notify de-init DONE !!!\n", Utils_getCurTimeInMsec()); return status; }
Int32 AlgLink_scdAlgPrintStatistics(AlgLink_ScdObj * pObj, Bool resetAfterPrint) { UInt32 chId; AlgLink_ScdChObj *pChObj; UInt32 elaspedTime; UInt64 referenceTimeInUsecs; elaspedTime = Utils_getCurTimeInMsec() - pObj->statsStartTime; // in msecs elaspedTime /= 1000; // convert to secs referenceTimeInUsecs = (Utils_getCurTimeInMsec() - pObj->statsStartTime)*1000; Vps_printf( " \n" " *** (SIMCOP) SCD Statistics *** \n" " \n" " Elasped Time : %d secs\n" " Total Fields Processed : %d \n" " Total Fields FPS : %d FPS\n" " \n" " Detailed Internal Profile Log, \n" " - SCD ALG Total time : %10d msecs (%d %% of elasped time) \n" " - SIMCOP Total time : %10d msecs (%d %% of elasped time) \n" " - SCD ALG CPU time : %10d msecs (%d %% of elasped time) \n" " \n" " \n" " CH | In Recv In Skip In Process \n" " Num | FPS FPS FPS \n" " ---------------------------------\n", elaspedTime, pObj->processFrameCount, pObj->processFrameCount * 100 / (pObj->totalTime / 10), (UInt32)(pObj->profileLog[SCD_PROFILE_TOTAL_TIME]/1000), (UInt32)(pObj->profileLog[SCD_PROFILE_TOTAL_TIME]*100/referenceTimeInUsecs), (UInt32)(pObj->profileLog[SCD_PROFILE_SIMCOP_TIME]/1000), (UInt32)(pObj->profileLog[SCD_PROFILE_SIMCOP_TIME]*100/referenceTimeInUsecs), (UInt32)(pObj->profileLog[SCD_PROFILE_CPU_TIME]/1000), (UInt32)(pObj->profileLog[SCD_PROFILE_CPU_TIME]*100/referenceTimeInUsecs) ); for (chId = 0; chId < pObj->inQueInfo->numCh; chId++) { pChObj = &pObj->chObj[chId]; Vps_printf( " %3d | %7d %7d %10d\n", chId, pChObj->inFrameRecvCount/elaspedTime, pChObj->inFrameSkipCount/elaspedTime, pChObj->inFrameProcessCount/elaspedTime ); } Vps_printf( " \n"); if(resetAfterPrint) { AlgLink_scdAlgResetStatistics(pObj); } return FVID2_SOK; }
Void Utils_bitbufPrintStatus(UInt8 *str, Utils_BitBufHndl * pHndl) { Uint8 i; Vps_printf(" %s BitBuf Q Status\n", str); for (i=0; i<pHndl->numAllocPools; i++) { Vps_printf("Empty Q %d -> count %d, wrPtr %d, rdPtr %d\n", i, pHndl->emptyQue[i].count, pHndl->emptyQue[i].curWr, pHndl->emptyQue[i].curRd); } Vps_printf("Full Q -> count %d, wrPtr %d, rdPtr %d\n", pHndl->fullQue.count, pHndl->fullQue.curWr, pHndl->fullQue.curRd); }
Int32 AlgLink_algCreate(AlgLink_Obj * pObj, AlgLink_CreateParams * pPrm) { Int32 status; Vps_printf(" %d: ALG : Create in progress !!!\n", Utils_getCurTimeInMsec()); UTILS_MEMLOG_USED_START(); memcpy(&pObj->createArgs, pPrm, sizeof(*pPrm)); memcpy(&pObj->scdAlg.createArgs, &pPrm->scdCreateParams, sizeof(AlgLink_ScdCreateParams)); memcpy(&pObj->osdAlg.osdChCreateParams, &pPrm->osdChCreateParams, (sizeof(AlgLink_OsdChCreateParams) * ALG_LINK_OSD_MAX_CH)); status = System_linkGetInfo(pPrm->inQueParams.prevLinkId, &pObj->inTskInfo); UTILS_assert(status == FVID2_SOK); UTILS_assert(pPrm->inQueParams.prevLinkQueId < pObj->inTskInfo.numQue); memcpy(&pObj->inQueInfo, &pObj->inTskInfo.queInfo[pPrm->inQueParams.prevLinkQueId], sizeof(pObj->inQueInfo)); UTILS_assert(pObj->inQueInfo.numCh <= ALG_LINK_OSD_MAX_CH); pObj->scdAlg.inQueInfo = &pObj->inQueInfo; pObj->osdAlg.inQueInfo = &pObj->inQueInfo; if (pObj->createArgs.enableOSDAlg) { status = AlgLink_OsdalgCreate(&pObj->osdAlg); UTILS_assert(status == FVID2_SOK); } if (pObj->createArgs.enableSCDAlg) { status = AlgLink_ScdalgCreate(&pObj->scdAlg); UTILS_assert(status == FVID2_SOK); AlgLink_createOutObj(pObj); } pObj->isCreated = ALG_LINK_STATE_ACTIVE; UTILS_MEMLOG_USED_END(pObj->memUsed); UTILS_MEMLOG_PRINT("ALGLINK", pObj->memUsed, UTILS_ARRAYSIZE(pObj->memUsed)); Vps_printf(" %d: ALG : Create Done !!!\n", Utils_getCurTimeInMsec()); return FVID2_SOK; }
Int32 AlgLink_scdAlgCreate(AlgLink_ScdObj * pObj) { Int32 status; SCD_CreatePrm *pAlgCreatePrm; pAlgCreatePrm = &pObj->algCreatePrm; memset(pAlgCreatePrm, 0, sizeof(*pAlgCreatePrm)); AlgLink_scdAlgResetStatistics(pObj); pObj->processFrameCount = 0; pObj->totalTime = 0; pAlgCreatePrm->maxWidth = SystemUtils_align(pObj->scdCreateParams.maxStride, ALG_LINK_SIMCOP_SCD_WIDTH_ALIGN); pAlgCreatePrm->maxHeight = pObj->scdCreateParams.maxHeight; pAlgCreatePrm->maxPitch = pAlgCreatePrm->maxWidth; Vps_printf(" %d: SCD: Opening algorithm ... !!!\n", Utils_getCurTimeInMsec() ); status = SCD_open(&pObj->algObj, pAlgCreatePrm); UTILS_assert(status==FVID2_SOK); Vps_printf(" %d: SCD: Opening algorithm ... DONE !!!\n", Utils_getCurTimeInMsec() ); AlgLink_scdAlgAllocMem(pObj); AlgLink_scdAlgChCreate(pObj); status = Utils_dmaCreateCh(&pObj->dmaCh, UTILS_DMA_DEFAULT_EVENT_Q, 1, TRUE); UTILS_assert(status==FVID2_SOK); status = Utils_queCreate(&pObj->processQ, ALG_LINK_MAX_PROCESS_FRAMES*ALG_LINK_SIMCOP_SCD_MAX_CH, pObj->processQMem, UTILS_QUE_FLAG_BLOCK_QUE_GET ); UTILS_assert(status==FVID2_SOK); AlgLink_scdAlgProcessTskSendCmd(pObj, SYSTEM_CMD_START); return FVID2_SOK; }
Int32 System_deInit() { Int32 status = FVID2_SOK; IpcInM3Link_deInit(); IpcOutM3Link_deInit(); IpcFramesInLink_deInit(); IpcFramesOutLink_deInit(); Utils_dmaDeInit(); Utils_dmTimerDeInit(); System_deInitLinks(); #ifdef SYSTEM_DEBUG Vps_printf(" %d: SYSTEM : System VPSS De-Init in progress !!!\n", Utils_getCurTimeInMsec()); #endif System_freeBlankFrame(); Semaphore_delete(&gSystem_objVpss.vipLock[SYSTEM_VIP_0]); Semaphore_delete(&gSystem_objVpss.vipLock[SYSTEM_VIP_1]); #ifdef TI816X_DVR status = Vps_tvp5158DeInit(); UTILS_assert(status == FVID2_SOK); #endif Vps_platformDeviceDeInit(); /* * FVID2 system de-init */ FVID2_deInit(NULL); Vps_platformDeInit(); #ifdef SYSTEM_USE_TILER Utils_tilerAllocatorDeInit(); #endif #ifdef SYSTEM_DEBUG Vps_printf(" %d: SYSTEM : System VPSS De-Init Done !!!\n", Utils_getCurTimeInMsec()); #endif return status; }
Int32 Utils_memFree(Ptr addr, UInt32 size) { UInt32 heapId = UTILS_MEM_VID_FRAME_BUF_HEAP; SharedRegion_Entry srEntry; SharedRegion_getEntry(SYSTEM_IPC_SR_VIDEO_FRAME, &srEntry); /* if address falls in tiler buffer then free from that heap */ if((UInt32)addr >= (UInt32)srEntry.base && (UInt32)addr < ((UInt32)srEntry.base + srEntry.len) ) { #ifdef UTILS_MEM_DEBUG Vps_printf(" UTILS: MEM: FRAME FREE, addr = 0x%08x, size = %d bytes, heap = %d\n", addr, size, heapId); #endif /* free previously allocated memory */ Memory_free(gUtils_heapMemHandle[heapId], addr, size); } else { Int32 status; status = SystemTiler_freeRaw(addr,size); UTILS_assert(status == 0); } return 0; }
Int32 Utils_tskDelete(Utils_TskHndl * pHndl) { UInt32 sleepTime = 8; /* in OS ticks */ Utils_tskSendCmd(pHndl, UTILS_TSK_CMD_EXIT); /* wait for command to be received and task to be exited */ Task_sleep(1); while (Task_Mode_TERMINATED != Task_getMode(pHndl->tsk)) { Task_sleep(sleepTime); sleepTime >>= 1; if (sleepTime == 0) { char name[64]; strcpy(name, "INVALID_TSK"); Utils_prfGetTaskName(pHndl->tsk, name); Vps_printf("Task Delete Error!!!!!!, task %s not deleted\n", name); UTILS_assert(0); } } Utils_prfLoadUnRegister(pHndl->tsk); Task_delete(&pHndl->tsk); Utils_mbxDelete(&pHndl->mbx); return FVID2_SOK; }
Int32 IpcOutM3Link_delete(IpcOutM3Link_Obj * pObj) { #ifdef SYSTEM_DEBUG_IPC Vps_printf(" %d: IPC_OUT_M3 : Delete in progress !!!\n", Utils_getCurTimeInMsec()); #endif Utils_queDelete(&pObj->listElemQue); IpcOutM3Link_deletePrdObj(pObj); #ifdef SYSTEM_DEBUG_IPC Vps_printf(" %d: IPC_OUT_M3 : Delete Done !!!\n", Utils_getCurTimeInMsec()); #endif return FVID2_SOK; }
static Void DisplayLink_drvSetFieldSeparatedInfo(DisplayLink_Obj * pObj) { Int i,status; DisplayLink_CreateParams * pPrm; pPrm = &pObj->createArgs; for (i = 0; i < pObj->createArgs.numInputQueues;i++) { status = System_linkGetInfo(pPrm->inQueParams[i].prevLinkId, &pObj->inTskInfo[i]); UTILS_assert(status == FVID2_SOK); if (DisplayLink_drvIsSDDef(pObj)) { pObj->fieldInput[i] = DisplayLink_drvIsFieldSeparatedInput (pObj, &pObj->inTskInfo[i].queInfo[pPrm->inQueParams[i].prevLinkQueId]); if(pObj->fieldInput[i]) { Vps_printf(" %d: DISPLAY: %d: Field Separate Mode ENABLED for Que %d !!!\n", Utils_getCurTimeInMsec(), SYSTEM_GET_LINK_ID(pObj->tskId), i ); } } else { pObj->fieldInput[i] = FALSE; } } }
Int32 Utils_prfTsPrint(Utils_PrfTsHndl * pHndl, Bool resetAfterPrint) { UInt32 timeMs, fps, fpc; Types_FreqHz cpuHz; /* This is not used as 64 bit timestamp is not working TODO */ UInt32 cpuKhz; Timestamp_getFreq(&cpuHz); /* Currently thi is not used as 64bit timestamp is not working TODO */ cpuKhz = cpuHz.lo / 1000; /* convert to Khz */ /* Currently thi is not used as 64bit timestamp is not working TODO */ timeMs = (pHndl->totalTs) / cpuKhz; fps = (pHndl->numFrames * 1000) / timeMs; fpc = (pHndl->numFrames) / pHndl->count; Vps_printf(" %d: PRF : %s : t: %d ms, c: %d, f: %d, fps: %d, fpc: %d \r\n", Utils_getCurTimeInMsec(), pHndl->name, timeMs, /* in * msecs */ pHndl->count, pHndl->numFrames, fps, /* frames per * second */ fpc /* frames per * count */ ); if (resetAfterPrint) Utils_prfTsReset(pHndl); return 0; }
Int32 IpcFramesInLink_getFullFrames(Utils_TskHndl * pTsk, UInt16 queId, FVID2_FrameList * pFrameBufList) { IpcFramesInLink_Obj *pObj = (IpcFramesInLink_Obj *) pTsk->appData; UInt32 idx; Int32 status; if (IPC_FRAMES_IN_LINK_STATE_ACTIVE == pObj->state) { for (idx = 0; idx < FVID2_MAX_FVID_FRAME_PTR; idx++) { status = Utils_queGet(&pObj->outFrameBufQue, (Ptr *) & pFrameBufList->frames[idx], 1, BIOS_NO_WAIT); if (status != FVID2_SOK) break; } pFrameBufList->numFrames = idx; } else { Vps_printf(" %d: IPC_FRAMES_IN:Warning! Get Frames invoked after link delete\n", Utils_getCurTimeInMsec()); pFrameBufList->numFrames = 0; } return IPC_FRAMES_IN_LINK_S_SUCCESS; }
static void NullSrcLink_fillcolorbar(unsigned char *pY, unsigned char *pUV, unsigned int width, unsigned int heigh, FVID2_DataFormat format) { int i,j,k; switch (format) { case SYSTEM_DF_YUV422I_YUYV: Vps_printf("width = %d, heigh = %d\n",width, heigh); for(k=0;k<heigh;k++){ for(i=0;i<8;i++){ for(j=0;j<width/(8*2);j++){ *pY = ycrcb[i][0];pY++; *pY = ycrcb[i][1];pY++; *pY = ycrcb[i][0];pY++; *pY = ycrcb[i][2];pY++; } } } break; case SYSTEM_DF_YUV422SP_UV: for(k=0;k<heigh;k++){ for(i=0;i<8;i++){ for(j=0;j<width/(8*2);j++){ *pY = ycrcb[i][0];pY++; *pY = ycrcb[i][0];pY++; *pUV = ycrcb[i][1];pUV++; *pUV = ycrcb[i][2];pUV++; } } } break; } }
Int32 IpcOutM3Link_printStatistics (IpcOutM3Link_Obj *pObj, Bool resetAfterPrint) { UInt32 chId; IpcOutM3Link_ChObj *pChObj; UInt32 elaspedTime; elaspedTime = Utils_getCurTimeInMsec() - pObj->statsStartTime; // in msecs elaspedTime /= 1000; // convert to secs Vps_printf( " \n" " *** IpcOutM3 Statistics *** \n" " \n" " Elasped Time : %d secs\n" " Total Fields Processed : %d \n" " Total Fields FPS : %d FPS\n" " \n" " \n" " CH | In Recv In Process In Skip\n" " Num | FPS FPS FPS \n" " --------------------------------\n", elaspedTime, pObj->totalFrameCount , pObj->totalFrameCount / (elaspedTime) ); for (chId = 0; chId < pObj->numCh; chId++) { pChObj = &pObj->chObj[chId]; Vps_printf( " %3d | %7d %10d %7d\n", chId, pChObj->inFrameRecvCount/elaspedTime, pChObj->inFrameProcessCount/elaspedTime, pChObj->inFrameUserSkipCount/elaspedTime ); } Vps_printf( " \n"); if(resetAfterPrint) { IpcOutM3Link_resetStatistics(pObj); } return FVID2_SOK; }
static Int32 HelloWorldLink_algCreate(HelloWorldLink_Obj * pObj) { HELLOWORLDALG_createPrm algCreatePrm; IALG_Fxns *algFxns = (IALG_Fxns *)&HELLOWORLDALG_TI_IALG; Vps_printf(" %d: HELLOWORLD : Algorithm Create in progress !!!\n", Utils_getCurTimeInMsec()); algCreatePrm.maxWidth = pObj->createArgs.maxWidth; algCreatePrm.maxHeight = pObj->createArgs.maxHeight; algCreatePrm.maxStride = pObj->createArgs.maxStride; algCreatePrm.maxChannels = pObj->createArgs.maxChannels; /*************************************************************************/ /* Create algorithm instance and get hello world algo handle. */ /* DSKT2 is memory manager and creates instance for algorithm that has */ /* XDAIS/Alg interface APIs implemented (numAlloc, memAlloc and algInit) */ /*************************************************************************/ pObj->algHndl = DSKT2_createAlg((Int)gScratchId, (IALG_Fxns *)algFxns, NULL,(IALG_Params *)&algCreatePrm); if(pObj->algHndl == NULL) { Vps_printf(" %d: HELLOWORLD : Algorithm Create ERROR !!!\n", Utils_getCurTimeInMsec()); return FVID2_EFAIL; } /*************************************************************************/ /* Once algorithm instace is created, initialize channel specific */ /* parameters here */ /*************************************************************************/ /* for(chNum = 0; chNum < algCreatePrm.maxChannels; chNum++) { HELLOWORLDALG_TI_setPrms(pObj->algHndl, HELLOWORLDALG_chPrm, chNum) } */ Vps_printf(" %d: HELLOWORLD : Algorithm Create Done !!!\n", Utils_getCurTimeInMsec()); return FVID2_SOK; }
Int32 AlgLink_scdAlgPrintStatistics(AlgLink_ScdObj * pObj, Bool resetAfterPrint) { UInt32 chId; AlgLink_ScdChObj *pChObj; UInt32 elaspedTime; elaspedTime = Utils_getCurTimeInMsec() - pObj->statsStartTime; // in msecs elaspedTime /= 1000; // convert to secs Vps_printf( " \n" " *** (SIMCOP) SCD Statistics *** \n" " \n" " Elasped Time : %d secs\n" " Total Fields Processed : %d \n" " Total Fields FPS : %d FPS\n" " \n" " \n" " CH | In Recv In Skip In Process \n" " Num | FPS FPS FPS \n" " ---------------------------------\n", elaspedTime, pObj->processFrameCount, pObj->processFrameCount * 100 / (pObj->totalTime / 10) ); for (chId = 0; chId < pObj->inQueInfo->numCh; chId++) { pChObj = &pObj->chObj[chId]; Vps_printf( " %3d | %7d %7d %10d\n", chId, pChObj->inFrameRecvCount/elaspedTime, pChObj->inFrameSkipCount/elaspedTime, pChObj->inFrameProcessCount/elaspedTime ); } Vps_printf( " \n"); if(resetAfterPrint) { AlgLink_scdAlgResetStatistics(pObj); } return FVID2_SOK; }
Int32 AlgLink_algDelete(AlgLink_Obj * pObj) { Int32 status; Int32 i,outId,bitbuf_index; AlgLink_OutObj *pOutObj; Vps_printf(" %d: ALG : Delete in progress !!!\n", Utils_getCurTimeInMsec()); if (pObj->createArgs.enableOSDAlg) { status = AlgLink_OsdalgDelete(&pObj->osdAlg); UTILS_assert(status == FVID2_SOK); } if (pObj->createArgs.enableSCDAlg) { status = AlgLink_ScdalgDelete(&pObj->scdAlg); UTILS_assert(status == FVID2_SOK); for (outId = 0; outId < ALG_LINK_MAX_OUT_QUE; outId++) { { pOutObj = &pObj->outObj[outId]; status = Utils_bitbufDelete(&pOutObj->bufOutQue); UTILS_assert(status == FVID2_SOK); bitbuf_index = 0; for (i = 0; i < pOutObj->numAllocPools; i++) { UTILS_assert((pOutObj->outBufs[bitbuf_index].bufSize == pOutObj->buf_size[i])); status = Utils_memBitBufFree(&pOutObj->outBufs[bitbuf_index], pOutObj->outNumBufs[i]); UTILS_assert(status == FVID2_SOK); bitbuf_index += pOutObj->outNumBufs[i]; } } } } pObj->isCreated = ALG_LINK_STATE_INACTIVE; Vps_printf(" %d: ALG : Delete Done !!!\n", Utils_getCurTimeInMsec()); return FVID2_SOK; }
Int32 Utils_prfLoadPrintAll(Bool printTskLoad) { Int32 hwiLoad, swiLoad, tskLoad, hndlId, cpuLoad; Utils_PrfLoadObj *pHndl; hwiLoad = swiLoad = tskLoad = -1; hwiLoad = (gUtils_accPrfLoadObj.totalHwiThreadTime * 100) / gUtils_accPrfLoadObj.totalTime; swiLoad = (gUtils_accPrfLoadObj.totalSwiThreadTime * 100) / gUtils_accPrfLoadObj.totalTime; cpuLoad = 100 - ((gUtils_accPrfLoadObj.totalIdlTskTime * 100) / gUtils_accPrfLoadObj.totalTime); Vps_printf(" \n"); Vps_printf(" %d: LOAD: CPU: %d%% HWI: %d%%, SWI:%d%% \n", Utils_getCurTimeInMsec(), cpuLoad, hwiLoad, swiLoad); if (printTskLoad) { Vps_printf(" \n"); for (hndlId = 0; hndlId < UTILS_PRF_MAX_HNDL; hndlId++) { pHndl = &gUtils_prfObj.loadObj[hndlId]; if (pHndl->isAlloc) { tskLoad = -1; tskLoad = (pHndl->totalTskThreadTime * 100) / gUtils_accPrfLoadObj.totalTime; if (tskLoad) { Vps_printf(" %d: LOAD: TSK: %s: %d%% \r\n", Utils_getCurTimeInMsec(), pHndl->name, tskLoad); } } } } Vps_printf(" \n"); return 0; }
/* =================================================================== * @func HelloWorldLink_algDelete * * @desc Delete HelloWorld link instance * * @modif This function modifies the following structures * * @inputs This function takes the following inputs * <HelloWorldLink_Obj> * Object to hello world link * * @outputs <argument name> * Description of usage * * @return Status of instance creation * ================================================================== */ Int32 HelloWorldLink_delete(HelloWorldLink_Obj * pObj) { Int32 status; Int32 i,outId,bitbuf_index; HelloWorldLink_OutObj *pOutObj; Vps_printf(" %d: HELLOWORLD : Delete in progress !!!\n", Utils_getCurTimeInMsec()); /*************************************************************************/ /* Make a call to your algrithm instance deletion here. At this place */ /* you should free memory and DMA resource (if any) held by your algo */ /*************************************************************************/ //status = HelloWorldLink_algDelete(&pObj->Alg1); //UTILS_assert(status == FVID2_SOK); /*************************************************************************/ /* Free the output buffer and it's queue created by helloWorld link */ /*************************************************************************/ for (outId = 0; outId < HELLOWORLD_LINK_MAX_OUT_QUE; outId++) { { pOutObj = &pObj->outObj[outId]; status = Utils_bitbufDelete(&pOutObj->bufOutQue); UTILS_assert(status == FVID2_SOK); bitbuf_index = 0; for (i = 0; i < pOutObj->numAllocPools; i++) { UTILS_assert((pOutObj->outBufs[bitbuf_index].bufSize == pOutObj->bufSize[i])); status = Utils_memBitBufFree(&pOutObj->outBufs[bitbuf_index], pOutObj->outNumBufs[i]); UTILS_assert(status == FVID2_SOK); bitbuf_index += pOutObj->outNumBufs[i]; } } } Vps_printf(" %d: HELLOWORLD : Delete Done !!!\n", Utils_getCurTimeInMsec()); return FVID2_SOK; }
Int32 DisplayLink_drvStop(DisplayLink_Obj * pObj) { Int32 status = FVID2_SOK; #ifdef SYSTEM_DEBUG_DISPLAY Vps_printf(" %d: DISPLAY: Stop in progress !!!\n", Utils_getCurTimeInMsec()); #endif pObj->totalTime = Utils_getCurTimeInMsec() - pObj->totalTime; status = FVID2_stop(pObj->displayHndl, NULL); UTILS_assert(status == FVID2_SOK); #ifdef SYSTEM_DEBUG_DISPLAY Vps_printf(" %d: DISPLAY: Stop Done !!!\n", Utils_getCurTimeInMsec()); #endif return status; }
Int32 AlgLink_scdAlgAllocMem(AlgLink_ScdObj * pObj) { UInt32 blockId; Int32 status; status = SCD_getAllocInfo(&pObj->algObj, &pObj->algMemAllocPrm, &pObj->algPerChMemAllocPrm); UTILS_assert(status==FVID2_SOK); for(blockId=0; blockId<pObj->algMemAllocPrm.numMemBlocks; blockId++) { #ifdef SYSTEM_VERBOSE_PRINTS Vps_printf(" %d: SCD: MEM REQUEST %d: of size %d B (align=%d)\n", Utils_getCurTimeInMsec(), blockId, pObj->algMemAllocPrm.memBlockSize[blockId], pObj->algMemAllocPrm.memBlockAlign[blockId] ); #endif pObj->algMemAllocPrm.memBlockAddr[blockId] = Utils_memAlloc( pObj->algMemAllocPrm.memBlockSize[blockId], pObj->algMemAllocPrm.memBlockAlign[blockId] ); UTILS_assert(pObj->algMemAllocPrm.memBlockAddr[blockId]!=NULL); #ifdef SYSTEM_VERBOSE_PRINTS Vps_printf(" %d: SCD: MEM ALLOC %d: @ 0x%08x of size %d B (align=%d)\n", Utils_getCurTimeInMsec(), blockId, pObj->algMemAllocPrm.memBlockAddr[blockId], pObj->algMemAllocPrm.memBlockSize[blockId], pObj->algMemAllocPrm.memBlockAlign[blockId] ); #endif } status = SCD_setAllocInfo(&pObj->algObj, &pObj->algMemAllocPrm); UTILS_assert(status==FVID2_SOK); return FVID2_SOK; }
Int32 NullSrcLink_drvStop(NullSrcLink_Obj * pObj) { Clock_stop(pObj->timer); #ifdef SYSTEM_DEBUG_NULL Vps_printf(" %d: NULL_SRC: Stop Done !!!\n", Utils_getCurTimeInMsec()); #endif return FVID2_SOK; }
Int32 NullSrcLink_drvProcessFrames(NullSrcLink_Obj * pObj) { System_LinkQueInfo *pChInfo; FVID2_FrameList frameList; UInt32 chId; FVID2_Frame *pFrame; Int32 status; static UInt32 StartTime = 0; pChInfo = &pObj->createArgs.inputInfo; frameList.numFrames = 0; if ((Utils_getCurTimeInMsec() - StartTime) > 5 * 1000) { //NullSrcLink_fillDataPattern(&pObj->outFormat, pObj->outFrames, 1); StartTime = Utils_getCurTimeInMsec(); Vps_printf("NullSrcLink_fillDataPattern ......NullSrcGetEmptyFrameNum:%d\n",s_NullSrcGetEmptyFrameNum); Utils_bufPrintStatus("NullSrcLink",&pObj->bufOutQue); } for (chId = 0; chId < pChInfo->numCh; chId++) { status = Utils_bufGetEmptyFrame(&pObj->bufOutQue, &pFrame, BIOS_NO_WAIT); if (status != FVID2_SOK) continue; s_NullSrcGetEmptyFrameNum++; frameList.frames[frameList.numFrames] = pFrame; frameList.numFrames++; pFrame->channelNum = chId; pFrame->timeStamp = Utils_getCurTimeInMsec(); if (pChInfo->chInfo[chId].scanFormat == FVID2_SF_INTERLACED) { pFrame->fid = pObj->chNextFid[chId]; pObj->chNextFid[chId] ^= 1; } } Utils_bufPutFull(&pObj->bufOutQue, &frameList); System_sendLinkCmd(pObj->createArgs.outQueParams.nextLink, SYSTEM_CMD_NEW_DATA); return FVID2_SOK; }
Int32 HelloWorldLink_algDelete(HelloWorldLink_Obj * pObj) { Int32 scratchId = gScratchId; Vps_printf(" %d: HELLOWORLD : Algorithm Delete in progress !!!\n", Utils_getCurTimeInMsec()); if(pObj->algHndl == NULL) return FVID2_EFAIL; /* Deactivate algorithm */ DSKT2_deactivateAlg(scratchId, (IALG_Handle)pObj->algHndl); DSKT2_freeAlg(scratchId, (IALG_Handle)pObj->algHndl); Vps_printf(" %d: HELLOWORLD : Algorithm Delete Done !!!\n", Utils_getCurTimeInMsec()); return FVID2_SOK; }
Int32 AlgLink_ScdalgDelete(AlgLink_ScdObj * pObj) { Int32 scratchId = gScratchId; //IRES_Status status; //IRES_Fxns * resFxns = &SCD_TI_IRES; #ifdef SYSTEM_DEBUG_SCD Vps_printf(" %d: SCD : Delete in progress !!!\n", Utils_getCurTimeInMsec()); #endif if(pObj->algHndl == NULL) return FVID2_EFAIL; /* * Deactivate All Resources RMAN_deactivateAllResources((IALG_Handle)pObj->algHndl, resFxns, scratchId); */ /* Deactivate algorithm */ DSKT2_deactivateAlg(scratchId, (IALG_Handle)pObj->algHndl); /* * Free resources assigned to this algorihtm status = RMAN_freeResources((IALG_Handle)pObj->algHndl, resFxns, scratchId); if (IRES_OK != status) { return SWOSD_EFAIL; } */ DSKT2_freeAlg(scratchId, (IALG_Handle)pObj->algHndl); #ifdef SYSTEM_DEBUG_SCD Vps_printf(" %d: SCD : Delete Done !!!\n", Utils_getCurTimeInMsec()); #endif return FVID2_SOK; }
Ptr Utils_memAlloc(UInt32 size, UInt32 align) { Ptr addr; Error_Block ebObj; Error_Block *eb = &ebObj; Error_init(eb); /* allocate memory */ addr = Memory_alloc(gUtils_heapMemHandle[UTILS_MEM_VID_FRAME_BUF_HEAP], size, align, eb); if(addr==NULL) { /* if memory allocation in Frame buf heap failed, then try in tiler buf heap But tiler needs to be disabled for this to work */ if (SystemTiler_isAllocatorDisabled()) { Error_init(eb); #ifdef SYSTEM_DEBUG_MEMORY_ALLOC Vps_printf("MEM:Primary Heap Alloc Failed" "Trying Secondary heap:Size:%d:",size); #endif /* SYSTEM_DEBUG_MEMORY_ALLOC */ addr = SystemTiler_allocRaw(size, align); } } #ifdef UTILS_MEM_DEBUG Vps_printf(" UTILS: MEM: FRAME ALLOC, addr = 0x%08x, size = %d bytes, headId = %d\n", addr, size, gUtils_heapMemHandle[UTILS_MEM_VID_FRAME_BUF_HEAP]); #endif if (!Error_check(eb) && (addr != NULL) && gUtils_memClearBuf[UTILS_MEM_VID_FRAME_BUF_HEAP]) memset(addr, 0x80, size); return addr; }
Int32 Utils_prfTsPrintAll(Bool resetAfterPrint) { UInt32 hndlId; Utils_PrfTsHndl *pHndl; Vps_printf("\r\n"); for (hndlId = 0; hndlId < UTILS_PRF_MAX_HNDL; hndlId++) { pHndl = &gUtils_prfObj.tsObj[hndlId]; if (pHndl->isAlloc) { Utils_prfTsPrint(pHndl, resetAfterPrint); } } Vps_printf("\r\n"); return 0; }