Everything

ref_tst

iref_tst

Outline
Reference task state (simplified version).
C format
 ER      ref_tst (ID tskid, T_RTST *pk_rtst);
 ER      iref_tst (ID tskid, T_RTST *pk_rtst);
Parameter(s)
I/O
Parameter
Description
I
 ID      tskid;
ID number of the task.
TSK_SELF: Invoking task.
Value: ID number of the task.
O
 T_RTST  *pk_rtst;
Pointer to the packet returning the task state.

[Task state packet (simplified version): T_RTST]
 typedef struct  t_rtst {
     STAT    tskstat;        /*Current state*/
     STAT    tskwait;        /*Reason for waiting*/
 } T_RTST;

Explanation
Stores task state packet (current state, reason for waiting) of the task specified by parameter tskid in the area specified by parameter pk_rtst.
Used for referencing only the current state and reason for wait among task information.
Response becomes faster than using ref_tsk or iref_tsk because only a few information items are acquired.
- tskstat
Stores the current state.
TTS_RUN: RUNNING state
TTS_RDY: READY state
TTS_WAI: WAITING state
TTS_SUS: SUSPENDED state
TTS_WAS: WAITING-SUSPENDED state
TTS_DMT: DORMANT state
- tskwait
Stores the reason for waiting.
The tskwait is effective only when the tskstat is TTS_WAI or TTS_WAS.
TTW_SLP: Sleeping state caused by slp_tsk or tslp_tsk
TTW_DLY: Delayed state caused by dly_tsk
TTW_SEM: WAITING state for a semaphore resource caused by wai_sem or twai_sem
TTW_FLG: WAITING state for an eventflag caused by wai_flg or twai_flg
TTW_SDTQ: Sending WAITING state for a data queue caused by snd_dtq or tsnd_dtq
TTW_RDTQ: Receiving WAITING state for a data queue caused by rcv_dtq or trcv_dtq
TTW_MBX: Receiving WAITING state for a mailbox caused by rcv_mbx or trcv_mbx
TTW_MTX: WAITING state for a mutex caused by loc_mtx or tloc_mtx
TTW_SMBF: Sending WAITING state for a message buffer caused by snd_mbf or tsnd_mbf
TTW_RMBF: Receiving WAITING state for a message buffer caused by rcv_mbf or trcv_mbf
TTW_MPF: WAITING state for a fixed-sized memory block caused by get_mpf or tget_mpf
TTW_MPL: WAITING state for a variable-sized memory block caused by get_mpl or tget_mpl
Return value
Macro
Value
Description
E_OK
0
Normal completion.
E_ID
-18
Invalid ID number.
- tskid < 0
- tskid > VTMAX_TSK
- When this service call was issued from a non-task, TSK_SELF was specified for tskid.
E_CTX
-25
Context error.
- This service call was issued in the CPU locked state.
- This service call was issued in the status "PSW.IPL > kernel interrupt mask level".
Note When the iref_tst is issued from task or the ref_tst is issued from non-task, the context error is not detected and normal operation of the system is not guaranteed.