Void DupLink_tskMain(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg) { UInt32 cmd = Utils_msgGetCmd(pMsg); Bool ackMsg, done; Int32 status; DupLink_Obj *pObj = (DupLink_Obj *) pTsk->appData; if (cmd != SYSTEM_CMD_CREATE) { Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL); return; } status = DupLink_drvCreate(pObj, Utils_msgGetPrm(pMsg)); Utils_tskAckOrFreeMsg(pMsg, status); if (status != FVID2_SOK) return; done = FALSE; ackMsg = FALSE; while (!done) { status = Utils_tskRecvMsg(pTsk, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); switch (cmd) { case SYSTEM_CMD_DELETE: done = TRUE; ackMsg = TRUE; break; case SYSTEM_CMD_NEW_DATA: Utils_tskAckOrFreeMsg(pMsg, status); DupLink_drvProcessFrames(pObj); break; default: Utils_tskAckOrFreeMsg(pMsg, status); break; } } DupLink_drvDelete(pObj); if (ackMsg && pMsg != NULL) Utils_tskAckOrFreeMsg(pMsg, status); return; }
Void Utils_tskMain(UArg arg0, UArg arg1) { Utils_TskHndl *pHndl = (Utils_TskHndl *) arg0; Utils_MsgHndl *pMsg; Int32 status; UInt32 cmd; UTILS_assert(pHndl != NULL); while (1) { status = Utils_mbxRecvMsg(&pHndl->mbx, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); if (cmd == UTILS_TSK_CMD_EXIT) { Utils_tskAckOrFreeMsg(pMsg, FVID2_SOK); break; } if (pHndl->funcMain) pHndl->funcMain(pHndl, pMsg); } }
Int32 Utils_tskFlushMsg(Utils_TskHndl * pHndl, UInt32 *flushCmdId, UInt32 numCmds) { Utils_MsgHndl *pMsg; UInt32 i, cmd; Int32 status; Bool done; do { status = Utils_tskPeekMsg(pHndl, &pMsg); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); done = TRUE; // search the commands the need to be flushed for(i=0; i<numCmds; i++) { if(cmd==flushCmdId[i]) { // same command in queue to pull it out of the queue and free it status = Utils_tskRecvMsg(pHndl, &pMsg, BIOS_NO_WAIT); UTILS_assert(status==FVID2_SOK); Utils_tskAckOrFreeMsg(pMsg, status); done = FALSE; break; } } } while(!done); return FVID2_SOK; }
Void SystemLink_tskMain(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg) { Int32 status; SystemLink_Obj *pObj = (SystemLink_Obj *) pTsk->appData; status = SystemLink_cmdHandler(pObj, Utils_msgGetCmd(pMsg), Utils_msgGetPrm(pMsg)); Utils_tskAckOrFreeMsg(pMsg, status); return; }
Void MpSclrLink_tskSclr(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg) { UInt32 cmd = Utils_msgGetCmd(pMsg); Bool ackMsg, done; Int32 status; MpSclrLink_Obj *pObj; UInt32 flushCmds[2]; pObj = (MpSclrLink_Obj *) pTsk->appData; if (cmd != SYSTEM_CMD_CREATE) { Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL); return; } Utils_tskAckOrFreeMsg(pMsg, FVID2_SOK); done = FALSE; ackMsg = FALSE; while (!done) { status = Utils_tskRecvMsg(pTsk, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); switch (cmd) { case SYSTEM_CMD_NEW_DATA: Utils_tskAckOrFreeMsg(pMsg, status); flushCmds[0] = SYSTEM_CMD_NEW_DATA; Utils_tskFlushMsg(pTsk, flushCmds, 1); MpSclrLink_drvProcessMpFrames(pObj); break; case MP_SCLR_LINK_CMD_SCALING_DONE: Utils_tskAckOrFreeMsg(pMsg, status); MpSclrLink_drvMpPostProcessedFrames(pObj); break; case MP_SCLR_LINK_CMD_PRINT_STATISTICS: MpSclrLink_drvPrintStatistics(pObj, TRUE); Utils_tskAckOrFreeMsg(pMsg, status); break; case MP_SCLR_LINK_CMD_SET_OUTPUTRESOLUTION: { MpSclrLink_chDynamicSetOutRes *params; params = (MpSclrLink_chDynamicSetOutRes *) Utils_msgGetPrm(pMsg); MpSclrLink_drvSetChOutputRes(pObj, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case SYSTEM_CMD_DELETE: done = TRUE; ackMsg = TRUE; break; default : Utils_tskAckOrFreeMsg(pMsg, status); break; } } MpSclrLink_drvDelete(pObj); if (ackMsg && pMsg != NULL) Utils_tskAckOrFreeMsg(pMsg, status); return; }
Void MpSclrLink_tskFwdQ(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg) { UInt32 cmd = Utils_msgGetCmd(pMsg); Bool ackMsg, done; Int32 status; MpSclrLink_Obj *pObj; UInt32 flushCmds[2]; pObj = (MpSclrLink_Obj *) pTsk->appData; if (cmd != SYSTEM_CMD_CREATE) { Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL); return; } status = MpSclrLink_drvCreate(pObj, (MpSclrLink_CreateParams *) Utils_msgGetPrm(pMsg)); Utils_tskAckOrFreeMsg(pMsg, status); if (status != FVID2_SOK) return; /* Create the MP Scalar Task */ status = Utils_tskSendCmd(&pObj->mpScTskHndl, SYSTEM_CMD_CREATE); if (status != FVID2_SOK) { MpSclrLink_drvDelete(pObj); return; } done = FALSE; ackMsg = FALSE; while (!done) { status = Utils_tskRecvMsg(pTsk, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); switch (cmd) { case SYSTEM_CMD_NEW_DATA: Utils_tskAckOrFreeMsg(pMsg, status); flushCmds[0] = SYSTEM_CMD_NEW_DATA; Utils_tskFlushMsg(pTsk, flushCmds, 1); MpSclrLink_drvMpProcessAllCh(pObj); break; case MP_SCLR_LINK_CMD_GET_OUTPUTRESOLUTION: { MpSclrLink_chDynamicSetOutRes *params; params = (MpSclrLink_chDynamicSetOutRes *) Utils_msgGetPrm(pMsg); MpSclrLink_drvGetChOutputRes(pObj, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case MP_SCLR_LINK_CMD_SET_OUTPUTRESOLUTION: { MpSclrLink_chDynamicSetOutRes *params; params = (MpSclrLink_chDynamicSetOutRes *) Utils_msgGetPrm(pMsg); MpSclrLink_drvSetChOutputRes(pObj, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case SYSTEM_CMD_DELETE: /* The SCALAR Task will release all acquired resources, as this this does not use any resorces post this command. We should not release resources here, as scalar task might still be using them */ status = Utils_tskSendCmd(&pObj->mpScTskHndl, SYSTEM_CMD_DELETE); UTILS_assert(status == FVID2_SOK); done = TRUE; ackMsg = TRUE; break; case MP_SCLR_LINK_CMD_PRINT_STATISTICS: status = Utils_tskSendCmd(&pObj->mpScTskHndl, MP_SCLR_LINK_CMD_PRINT_STATISTICS); UTILS_assert(status == FVID2_SOK); Utils_tskAckOrFreeMsg(pMsg, status); break; default: Utils_tskAckOrFreeMsg(pMsg, status); break; } } if (ackMsg && pMsg != NULL) Utils_tskAckOrFreeMsg(pMsg, status); return; }
Void SclrLink_tskMain(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg) { UInt32 cmd = Utils_msgGetCmd(pMsg); Bool ackMsg, done; Int32 status; SclrLink_Obj *pObj; SclrLink_ChannelInfo * channelInfo; UInt32 flushCmds[2]; pObj = (SclrLink_Obj *) pTsk->appData; if (cmd != SYSTEM_CMD_CREATE) { Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL); return; } status = SclrLink_drvCreate(pObj, Utils_msgGetPrm(pMsg)); Utils_tskAckOrFreeMsg(pMsg, status); if (status != FVID2_SOK) return; done = FALSE; ackMsg = FALSE; while (!done) { status = Utils_tskRecvMsg(pTsk, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); switch (cmd) { case SYSTEM_CMD_NEW_DATA: Utils_tskAckOrFreeMsg(pMsg, status); flushCmds[0] = SYSTEM_CMD_NEW_DATA; Utils_tskFlushMsg(pTsk, flushCmds, 1); SclrLink_drvProcessData(pObj); break; case SCLR_LINK_CMD_GET_PROCESSED_DATA: Utils_tskAckOrFreeMsg(pMsg, status); SclrLink_drvGetProcessedData(pObj); break; case SYSTEM_CMD_STOP: SclrLink_drvStop(pObj); Utils_tskAckOrFreeMsg(pMsg, status); break; case SCLR_LINK_CMD_SET_FRAME_RATE: { SclrLink_ChFpsParams *params; params = (SclrLink_ChFpsParams *) Utils_msgGetPrm(pMsg); SclrLink_SetFrameRate(pObj, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case SCLR_LINK_CMD_GET_OUTPUTRESOLUTION: { SclrLink_chDynamicSetOutRes *params; params = (SclrLink_chDynamicSetOutRes *) Utils_msgGetPrm(pMsg); SclrLink_drvGetChDynamicOutputRes(pObj, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case SCLR_LINK_CMD_SET_OUTPUTRESOLUTION: { SclrLink_chDynamicSetOutRes *params; params = (SclrLink_chDynamicSetOutRes *) Utils_msgGetPrm(pMsg); SclrLink_drvSetChDynamicOutputRes(pObj, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case SCLR_LINK_CMD_SKIP_FID_TYPE: { SclrLink_chDynamicSkipFidType *params; params = (SclrLink_chDynamicSkipFidType *) Utils_msgGetPrm(pMsg); SclrLink_drvDynamicSkipFidType(pObj, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case SCLR_LINK_CMD_DISABLE_CHANNEL: case SCLR_LINK_CMD_ENABLE_CHANNEL: #ifdef SYSTEM_DEBUG_SCLR Vps_rprintf(" %d: SCLR : Channel Enable/Disable in progress ... !!!\n", Utils_getCurTimeInMsec()); #endif channelInfo = (SclrLink_ChannelInfo *) Utils_msgGetPrm(pMsg); SclrLink_drvSetChannelInfo(pObj,channelInfo); Utils_tskAckOrFreeMsg(pMsg, status); #ifdef SYSTEM_DEBUG_SCLR Vps_rprintf(" %d: SCLR : Channel Enable/Disable in progress ... DONE !!!\n", Utils_getCurTimeInMsec()); #endif break; case SYSTEM_CMD_DELETE: SclrLink_drvStop(pObj); done = TRUE; ackMsg = TRUE; break; case SCLR_LINK_CMD_PRINT_STATISTICS: SclrLink_drvPrintStatistics(pObj, TRUE); Utils_tskAckOrFreeMsg(pMsg, status); break; default: Utils_tskAckOrFreeMsg(pMsg, status); break; } } SclrLink_drvDelete(pObj); if (ackMsg && pMsg != NULL) Utils_tskAckOrFreeMsg(pMsg, status); return; }
Void IpcFramesInLink_tskMain(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg) { UInt32 cmd = Utils_msgGetCmd(pMsg); Bool ackMsg, done; Int32 status; IpcFramesInLink_Obj *pObj = (IpcFramesInLink_Obj *) pTsk->appData; if (cmd != SYSTEM_CMD_CREATE) { Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL); return; } status = IpcFramesInLink_create(pObj, Utils_msgGetPrm(pMsg)); Utils_tskAckOrFreeMsg(pMsg, status); if (status != FVID2_SOK) return; done = FALSE; ackMsg = FALSE; while (!done) { status = Utils_tskRecvMsg(pTsk, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); switch (cmd) { case SYSTEM_CMD_DELETE: done = TRUE; ackMsg = TRUE; break; case SYSTEM_CMD_NEW_DATA: Utils_tskAckOrFreeMsg(pMsg, status); IpcFramesInLink_processFrameBufs(pObj); break; case SYSTEM_CMD_STOP: IpcFramesInLink_stop(pObj); Utils_tskAckOrFreeMsg(pMsg, status); break; default: Utils_tskAckOrFreeMsg(pMsg, status); break; } } IpcFramesInLink_delete(pObj); #ifdef SYSTEM_DEBUG_IPC_FRAMES_IN Vps_printf(" %d: IPC_FRAMES_IN : Delete Done !!!\n", Utils_getCurTimeInMsec()); #endif if (ackMsg && pMsg != NULL) Utils_tskAckOrFreeMsg(pMsg, status); return; }
Void IpcOutM3Link_tskMain(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg) { UInt32 cmd = Utils_msgGetCmd(pMsg); Bool ackMsg, done; Int32 status; IpcOutM3Link_Obj *pObj = (IpcOutM3Link_Obj *) pTsk->appData; if (cmd != SYSTEM_CMD_CREATE) { Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL); return; } status = IpcOutM3Link_create(pObj, Utils_msgGetPrm(pMsg)); Utils_tskAckOrFreeMsg(pMsg, status); if (status != FVID2_SOK) return; done = FALSE; ackMsg = FALSE; while (!done) { status = Utils_tskRecvMsg(pTsk, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); switch (cmd) { case SYSTEM_CMD_DELETE: done = TRUE; ackMsg = TRUE; break; case SYSTEM_CMD_NEW_DATA: Utils_tskAckOrFreeMsg(pMsg, status); IpcOutM3Link_processFrames(pObj); IpcOutM3Link_releaseFrames(pObj); break; case IPCOUTM3_LINK_CMD_SET_FRAME_RATE: { IpcOutM3Link_ChFpsParams *params; params = (IpcOutM3Link_ChFpsParams *) Utils_msgGetPrm(pMsg); IpcOutM3Link_SetFrameRate(pObj, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case IPCOUTM3_LINK_CMD_PRINT_STATISTICS: Utils_tskAckOrFreeMsg(pMsg, status); IpcOutM3Link_printStatistics(pObj, TRUE); break; case SYSTEM_IPC_CMD_RELEASE_FRAMES: Utils_tskAckOrFreeMsg(pMsg, status); #ifdef SYSTEM_DEBUG_IPC_RT Vps_printf(" %d: IPC_OUT_M3 : Received Notify !!!\n", Utils_getCurTimeInMsec()); #endif IpcOutM3Link_releaseFrames(pObj); break; default: Utils_tskAckOrFreeMsg(pMsg, status); break; } } IpcOutM3Link_delete(pObj); #ifdef SYSTEM_DEBUG_IPC_OUT_M3 Vps_printf(" %d: IPC_OUT_M3 : Delete Done !!!\n", Utils_getCurTimeInMsec()); #endif if (ackMsg && pMsg != NULL) Utils_tskAckOrFreeMsg(pMsg, status); return; }
Void AlgLink_tskMain(struct Utils_TskHndl *pTsk, Utils_MsgHndl * pMsg) { UInt32 cmd = Utils_msgGetCmd(pMsg); Bool ackMsg, done; Int32 status; AlgLink_Obj *pObj; UInt32 flushCmds[4]; pObj = (AlgLink_Obj *) pTsk->appData; if (cmd != SYSTEM_CMD_CREATE) { Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL); return; } status = AlgLink_algCreate(pObj, Utils_msgGetPrm(pMsg)); Utils_tskAckOrFreeMsg(pMsg, status); if (status != FVID2_SOK) return; done = FALSE; ackMsg = FALSE; while (!done) { status = Utils_tskRecvMsg(pTsk, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); switch (cmd) { case SYSTEM_CMD_NEW_DATA: Utils_tskAckOrFreeMsg(pMsg, status); flushCmds[0] = SYSTEM_CMD_NEW_DATA; Utils_tskFlushMsg(pTsk, flushCmds, 1); AlgLink_algProcessData(pTsk, pObj); break; case ALG_LINK_OSD_CMD_SET_CHANNEL_WIN_PRM: { AlgLink_OsdChWinParams *params; params = (AlgLink_OsdChWinParams *) Utils_msgGetPrm(pMsg); AlgLink_osdAlgSetChOsdWinPrm(&pObj->osdAlg, params, TRUE); Utils_tskAckOrFreeMsg(pMsg, status); } break; case ALG_LINK_OSD_CMD_SET_CHANNEL_BLIND_WIN_PRM: { AlgLink_OsdChBlindWinParams *params; params = (AlgLink_OsdChBlindWinParams *) Utils_msgGetPrm(pMsg); AlgLink_osdAlgSetChOsdBlindWinPrm(&pObj->osdAlg, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case ALG_LINK_SCD_CMD_GET_ALL_CHANNEL_FRAME_STATUS: { AlgLink_ScdAllChFrameStatus *params; params = (AlgLink_ScdAllChFrameStatus *) Utils_msgGetPrm(pMsg); AlgLink_scdAlgGetAllChFrameStatus(&pObj->scdAlg, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case ALG_LINK_SCD_CMD_SET_CHANNEL_MODE: { AlgLink_ScdChParams *params; params = (AlgLink_ScdChParams *) Utils_msgGetPrm(pMsg); AlgLink_scdAlgSetChMode(&pObj->scdAlg, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case ALG_LINK_SCD_CMD_SET_CHANNEL_IGNORELIGHTSON: { AlgLink_ScdChParams *params; params = (AlgLink_ScdChParams *) Utils_msgGetPrm(pMsg); AlgLink_scdAlgSetChIgnoreLightsOn(&pObj->scdAlg, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case ALG_LINK_SCD_CMD_SET_CHANNEL_IGNORELIGHTSOFF: { AlgLink_ScdChParams *params; params = (AlgLink_ScdChParams *) Utils_msgGetPrm(pMsg); AlgLink_scdAlgSetChIgnoreLightsOff(&pObj->scdAlg, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case ALG_LINK_SCD_CMD_SET_CHANNEL_SENSITIVITY: { AlgLink_ScdChParams *params; params = (AlgLink_ScdChParams *) Utils_msgGetPrm(pMsg); AlgLink_scdAlgSetChSensitivity(&pObj->scdAlg, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case ALG_LINK_SCD_CMD_CHANNEL_RESET: { AlgLink_ScdChCtrl *params; params = (AlgLink_ScdChCtrl *) Utils_msgGetPrm(pMsg); AlgLink_scdAlgResetCh(&pObj->scdAlg, params); Utils_tskAckOrFreeMsg(pMsg, status); } break; case ALG_LINK_SCD_CMD_PRINT_STATISTICS: AlgLink_osdAlgPrintStatistics(&pObj->osdAlg, TRUE); AlgLink_scdAlgPrintStatistics(&pObj->scdAlg, TRUE); Utils_tskAckOrFreeMsg(pMsg, status); break; case SYSTEM_CMD_DELETE: done = TRUE; ackMsg = TRUE; break; default: Utils_tskAckOrFreeMsg(pMsg, status); break; } } AlgLink_algDelete(pObj); if (ackMsg && pMsg != NULL) Utils_tskAckOrFreeMsg(pMsg, status); return; }
Void NullSrcLink_tskMain(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg) { UInt32 cmd = Utils_msgGetCmd(pMsg); Bool ackMsg, done; Int32 status; NullSrcLink_Obj *pObj; pObj = (NullSrcLink_Obj *) pTsk->appData; if (cmd != SYSTEM_CMD_CREATE) { Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL); return; } status = NullSrcLink_drvCreate(pObj, Utils_msgGetPrm(pMsg)); Utils_tskAckOrFreeMsg(pMsg, status); if (status != FVID2_SOK) return; done = FALSE; ackMsg = FALSE; while (!done) { status = Utils_tskRecvMsg(pTsk, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); switch (cmd) { case SYSTEM_CMD_START: status = NullSrcLink_drvStart(pObj); Utils_tskAckOrFreeMsg(pMsg, status); if (status == FVID2_SOK) { status = NullSrcLink_tskRun(pObj, pTsk, &pMsg, &done, &ackMsg); } break; case SYSTEM_CMD_DELETE: done = TRUE; ackMsg = TRUE; break; default: Utils_tskAckOrFreeMsg(pMsg, status); break; } } NullSrcLink_drvDelete(pObj); if (ackMsg && pMsg != NULL) Utils_tskAckOrFreeMsg(pMsg, status); return; }
Int32 NullSrcLink_tskRun(NullSrcLink_Obj * pObj, Utils_TskHndl * pTsk, Utils_MsgHndl ** pMsg, Bool * done, Bool * ackMsg) { Int32 status = FVID2_SOK; Bool runDone, runAckMsg; Utils_MsgHndl *pRunMsg; UInt32 cmd; *done = FALSE; *ackMsg = FALSE; runDone = FALSE; runAckMsg = FALSE; *pMsg = NULL; while (!runDone) { status = Utils_tskRecvMsg(pTsk, &pRunMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pRunMsg); switch (cmd) { case SYSTEM_CMD_NEW_DATA: Utils_tskAckOrFreeMsg(pRunMsg, status); status = NullSrcLink_drvProcessFrames(pObj); if (status != FVID2_SOK) { runDone = TRUE; runAckMsg = FALSE; } break; case SYSTEM_CMD_STOP: runDone = TRUE; runAckMsg = TRUE; break; case SYSTEM_CMD_DELETE: *done = TRUE; *ackMsg = TRUE; *pMsg = pRunMsg; runDone = TRUE; break; default: Utils_tskAckOrFreeMsg(pRunMsg, status); break; } } NullSrcLink_drvStop(pObj); if (runAckMsg) Utils_tskAckOrFreeMsg(pRunMsg, status); return status; }
Int32 SwMsLink_tskRun(SwMsLink_Obj * pObj, Utils_TskHndl * pTsk, Utils_MsgHndl ** pMsg, Bool * done, Bool * ackMsg) { Int32 status = FVID2_SOK; Bool runDone, runAckMsg; Utils_MsgHndl *pRunMsg; UInt32 cmd; Void *pPrm; UInt32 flushCmds[4]; *done = FALSE; *ackMsg = FALSE; runDone = FALSE; runAckMsg = FALSE; *pMsg = NULL; while (!runDone) { status = Utils_tskRecvMsg(pTsk, &pRunMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pRunMsg); switch (cmd) { case SYSTEM_CMD_NEW_DATA: Utils_tskAckOrFreeMsg(pRunMsg, status); flushCmds[0] = SYSTEM_CMD_NEW_DATA; Utils_tskFlushMsg(pTsk, flushCmds, 1); SwMsLink_drvProcessData(pObj); break; case SW_MS_LINK_CMD_DO_SCALING: Utils_tskAckOrFreeMsg(pRunMsg, status); flushCmds[0] = SYSTEM_CMD_NEW_DATA; flushCmds[1] = SW_MS_LINK_CMD_DO_SCALING; Utils_tskFlushMsg(pTsk, flushCmds, 2); SwMsLink_drvProcessData(pObj); SwMsLink_drvDoScaling(pObj); break; case SYSTEM_SW_MS_LINK_CMD_SWITCH_LAYOUT: pPrm = Utils_msgGetPrm(pRunMsg); status = SwMsLink_drvSwitchLayout(pObj, pPrm, FALSE); Utils_tskAckOrFreeMsg(pRunMsg, status); break; case SYSTEM_SW_MS_LINK_CMD_GET_LAYOUT_PARAMS: pPrm = Utils_msgGetPrm(pRunMsg); status = SwMsLink_drvGetLayoutParams(pObj, pPrm); Utils_tskAckOrFreeMsg(pRunMsg, status); break; case SYSTEM_SW_MS_LINK_CMD_GET_INPUT_CHNL_INFO: pPrm = Utils_msgGetPrm(pRunMsg); status = SwMsLink_drvGetInputChInfoFromWinId(pObj, pPrm); Utils_tskAckOrFreeMsg(pRunMsg, status); break; case SYSTEM_SW_MS_LINK_CMD_SET_CROP_PARAM: pPrm = Utils_msgGetPrm(pRunMsg); status = SwMsLink_drvSetCropParam(pObj, pPrm); Utils_tskAckOrFreeMsg(pRunMsg, status); break; case SYSTEM_CMD_STOP: runDone = TRUE; runAckMsg = TRUE; break; case SYSTEM_CMD_DELETE: *done = TRUE; *ackMsg = TRUE; *pMsg = pRunMsg; runDone = TRUE; break; case SYSTEM_SW_MS_LINK_CMD_PRINT_STATISTICS: SwMsLink_drvPrintStatistics(pObj, TRUE); Utils_tskAckOrFreeMsg(pRunMsg, status); break; case SYSTEM_SW_MS_LINK_CMD_PRINT_BUFFER_STATISTICS: SwMsLink_printBufferStatus(pObj); Utils_tskAckOrFreeMsg(pRunMsg, status); break; case SYSTEM_SW_MS_LINK_CMD_FLUSH_BUFFERS: pPrm = Utils_msgGetPrm(pRunMsg); status = SwMsLink_flushBuffers(pObj,pPrm); Utils_tskAckOrFreeMsg(pRunMsg, status); break; default: Utils_tskAckOrFreeMsg(pRunMsg, status); break; } } SwMsLink_drvStop(pObj); if (runAckMsg) Utils_tskAckOrFreeMsg(pRunMsg, status); return status; }
Void SwMsLink_tskMain(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg) { UInt32 cmd = Utils_msgGetCmd(pMsg); Bool ackMsg, done; Int32 status; SwMsLink_Obj *pObj; Void *pPrm; pObj = (SwMsLink_Obj *) pTsk->appData; if (cmd != SYSTEM_CMD_CREATE) { Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL); return; } status = SwMsLink_drvCreate(pObj, Utils_msgGetPrm(pMsg)); Utils_tskAckOrFreeMsg(pMsg, status); if (status != FVID2_SOK) return; done = FALSE; ackMsg = FALSE; while (!done) { status = Utils_tskRecvMsg(pTsk, &pMsg, BIOS_WAIT_FOREVER); if (status != FVID2_SOK) break; cmd = Utils_msgGetCmd(pMsg); switch (cmd) { case SYSTEM_CMD_START: status = SwMsLink_drvStart(pObj); Utils_tskAckOrFreeMsg(pMsg, status); if (status == FVID2_SOK) { status = SwMsLink_tskRun(pObj, pTsk, &pMsg, &done, &ackMsg); } break; case SYSTEM_CMD_DELETE: done = TRUE; ackMsg = TRUE; break; case SYSTEM_SW_MS_LINK_CMD_SWITCH_LAYOUT: pPrm = Utils_msgGetPrm(pMsg); status = SwMsLink_drvSwitchLayout(pObj, pPrm, FALSE); Utils_tskAckOrFreeMsg(pMsg, status); break; case SYSTEM_SW_MS_LINK_CMD_GET_LAYOUT_PARAMS: pPrm = Utils_msgGetPrm(pMsg); status = SwMsLink_drvGetLayoutParams(pObj, pPrm); Utils_tskAckOrFreeMsg(pMsg, status); break; default: Utils_tskAckOrFreeMsg(pMsg, status); break; } } SwMsLink_drvDelete(pObj); if (ackMsg && pMsg != NULL) Utils_tskAckOrFreeMsg(pMsg, status); return; }