[rtems-central commit] spec: Specify _Timecounter_Tick_simple()

Sebastian Huber sebh at rtems.org
Thu Oct 28 18:14:04 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Oct 28 13:06:16 2021 +0200

spec: Specify _Timecounter_Tick_simple()

---

 spec/score/timecounter/req/tick-simple-delta.yml  | 16 ++++++++
 spec/score/timecounter/req/tick-simple-offset.yml | 16 ++++++++
 spec/score/timecounter/req/tick-simple.yml        | 16 ++++++++
 spec/score/timecounter/unit/kern-tc.yml           | 42 ---------------------
 spec/score/timecounter/val/install.yml            | 45 +++++++++++++++++++++++
 5 files changed, 93 insertions(+), 42 deletions(-)

diff --git a/spec/score/timecounter/req/tick-simple-delta.yml b/spec/score/timecounter/req/tick-simple-delta.yml
new file mode 100644
index 0000000..09f50c0
--- /dev/null
+++ b/spec/score/timecounter/req/tick-simple-delta.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
+links:
+- role: requirement-refinement
+  uid: tick-simple
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+  When the simple timecounter tick service is called, the time points of the
+  current timehand shall be advanced by the time interval specified by the
+  ``delta`` parameter.
+type: requirement
diff --git a/spec/score/timecounter/req/tick-simple-offset.yml b/spec/score/timecounter/req/tick-simple-offset.yml
new file mode 100644
index 0000000..0283238
--- /dev/null
+++ b/spec/score/timecounter/req/tick-simple-offset.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
+links:
+- role: requirement-refinement
+  uid: tick-simple
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+  When the simple timecounter tick service is called, the timecounter offset of
+  the current timehand shall be set to the offset specified by the ``offset``
+  parameter.
+type: requirement
diff --git a/spec/score/timecounter/req/tick-simple.yml b/spec/score/timecounter/req/tick-simple.yml
new file mode 100644
index 0000000..46ef3c8
--- /dev/null
+++ b/spec/score/timecounter/req/tick-simple.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
+links:
+- role: requirement-refinement
+  uid: group
+non-functional-type: design
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+  The clock implementation shall provide a simple timecounter tick service for
+  timecounter devices with a period equal to the ${/glossary/clock-tick:/term}
+  interval.
+type: requirement
diff --git a/spec/score/timecounter/unit/kern-tc.yml b/spec/score/timecounter/unit/kern-tc.yml
deleted file mode 100644
index fb1cdca..0000000
--- a/spec/score/timecounter/unit/kern-tc.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
-copyrights:
-- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
-enabled-by: true
-links: []
-test-actions:
-
-#### _Timecounter_Tick_simple() ###############################################
-
-- action-brief: |
-    Call function _Timecounter_Tick_simple().
-  action-code: |
-    ISR_lock_Context lock_context;
-    _Timecounter_Acquire( &lock_context );
-    _Timecounter_Tick_simple( 0, 0, &lock_context );
-  checks: []
-  links:
-  - name: _Timecounter_Tick_simple
-    role: unit-test
-    uid: ../../if/domain
-
-###############################################################################
-
-test-brief: |
-  Unit tests for the time counter kern_tc part.
-test-context: []
-test-context-support: null
-test-description: |
-  Parts of the file ``cpukit/score/src/kern_tc.c`` are only executed by certain
-  device driver code.  The space qualified code subset does not contain those
-  features.  This test exercises the code parts otherwise not reached in order
-  to achieve full code coverage.
-test-header: null
-test-includes:
-- rtems/score/timecounter.h
-test-local-includes: []
-test-setup: null
-test-stop: null
-test-support: null
-test-target: testsuites/unit/tc-score-kern-tc.c
-test-teardown: null
-type: test-case
diff --git a/spec/score/timecounter/val/install.yml b/spec/score/timecounter/val/install.yml
index f9b99a2..543dc00 100644
--- a/spec/score/timecounter/val/install.yml
+++ b/spec/score/timecounter/val/install.yml
@@ -5,6 +5,21 @@ enabled-by: true
 links: []
 test-actions:
 - action-brief: |
+    Call the simple timecounter tick service with a zero delta and offset.
+    This will lead to an overflow to zero of the timehand generation.  It shall
+    not change the initial clock values.
+  action-code: |
+    ISR_lock_Context lock_context;
+
+    _Timecounter_Acquire( &lock_context );
+    _Timecounter_Tick_simple( 0, 0, &lock_context );
+  checks: []
+  links:
+  - role: validation
+    uid: ../req/tick-simple-delta
+  - role: validation
+    uid: ../req/tick-simple-offset
+- action-brief: |
     Call the directives to get the initial value of
     ${/glossary/clock-realtime:/term} and the initial boot time.
   action-code: |
@@ -780,6 +795,36 @@ test-actions:
   links:
   - role: validation
     uid: ../req/tick-large-delta
+- action-brief: |
+    Call the simple timecounter tick service with non-zero delta and offset
+    parameter values so that exactly one second passed.
+  action-code: |
+    ISR_lock_Context lock_context;
+    Timecounter     *tc;
+    struct bintime   bt;
+
+    tc = &high_quality_high_frequency;
+
+    _Timecounter_Acquire( &lock_context );
+    _Timecounter_Tick_simple(
+      tc->base.tc_frequency / 2,
+      GetCounter( tc ) - tc->base.tc_frequency / 2,
+      &lock_context
+    );
+  checks:
+  - brief: |
+      Check that exactly one second passed due to the simple clock tick
+      service.
+    code: |
+      rtems_clock_get_realtime_bintime( &bt );
+      T_eq_i64( bt.sec, 567993603 );
+      T_eq_u64( bt.frac, 103079215104 );
+    links:
+    - role: validation
+      uid: ../req/tick-simple-delta
+    - role: validation
+      uid: ../req/tick-simple-offset
+  links: []
 test-brief: |
   Tests timecounter installation related functions and directives of the Clock
   Manager.



More information about the vc mailing list