Timers
SPDX-License-Identifier: Apache-2.0
The Zephyr RTOS shall provide a mechanism to define and statically (i.e. compile time) initialize timers.
When initializing a timer, the Zephyr RTOS shall support setting a function that gets called when the timer expires.
When initializing a timer, the Zephyr RTOS shall support setting a function that gets called when a running timer is stopped.
The Zephyr RTOS shall provide a mechanism to define and initialize timers at run time.
The Zephyr RTOS shall provide a mechanism to start a timer for a specific duration and periodicity.
The Zephyr RTOS shall provide a mechanism to stop a running timer.
The Zephyr RTOS shall provide a mechanism to read the number of times a timer has expired and then reset this count to zero.
When a timer is initialized, started, or read via the timer status or synchronization mechanism, the Zephyr RTOS shall reset the timer's expiration count to zero.
The Zephyr RTOS shall provide a mechanism to synchronize a thread to a timer and then block the thread's execution until any of the following conditions is satisfied: - The timer is stopped - The timer's expiration count is greater than zero
The Zephyr RTOS shall provide a mechanism to get a timer's next expiration time in system ticks.
The Zephyr RTOS shall provide a mechanism to get a timer's remaining time until its next expiry in system ticks.
The Zephyr RTOS shall provide a mechanism to get the timer's remaining time until its next expiry in milliseconds.
The Zephyr RTOS shall support adding user defined data to a timer.
The Zephyr RTOS shall support retrieving user defined data from a timer.
When a timer expiry function is called, the Zephyr RTOS shall do so in the interrupt context.
The Zephyr RTOS shall provide a mechanism to release the resources associated with a timer.
If a timer is cleaned up while one or more threads are still waiting on it, then the Zephyr RTOS shall leave the timer's resources unreleased and return an error indicating that the cleanup could not be performed.
Where timer observers are enabled, the Zephyr RTOS shall provide a mechanism to register observers that are notified of the following timer lifecycle events: initialization, start, stop, and expiry.