Zephyr Project Requirements
Timers

Timers

STATEMENT:

SPDX-License-Identifier: Apache-2.0

ZEP-SRS-4-1
1. Timer definition at compile time
UID: ZEP-SRS-4-1
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism to define and statically (i.e. compile time) initialize timers.

ZEP-SRS-4-2
2. Timer expiry function
UID: ZEP-SRS-4-2
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

When initializing a timer, the Zephyr RTOS shall support setting a function that gets called when the timer expires.

ZEP-SRS-4-3
3. Timer stop function
UID: ZEP-SRS-4-3
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

When initializing a timer, the Zephyr RTOS shall support setting a function that gets called when a running timer is stopped.

ZEP-SRS-4-4
4. Timer definition at run time
UID: ZEP-SRS-4-4
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism to define and initialize timers at run time.

ZEP-SRS-4-5
5. Timer start
UID: ZEP-SRS-4-5
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism to start a timer for a specific duration and periodicity.

ZEP-SRS-4-6
6. Timer stop
UID: ZEP-SRS-4-6
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism to stop a running timer.

ZEP-SRS-4-7
7. Timer status
UID: ZEP-SRS-4-7
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism to read the number of times a timer has expired and then reset this count to zero.

ZEP-SRS-4-8
8. Timer status reinitialization
UID: ZEP-SRS-4-8
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

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.

ZEP-SRS-4-9
9. Timer thread synchronization
UID: ZEP-SRS-4-9
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

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

ZEP-SRS-4-10
10. Timer next expiration time in system ticks
UID: ZEP-SRS-4-10
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism to get a timer's next expiration time in system ticks.

ZEP-SRS-4-11
11. Timer remaining time until expiration in system ticks
UID: ZEP-SRS-4-11
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism to get a timer's remaining time until its next expiry in system ticks.

ZEP-SRS-4-12
12. Timer remaining time until expiration in milliseconds
UID: ZEP-SRS-4-12
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism to get the timer's remaining time until its next expiry in milliseconds.

ZEP-SRS-4-13
13. Timer set user data
UID: ZEP-SRS-4-13
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall support adding user defined data to a timer.

ZEP-SRS-4-14
14. Timer get user data
UID: ZEP-SRS-4-14
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall support retrieving user defined data from a timer.

ZEP-SRS-4-15
15. Timer expire functions in interrupt context
UID: ZEP-SRS-4-15
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

When a timer expiry function is called, the Zephyr RTOS shall do so in the interrupt context.

ZEP-SRS-4-16
16. Timer resource cleanup
UID: ZEP-SRS-4-16
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism to release the resources associated with a timer.

ZEP-SRS-4-17
17. Timer cleanup with pending threads
UID: ZEP-SRS-4-17
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

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.

ZEP-SRS-4-18
18. Observing timer lifecycle events
UID: ZEP-SRS-4-18
STATUS: Draft
TYPE: Functional
COMPONENT: Timers
RELATIONS (Parent):
STATEMENT:

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.