From 46dcfe4516f387d55ee66d5c1eb527692945f145 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 17 Aug 2020 18:11:11 +0200 Subject: spec: Specify task modes --- spec/req/rtems/modes/bit-set.yml | 15 ++ spec/req/rtems/modes/default.yml | 14 ++ spec/req/rtems/modes/masks-all.yml | 16 +++ spec/req/rtems/modes/masks-unique.yml | 14 ++ spec/req/rtems/modes/masks.yml | 16 +++ spec/req/rtems/modes/unique.yml | 14 ++ spec/req/rtems/modes/val/modes.yml | 242 +++++++++++++++++++++++++++++++++ spec/req/rtems/options/val/options.yml | 2 +- 8 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 spec/req/rtems/modes/bit-set.yml create mode 100644 spec/req/rtems/modes/default.yml create mode 100644 spec/req/rtems/modes/masks-all.yml create mode 100644 spec/req/rtems/modes/masks-unique.yml create mode 100644 spec/req/rtems/modes/masks.yml create mode 100644 spec/req/rtems/modes/unique.yml create mode 100644 spec/req/rtems/modes/val/modes.yml diff --git a/spec/req/rtems/modes/bit-set.yml b/spec/req/rtems/modes/bit-set.yml new file mode 100644 index 00000000..04928658 --- /dev/null +++ b/spec/req/rtems/modes/bit-set.yml @@ -0,0 +1,15 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: +- role: requirement-refinement + uid: /if/rtems/modes/group +non-functional-type: interface +rationale: null +references: [] +requirement-type: non-functional +text: | + Each non-default task mode constant shall be a power of two representable as + an integer of type ${/if/rtems/modes/mode:/name}. +type: requirement diff --git a/spec/req/rtems/modes/default.yml b/spec/req/rtems/modes/default.yml new file mode 100644 index 00000000..3eb1c0c0 --- /dev/null +++ b/spec/req/rtems/modes/default.yml @@ -0,0 +1,14 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: +- role: requirement-refinement + uid: /if/rtems/modes/group +non-functional-type: interface +rationale: null +references: [] +requirement-type: non-functional +text: | + Each default task mode constant shall have a value of zero. +type: requirement diff --git a/spec/req/rtems/modes/masks-all.yml b/spec/req/rtems/modes/masks-all.yml new file mode 100644 index 00000000..ceb0a07f --- /dev/null +++ b/spec/req/rtems/modes/masks-all.yml @@ -0,0 +1,16 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: +- role: requirement-refinement + uid: /if/rtems/modes/all-mode-masks +non-functional-type: interface +rationale: null +references: [] +requirement-type: non-functional +text: | + The bitwise and of a task mode mask constant and + ${/if/rtems/modes/all-mode-masks:/name} shall be equal to the task mode mask + constant. +type: requirement diff --git a/spec/req/rtems/modes/masks-unique.yml b/spec/req/rtems/modes/masks-unique.yml new file mode 100644 index 00000000..770faf6d --- /dev/null +++ b/spec/req/rtems/modes/masks-unique.yml @@ -0,0 +1,14 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: +- role: requirement-refinement + uid: /if/rtems/modes/group +non-functional-type: interface +rationale: null +references: [] +requirement-type: non-functional +text: | + The task mode mask constants and 0xff shall have unique values. +type: requirement diff --git a/spec/req/rtems/modes/masks.yml b/spec/req/rtems/modes/masks.yml new file mode 100644 index 00000000..9b066881 --- /dev/null +++ b/spec/req/rtems/modes/masks.yml @@ -0,0 +1,16 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: +- role: requirement-refinement + uid: /if/rtems/modes/group +non-functional-type: interface +rationale: null +references: [] +requirement-type: non-functional +text: | + Each task mode mask constant except ${/if/rtems/modes/interrupt-mask} shall + be a power of two representable as an integer of type + ${/if/rtems/modes/mode:/name}. +type: requirement diff --git a/spec/req/rtems/modes/unique.yml b/spec/req/rtems/modes/unique.yml new file mode 100644 index 00000000..39a39b07 --- /dev/null +++ b/spec/req/rtems/modes/unique.yml @@ -0,0 +1,14 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: +- role: requirement-refinement + uid: /if/rtems/modes/group +non-functional-type: interface +rationale: null +references: [] +requirement-type: non-functional +text: | + The non-default task mode constants shall have unique values. +type: requirement diff --git a/spec/req/rtems/modes/val/modes.yml b/spec/req/rtems/modes/val/modes.yml new file mode 100644 index 00000000..cdb67966 --- /dev/null +++ b/spec/req/rtems/modes/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: ../bit-set + - role: validation + uid: /if/rtems/modes/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: ../bit-set + - role: validation + uid: /if/rtems/modes/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: ../bit-set + - role: validation + uid: /if/rtems/modes/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: ../default + - role: validation + uid: /if/rtems/modes/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: ../default + - role: validation + uid: /if/rtems/modes/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: ../default + - role: validation + uid: /if/rtems/modes/no-timeslice + - check: | + T_step_eq_u32( ${step}, RTEMS_PREEMPT, 0 ); + description: | + Check that RTEMS_PREEMPT is equal to zero. + links: + - role: validation + uid: ../default + - role: validation + uid: /if/rtems/modes/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: ../masks-all + - role: validation + uid: /if/rtems/modes/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: ../masks-all + - role: validation + uid: /if/rtems/modes/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: ../masks-all + - role: validation + uid: /if/rtems/modes/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: ../masks-all + - role: validation + uid: /if/rtems/modes/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: ../masks + - role: validation + uid: /if/rtems/modes/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: ../masks + - role: validation + uid: /if/rtems/modes/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: ../masks + - role: validation + uid: /if/rtems/modes/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: ../unique + - role: validation + uid: /if/rtems/modes/asr-mask + - role: validation + uid: /if/rtems/modes/preempt-mask + - role: validation + uid: /if/rtems/modes/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 diff --git a/spec/req/rtems/options/val/options.yml b/spec/req/rtems/options/val/options.yml index 21b01517..108d3023 100644 --- a/spec/req/rtems/options/val/options.yml +++ b/spec/req/rtems/options/val/options.yml @@ -48,7 +48,7 @@ test-actions: - role: validation uid: ../default - role: validation - uid: /if/rtems/options/default + uid: /if/rtems/options/event-all - check: | T_step_eq_u32( ${step}, RTEMS_WAIT, 0 ); description: | -- cgit v1.2.3