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; } } }
Void System_ipcNotifyHandler(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg, UInt32 payload) { UInt32 linkId, linkProcId; Utils_TskHndl *pTsk; if (lineId != SYSTEM_IPC_NOTIFY_LINE_ID) return; if (eventId != SYSTEM_IPC_NOTIFY_EVENT_ID) return; linkProcId = SYSTEM_GET_PROC_ID(payload); linkId = SYSTEM_GET_LINK_ID(payload); if (linkId >= SYSTEM_LINK_ID_MAX) return; UTILS_assert(System_getSelfProcId() == linkProcId); if (gSystem_ipcObj.notifyCb[linkId]) { pTsk = System_getLinkTskHndl(linkId); gSystem_ipcObj.notifyCb[linkId] (pTsk); } }
Int32 System_ipcRegisterNotifyCb(UInt32 linkId, System_ipcNotifyCb notifyCb) { linkId = SYSTEM_GET_LINK_ID(linkId); UTILS_assert(linkId < SYSTEM_LINK_ID_MAX); gSystem_ipcObj.notifyCb[linkId] = notifyCb; return FVID2_SOK; }
Int32 System_registerLink(UInt32 linkId, System_LinkObj *pTskObj) { linkId = SYSTEM_GET_LINK_ID(linkId); UTILS_assert( linkId < SYSTEM_LINK_ID_MAX); memcpy(&gSystem_objCommon.linkObj[linkId], pTskObj, sizeof(*pTskObj)); return OSA_SOK; }
OSA_TskHndl *System_getLinkTskHndl(UInt32 linkId) { System_LinkObj *pTsk; linkId = SYSTEM_GET_LINK_ID(linkId); UTILS_assert( linkId < SYSTEM_LINK_ID_MAX); pTsk = &gSystem_objCommon.linkObj[linkId]; return pTsk->pTsk; }
Int32 System_ipcSendNotify(UInt32 linkId) { Int32 status; UInt32 procId = SYSTEM_GET_PROC_ID(linkId); UTILS_assert(procId < SYSTEM_PROC_MAX); status = Notify_sendEvent(procId, SYSTEM_IPC_NOTIFY_LINE_ID, SYSTEM_IPC_NOTIFY_EVENT_ID, linkId, TRUE); if (status != Notify_S_SUCCESS) { Vps_printf (" %d: NOTIFY: Send Event to [%s][%d] failed !!! (status = %d)\n", Utils_getCurTimeInMsec(), MultiProc_getName(SYSTEM_GET_PROC_ID(linkId)), SYSTEM_GET_LINK_ID(linkId), status); UTILS_assert(status == Notify_S_SUCCESS); } return FVID2_SOK; }
Int32 System_ipcMsgQSendMsg(UInt32 linkId, UInt32 cmd, Void *pPrm, UInt32 prmSize, Bool waitAck, UInt32 timeout) { Int32 status=OSA_SOK; SystemIpcMsgQ_Msg *pMsgCommon; UInt32 procId; Void *pMsgPrm; UTILS_assert(prmSize<=SYSTEM_IPC_MSGQ_MSG_SIZE_MAX); procId = SYSTEM_GET_PROC_ID(linkId); #ifdef TI_8107_BUILD if(procId==SYSTEM_PROC_DSP) { printf(" %u: MSGQ: WARNING: Trying to send command [0x%04x] to link [%d] on processor [%s], BUT [%s] is NOT present on this platform !!!\n", OSA_getCurTimeInMsec(), cmd, SYSTEM_GET_LINK_ID(linkId), MultiProc_getName(procId), MultiProc_getName(procId) ); /* return SUCCESS so that calling API can continue */ return status; } #endif UTILS_assert( procId < SYSTEM_PROC_MAX); /*wuzc modify for malloc fail*/ OSA_mutexLock(&gSystem_ipcObj.msgQLock); pMsgCommon = (SystemIpcMsgQ_Msg *)MessageQ_alloc( SYSTEM_IPC_MSGQ_HEAP, sizeof(*pMsgCommon)+prmSize ); UTILS_assert(pMsgCommon!=NULL); if(prmSize && pPrm) { pMsgPrm = SYSTEM_IPC_MSGQ_MSG_PAYLOAD_PTR(pMsgCommon); memcpy(pMsgPrm, pPrm, prmSize); } pMsgCommon->linkId = linkId; pMsgCommon->cmd = cmd; pMsgCommon->prmSize = prmSize; pMsgCommon->waitAck = waitAck; pMsgCommon->status = OSA_SOK; MessageQ_setReplyQueue(gSystem_ipcObj.selfAckMsgQ, (MessageQ_Msg)pMsgCommon); MessageQ_setMsgId(pMsgCommon, linkId); //OSA_mutexLock(&gSystem_ipcObj.msgQLock); status = MessageQ_put(gSystem_ipcObj.remoteProcMsgQ[procId], (MessageQ_Msg)pMsgCommon); if(status!=MessageQ_S_SUCCESS) { printf(" %u: MSGQ: MsgQ put for [%s] failed !!!\n", OSA_getCurTimeInMsec(), MultiProc_getName(procId) ); MessageQ_free((MessageQ_Msg)pMsgCommon); OSA_mutexUnlock(&gSystem_ipcObj.msgQLock); return status; } if(waitAck) { SystemIpcMsgQ_Msg *pAckMsg; status = MessageQ_get(gSystem_ipcObj.selfAckMsgQ, (MessageQ_Msg*)&pAckMsg, timeout); if(status!=MessageQ_S_SUCCESS) { printf(" %u: MSGQ: MsgQ Ack get from [%s] failed !!!\n", OSA_getCurTimeInMsec(), MultiProc_getName(procId) ); MessageQ_free((MessageQ_Msg)pMsgCommon); OSA_mutexUnlock(&gSystem_ipcObj.msgQLock); return status; } if(prmSize && pPrm) { pMsgPrm = SYSTEM_IPC_MSGQ_MSG_PAYLOAD_PTR(pAckMsg); memcpy(pPrm, pMsgPrm, prmSize); } status = pAckMsg->status; MessageQ_free((MessageQ_Msg)pAckMsg); } OSA_mutexUnlock(&gSystem_ipcObj.msgQLock); return status; }
Void *System_ipcMsgQTaskMain(Void *arg) { UInt32 prmSize; SystemIpcMsgQ_Msg *pMsgCommon; Void *pPrm; Int32 status; while(1) { status = MessageQ_get(gSystem_ipcObj.selfMsgQ, (MessageQ_Msg*)&pMsgCommon, OSA_TIMEOUT_FOREVER); if(status==MessageQ_E_UNBLOCKED) break; if(status!=MessageQ_S_SUCCESS) { printf(" %u: MSGQ: MsgQ get failed !!!\n", OSA_getCurTimeInMsec() ); continue; } #if 0 printf(" %u: MSGQ: Received command [0x%04x] (prmSize = %d) for [%s][%02d] (waitAck=%d)\n", OSA_getCurTimeInMsec(), pMsgCommon->cmd, pMsgCommon->prmSize, MultiProc_getName(SYSTEM_GET_PROC_ID(pMsgCommon->linkId)), SYSTEM_GET_LINK_ID(pMsgCommon->linkId), pMsgCommon->waitAck ); #endif prmSize = pMsgCommon->prmSize; pPrm = SYSTEM_IPC_MSGQ_MSG_PAYLOAD_PTR(pMsgCommon); if(pMsgCommon->cmd==SYSTEM_CMD_GET_INFO) { UTILS_assert(prmSize == sizeof(System_LinkInfo)); pMsgCommon->status = System_linkGetInfo_local(pMsgCommon->linkId, pPrm); } else { pMsgCommon->status = System_linkControl_local( pMsgCommon->linkId, pMsgCommon->cmd, pPrm, prmSize, pMsgCommon->waitAck ); } if(pMsgCommon->waitAck) { MessageQ_QueueId replyMsgQ; replyMsgQ = MessageQ_getReplyQueue(pMsgCommon); status = MessageQ_put(replyMsgQ, (MessageQ_Msg)pMsgCommon); if(status!=MessageQ_S_SUCCESS) { printf(" %u: MSGQ: MsgQ Ack put failed !!!\n", OSA_getCurTimeInMsec() ); MessageQ_free((MessageQ_Msg)pMsgCommon); } } else { MessageQ_free((MessageQ_Msg)pMsgCommon); } } return NULL; }