Renesas M3T-MR100 Network Card User Manual


 
- 48 -
4.1.8 Synchronization and Communication Function (Mailbox)
The mailbox is a mechanism to perform data communication between tasks. In Figure 4.15, for example, task A can drop a
message into the mailbox and task B can retrieve the message from the mailbox. Since mailbox-based communication is
achieved by transferring the start address of a message from a task to another, this mode of communication is performed at
high speed independently of the message size.
The kernel manages the message queue by means of a link list. The application should prepare a header area that is to be
used for a link list. This is called the message header. The message header and the area actually used by the application to
store a message are called the message packet. The kernel rewrites the content of the message header as it manages the
message queue. The message header cannot be rewritten from the application. The structure of the message queue is shown
in Figure 4.16. The message header has its data types defined as shown below.
T_MSG: Mailbox message header
T_MSG_PRI: Mailbox message header with priority included
Messages in any size can be enqueued in the message queue because the header area is reserved on the application side. In
no event will tasks be kept waiting for transmission.
Messages can be assigned priority, so that messages will be received in order of priority beginning with the highest. In this
case, TA_MPRI should be added to the mailbox attribute. If messages need to be received in order of FIFO, add
TA_MFIFO to the mailbox attribute.
23
Furthermore, if tasks in a message wait state are to receive a message, the tasks can
be prioritized in which order they can receive a message, beginning with one that has the highest priority. In this case, add
TA_TPRI to the mailbox attribute. If tasks are to receive a message in order of FIFO, add TA_TFIFO to the mailbox attrib-
ute.
24
Message Message
TaskB
TaskA
Figure 4.15 Mailbox
23
It is in the mailbox definition "message_queue" of the configuration file that the TA_MPRI or TA_MFIFO attribute should be added.
24
It is in the mailbox definition "wait_queue" of the configuration file that the TA_TPRI or TA_TFIFO attribute should be added.