Everything

trcv_mbx

Outline
Receive from mailbox (with time-out).
C format
 ER      trcv_mbx (ID mbxid, T_MSG **ppk_msg, TMO tmout);
Parameter(s)
I/O
Parameter
Description
I
 ID      mbxid;
ID number of the mailbox.
O
 T_MSG   **ppk_msg;
Start address of the message packet received from the mailbox.
I
 TMO     tmout;
Specified time-out (in millisecond).
TMO_FEVR: Waiting forever.
TMO_POL: Polling.
Value: Specified time-out.

[Message packet: T_MSG]
 typedef struct  t_msg {
     struct  t_msg   *msgnext;   /*Reserved for future use*/
 } T_MSG;

[Message packet: T_MSG_PRI]
 typedef struct  t_msg_pri {
     struct  t_msg   msgque;     /*Reserved for future use*/
     PRI     msgpri;             /*Message priority*/
 } T_MSG_PRI;

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 no message could be received from the target mailbox (no messages were queued to the wait queue) when this service call is issued, this service call does not receive messages but queues the invoking task to the target mailbox wait queue and moves it from the RUNNING state to the WAITING state with time-out (message reception wait state).
The receiving WAITING state for a mailbox is cancelled in the following cases.
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
A message was transmitted to the target mailbox as a result of issuing isnd_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
The time specified by tmout has elapsed.
E_TMOUT
Forced release from waiting (accept del_mbx while waiting).
E_DLT

Note 1 Invoking tasks are queued to the target mailbox wait queue in the order specified at creating the mailbox (FIFO order or current priority order).
Note 2 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.
Return value
Macro
Value
Description
E_OK
0
Normal completion.
E_PAR
-17
Parameter error.
- ppk_msg == NULL
- tmout < -1
- tmout > (0x7FFFFFFF - TIC_NUME) / TIC_DENO
E_ID
-18
Invalid ID number.
- mbxid < 0
- mbxid > VTMAX_MBX
E_CTX
-25
Context error.
- This service call was issued from a non-task.
- This service call was issued in the CPU locked state.
- This service call was issued in the dispatching disabled state.
- This service call was issued in the status "PSW.IPL > kernel interrupt mask level".
E_MACV
-26
Memory access violation.
- Stack pointer points out of user stack for invoking task.
- The operand-write access to the area indicated by ppk_msg has not been permitted to the invoking task.
E_NOEXS
-42
Non-existent object.
- The mailbox specified by mbxid does not exist.
E_RLWAI
-49
Forced release from the WAITING state.
- Accept rel_wai/irel_wai while waiting.
E_TMOUT
-50
Polling failure or specified time has elapsed.
E_DLT
-51
Waiting object deleted.
- Accept del_mbx while waiting.