- 83 -
[
[
[
[
F
F
u
u
n
n
c
c
t
t
i
i
o
o
n
n
a
a
l
l
d
d
e
e
s
s
c
c
r
r
i
i
p
p
t
t
i
i
o
o
n
n
]
]
]
]
This service call inspects the status of the task indicated by tskid and returns the current information on that task to the area
pointed to by pk_rtst as a return value. If TSK_SELF is specified, the status of the issuing task itself is inspected. If
TSK_SELF is specified for tskid in non-task context, operation of the service call cannot be guaranteed.
tskstat (task status)
tskstat has one of the following values returned to it depending on the status of the specified task.
•
TTS_RUN(0x0001) RUNNING
state
•
TTS_RDY(0x0002) READY
state
•
TTS_WAI(0x0004) WAITING
state
•
TTS_SUS(0x0008) SUSPENDED
state
•
TTS_WAS(0x000C) WAITING-SUSPENDED
state
•
TTS_DMT(0x0010) DORMANT
state
tskwait (cause of wait)
If the target task is in a wait state, one of the following causes of wait is returned. The values of the respective
causes of wait are listed below. If the task status is other than a wait state (TTS_WAI or TTS_WAS), tskwait is
indeterminate.
•
TTW_SLP (0x0001)
Kept waiting by slp_tsk or tslp_tsk
•
TTW_DLY (0x0002)
Kept waiting by dly_tsk
•
TTW_SEM (0x0004)
Kept waiting by wai_sem or twai_sem
•
TTW_FLG (0x0008)
Kept waiting by wai_flg or twai_flg
•
TTW_SDTQ(0x0010)
Kept waiting by snd_dtq or tsnd_dtq
•
TTW_RDTQ(0x0020)
Kept waiting by rcv_dtq or trcv_dtq
•
TTW_MBX (0x0040)
Kept waiting by rcv_mbx or trcv_mbx
•
TTW_MPF (0x2000)
Kept waiting by get_mpf or tget_mpf
•
TTW_VSDTQ (0x4000) Kept waiting by vsnd_dtq or vtsnd_dtq
•
TTW_VRDTQ(0x8000) Kept waiting by vrcv_dtq or vtrcv_dtq
If this service call is to be issued from task context, use ref_tst; if issued from non-task context, use iref_tst.
[
[
[
[
E
E
x
x
a
a
m
m
p
p
l
l
e
e
p
p
r
r
o
o
g
g
r
r
a
a
m
m
s
s
t
t
a
a
t
t
e
e
m
m
e
e
n
n
t
t
]
]
]
]
<<Example statement in C language>>
#include <itron.h>
#include <kernel.h>
#include “kernel_id.h”
void task()
{
T_RTST rtst;
ER ercd;
:
ercd = ref_tst( ID_main, &rtst );
:
}
<<Example statement in assembly language>>
_refdata: .blkb
4
.include
mr100.inc
.GLB
task
task:
:
PUSH.W
R2
PUSH.L
A1
ref_tst #ID_TASK2,#_refdata
:
33
TTW_VSDTQ and TTW_VRDTQ are the causes of wait outside the scope of µITRON 4.0 Specification.