osal发送带有讯息任务问题 !
TI好:
我用串口来控制代码做OSAL带有讯息任务的轮循动作,
以下为简单的代码描述:
if ( events & SYS_EVENT_MSG )
{
uint8 *pMsg;
if ( (pMsg = osal_msg_receive( simpleBLECentral_TaskID )) != NULL )
ProcessOSALMsg( (osal_event_hdr_t *)pMsg );
// Release the OSAL message
VOID osal_msg_deallocate( pMsg );
}
void ProcessOSALMsg(osal_event_hdr_t *msg){
switch(msg -> event)
case MyEvent:
Myfunction((myStructData_t*) msg);
break;
}
void Myfunction((myStructData_t*) msg){
switch(msg->Myevent)
case seriaPortlEvent:
myStructData_t *receive;
receive = (myStructData_t*)osal_msg_allocate( sizeof(myStructData_t));
receive->hdr.event = MyEvent;
receive->Myevent = seriaPortlEvent;
osal_msg_send( TaskID, (uint8 *) receive ); //轮循
(void)HalUARTWrite(0,"1\n",2);
}
问题:
想要的结果是会一直打印“1” , 但代码每次运行到一半都会停止,需要重新用串口送命令才會繼續打印"1",
这是内存的问题吗?但每次都有运行到VOID osal_msg_deallocate(PMSG)才对阿
求解
有人遇过相同问题吗?