Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Requirements

Dynamic Tick requires a programmable hardware timer which features:

An up-counting mode

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

There are also non-essential timer characteristics which ensure that Dynamic Tick works optimally in your system.

The timer frequency should be equal to

For 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.

Template

bsp_os.c

OS_DynTickGet()

OS_DynTickSet()

Dynamic Tick ISR