Thread 中讨论的其他器件:MMWAVE-SDK
工具/软件:TI-RTOS
我想使用邮箱在 ARM 和 DSP 之间进行通信、但是当 ARM 写入邮箱时、新消息标志未设置、并且 DSP 无法通过 while 循环读取邮箱中的消息。
ARM 上的代码:
//
//邮箱初始化
mailbox_init (mailbox_type_MSS);
//设置邮箱
Mailbox_Config_init (.cfg);
cfg.readMode = mailbox_mode_callback;
cfg.readCallback = test_callback;
//打开 DSS 实例
handleDss = Mailbox_open (mailbox_type_dss、&cfg、&errCode);
if (handleDss ==空)
{
printf ("MSS:错误:无法打开 DSS 的邮箱");
返回;
}
if (错误代码!=0)
{
printf("MSS:错误:无法打开邮箱实例。 error=%d\n",errCode);
返回;
}
printf ("MSS:DSS %p 的邮箱实例已成功打开\n"、handleDss);
//向 DSS 写入并发送混乱消息
Mmess=2000;
printf ("MSS:DSS %p 的邮箱实例已成功打开\n"、handleDss);
size = Mailbox_write (handleDss、(uint8_t*)&mess, sizeof (mess));
printf ("MSS:收到来自 DSS 的 ACK \n");
if (size!= sizeof (mess))
{
printf ("MSS:写入 MBX 失败");
}
//
DSP 上的代码:
//
mailbox_init (mailbox_type_dss);
//设置邮箱
Mailbox_Config_init (.cfg);
cfg.readMode = mailbox_mode_callback;
cfg.readCallback = test_callback;
//打开邮箱通道
Handle = Mailbox_open (mailbox_type_MSS、.cfg、errCode);
if (handle == NULL)
{
System_printf ("dss:错误:无法打开邮箱实例\n");
返回;
}
if (错误代码!= 0)
{
System_printf ("DSS:错误:无法打开邮箱实例。 error=%d\n",errCode);
返回;
}
System_printf ("dss:邮箱实例%p 已成功打开\n"、句柄);
System_printf ("dss:********** 正在等待来自 MSS 的消息1 ************* \n");
/*等待回拨以设置标志*/
while (testAppCallbackFlag_DSS = 0)
{
Task_sleep (100);
}
System_printf ("DSS:消息1已接收。\n");
//读取混乱
mess_Rx = 0;
size = Mailbox_read (handle,(uint8_t*))&mess_Rx,sizeof (mess));
if (size!= sizeof (mess))(如果(大小!= sizeof (mess))))
{
System_printf ("dss:读取错误。\n");
}
//