Hello,
I'm working with CSS5, bios_5_41_10_38 and C6748.
I have two task with the same priority, created in DSP/BIOS statically:
- Mailbox reader task.
- Mailbox writer task.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I'm working with CSS5, bios_5_41_10_38 and C6748.
I have two task with the same priority, created in DSP/BIOS statically:
Anatoly,
The behavior you describe is as expected for mailboxes. The pend and post operations relate to individual messages being available or not, and not to *all* messages that the mailbox could hold.
If you want to signal a reader task when the writer has filled the mailbox, you could explicitly create a semaphore for this purpose to signal “full”. You’d need to then keep track of the number of messages to write before signaling full, and then to read when emptying the mailbox.
If you don’t want to explicitly track or define the number of messages that indicate “full”, I guess you could call MBX_pend() and MBX_post() with timeouts of zero, and be sure to check the return values of these calls to know if an individual message was really written or read successfully. For example, the writer could post messages until MBX_post() returns FALSE indicating the mailbox is full, and then the writer posts the “full” semaphore. And then the reader could call MBX_pend() to read messages, until a FALSE value is returned indicating the mailbox is empty. I think this should work too.
Scott
By adding a CLK object that periodically invokes TSK_yield(), you can effectively achieve time slicing among tasks of the same priority.
tcf configuration code:
clk_slice = bios.CLK.create("clk_slice");
clk_slice.fxn = prog.extern("clk_fxn");
C code:
/* periodically call TSK_yield() */
Void clk_fxn(Void)
{
TSK_yield();
}
If you want to times slice less often than on every CLK tick, you can use a PRD object configured with a longer period instead.
Alan