3.3.3. ClockTimer component

The ClockTimer component provides a mechanism for other components to schedule a callback after a number of ticks at a given ClockSignal rate.

Figure 3.3 shows a view of the component in System Canvas.

Figure 3.3. ClockTimer in System Canvas

ClockTimer in System Canvas

This component is written in C++.

Ports

Table 3.4 provides a brief description of the ClockTimer component ports.

Table 3.4. ClockTimer ports

NamePort protocolTypeDescription
timer_callbackTimerCallbackslaveport on which a signal is sent after the number of scheduled ticks has elapsed
timer_controlTimerControlslavepermits the timer to be set, canceled and queried
clk_inClockSignalslavedetermines the tick rate of the timer

TimerControl protocol

The TimerControl protocol is used to control the actions of a ClockTimer component. It permits a timer to be set to schedule a callback after a given number of ticks at the rate of the clock input.

If a timer is set while it is counting, it starts counting the new number of ticks without sending the original callback. Cancelling a timer when it is not active has no effect.

The TimerControl protocol has the following behaviors:

set(uint32_t ticks) : void

sets the timer to countdown the given number of ticks

cancel()

cancels an active timer, preventing the callback being invoked

isSet() : bool

checks whether a timer is set to generate a callback

remaining() : uint32_t

returns how many ticks remain before the callback is invoked.

TimerCallback protocol

The TimerCallback protocol is used to invoke a behavior on the component which set the timer. The timer_control port of the timer must not be used during the invoked behavior.

signal() : uint32_t

Invoked by the timer when the timer countdown expires. The invoked behavior returns the number of ticks after which it is called again or 0 to make the timer one-shot.

Parameters

The ClockTimer component has no parameters.

Registers

The ClockTimer component has no registers.

Debug features

The ClockTimer component has no debug features.

Verification and testing

Validation of the ClockTimer component consisted of booting operating systems and VE test suites on a VE model that contained a ClockTimer component.

Performance

An active ClockTimer component incurs no simulation overhead. For best performance, avoid having your performance-critical code frequently cancel timers or query the number of remaining ticks.

Library dependencies

The ClockTimer component has no dependencies on external libraries.

Copyright © 2008-2013 ARM. All rights reserved.ARM DUI 0423O
Non-ConfidentialID060613