Int32 IpcFramesInLink_init() { Int32 status; System_LinkObj linkObj; UInt32 ipcFramesInId; IpcFramesInLink_Obj *pObj; char tskName[32]; UInt32 procId = System_getSelfProcId(); // UTILS_COMPILETIME_ASSERT(offsetof(SystemIpcFrames_ListElem, frameBuf) == 0); UTILS_COMPILETIME_ASSERT(offsetof(SystemIpcFrames_ListElem, frameBuf) == 0); UTILS_COMPILETIME_ASSERT(offsetof(VIDFrame_Buf, reserved) == 0); UTILS_COMPILETIME_ASSERT(sizeof(((SystemIpcFrames_ListElem *) 0)->frameBuf.reserved) == sizeof(ListMP_Elem)); for (ipcFramesInId = 0; ipcFramesInId < IPC_FRAMES_IN_LINK_OBJ_MAX; ipcFramesInId++) { pObj = &gIpcFramesInLink_obj[ipcFramesInId]; memset(pObj, 0, sizeof(*pObj)); pObj->tskId = SYSTEM_MAKE_LINK_ID(procId, SYSTEM_LINK_ID_IPC_FRAMES_IN_0) + ipcFramesInId; pObj->state = IPC_FRAMES_IN_LINK_STATE_INACTIVE; linkObj.pTsk = &pObj->tsk; linkObj.linkGetFullFrames = NULL; linkObj.linkPutEmptyFrames = NULL; linkObj.linkGetFullFrames = IpcFramesInLink_getFullFrames; linkObj.linkPutEmptyFrames = IpcFramesInLink_putEmptyFrames; linkObj.getLinkInfo = IpcFramesInLink_getLinkInfo; System_registerLink(pObj->tskId, &linkObj); UTILS_SNPRINTF(tskName, "IPC_FRAMES_IN%d", ipcFramesInId); System_ipcRegisterNotifyCb(pObj->tskId, IpcFramesInLink_notifyCb); status = Utils_tskCreate(&pObj->tsk, IpcFramesInLink_tskMain, IPC_LINK_TSK_PRI, gIpcFramesInLink_tskStack[ipcFramesInId], IPC_LINK_TSK_STACK_SIZE, pObj, tskName); UTILS_assert(status == FVID2_SOK); } return status; }
Int32 IpcOutM3Link_init() { Int32 status; System_LinkObj linkObj; UInt32 ipcOutM3Id; IpcOutM3Link_Obj *pObj; char tskName[32]; UInt32 procId = System_getSelfProcId(); for (ipcOutM3Id = 0; ipcOutM3Id < IPC_OUT_M3_LINK_OBJ_MAX; ipcOutM3Id++) { pObj = &gIpcOutM3Link_obj[ipcOutM3Id]; memset(pObj, 0, sizeof(*pObj)); pObj->tskId = SYSTEM_MAKE_LINK_ID(procId, SYSTEM_LINK_ID_IPC_OUT_M3_0) + ipcOutM3Id; linkObj.pTsk = &pObj->tsk; linkObj.linkGetFullFrames = NULL; linkObj.linkPutEmptyFrames = NULL; linkObj.getLinkInfo = IpcOutM3Link_getLinkInfo; System_registerLink(pObj->tskId, &linkObj); sprintf(tskName, "IPC_OUT_M3%d", ipcOutM3Id); System_ipcRegisterNotifyCb(pObj->tskId, IpcOutM3Link_notifyCb); IpcOutM3Link_initListMP(pObj); status = Utils_tskCreate(&pObj->tsk, IpcOutM3Link_tskMain, IPC_LINK_TSK_PRI, gIpcOutM3Link_tskStack[ipcOutM3Id], IPC_LINK_TSK_STACK_SIZE, pObj, tskName); UTILS_assert(status == FVID2_SOK); } return status; }
Int32 NullSrcLink_init() { Int32 status; System_LinkObj linkObj; UInt32 nullSrcId; NullSrcLink_Obj *pObj; char tskName[32]; UInt32 procId = System_getSelfProcId(); for (nullSrcId = 0; nullSrcId < NULL_SRC_LINK_OBJ_MAX; nullSrcId++) { pObj = &gNullSrcLink_obj[nullSrcId]; memset(pObj, 0, sizeof(*pObj)); pObj->tskId = SYSTEM_MAKE_LINK_ID(procId, SYSTEM_LINK_ID_NULL_SRC_0) + nullSrcId; linkObj.pTsk = &pObj->tsk; linkObj.linkGetFullFrames = NullSrcLink_getFullFrames; linkObj.linkPutEmptyFrames = NullSrcLink_putEmptyFrames; linkObj.getLinkInfo = NullSrcLink_getInfo; System_registerLink(pObj->tskId, &linkObj); sprintf(tskName, "NULL_SRC%d", nullSrcId); status = Utils_tskCreate(&pObj->tsk, NullSrcLink_tskMain, NULL_SRC_LINK_TSK_PRI, gNullSrcLink_tskStack[nullSrcId], (NULL_SRC_LINK_TSK_STACK_SIZE), pObj, tskName); UTILS_assert(status == FVID2_SOK); } return status; }
Int32 DupLink_init() { Int32 status; System_LinkObj linkObj; UInt32 dupId; DupLink_Obj *pObj; char tskName[32]; UInt32 procId = System_getSelfProcId(); for (dupId = 0; dupId < DUP_LINK_OBJ_MAX; dupId++) { pObj = &gDupLink_obj[dupId]; memset(pObj, 0, sizeof(*pObj)); pObj->tskId = SYSTEM_MAKE_LINK_ID(procId, SYSTEM_LINK_ID_DUP_0) + dupId; linkObj.pTsk = &pObj->tsk; linkObj.linkGetFullFrames = DupLink_getFullFrames; linkObj.linkPutEmptyFrames = DupLink_putEmptyFrames; linkObj.getLinkInfo = DupLink_getLinkInfo; System_registerLink(pObj->tskId, &linkObj); sprintf(tskName, "DUP%d", dupId); status = Utils_tskCreate(&pObj->tsk, DupLink_tskMain, DUP_LINK_TSK_PRI, gDupLink_tskStack[dupId], DUP_LINK_TSK_STACK_SIZE, pObj, tskName); UTILS_assert(status == FVID2_SOK); } return status; }