[rtems-central commit] spec: Specify and test clock manager directives

Sebastian Huber sebh at rtems.org
Thu Sep 22 11:17:58 UTC 2022


Module:    rtems-central
Branch:    master
Commit:    1167cbc0cbce5972409ef4e334f39c56f2337ef0
Changeset: http://git.rtems.org/rtems-central/commit/?id=1167cbc0cbce5972409ef4e334f39c56f2337ef0

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Sep 22 13:24:21 2022 +0200

spec: Specify and test clock manager directives

---

 spec/rtems/clock/if/get-ticks-per-second-macro.yml |  2 -
 spec/rtems/clock/if/get-ticks-since-boot-macro.yml |  2 -
 .../rtems/clock/req/get-ticks-per-second-macro.yml | 16 +++++++
 spec/rtems/clock/req/get-ticks-per-second.yml      |  6 +--
 .../rtems/clock/req/get-ticks-since-boot-macro.yml | 16 +++++++
 spec/rtems/clock/req/get-ticks-since-boot.yml      |  5 +-
 spec/rtems/clock/val/clock.yml                     | 56 +++++++++++++++++-----
 7 files changed, 82 insertions(+), 21 deletions(-)

diff --git a/spec/rtems/clock/if/get-ticks-per-second-macro.yml b/spec/rtems/clock/if/get-ticks-per-second-macro.yml
index d1138b31..3b5e5fb9 100644
--- a/spec/rtems/clock/if/get-ticks-per-second-macro.yml
+++ b/spec/rtems/clock/if/get-ticks-per-second-macro.yml
@@ -15,8 +15,6 @@ links:
   uid: header
 - role: interface-ingroup-hidden
   uid: group
-- role: constraint
-  uid: /constraint/directive-not-pre-qualified
 name: rtems_clock_get_ticks_per_second
 notes: null
 params: []
diff --git a/spec/rtems/clock/if/get-ticks-since-boot-macro.yml b/spec/rtems/clock/if/get-ticks-since-boot-macro.yml
index a96858cc..48b2aff1 100644
--- a/spec/rtems/clock/if/get-ticks-since-boot-macro.yml
+++ b/spec/rtems/clock/if/get-ticks-since-boot-macro.yml
@@ -14,8 +14,6 @@ links:
   uid: header
 - role: interface-ingroup-hidden
   uid: group
-- role: constraint
-  uid: /constraint/directive-not-pre-qualified
 name: rtems_clock_get_ticks_since_boot
 notes: null
 params: []
diff --git a/spec/rtems/clock/req/get-ticks-per-second-macro.yml b/spec/rtems/clock/req/get-ticks-per-second-macro.yml
new file mode 100644
index 00000000..6f2bae2e
--- /dev/null
+++ b/spec/rtems/clock/req/get-ticks-per-second-macro.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+functional-type: function
+links:
+- role: interface-function
+  uid: ../if/get-ticks-per-second-macro
+rationale: null
+references: []
+requirement-type: functional
+text: |
+  The directive shall return the number of configured clock ticks per second as
+  defined by the ${/acfg/if/microseconds-per-tick:/name} application
+  configuration option.
+type: requirement
diff --git a/spec/rtems/clock/req/get-ticks-per-second.yml b/spec/rtems/clock/req/get-ticks-per-second.yml
index b36cbb4d..947db8c9 100644
--- a/spec/rtems/clock/req/get-ticks-per-second.yml
+++ b/spec/rtems/clock/req/get-ticks-per-second.yml
@@ -10,7 +10,7 @@ rationale: null
 references: []
 requirement-type: functional
 text: |
-  The ${../if/get-ticks-per-second:/name} function shall
-  return the number of clock ticks per second which is defined indirectly
-  by the CONFIGURE_MICROSECONDS_PER_TICK configuration option..
+  The directive shall return the number of configured clock ticks per second as
+  defined by the ${/acfg/if/microseconds-per-tick:/name} application
+  configuration option.
 type: requirement
