hi,I met a problem with c6678.I use MessageQ to transfer data with 8 cores
but there is always a bug when the program run a long time.That is
TMsgQHeader* ptMsgQHead = NULL;
ptMsgQHead = (TMsgQHeader*)MessageQ_alloc(HEAPMP_ID, sizeof(TMsgQHeader));
if (ptMsgQHead == NULL)
{
u32 dwMsgNums = MessageQ_count(m_msgQHandle);
PciePrintf("MessageQ_alloc failed:%d--%d,%d\n", dwMsgNums, m_dwSendCount, m_dwRecvCount);
return Codec_Error_MSGQ_Memory;
}
I create the MessageQ with code like this:
if (MultiProc_self() == COREID0)
{
/*
* Create the heap that will be used to allocate messages.
*/
HeapBufMP_Params_init(&m_heapBufParams);
m_heapBufParams.regionId = 0;
m_heapBufParams.name = (String)g_szHeapMpNameList[COREID0];
m_heapBufParams.numBlocks = MSGQ_BUF_NUM_MAX;//6000
m_heapBufParams.blockSize = sizeof(TMsgQHeader);
m_heapHandle = HeapBufMP_create(&m_heapBufParams);
if (m_heapHandle == NULL)
{
printf("HeapBufMP_create failed\n" );
return Codec_Error_MSGQ_Init;
}
}
else
{
/* Open the heap created by the other processor. Loop until opened. */
do
{
nStatus = HeapBufMP_open((String)g_szHeapMpNameList[COREID0], &m_heapHandle);
/*
* Sleep for 1 clock tick to avoid inundating remote processor
* with interrupts if open failed
*/
if (nStatus < 0)
{
Task_sleep(1);
}
} while (nStatus < 0);
}
/* Register this heap with MessageQ */
MessageQ_registerHeap((IHeap_Handle)m_heapHandle, HEAPMP_ID);
//////////////////////////////////////////////////////////////////////////
//MessageQ
//u32 dwLocalcoreId = MultiProc_self();
m_dwLocalCoreId = MultiProc_self();
System_sprintf(m_szMsgQName, "%s", MultiProc_getName(m_dwLocalCoreId));
/* Create a message queue using SyncSem as synchronizer */
SyncSem_Handle syncSemHandle = NULL;
syncSemHandle = SyncSem_create(NULL, NULL);
/* Create the local message queue */
/*每个核都创建一个messageQ,*/
MessageQ_Params msgQParams;
MessageQ_Params_init(&msgQParams);
msgQParams.synchronizer = SyncSem_Handle_upCast(syncSemHandle);
m_msgQHandle = MessageQ_create(m_szMsgQName, &msgQParams);
if (m_msgQHandle == NULL)
{
printf("MessageQ_create failed:%d\n", __LINE__);
return Codec_Error_MSGQ_Init;
}
I use the MessageQ API like this:
MessageQ_alloc-->MessageQ_put
MessageQ_get-->MessageQ_free
I dont know what mistake I made?
the program can run 1442min,then it report error
sometimes it report MessageQ alloc error,but sometimes it report nothing,just like breakdown
i try to use emulator to debug the program, but i just can debug the core0.If i connect all the 8 cores and load the program,then run it,it doesnt work
please help me,ths