From 28fb0afff0eb5a9558121c5b4793f6af4f117916 Mon Sep 17 00:00:00 2001 From: Simon H Date: Mon, 24 Jun 2024 23:49:36 +0200 Subject: [PATCH 1/2] system: Add and update Timer requirements Add new Timers system requirements. Remove user story from the system requirements. Update description and titels of the existing requirements to fit better to the guidelines. Signed-off-by: Simon Hein --- docs/system_requirements/index.sdoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/system_requirements/index.sdoc b/docs/system_requirements/index.sdoc index a73ccdaf..906e8a62 100644 --- a/docs/system_requirements/index.sdoc +++ b/docs/system_requirements/index.sdoc @@ -268,18 +268,20 @@ As a Zephyr RTOS user, I want to be able to give my threads different priorities [/SECTION] +[SECTION] +TITLE: Timers + [REQUIREMENT] UID: ZEP-SYRS-18 STATUS: Draft TYPE: Functional COMPONENT: Timers -TITLE: Timers +TITLE: Time based events STATEMENT: >>> The Zephyr RTOS shall provide a framework for managing time-based events. <<< -USER_STORY: >>> -As a Zephyr RTOS user, I want to start, suspend, resume and stop timers which shall trigger an event on a set expiration time. -<<< + +[/SECTION] [REQUIREMENT] UID: ZEP-SYRS-19 From 4f00c7a9e9153ef576d9cbce239f8e9e4326eed6 Mon Sep 17 00:00:00 2001 From: Simon H Date: Mon, 24 Jun 2024 23:51:11 +0200 Subject: [PATCH 2/2] software: Adept and add new timers requirements Add new timers requirements on the software level Remove the user stories from the existing requirements. Remove obsolete requirements and rephrase existing ones. Signed-off-by: Simon Hein --- docs/software_requirements/timers.sdoc | 311 ++++++++++++++++++++++++- 1 file changed, 302 insertions(+), 9 deletions(-) diff --git a/docs/software_requirements/timers.sdoc b/docs/software_requirements/timers.sdoc index d4ca1d55..84c1c8ad 100644 --- a/docs/software_requirements/timers.sdoc +++ b/docs/software_requirements/timers.sdoc @@ -15,12 +15,9 @@ UID: ZEP-SRS-4-1 STATUS: Draft TYPE: Functional COMPONENT: Timers -TITLE: Kernel Clock +TITLE: Timer definition at run time STATEMENT: >>> -The Zephyr RTOS shall provide a interface for checking the current value of the real-time clock. -<<< -USER_STORY: >>> -As a Zephyr RTOS user, I want to be able to track the passed real time in the OS with a dedicated hardware counter and interrupt. +The Zephyr RTOS shall provide a mechanism to define and initialize timers at run time. <<< RELATIONS: - TYPE: Parent @@ -31,12 +28,308 @@ UID: ZEP-SRS-4-2 STATUS: Draft TYPE: Functional COMPONENT: Timers -TITLE: Call functions in interrupt context +TITLE: Timer definition at compile time +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism to define and static initialize timers (compile time). +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-3 +STATUS: Draft +TYPE: Non-Functional +COMPONENT: Timers +TITLE: Timer status +STATEMENT: >>> +A Zephyr RTOS timer shall have a status which indicates the expiration of the timer. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-4 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer period +STATEMENT: >>> +A Zephyr RTOS timer shall support repeated expiration of the timer given by a timer-specific time period. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-5 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer duration STATEMENT: >>> -The Zephyr RTOS shall provide an interface to schedule user mode call back function triggered by a real time clock value. +A Zephyr RTOS timer shall have a duration which indicates when the timer expires for the first time. <<< -USER_STORY: >>> -As a Zephyr RTOS user, I want to be able to execute functions in the interrupt context and the interrupt context shall be base on a real-time counter. +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-6 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer expiry function +STATEMENT: >>> +A Zephyr RTOS timer shall support a user-settable expiry function that gets called whenever the timer expires. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-7 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer stop function +STATEMENT: >>> +A Zephyr RTOS timer shall support a user-settable stop function that gets called when the timer is stopped while running. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-8 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Initialialization with expiry function +STATEMENT: >>> +When initializing a Zephyr RTOS timer, the expiry function a timer can have shall be settable. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-9 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Initialialization with stop function +STATEMENT: >>> +When initializing a Zephyr RTOS timer, the stop function a timer can have shall be settable. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-10 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer start +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism to start a defined and initialized timer. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-11 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Start timer status reset +STATEMENT: >>> +Whenever a not running timer is started the timer's status shall be reset to zero. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-12 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Start timer counting values +STATEMENT: >>> +Whenever a Zephyr RTOS timer is started, the timer shall start running with the duration and period values provided during timer initialization. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-13 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer stop +STATEMENT: >>> +A Zephyr RTOS timer that is running shall be stoppable +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-14 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer status read +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism to read the number of times a timer that is running has already expired. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-15 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer status read reset +STATEMENT: >>> +When the timer is read via the timer status read mechanism, the status shall be reset. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-16 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer thread synchronization +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism to synchronize a thread with a defined and initialized timer. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-17 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Synchronized thread blocks until timer has expired +STATEMENT: >>> +When the thread synchronization mechanism is used, the thread shall be blocked until the timer expires. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-18 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Synchronized thread is unblocked when timer is stopped. +STATEMENT: >>> +When the thread synchronization mechanism is used, the synchronized thread shall be unblocked when the timer is stopped. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-19 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer thread synchronization status reset +STATEMENT: >>> +When the thread synchronization mechanism is used, the status of the timer shall be reset. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-20 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Provide timer remaining expiration time in units of system ticks +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism to get the timer's remaining time until its next expiry in system ticks. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-21 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Provide timer remaining expiration time in milliseconds +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism to get the timer's remaining time until its next expiry in milliseconds. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-22 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer set user data +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism to set user data to a timer. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-23 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer get user data +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism to get user data from a timer. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-24 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Timer expire functions in interrupt context +STATEMENT: >>> +When the timer expiry function is defined, it shall be called in the interrupt context. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-18 + +[REQUIREMENT] +UID: ZEP-SRS-4-25 +STATUS: Draft +TYPE: Functional +COMPONENT: Timers +TITLE: Provide timer next expiration time in units of system ticks +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism to get the timer's next time of expiration in system ticks. <<< RELATIONS: - TYPE: Parent