Texas Instruments TMS320 User Manual page 173

Dsp/bios v5.40
Hide thumbs Also See for TMS320:
Table of Contents

Advertisement

Mailboxes
Figure 4-15. Trace Results from Example 4-15
Associated with the mailbox at creation time is a total number of available
message slots, determined by the mailbox length you specify when you
create the mailbox. In order to synchronize tasks writing to the mailbox, a
counting semaphore is created and its count is set to the length of the
mailbox. When a task does an MBX_post operation, this count is
decremented. Another semaphore is created to synchronize the use of
reader tasks with the mailbox; this counting semaphore is initially set to zero
so that reader tasks block on empty mailboxes. When messages are posted
to the mailbox, this semaphore is incremented.
In Example 4-15, all the tasks have the same priority. The writer tasks try to
post all their messages, but a full mailbox causes each writer to block
indefinitely. The readers then read the messages until they block on an empty
mailbox. The cycle is repeated until the writers have exhausted their supply
of messages.
At this point, the readers pend for a period of time according to the following
formula, and then time out:
TIMEOUT*1ms/(clock ticks per millisecond)
After this timeout occurs, the pending reader task continues executing and
then concludes.
Thread Scheduling
4-69

Advertisement

Table of Contents
loading

Table of Contents