TI中文支持网
TI专业的中文技术问题搜集分享网站

event has no registered callback!0核向1核发Notify 不成功

又是奇怪的问题:使用Notify 在core 0和core1 进行通信,core0 向core 1 sendEvent就:event has no registered callback!

core1 给自己sendEvent 就能正常运行!这是为什么?代码如下(其中Ipc_attach的使用部分参考了帖子:e2e.ti.com/support/processors/f/791/p/661148/2429976?tisearch=e2e-quicksearch&keymatch=Ipc.procSync#2429976)

.c code:

#include "EVM_init.h"

uint32_t maxFlashes = 3;
uint32_t EVENTID = 0;
Void cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg, UInt32 payload)
{Semaphore_post(semHandle);
}
void ledPlayTask (void)
{Int status;uint32_t coreId/*,i=0*/;coreId = CSL_chipReadReg (CSL_CHIP_DNUM);/*UInt16  procId;procId = 2;*/UInt16  numProcs;numProcs = MultiProc_getNumProcessors();switch(coreId){case 0:platform_write("core %d is working, Dsp num : %d\n",coreId,numProcs);/*status = Ipc_start();if (status < 0) {System_abort("Ipc_start failed\n");}*/while(Ipc_attach(1)){Task_sleep(1);}status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE);switch(status){case Notify_E_EVTNOTREGISTERED :platform_write("event has no registered callback \n");break;case Notify_E_NOTINITIALIZED :platform_write("remote driver has not yet been initialized \n");break;case Notify_E_EVTDISABLED :platform_write("remote event is disabled \n");break;case Notify_E_TIMEOUT :platform_write("timeout occurred (when waitClear is TRUE) \n");break;case Notify_S_SUCCESS :platform_write(" event successfully sent \n");break;default :platform_write(" What? \n");break;}break;case 1:platform_write("core %d is working, Dsp num : %d\n",coreId,numProcs);/*status = Ipc_start();if (status < 0) {System_abort("Ipc_start failed\n");}*/while(Ipc_attach(0)){Task_sleep(1);}//Task_sleep(10);//status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE);/*status = Notify_sendEvent(coreId, 0, EVENTID, 0, TRUE);switch(status){case Notify_E_EVTNOTREGISTERED :platform_write("event has no registered callback \n");break;case Notify_E_NOTINITIALIZED :platform_write("remote driver has not yet been initialized \n");break;case Notify_E_EVTDISABLED :platform_write("remote event is disabled \n");break;case Notify_E_TIMEOUT :platform_write("timeout occurred (when waitClear is TRUE) \n");break;case Notify_S_SUCCESS :platform_write(" event successfully sent \n");break;default :platform_write(" What? \n");break;}*/Semaphore_pend(semHandle,BIOS_WAIT_FOREVER);platform_write("Core %d EVENT HAVE ARRIVED!\n",coreId);break;}

}
Int main()
{UInt16 dsp_id;Int status;status = Ipc_start();if (status < 0) {System_abort("Ipc_start failed\n");}else{platform_write("IPC STATUS:%d \n",status);}dsp_id = MultiProc_self();//platform_write("dsp_id is %d  \n",dsp_id);status = Notify_registerEvent(dsp_id, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);if (status < 0) {System_abort("Notify_registerEvent failed\n");}platform_write("Start BIOS 6\n");BIOS_start();/* does not return */return(0);
}

运行到status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE);就返回event has no registered callback,能帮看看为什么吗?

Lucius Green:

打印输出:

IPC STATUS:0[C66xx_1] IPC STATUS:0[C66xx_0] Start BIOS 6
[C66xx_1] Start BIOS 6
[C66xx_0] core 0 is working, Dsp num : 8
[C66xx_1] core 1 is working, Dsp num : 8
[C66xx_0] event has no registered callback 

Nancy Wang:

