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