OS_DynTickSet

Description

OS_DynTickSet() is part of the dynamic tick mechanism and must be implemented in the BSP. When called by the kernel, this function configures a hardware timer to fire an interrupt after the specified number of ticks has elapsed.
If the hardware timer cannot reach this value without overflowing, it should count to the highest tick value it can reach before triggering the interrupt.

Files

os.h/bsp_os.c

Prototype

OS_TICK  OS_DynTickSet (OS_TICK  ticks)

Arguments

ticks

The number of ticks that the kernel wants to wait before the next tick interrupt.

A value of indicates that the kernel wants to wait indefinitely. The hardware timer should count to the highest tick value it can reach before triggering the interrupt.

Returned Value

The number of ticks that will actually elapse before the next interrupt. This is usually the same as the ticks argument, but may less if the hardware timer has insufficient bit-length. 

If ticks was 0, this should be the highest number of ticks that the timer can count to.

Required Configuration

OS_CFG_TICK_EN and OS_CFG_DYN_TICK_EN must be enabled in os_cfg.h.

Notes/Warnings

  1. To use the Dynamic Tick feature, the OS Board Support Package (BSP) should implement the Dynamic Tick API defined in Dynamic Tick BSP.
  2. Do not call OS_DynTickSet() from your application.
  3. OS_DynTickSet() is always called within a critical section.
  4. If your port supports Non-Kernel Aware interrupts, make sure that the dynamic tick interrupt is assigned a kernel-aware priority.