DVRRDK之MCFW下syslink操作
syslink主要用在DM8168四个大核之间的通信,其中封装成的主要函数是System_linkControl
发送端主要函数:
System_linkControl( USER_DSP_LINK_ID_APP,
USER_DSP_LINK_CMD_APP_GRAY,
&grayPrms,
sizeof(grayPrms),
TRUE);
以上主要实现的是A8向DSP传送数据,其中 USER_DSP_LINK_ID_APP 为用户链路的ID, USER_DSP_LINK_CMD_APP_GRAY是App Link's command 。
grayPrms是传送的结构体数据。
接收端主要函数:
static Void AppLink_tskMain(struct Utils_TskHndl * pTsk, Utils_MsgHndl * pMsg)
{
/* Wait CREATE command */
UInt32 cmd = Utils_msgGetCmd(pMsg);
if (cmd != SYSTEM_CMD_CREATE)
{
Utils_tskAckOrFreeMsg(pMsg, FVID2_EFAIL);
return;
}
/* Create App link object */
AppLink_Obj *pObj = (AppLink_Obj *) pTsk->appData;
Int32 status = AppLink_drvCreate(pObj, Utils_msgGetPrm(pMsg));
Utils_tskAckOrFreeMsg(pMsg, status);
if (status != FVID2_SOK)
return;
Bool done = FALSE;
Bool ackMsg = FALSE;
/* Message loop */
while (!done)
{
/* Wait message */
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);
AppLink_drvProcessFrames(pObj);
break;
/* Dynamic gray params */
case USER_DSP_LINK_CMD_APP_GRAY:
memcpy(&pObj->grayPrms, Utils_msgGetPrm(pMsg), sizeof(AppLink_GrayParams));
Vps_printf("gpio_temp = %d
",pObj->grayPrms.gpio_rise);
pObj->grayPrms.gpio_rise = 0;
// 获取发送端结构体 grayPrms 的数据
Utils_tskAckOrFreeMsg(pMsg, status);
break;
default:
Utils_tskAckOrFreeMsg(pMsg, status);
break;
}
}
Vps_printf(" %d: App : Delete Done !!!
", Utils_getCurTimeInMsec());
if (ackMsg && pMsg != NULL)
Utils_tskAckOrFreeMsg(pMsg, status);
return;
}