Notify_registerEvent的第一个参数procId 是指 Remote processor id,看你的代码中是MultiProc_self,是不是这里有问题?改一下看看。
dsp_id = MultiProc_self();
status = Notify_registerEvent(dsp_id, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);

Lucius Green:

回复 Nancy Wang:

Nancy:是这样的, 我的代码是在coro0 和core 1都下载了的,下面这句:
Notify_registerEvent(MultiProc_self(), 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);
代表core0 注册:Notify_registerEvent(0, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);core1 注册:Notify_registerEvent(1, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);
按照我的理解,0核的注册0核的,1核注册1核的,
0核通知1核的时候 就 : status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE); 启动1核的事件
1核通知0核的时候就:status = Notify_sendEvent(0, 0, EVENTID, 0, TRUE);启动0核的事件
我这么做逻辑对吗?还是我就这个逻辑理解有问题?

Lucius Green:

回复 Nancy Wang:

Nancy :       改了试了下,也不对。试了几种:

1核注册 0 :Notify_registerEvent(0, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);0核发送1:status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE); 
1核注册0 :Notify_registerEvent(0, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);0核发送0:status = Notify_sendEvent(0, 0, EVENTID, 0, TRUE); 
1核注册1 :Notify_registerEvent(1, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);0核发送0:status = Notify_sendEvent(0, 0, EVENTID, 0, TRUE); 
1核注册1 :Notify_registerEvent(1, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);0核发送1:status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE);
这4种情况都不对,都是打印:status = Notify_sendEvent(0, 0, EVENTID, 0, TRUE); 
我彻底混乱了,哈哈,完全摸不到头脑

  

Nancy Wang:

回复 Lucius Green:

1核注册 0 :Notify_registerEvent(0, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);0核发送1:status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE);
这个逻辑是对的。
main函数中加上判断看看:if(MultiProc_self()==masterProc)
status = Notify_registerEvent(sloverProc1, INTERRUPT_LINE, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);

elsestatus = Notify_registerEvent(masterProc, INTERRUPT_LINE, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);

Lucius Green:

回复 Nancy Wang:

masterProc 是指 0核 吗(masterProc=0)? sloverProc1 是指1核吗(sloverProc1=1)?

Lucius Green:

回复 Nancy Wang:

程序已经改了,如下:

#include "EVM_init.h"uint32_t maxFlashes = 3;
uint32_t EVENTID = 0;
UInt16 masterProc=0;
UInt16 sloverProc=1;Void cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg, UInt32 payload)
{Semaphore_post(semHandle);
}
void ledPlayTask (void)
{Int status;uint32_t coreId;coreId = CSL_chipReadReg (CSL_CHIP_DNUM);switch(coreId){case 0:platform_write("core %d is working\n",coreId);while(Ipc_attach(1)){Task_sleep(1);}status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE);//core0 sendEventmy_print_status_for_Notify_sendEvent(status);break;case 1:platform_write("core %d is working\n",coreId);while(Ipc_attach(0)){Task_sleep(1);}// status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE);//core1 sendEventSemaphore_pend(semHandle,BIOS_WAIT_FOREVER);platform_write("Core0 to core1 Notify event successfully!\n",coreId);break;}
}
Int main()
{Int status;platform_write("*****************************\n");status = Ipc_start();if (status < 0) {System_abort("Ipc_start failed\n");}if(MultiProc_self()==1)//Core1 register event callback function:{status = Notify_registerEvent(masterProc, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);if (status < 0) {System_abort("Notify_registerEvent failed\n");}else{platform_write("Core 1 ,registerEvent %d \n",masterProc);}}else{status = Notify_registerEvent(sloverProc, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);}BIOS_start();return(0);
}

输出:

*****************************[C66xx_1] *****************************[C66xx_0] core 0 is working[C66xx_1] Core 1 ,registerEvent 0 core 1 is working[C66xx_0] event has no registered callback


赞(0)
未经允许不得转载:TI中文支持网 » event has no registered callback!0核向1核发Notify 不成功
分享到: 更多 (0)