tslp_tsk

Outline

Put task to sleep (with timeout).

C format

 ER      tslp_tsk (TMO tmout);
Parameter(s)

I/O

Parameter

Description

I

 TMO     tmout;
Specified timeout (unit:millisecond).

TMO_FEVR: Waiting forever.

TMO_POL: Polling.

Value: Specified timeout.



Explanation

This service call moves an invoking task from the RUNNING state to the WAITING state (sleeping state).

As a result, the invoking task is unlinked from the ready queue and excluded from the RI850V4 scheduling subject.

If a wakeup request has been queued to the target task (the wakeup request counter is not set to 0x0) when this service call is issued, this service call does not move the state but decrements the wakeup request counter (by subtracting 0x1 from the wakeup request counter).

The sleeping state is cancelled in the following cases, and then moved to the READY state.

Sleeping State Cancel Operation

Return Value

A wakeup request was issued as a result of issuing wup_tsk.

E_OK

A wakeup request was issued as a result of issuing iwup_tsk.

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 When TMO_FEVR is specified for wait time tmout, processing equivalent to slp_tsk will be executed.

Return value

Macro

Value

Description

E_OK

0

Normal completion.

E_PAR

-17

Parameter error.

- tmout < TMO_FEVR

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.

E_RLWAI

-49

Forced release from the WAITING state.

- Accept rel_wai/irel_wai while waiting.

E_TMOUT

-50

Timeout.

- Polling failure or timeout.