Everything

trcv_mbx

Outline
Receive from mailbox (with timeout).
C format
 ER      trcv_mbx ( ID mbxid, T_MSG **ppk_msg, TMO tmout );

Assembly format
 MOVW    AX, #tmout_hi
 PUSH    AX
 MOVW    AX, #tmout_lo
 PUSH    AX
 MOVW    BC, #LOWW(_ppk_msg)
 MOV     A, #mbxid
 CALL    !!_trcv_mbx
 ADDW    SP, #0x0004

Parameter(s)
I/O
Parameter
Description
I
 ID      mbxid;
ID number of the mailbox from which a message is received.
O
 T_MSG   **ppk_msg;
Start address of the message packet received from the mailbox.
I
 TMO     tmout;
Specified timeout (unit: ticks).
TMO_FEVR: Waiting forever.
TMO_POL: Polling.
Value: Specified timeout.

Explanation
This service call receives a message from the mailbox specified by parameter mbxid, and stores its start address in the area specified by parameter ppk_msg.
If the message could not be received from the target mailbox (no messages were queued in the wait queue) when this service call is issued, message reception processing is not executed but the invoking task is queued to the target mailbox wait queue in the order of message reception request (FIFO order).
As a result, the invoking task is unlinked from the ready queue and is moved from the RUNNING state to the WAITING state (receiving waiting state for a mailbox).
The receiving waiting state for a mailbox is cancelled in the following cases, and then moved to the READY state.
Receiving Waiting State for a mailbox Cancel Operation
Return Value
A message was transmitted to the target mailbox as a result of issuing snd_mbx.
E_OK
Forced release from waiting (accept rel_wai while waiting).
E_RLWAI
Forced release from waiting (accept irel_wai while waiting).
E_RLWAI
Polling failure or timeout.
E_TMOUT

Note 1 When TMO_FEVR is specified for wait time tmout, processing equivalent to rcv_mbx will be executed. When TMO_POL is specified, processing equivalent to prcv_mbx will be executed.
Note 2 For details about the message packet, refer to "12.5.5 Message packet".
Return value
Macro
Value
Description
E_OK
0
Normal completion.
E_RLWAI
-49
Forced release from waiting (accept rel_wai/irel_wai while waiting).
E_TMOUT
-50
Polling failure or timeout.