diff --git a/spec/rtems/clock/req/get-ticks-since-boot-macro.yml b/spec/rtems/clock/req/get-ticks-since-boot-macro.yml
new file mode 100644
index 00000000..9f59d361
--- /dev/null
+++ b/spec/rtems/clock/req/get-ticks-since-boot-macro.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+functional-type: function
+links:
+- role: interface-function
+  uid: ../if/get-ticks-since-boot-macro
+rationale: null
+references: []
+requirement-type: functional
+text: |
+  The directive shall return the number of ${/glossary/clock-tick:/plural}
+  since a point in time during the system initialization or the last overflow
+  of the ${/glossary/clock-tick:/term} counter.
+type: requirement
diff --git a/spec/rtems/clock/req/get-ticks-since-boot.yml b/spec/rtems/clock/req/get-ticks-since-boot.yml
index f0b530e3..d164d1d1 100644
--- a/spec/rtems/clock/req/get-ticks-since-boot.yml
+++ b/spec/rtems/clock/req/get-ticks-since-boot.yml
@@ -10,8 +10,7 @@ rationale: null
 references: []
 requirement-type: functional
 text: |
-  The ${../if/get-ticks-since-boot:/name} function shall
-  return the number of ${/glossary/clock-tick:/plural} since a
-  point in time during the system initialization or the last overflow
+  The directive shall return the number of ${/glossary/clock-tick:/plural}
+  since a point in time during the system initialization or the last overflow
   of the ${/glossary/clock-tick:/term} counter.
 type: requirement
diff --git a/spec/rtems/clock/val/clock.yml b/spec/rtems/clock/val/clock.yml
index 190431b5..2d4e5e39 100644
--- a/spec/rtems/clock/val/clock.yml
+++ b/spec/rtems/clock/val/clock.yml
@@ -1,38 +1,72 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 copyrights:
-- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+- Copyright (C) 2021, 2022 embedded brains GmbH (http://www.embedded-brains.de)
 enabled-by: true
 links: []
 test-actions:
 - action-brief: |
-    Use the ${../if/get-ticks-since-boot:/name} function.
+    Use the ${../if/get-ticks-since-boot-macro:/name} directive before and
+    after exactly one clock tick.
   action-code: |
     rtems_interval result_0;
     rtems_interval result_1;
-    int32_t difference; /* Note: rtems_interval = uint32_t (unsigned!) */
 
     result_0 = rtems_clock_get_ticks_since_boot();
     ClockTick();
     result_1 = rtems_clock_get_ticks_since_boot();
-    /*
-     * Because of the ones-complement, the overflow
-     * is handled correctly. result_0 = 0xFFFFFFFF will become -1
-     * and result_1 = 0x0 will become 0.
-     */
-    difference = (int32_t) result_1 - (int32_t) result_0;
   checks:
   - brief: |
       Check that ${/glossary/clock-tick:/term} gets incremented.
     code: |
-      T_step_eq_i32( ${step}, difference, 1 );
+      T_step_eq_u32( ${step}, result_1 - result_0, 1 );
+    links:
+    - role: validation
+      uid: ../req/get-ticks-since-boot-macro
+  links: []
+- action-brief: |
+    Use the ${../if/get-ticks-since-boot:/name} directive before and after
+    exactly one clock tick.
+  action-code: |
+    rtems_interval result_0;
+    rtems_interval result_1;
+
+    #undef rtems_clock_get_ticks_since_boot
+
+    result_0 = rtems_clock_get_ticks_since_boot();
+    ClockTick();
+    result_1 = rtems_clock_get_ticks_since_boot();
+  checks:
+  - brief: |
+      Check that ${/glossary/clock-tick:/term} gets incremented.
+    code: |
+      T_step_eq_u32( ${step}, result_1 - result_0, 1 );
     links:
     - role: validation
       uid: ../req/get-ticks-since-boot
   links: []
 - action-brief: |
-    Use the ${../if/get-ticks-per-second:/name} function.
+    Use the ${../if/get-ticks-per-second-macro:/name} directive.
   action-code: |
     rtems_interval result;
+
+    result = rtems_clock_get_ticks_per_second();
+  checks:
+  - brief: |
+      Check that ${../if/get-ticks-per-second:/name} actually returns
+      1us / CONFIGURE_MICROSECONDS_PER_TICK.
+    code: |
+      T_step_eq_u32( ${step}, result, 1000000UL / TEST_MICROSECONDS_PER_TICK );
+    links:
+    - role: validation
+      uid: ../req/get-ticks-per-second-macro
+  links: []
+- action-brief: |
+    Use the ${../if/get-ticks-per-second:/name} directive.
+  action-code: |
+    rtems_interval result;
+
+    #undef rtems_clock_get_ticks_per_second
+
     result = rtems_clock_get_ticks_per_second();
   checks:
   - brief: |



More information about the vc mailing list