Requirements
Dynamic Tick requires a hardware timer which features:
- An up-counting mode
- 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 to the OS Tick frequency.
- The register width of the timer should match the size 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.