summaryrefslogtreecommitdiffstats
path: root/spec/rtems/mode/val/modes.yml
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rtems/mode/val/modes.yml')
-rw-r--r--spec/rtems/mode/val/modes.yml242
1 files changed, 242 insertions, 0 deletions
diff --git a/spec/rtems/mode/val/modes.yml b/spec/rtems/mode/val/modes.yml
new file mode 100644
index 00000000..bcbb32a2
--- /dev/null
+++ b/spec/rtems/mode/val/modes.yml
@@ -0,0 +1,242 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links: []
+test-actions:
+- action: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_true( ${step}, IsPowerOfTwo( RTEMS_NO_ASR ) );
+ description: |
+ Check that RTEMS_NO_ASR is a power of two representable as an integer of
+ type rtems_mode.
+ links:
+ - role: validation
+ uid: ../req/bit-set
+ - role: validation
+ uid: ../if/no-asr
+ - check: |
+ T_step_true( ${step}, IsPowerOfTwo( RTEMS_NO_PREEMPT ) );
+ description: |
+ Check that RTEMS_NO_PREEMPT is a power of two representable as an integer
+ of type rtems_mode.
+ links:
+ - role: validation
+ uid: ../req/bit-set
+ - role: validation
+ uid: ../if/no-preempt
+ - check: |
+ T_step_true( ${step}, IsPowerOfTwo( RTEMS_TIMESLICE ) );
+ description: |
+ Check that RTEMS_TIMESLICE is a power of two representable as an integer
+ of type rtems_mode.
+ links:
+ - role: validation
+ uid: ../req/bit-set
+ - role: validation
+ uid: ../if/timeslice
+ description: |
+ Validate the non-default task mode constants.
+ links: []
+- action: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_eq_u32( ${step}, RTEMS_ASR, 0 );
+ description: |
+ Check that RTEMS_ASR is equal to zero.
+ links:
+ - role: validation
+ uid: ../req/default
+ - role: validation
+ uid: ../if/asr
+ - check: |
+ T_step_eq_u32( ${step}, RTEMS_DEFAULT_MODES, 0 );
+ description: |
+ Check that RTEMS_DEFAULT_MODES is equal to zero.
+ links:
+ - role: validation
+ uid: ../req/default
+ - role: validation
+ uid: ../if/default
+ - check: |
+ T_step_eq_u32( ${step}, RTEMS_NO_TIMESLICE, 0 );
+ description: |
+ Check that RTEMS_NO_TIMESLICE is equal to zero.
+ links:
+ - role: validation
+ uid: ../req/default
+ - role: validation
+ uid: ../if/no-timeslice
+ - check: |
+ T_step_eq_u32( ${step}, RTEMS_PREEMPT, 0 );
+ description: |
+ Check that RTEMS_PREEMPT is equal to zero.
+ links:
+ - role: validation
+ uid: ../req/default
+ - role: validation
+ uid: ../if/preempt
+ description: |
+ Validate the default task mode constants.
+ links: []
+- action: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_eq_u32(
+ ${step},
+ RTEMS_ASR_MASK & RTEMS_ALL_MODE_MASKS,
+ RTEMS_ASR_MASK
+ );
+ description: |
+ Check that the bitwise and of RTEMS_ASR_MASK and RTEMS_ALL_MODE_MASKS is
+ equal to RTEMS_ASR_MASK.
+ links:
+ - role: validation
+ uid: ../req/masks-all
+ - role: validation
+ uid: ../if/asr-mask
+ - check: |
+ T_step_eq_u32(
+ ${step},
+ RTEMS_PREEMPT_MASK & RTEMS_ALL_MODE_MASKS,
+ RTEMS_PREEMPT_MASK
+ );
+ description: |
+ Check that the bitwise and of RTEMS_PREEMPT_MASK and RTEMS_ALL_MODE_MASKS
+ is equal to RTEMS_PREEMPT_MASK.
+ links:
+ - role: validation
+ uid: ../req/masks-all
+ - role: validation
+ uid: ../if/preempt-mask
+ - check: |
+ T_step_eq_u32(
+ ${step},
+ RTEMS_TIMESLICE_MASK & RTEMS_ALL_MODE_MASKS,
+ RTEMS_TIMESLICE_MASK
+ );
+ description: |
+ Check that the bitwise and of RTEMS_TIMESLICE_MASK and
+ RTEMS_ALL_MODE_MASKS is equal to RTEMS_TIMESLICE_MASK.
+ links:
+ - role: validation
+ uid: ../req/masks-all
+ - role: validation
+ uid: ../if/timeslice-mask
+ - check: |
+ T_step_eq_u32(
+ ${step},
+ RTEMS_INTERRUPT_MASK & RTEMS_ALL_MODE_MASKS,
+ RTEMS_INTERRUPT_MASK
+ );
+ description: |
+ Check that the bitwise and of RTEMS_INTERRUPT_MASK and
+ RTEMS_ALL_MODE_MASKS is equal to RTEMS_INTERRUPT_MASK.
+ links:
+ - role: validation
+ uid: ../req/masks-all
+ - role: validation
+ uid: ../if/interrupt-mask
+ description: |
+ Validate RTEMS_ALL_MODE_MASKS.
+ links: []
+- action: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_true( ${step}, IsPowerOfTwo( RTEMS_ASR_MASK ) );
+ description: |
+ Check that RTEMS_ASR_MASK is a power of two representable as an integer
+ of type rtems_mode.
+ links:
+ - role: validation
+ uid: ../req/masks
+ - role: validation
+ uid: ../if/asr-mask
+ - check: |
+ T_step_true( ${step}, IsPowerOfTwo( RTEMS_PREEMPT_MASK ) );
+ description: |
+ Check that RTEMS_PREEMPT_MASK is a power of two representable as an
+ integer of type rtems_mode.
+ links:
+ - role: validation
+ uid: ../req/masks
+ - role: validation
+ uid: ../if/preempt-mask
+ - check: |
+ T_step_true( ${step}, IsPowerOfTwo( RTEMS_TIMESLICE_MASK ) );
+ description: |
+ Check that RTEMS_TIMESLICE_MASK is a power of two representable as an
+ integer of type rtems_mode.
+ links:
+ - role: validation
+ uid: ../req/masks
+ - role: validation
+ uid: ../if/timeslice-mask
+ description: |
+ Validate the task mode mask constants except RTEMS_INTERRUPT_MASK.
+ links: []
+- action: |
+ modes = 0;
+ modes |= 0xff;
+ modes |= RTEMS_ASR_MASK;
+ modes |= RTEMS_PREEMPT_MASK;
+ modes |= RTEMS_TIMESLICE_MASK;
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, PopCount( modes ), 11 );
+ description: |
+ Check that the count of set bits in the calculated value is equal to the
+ count of task mode mask constants except RTEMS_INTERRUPT_MASK plus eight.
+ Since each task mode mask constants except RTEMS_INTERRUPT_MASK is a
+ power of two and the bitwise and of 0xff and RTEMS_INTERRUPT_MASK is
+ equal to RTEMS_INTERRUPT_MASK this proves that each constant and 0xff has
+ a unique value.
+ links:
+ - role: validation
+ uid: ../req/unique
+ - role: validation
+ uid: ../if/asr-mask
+ - role: validation
+ uid: ../if/preempt-mask
+ - role: validation
+ uid: ../if/timeslice-mask
+ description: |
+ Calculate the bitwise or of all task mode mask constants and 0xff.
+ links: []
+test-brief: |
+ Tests the task mode constants and function-like macros of the Classic API.
+test-description: null
+test-epilogue: null
+test-fixture: null
+test-header: null
+test-includes:
+- rtems.h
+test-local-includes: []
+test-prologue: |
+ rtems_mode modes;
+test-support: |
+ static bool IsPowerOfTwo( rtems_mode mode )
+ {
+ return mode != 0 && ( mode & ( mode - 1 ) ) == 0;
+ }
+
+ static int PopCount( rtems_mode modes )
+ {
+ int count;
+
+ count = 0;
+
+ while ( modes != 0 ) {
+ ++count;
+ modes &= modes - 1;
+ }
+
+ return count;
+ }
+test-target: testsuites/validation/tc-modes.c
+type: test-case