
CHAPTER 5 SYNCHRONOUS COMMUNICATION MANAGEMENT
User’s Manual U14833EJ2V0UM
60
5.5
Mailboxes
In the RX4000, data queues and mailboxes are provided as a means of realizing an intertask communication
function. For a data queue, transmit data is fixed to 4 bytes and there is a limit to the total amount of data that can be
stored. For a mailbox on the other hand, data of any format can be transmitted, and there is no limit to the total
amount of storable data. Users can therefore select and use whichever of these has the features that best suit their
system configuration. This section describes mailboxes, which consist of a receive task waiting queue and a transmit
message mail queue. Mailboxes not only enable communication between tasks, but also make it possible to have
tasks wait in response to messages.
5.5.1
Creating mailboxes
Mailboxes can be created either by issuing the service call (a)cre_mbx, or by specifying the static API CRE_MBX,
which performs equivalent processing to (a)cre_mbx when the system is initialized.
When (a)cre_mbx is issued, the attribute, etc., is stored in the block corresponding to the ID number that specifies
the mailbox control block array, and that control block is then initialized.
The mailbox ID number consists of a unique number of a value 1 or higher. The maximum value that can be
specified is the one defined in the system information table, up to a maximum of 0x7fff numbers.
5.5.2
Deleting mailboxes
A mailbox is deleted by issuing the del_mbx service call. When del_mbx is issued, the kernel invalidates the
specified mailbox control block and puts the target mailbox in the non-existent state.
Even if a task exists that has a receive message for the deleted mailbox, that mailbox will still be deleted. In this
case, all the waiting tasks are released from the waiting state and the error code E_DLT indicating that the mailbox
has been deleted is returned as the return value of the service call. Similarly, even if there is a message that has
been registered as waiting for reception, the mailbox will still be deleted. However, in this case, even if the message is
a memory block acquired from the memory pool, it will not be returned to the memory pool.