-
trcv_mbf
-
Receive from message buffer (with time-out).
ER_UINT trcv_mbf (ID mbfid, VP msg, TMO tmout);
|
|
|
|
ID mbfid;
|
ID number of the message buffer.
|
|
VP msg;
|
Pointer to store the message.
|
|
TMO tmout;
|
Specified time-out (in millisecond).
Value: Specified time-out.
|
This service call processes as follows according to the situation of the message buffer specified by the parameter
mbfid.
- There is a message in the message buffer.
This service call takes out the oldest message from the message buffer and stores the message to the area specified by
msg and return the size of the message. As a result, the size of available space in the target message buffer increases by the amount calculated by the following expression.
The amount of increase = up4( Return value ) +
VTSZ_MBFTBL
In addition, this service call repeats the following processing until task in the transmission wait queue is lost or it becomes impossible to store the message in the message buffer.
- When there is a task in the transmission wait queue and there is available space in the message buffer for the message specified by the task in the top of the transmission wait queue, the task is unlinked from the transmission wait queue and moves from the WAITING state (message transmission wait state) to the READY state, or from the WAITING-SUSPENDED state to the SUSPENDED state. As a result, the size of available space in the target message buffer decreases by the amount calculated by the following expression.
The amount of decrease =up4( The message size sent by the task ) +
VTSZ_MBFTBL
- There is no message in the message buffer and there is a task in the transmission wait queue.
This service call stores the message specified by the task in the top of the transmission wait queue to the area pointed by the parameter
msg. As a result, the task is unlinked from the transmission wait queue and moves from the WAITING state (message transmission wait state) to the READY state, or from the WAITING-SUSPENDED state to the SUSPENDED state.
Note, this situation is caused only when the size of the message buffer is 0.
- There is no message in the message buffer and there is no task in the transmission wait queue.
This service call queues the invoking task to the reception wait queue of the target message buffer and moves it from the RUNNING state to the WAITING state with time (message reception wait state).
The receiving WAITING state for a message buffer is cancelled in the following cases.
Receiving WAITING State for a Message Buffer Cancel Operation
|
|
Message was sent to the message buffer area as a result of issuing snd_mbf.
|
|
Message was sent to the message buffer area as a result of issuing psnd_mbf.
|
|
Message was sent to the message buffer area as a result of issuing ipsnd_mbf.
|
|
Message was sent to the message buffer area as a result of issuing tsnd_mbf.
|
|
Forced release from waiting (accept rel_wai while waiting).
|
|
Forced release from waiting (accept irel_wai while waiting).
|
|
The time specified by tmout has elapsed.
|
|
Forced release from waiting (accept del_mbf while waiting).
|
|
Note 1 The maximum message size is defined at creating the message buffer. The size of the area pointed by
msg must be not less than the maximum message size.
Note 2 Invoking tasks are queued to the reception wait queue of the target message buffer in the order of the message reception request.
Note 3
TMO_FEVR is specified for wait time
tmout, processing equivalent to
rcv_mbf will be executed. When
TMO_POL is specified, processing equivalent to
prcv_mbf will be executed.
|
|
|
|
|
Normal completion (the size of the received message).
|
|
|
|
|
|
|
|
|
- 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".
|
|
|
- Stack pointer points out of user stack for invoking task.
- The operand-write access to the area indicated by msg (start : msg, size : maximum message size specified at creation) has not been permitted to the invoking task.
|
|
|
- The message buffer specified by mbfid does not exist.
|
|
|
Forced release from the WAITING state.
|
|
|
Polling failure or specified time has elapsed.
|
|
|
|