
CHAPTER 5 SYNCHRONOUS COMMUNICATION MANAGEMENT
User’s Manual U14833EJ2V0UM
51
5.3.4
Setting event flags
The value of an event flag is set by issuing either (i)set_flg or (i)clr_flg.
(i)set_flg is issued when any bit of the event flag is set to 1. When (i)set_flg is issued, the bit pattern of the event
flag when the service call was issued is ORed with the specified bit pattern and set to the event flag as a new bit
pattern. (i)clr_flg is issued when any bit of the event flag is set to 0. When (i)clr_flg is issued, the bit pattern of the
event flag when the service call was issued is ANDed with the specified bit pattern and set to the event flag as a new
bit pattern.
When there is a task waiting for an event flag, if (i)set_flg is issued and the event flag is updated, wait release
condition judgement processing is carried out. This judgement processing is carried out either until a wait release
condition is first satisfied (for event flags with the attribute TA_CLR), or for all the event flags. When (i)clr_flg is issued,
only event flag update processing is carried out. This is because the judgement concerning the establishment of an
event is made by checking whether all or any one of the specified bits are 1, as described in 5.3.5 Wait conditions,
making it impossible for a condition to be established by issuing (i)clr_flg.
5.3.5
Wait conditions
One of the following judgement methods can be specified as a wait condition for wai_flg, twai_flg, and (i)pol_flg
when determining whether an event has been established.
(1) AND wait (TWF_ANDW)
The waiting state continues until all bits to be set to 1 in the required bit pattern have been set in the relevant
event flag. In other words, if the specified bit pattern is waiptn and the bit pattern of the event flag is curptn, the
event establishment condition is as follows.
curptn & waiptn == waiptn
(2) OR wait (TWF_ORW)
The wait state continues until any bit to be set to 1 in the required bit pattern has been set in the relevant event
flag. The event establishment condition is therefore as follows.
curptn & waiptn != 0
5.3.6
Event flag clear attribute
If an event flag has the attribute TA_CLR, it is cleared to 0 when the required condition is satisfied. An event flag
with the attribute TA_WMUL held by multiple waiting tasks is cleared to 0 as soon as the first task is released from the
waiting state. Accordingly, because the bit pattern subject to condition judgement is 0, wait release condition
judgement is not performed for tasks registered behind this task in the waiting task queue.
5.3.7
Obtaining event flag information
Task information such as the bit pattern of an event flag can be obtained by using the service calls ref_flg and
iref_flg. For details of each service call, refer to
CHAPTER 13
.