trcv_dtq

Outline

Receive from data queue (with time-out).

C format

 ER      trcv_dtq (ID dtqid, VP_INT *p_data, TMO tmout);
Parameter(s)

I/O

Parameter

Description

I

 ID      dtqid;
ID number of the data queue.

O

 VP_INT  *p_data;
Data element received from the data queue.

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 data queue specified by the parameter dtqid.

- There is a data in the data queue.
This service call takes out the oldest data from the data queue and stores the data to the area specified by p_data.
When there is a task in the transmission wait queue, this service call stores the data sent by the task in the top of the transmission wait queue and moves it from the WAITING state (data transmission wait state) to the READY state.



- There is no data in the data queue and there is a task in the transmission wait queue.
This service call stores the data specified by the task in the top of the transmission wait queue to the area specified by p_data. As a result, the task is unlinked from the transmission wait queue and moves from the WAITING state (data 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 capacity of the data queue is 0.



- There is no data in the data queue 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 data queue and moves it from the RUNNING state to the WAITING state with time (data reception wait state).
The receiving WAITING state for a data queue is cancelled in the following cases.



Receiving WAITING State for a Data Queue Cancel Operation

Return Value

Data was sent to the data queue area as a result of issuing snd_dtq.

E_OK

Data was sent to the data queue area as a result of issuing psnd_dtq.

E_OK

Data was sent to the data queue area as a result of issuing ipsnd_dtq.

E_OK

Data was sent to the data queue area as a result of issuing tsnd_dtq.

E_OK

Data was sent to the data queue area as a result of issuing fsnd_dtq.

E_OK

Data was sent to the data queue area as a result of issuing ifsnd_dtq.

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



Note 1 Invoking tasks are queued to the reception wait queue of the target data queue in the order of the data reception request.

Note 2 TMO_FEVR is specified for wait time tmout, processing equivalent to rcv_dtq will be executed. When TMO_POL is specified, processing equivalent to prcv_dtq will be executed.

Return value

Macro

Value

Description

E_OK

0

Normal completion.

E_PAR

-17

Parameter error.

- tmout < -1

- tmout > (0x7FFFFFFF - TIC_NUME) / TIC_DENO

E_ID

-18

Invalid ID number.

- dtqid < 0

- dtqid > VTMAX_DTQ

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_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.