Quantcast
Channel: 蓝牙论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 7485

死机问题

$
0
0

大家好:

            在调试CC2640的过程中,发现如果在接收 App发送的消息 和 程序内部发送消息处理 碰撞在一起是就会死机.每次都停留在如下图:

在这里 exit 内部死循环?

请问TI工程师 及 各位 大神有何大招解决,谢谢!

还有,我也从 e2e 的帖子上查询了下,内存泄漏的改善地方也修改了。

uint8_t Util_enqueueMsg(Queue_Handle msgQueue, Semaphore_Handle sem,
uint8_t *pMsg)
{
queueRec_t *pRec;

// Allocated space for queue node.
#ifdef USE_ICALL
if (pRec = ICall_malloc(sizeof(queueRec_t)))
#else
if (pRec = (queueRec_t *)malloc(sizeof(queueRec_t)))
#endif
{
ICall_CSState key;
key = ICall_enterCriticalSection(); //互斥功能,避免同时调用此函数会死机

pRec->pData = pMsg;

Queue_enqueue(msgQueue, &pRec->_elem);

ICall_leaveCriticalSection(key);

// Wake up the application thread event handler.
if (sem)
{
Semaphore_post(sem);
}

return TRUE;
}

// Free the message.
#ifdef USE_ICALL
ICall_free(pMsg);
#else
free(pMsg);
#endif
return FALSE;
}

uint8_t *Util_dequeueMsg(Queue_Handle msgQueue)
{

ICall_CSState key;
key = ICall_enterCriticalSection(); //互斥功能,避免同时调用此函数会死机

if (!Queue_empty(msgQueue))
{
queueRec_t *pRec = Queue_dequeue(msgQueue);
uint8_t *pData = pRec->pData;

ICall_leaveCriticalSection(key);
// Free the queue node
// Note: this does not free space allocated by data within the node.
#ifdef USE_ICALL
ICall_free(pRec);
#else
free(pRec);
#endif
return pData;
}

ICall_leaveCriticalSection(key);

return NULL;
}

麻烦TI工程师协助,此案子死机问题卡了很久,谢谢!


Viewing all articles
Browse latest Browse all 7485

Trending Articles