Here is the gist of the code I'm having trouble with (on a C6713 dsp)
void LogMsg(Int8 *str)
{
//process the str into mbx_in for the mailbox
if (SEM_pend(SEM_Mbox, 0))
{
MBX_post(&MBX_Log, &mbx_in, 0);
SEM_post(SEM_Mbox);
}
else
{
LOG_printf(&trace,"SEM_Mbox is taken");
}
}
I'm calling LogMsg from a SWI to log a message into the mailbox. Before the SWI is done, I'm calling another SWI (from that one) which is also calling LogMsg. The second ones causes the "SEM_Mbox is taken" statement and it seems like the SEM_Mbox is already taken (this is the only spot SEM_Mbox is used). Even though I call the SEM_post right after the SEM_pend it seems like it doesn't take affect until after it is done with both SWIs and pretty much back to the idleloop.
Pieces of my code was a project that was orgianlly built from CCS 2.2 with a much older bios. Now we are using CCS 3.3 with the 5.41.06.21 bios
The reason that if (SEM_pend(SEM_Mbox, 0)) is used in the first place is that there is other logs that happen asynchronicity and there was some trouble (in ccs2.2 days) of part of the data in the mailbox being overwritten by asynch logs that were a higher swi.
Thanks
Bryce