在调试ipc和ndk合并的时候,将helloworld_evmc6678l工程和messageQ工程合并,想实现这样的功能:core0接收到ndk数据后,用ipc给core1发送中断,core1接收到ipc中断后,core1再用ipc给core0一个中断,core0接收到中断后将数据用ndk发送出去;简单流程1)core0接收udp数据->2)core0给core1中断->3)core1给core0中断->4)core0发送udp数据;现在实现了步骤1)2),在步骤3)出现了问题,相关程序如下:
1)ipc通信任务函数
Void tsk0_func(UArg arg0, UArg arg1)
{
if (MultiProc_self() == 0) {
/*
* Create the heap that will be used to allocate messages.
*/
HeapBufMP_Params_init(&heapBufParams);
heapBufParams.regionId = 0;
heapBufParams.name = HEAP_NAME;
heapBufParams.numBlocks = 1;
heapBufParams.blockSize = sizeof(MessageQ_MsgHeader);
heapHandle = HeapBufMP_create(&heapBufParams);
if (heapHandle == NULL) {
System_abort("HeapBufMP_create failed\n" );
}
}
else {
/* Open the heap created by the other processor. Loop until opened. */
do {
status = HeapBufMP_open(HEAP_NAME, &heapHandle);
/*
* Sleep for 1 clock tick to avoid inundating remote processor
* with interrupts if open failed
*/
if (status < 0) {
Task_sleep(1);
}
} while (status < 0);
}
/* Register this heap with MessageQ */
MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);
/* Create the local message queue */
messageQ = MessageQ_create(localQueueName, NULL);
if (messageQ == NULL) {
System_abort("MessageQ_create failed\n" );
}
/* Open the remote message queue. Spin until it is ready. */
do {
status = MessageQ_open(nextQueueName, &remoteQueueId);
/*
* Sleep for 1 clock tick to avoid inundating remote processor
* with interrupts if open failed
*/
if (status < 0) {
Task_sleep(1);
}
} while (status < 0);
if (MultiProc_self() == 0) {
/* Allocate a message to be ping-ponged around the processors */
msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
if (msg == NULL) {
System_abort("MessageQ_alloc failed\n" );
}
while (TRUE)
{
status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
if (status < 0) {
System_abort("This should not happen since timeout is forever\n");
}
msgId = MessageQ_getMsgId(msg);
System_printf("Getting a message %d from core%d \n", msgId,msgId);
}
}
else {
System_printf("Start the main loop\n");
while (TRUE) {
/* Get a message */
status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
if (status < 0) {
System_abort("This should not happen since timeout is forever\n");
}
/* Get the message id */
msgId = MessageQ_getMsgId(msg);
System_printf("Getting a message %d from core%d \n", msgId,msgId);
MessageQ_setMsgId(msg, MultiProc_self());
//System_printf("Sending a message #%d to core%d\n", 0x55, 1);
/* send the message to the remote processor */
status = MessageQ_put(remoteQueueId, msg);
}
}
2)udp接收以及发送函数。
int dtask_udp_rec( SOCKET s, UINT32 unused )
{
struct sockaddr_in sin1;
struct timeval to;
int i,j,tmp;
char *pBuf,*ptr;
HANDLE hBuffer;
char data;
(void)unused;
// Configure our socket timeout to be 3 seconds
to.tv_sec = 3;
to.tv_usec = 0;
setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof( to ) );
setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof( to ) );
tmp = sizeof( sin1 );
i = (int)recvncfrom( s, (void **)&pBuf, 0, (PSA)&sin1, &tmp, &hBuffer );
sendto( s, pBuf, i, 0, (PSA)&sin1, sizeof(sin1) );
recvncfree( hBuffer );
MessageQ_setMsgId(msg, MultiProc_self());
//System_printf("Sending a message #%d to core%d\n", 0x55, 1);
/* send the message to the remote processor */
status = MessageQ_put(remoteQueueId, msg);//给core1一个中断
return(1);
}
下载后显示正常,但是用网络调试助手给评估版发送一帧数据后即显示:
[C66xx_0] ti.sdo.ipc.MessageQ: line 383: assertion failure: A_invalidMsg: Invalid message
[C66xx_0] xdc.runtime.Error.raise: terminating execution
请问此打印信息表示什么意思?需要怎样改动?谢谢