[rtems-central commit] spec: Improve task modes specification
Sebastian Huber
sebh at rtems.org
Fri Nov 19 07:51:57 UTC 2021
Module: rtems-central
Branch: master
Commit: 8fd32fd7f4f4a6168978b211e922bbca9817ce51
Changeset: http://git.rtems.org/rtems-central/commit/?id=8fd32fd7f4f4a6168978b211e922bbca9817ce51
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Nov 18 20:47:23 2021 +0100
spec: Improve task modes specification
---
spec/rtems/mode/req/interrupt-level.yml | 17 ++++++++++++
spec/rtems/mode/val/modes.yml | 46 ++++++++++++++++++++++++++++++++-
2 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/spec/rtems/mode/req/interrupt-level.yml b/spec/rtems/mode/req/interrupt-level.yml
new file mode 100644
index 0000000..1d0de57
--- /dev/null
+++ b/spec/rtems/mode/req/interrupt-level.yml
@@ -0,0 +1,17 @@
+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: interface-function
+ uid: ../if/interrupt-level
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+ When the ${../if/interrupt-level} macro is used, it shall expand to a
+ constant expression which computes the bitwise and of the value specified by
+ the ${../if/interrupt-level:/params[0]/name} parameter and
+ ${../if/interrupt-mask:/name}.
+type: requirement
diff --git a/spec/rtems/mode/val/modes.yml b/spec/rtems/mode/val/modes.yml
index b1bdb62..90842e1 100644
--- a/spec/rtems/mode/val/modes.yml
+++ b/spec/rtems/mode/val/modes.yml
@@ -202,7 +202,7 @@ test-actions:
T_step_eq_int( ${step}, PopCount( modes ), 11 );
links:
- role: validation
- uid: ../req/unique
+ uid: ../req/masks-unique
- role: validation
uid: ../if/asr-mask
- role: validation
@@ -210,6 +210,50 @@ test-actions:
- role: validation
uid: ../if/timeslice-mask
links: []
+- action-brief: |
+ Calculate the bitwise or of all non-default task mode constants.
+ action-code: |
+ rtems_mode modes;
+
+ modes = 0;
+ modes |= RTEMS_NO_ASR;
+ modes |= RTEMS_NO_PREEMPT;
+ modes |= RTEMS_TIMESLICE;
+ checks:
+ - brief: |
+ Check that the count of set bits in the calculated value is equal to the
+ count of non-default task mode constants. Since each non-default task
+ mode constants except is a power of this proves that each constant has a
+ unique value.
+ code: |
+ T_step_eq_int( ${step}, PopCount( modes ), 3 );
+ links:
+ - role: validation
+ uid: ../req/unique
+ - role: validation
+ uid: ../if/no-asr
+ - role: validation
+ uid: ../if/no-preempt
+ - role: validation
+ uid: ../if/timeslice
+ links: []
+- action-brief: |
+ Validate ${../if/interrupt-level:/name}.
+ action-code: |
+ /* Nothing to do */
+ checks:
+ - brief: |
+ Check the result of ${../if/interrupt-level:/name} for a sample value.
+ code: |
+ T_step_eq_u32(
+ ${step},
+ RTEMS_INTERRUPT_LEVEL( UINT32_MAX ),
+ RTEMS_INTERRUPT_MASK
+ );
+ links:
+ - role: validation
+ uid: ../req/interrupt-level
+ links: []
test-brief: |
Tests the task mode constants and function-like macros of the Classic API.
test-context: []
More information about the vc
mailing list