[rtems commit] rtems: Allow RTEMS_PRIORITY for MrsP semaphores

Sebastian Huber sebh at rtems.org
Wed Mar 17 09:48:52 UTC 2021


Module:    rtems
Branch:    5
Commit:    3a66586c9e8432eee26b0e74c49c91362e22d24d
Changeset: http://git.rtems.org/rtems/commit/?id=3a66586c9e8432eee26b0e74c49c91362e22d24d

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar 16 14:59:20 2021 +0100

rtems: Allow RTEMS_PRIORITY for MrsP semaphores

In order to improve the compatibility of RTEMS 5.2 with future version
of RTEMS which fixed #4346 allow MrsP semaphores to be created with
RTEMS_PRIORITY.

Close #4347.

---

 cpukit/rtems/src/semcreate.c       | 7 ++++++-
 testsuites/sptests/spmrsp01/init.c | 6 ------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c
index b57b635..ea89800 100644
--- a/cpukit/rtems/src/semcreate.c
+++ b/cpukit/rtems/src/semcreate.c
@@ -92,9 +92,14 @@ rtems_status_code rtems_semaphore_create(
   ) {
     variant = SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING;
   } else if (
-    mutex_with_protocol
+    ( mutex_with_protocol & ~RTEMS_PRIORITY )
       == ( RTEMS_BINARY_SEMAPHORE | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING )
   ) {
+    /*
+     * In RTEMS 5.2 using RTEMS_FIFO and RTEMS_PRIORITY for MrsP semaphores is
+     * allowed.  In RTEMS 6, RTEMS_PRIORITY is required for MrsP semaphores
+     * analogous to priority ceiling semaphores.
+     */
 #if defined(RTEMS_SMP)
     variant = SEMAPHORE_VARIANT_MRSP;
 #else
diff --git a/testsuites/sptests/spmrsp01/init.c b/testsuites/sptests/spmrsp01/init.c
index a5f645d..801b679 100644
--- a/testsuites/sptests/spmrsp01/init.c
+++ b/testsuites/sptests/spmrsp01/init.c
@@ -72,12 +72,6 @@ static void test_mrsp_create_errors(void)
 
   create_not_defined(
     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
-      | RTEMS_BINARY_SEMAPHORE
-      | RTEMS_PRIORITY
-  );
-
-  create_not_defined(
-    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
       | RTEMS_INHERIT_PRIORITY
       | RTEMS_BINARY_SEMAPHORE
   );



More information about the vc mailing list