Table of Contents |
---|
Requirements
Dynamic Tick requires a programmable hardware timer. 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
For an optimal implementation of Dynamic Tick, the following constraints are included:
- A timer frequency which matches the OS Tick frequency.
- A register width 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.