tsnd_mbf

Outline

Send to message buffer (with time-out).

C format

 ER      tsnd_mbf (ID mbfid, VP msg, UINT msgsz, TMO tmout);
Parameter(s)

I/O

Parameter

Description

I

 ID      mbfid;
ID number of the message buffer.

I

 VP      msg;
Pointer to the message to be sent.

I

 UINT    msgsz;
Message size to be sent (in bytes).

I

 TMO     tmout;
Specified time-out (in millisecond).

TMO_FEVR: Waiting forever.

TMO_POL: Polling.

Value: Specified time-out.



Explanation

This service call processes as follows according to the situation of the message buffer specified by the parameter mbfid.

- There is a task in the reception wait queue.
This service call transfers the message specified by parameter msg to the task in the top of the reception wait queue. As a result, the task is unlinked from the reception wait queue and moves from the WAITING state (message reception wait state) to the READY state, or from the WAITING-SUSPENDED state to the SUSPENDED state.


- There is no task neither in the reception wait queue and transmission wait queue and there is available space in the message buffer.
This service call stores the message specified by parameter msg to the message buffer. 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( msgsz ) + VTSZ_MBFTBL

- There is no task neither in the reception wait queue and transmission wait queue and there is no available space in the message buffer, or there is a task in the transmission wait queue.
This service call queues the invoking task to the transmission wait queue of the target message buffer and moves it from the RUNNING state to the WAITING state with time (message transmission wait state).
The sending WAITING state for a message buffer is cancelled in the following cases.



Sending WAITING State for a Message Buffer Cancel Operation

Return Value

Available space was secured in the message buffer area as a result of issuing rcv_mbf.

E_OK

Available space was secured in the message buffer area as a result of issuing prcv_mbf.

E_OK

Available space was secured in the message buffer area as a result of issuing trcv_mbf.

E_OK

The task at the top of the transmission wait queue was forcedly released from waiting by following either.

- Forced release from waiting (accept rel_wai while waiting).

- Forced release from waiting (accept irel_wai while waiting).

- Forced release from waiting (accept ter_tsk while waiting).

- The time specified by tmout for tsnd_mbf has elapsed.

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 message buffer is reset as a result of issuing vrst_mbf.

EV_RST

The time specified by tmout has elapsed.

E_TMOUT

Forced release from waiting (accept del_mbf while waiting).

E_DLT



Note 1 Message is written to the message buffer area in the order of the message transmission request.

Note 2 Invoking tasks are queued to the transmission wait queue of the target message buffer in the FIFO order.

Note 3 TMO_FEVR is specified for wait time tmout, processing equivalent to snd_mbf will be executed. When TMO_POL is specified, processing equivalent to psnd_mbf will be executed.

Return value

Macro

Value

Description

E_OK

0

Normal completion.

E_PAR

-17

Parameter error.

- msgsz == 0

- msgsz > (Maximum message size specified at creation)

- msg == NULL

- tmout < -1

- tmout > (0x7FFFFFFF - TIC_NUME) / TIC_DENO

E_ID

-18

Invalid ID number.

- mbfid < 0

- mbfid > VTMAX_MBF

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-read access to the area indicated by msg (start : msg, size : msgsz) has not been permitted to the invoking task.

E_NOEXS

-42

Non-existent object.

- The message buffer specified by mbfid 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_mbf while waiting.

EV_RST

-127

Released from WAITING state by the object reset (vrst_mbf)