Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
CCS 6.1.3
tirtos_tivac_2_16_01_14(bios_6_45_02_31)
xdctools_3_32_00_06_core
ti-cgt-arm_15.12.1.LTS
On page 117 of SPRUEX3P(SYS/BIOS (TI-RTOS Kernel) v6.45 Use's Guide), an example is shown for using event together with mailbox:
readerTask()
{
while (TRUE) {/* Wait for either ISR or Mailbox message */
events = Event_pend(myEvent,
Event_Id_NONE, /* andMask = 0 */
Event_Id_00 + Event_Id_01, /* orMask */
BIOS_WAIT_FOREVER); /* timeout */
if (events & Event_Id_00) {
/* Get the posted message.
* Mailbox_pend() will not block since Event_pend()
* has guaranteed that a message is available.
* Notice that the special BIOS_NO_WAIT
* parameter tells Mailbox that Event_pend()
* was used to acquire the available message.
*/
Mailbox_pend(mbox, &msgB, BIOS_NO_WAIT);
processMsg(&msgB);
}
if (events & Event_Id_01) {
processISR();
}
}
}
But during my debug, I believe I sometimes see return value of Mailbox_pend(mbox, &msgB, BIOS_NO_WAIT) is FALSE, and then msgB is invalid. I read the source code in "packages\ti\sysbios\knl\Mailbox.c", and I can't figure out why it returns FALSE when Event_Id_00 has been set and timeout is BIOS_NO_WAIT.
So could you please help make it clear? Shall I also check the return value in this case?
