
CHAPTER 7 TIME MANAGEMENT
User’s Manual U14833EJ2V0UM
86
7.5
Cyclic Handlers
Cyclic handlers are handlers used to execute specific processing at a fixed time interval.
Note that this type of handler was known as a cyclically activated handler in
μ
ITRON3.0. The following names and
terminology have accordingly been changed in the
μ
ITRON4.0.
Table 7-2. Cyclic Handler Terminology Correspondence Table
μ
ITRON3.0
μ
ITRON4.0
Cyclically activated handler
Cyclic handler
Define a cyclically activated handler
Create a cyclic handler
Activity state
State
TCY_ON (ON)
TCYC_STA (STA)
TCY_OFF (OFF)
TCYC_STP (STP)
def_cyc
cre_cyc
Note that a cyclic handler is described as a void type function with a VP_INT type argument. The extended data
exinf of an activated cyclic handler is passed for this argument.
Example)
void cyclic(VP_INT exinf)
{
...
return;
}
7.5.1
Creating cyclic handlers
Cyclic handlers are created by issuing the service call (a)cre_cyc. When acre_cyc is issued, the ID number of the
cyclic handler can be assigned by the kernel. Also, specifying the static API CRE_CYC allows processing equivalent
to cre_cyc to be carried out at kernel initialization. When cre_cyc is issued, the cyclic handler control block in the
system pool is secured, and initialized based on the cyclic handler creation data passed as a parameter.
The cyclic handler ID number consists of a unique number of a value 1 or higher. The maximum value that can be
specified is the one defined in the system information table.
7.5.2
Deleting cyclic handlers
Cyclic handlers are deleted by issuing the service call del_cyc. If del_cyc is issued, the control block of the target
cyclic handler is invalidated, and a cyclic handler with the same ID number as the deleted cyclic handler can be newly
created.
7.5.3
Cyclic handler states
Cyclic handlers have two states: operating (TCYC_STA) and stopped (TCYC_STP). In the former state, the cyclic
handler is activated after the time that passes when the system clock is updated is counted and the specified
activation interval time has elapsed. In the latter state, only the time is counted, and the handler is not activated, even
after the specified activation interval time has elapsed.
The initial state following creation of a cyclic handler depends on the specification of the attribute TA_STA (when
specified, the handler is created in the operating state). The state of a cyclic handler can be changed after creation by
issuing the service call (i)sta_cyc or (i)stp_cyc.