ref_tsk

iref_tsk

Outline

Reference task state.

C format

 ER      ref_tsk (ID tskid, T_RTSK *pk_rtsk);
 ER      iref_tsk (ID tskid, T_RTSK *pk_rtsk);
Parameter(s)

I/O

Parameter

Description

I

 ID      tskid;
ID number of the task to referenced.

TSK_SELF: Invoking task.

Value: ID number of the task to referenced.

O

 T_RTSK  *pk_rtsk;
Pointer to the packet returning the task state.



[Task state packet: T_RTSK]

 typedef struct  t_rtsk {
     STAT    tskstat;        /*Current state*/
     PRI     tskpri;         /*Current priority*/
     PRI     tskbpri;        /*Reserved for future use*/
     STAT    tskwait;        /*Reason for waiting*/
     ID      wobjid;         /*Object ID number for which the task is waiting*/
     TMO     lefttmo;        /*Remaining time until timeout*/
     UINT    actcnt;         /*Activation request count*/
     UINT    wupcnt;         /*Wakeup request count*/
     UINT    suscnt;         /*Suspension count*/
     ATR     tskatr;         /*Attribute*/
     PRI     itskpri;        /*Initial priority*/
     ID      memid;          /*Reserved for future use*/
 } T_RTSK;


Explanation

Stores task state packet (current state, current priority, etc.) of the task specified by parameter tskid in the area specified by parameter pk_rtsk.

Note For details about the task state packet, refer to "15.2.1 Task state packet".

Return value

Macro

Value

Description

E_OK

0

Normal completion.

E_ID

-18

Invalid ID number.

- tskid < 0x0

- tskid > Maximum ID number

- When this service call was issued from a non-task, TSK_SELF was specified tskid.

E_CTX

-25

Context error.

- This service call was issued in the CPU locked state.

E_NOEXS

-42

Non-Existent object.

- Specified task is not registered.