Table of Contents |
---|
Requirements
Dynamic Tick requires a programmable hardware timer which features:
An up-counting modetimer. A down-counting timer can be used, but we will assume an up-counter for the remainder of this document.
The timer must have the following characteristics:
- A programmable ceiling value which:
- Generates an interrupt on match
- Sets a status bit on match
- A counter that can be read while the timer is running
- A frequency that is an integer multiple of the OS Tick rate
There are also non-essential timer characteristics which ensure that Dynamic Tick works optimally in your system.
The timer frequency should be equal toFor an optimal implementation of Dynamic Tick, the following constraints are included:
- A timer frequency which matches the OS Tick frequency.
- The A register width of the timer should match the size with matches the width of the OS_TICK type (32-bit by default).
Dynamic Tick API
Because hardware timers are programmed in the BSP, µC/OS-III only provides the function declarations for OS_DynTickGet()
and OS_DynTickSet()
; the BSP developer is required to implement them correctly to support Dynamic Tick. OSTimeDynTick()
is defined by the OS and called from the Tick ISR, similarly to OSTimeTick()
. However, unlike OSTimeTick()
it passes an argument to the OS: the number of ticks that have elapsed.