- 114 -
[
[
[
[
E
E
r
r
r
r
o
o
r
r
c
c
o
o
d
d
e
e
]
]
]
]
E_RLWAI
Forced release from waiting
E_TMOUT
Polling failure or timeout or timed out
E_ILUSE
Service call improperly used (Tasks present waiting for TA_WSGL attribute eventflag)
[
[
[
[
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 waits until the eventflag indicated by flgid has its bits specified by waiptn set according to
task-awaking conditions indicated by wfmode. Returned to the area pointed to by p_flgptn is the eventflag bit pat-
tern at the time the task is released from WAITING state.
If the target eventflag has the TA_WSGL attribute and there are already other tasks waiting for the eventflag, the
error code E_ILUSE is returned.
If task-awaking conditions have already been met when this service call is invoked, the task returns immediately and
responds to the call with E_OK. If task-awaking conditions are not met and the invoked service call is wai_flg or
twai_flg, the task is enqueued in an eventflag waiting queue. In that case, if the attribute of the specified eventflag is
TA_TFIFO, the task is enqueued in order of FIFO; if TA_TPRI, the task is enqueued in order of priority. For the
pol_flg and ipol_flg service calls, the task returns immediately and responds to the call with the error code
E_TMOUT.
For the twai_flg service call, specify a wait time for tmout in ms units. The values specified for tmout must be with-
in (0x7FFFFFFF-time tick value). If any value exceeding this limit is specified, the service call may not operate
correctly. If TMO_POL=0 is specified for tmout, it means specifying 0 as a timeout value, in which case the service
call operates the same way as pol_flg. Furthermore, if specified as tmout=TMO_FEVR(–1), it means specifying an
infinite wait, in which case the service call operates the same way as wai_flg.
The task placed into a wait state by execution of the wai_flg or twai_flg service call is released from WAITING
state in the following cases:
When task-awaking conditions are met before the tmout time elapses
The error code returned in this case is E_OK.
When the first time tick occurred after tmout elapsed while task-awaking conditions remain
unsatisfied
The error code returned in this case is E_TMOUT.
When the task is forcibly released from WAITING state by the rel_wai or irel_wai service call
issued from another task or a handler
The error code returned in this case is E_RLWAI.
The following shows how wfmode is specified and the meaning of each mode.
wfmdoe (wait mode)
Meaning
TWF_ANDW
Wait until all bits specified by waiptn are set (wait for the bits AND’ed)
TWF_ORW
Wait until one of the bits specified by waiptn is set (wait for the bits OR’ed)
If this service call is to be issued from task context, use wai_flg,twai_flg,pol_flg; if issued from non-task context,
use ipol_flg.