[rtems commit] rtems: classic api to/from core priority conversions

Gedare Bloom gedare at rtems.org
Sun Dec 22 01:05:03 UTC 2013


Module:    rtems
Branch:    master
Commit:    2bafb96037ae80be736e6df05fa3d91aeb4a4063
Changeset: http://git.rtems.org/rtems/commit/?id=2bafb96037ae80be736e6df05fa3d91aeb4a4063

Author:    Daniel Ramirez <javamonn at gmail.com>
Date:      Fri Dec 20 21:44:12 2013 -0600

rtems: classic api to/from core priority conversions

---

 cpukit/libmisc/capture/capture.c             |    5 ++++-
 cpukit/rtems/include/rtems/rtems/tasksimpl.h |   12 ++++++++++++
 cpukit/rtems/src/semcreate.c                 |    5 ++++-
 cpukit/rtems/src/taskmp.c                    |    2 +-
 cpukit/rtems/src/tasksetpriority.c           |    8 ++++++--
 5 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/cpukit/libmisc/capture/capture.c b/cpukit/libmisc/capture/capture.c
index 5ebc967..3f81a1d 100644
--- a/cpukit/libmisc/capture/capture.c
+++ b/cpukit/libmisc/capture/capture.c
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <rtems/rtems/tasksimpl.h>
 
 #include "capture.h"
 
@@ -433,7 +434,9 @@ rtems_capture_create_capture_task (rtems_tcb* new_task)
 
   task->tcb->extensions[capture_extension_index] = task;
 
-  task->start_priority = new_task->Start.initial_priority;
+  task->start_priority = _RTEMS_tasks_Priority_from_Core(
+                           new_task->Start.initial_priority
+                         );
   task->stack_size     = new_task->Start.Initial_stack.size;
   task->stack_clean    = task->stack_size;
 
diff --git a/cpukit/rtems/include/rtems/rtems/tasksimpl.h b/cpukit/rtems/include/rtems/rtems/tasksimpl.h
index 379b1bc..982572e 100644
--- a/cpukit/rtems/include/rtems/rtems/tasksimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/tasksimpl.h
@@ -116,6 +116,18 @@ RTEMS_INLINE_ROUTINE Priority_Control _RTEMS_tasks_Priority_to_Core(
 }
 
 /**
+ *  @brief Converts a core priority into an RTEMS API priority.
+ *
+ *  This function converts a core priority into an RTEMS API priority.
+ */
+RTEMS_INLINE_ROUTINE rtems_task_priority _RTEMS_tasks_Priority_from_Core (
+  Priority_Control priority
+)
+{
+  return (rtems_task_priority) priority;
+}
+
+/**
  *  @brief Checks whether the priority is a valid user task.
  *
  *  This function returns TRUE if the_priority is a valid user task priority
diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c
index 5ac57dc..517dc7f 100644
--- a/cpukit/rtems/src/semcreate.c
+++ b/cpukit/rtems/src/semcreate.c
@@ -25,6 +25,7 @@
 #include <rtems/score/isr.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/semimpl.h>
+#include <rtems/rtems/tasksimpl.h>
 #include <rtems/score/coremuteximpl.h>
 #include <rtems/score/coresemimpl.h>
 #include <rtems/score/threaddispatch.h>
@@ -156,7 +157,9 @@ rtems_status_code rtems_semaphore_create(
       the_mutex_attr.discipline = CORE_MUTEX_DISCIPLINES_FIFO;
 
     if ( _Attributes_Is_binary_semaphore( attribute_set ) ) {
-      the_mutex_attr.priority_ceiling      = priority_ceiling;
+      the_mutex_attr.priority_ceiling      = _RTEMS_tasks_Priority_to_Core(
+                                               priority_ceiling
+                                             );
       the_mutex_attr.lock_nesting_behavior = CORE_MUTEX_NESTING_ACQUIRES;
       the_mutex_attr.only_owner_release    = false;
 
diff --git a/cpukit/rtems/src/taskmp.c b/cpukit/rtems/src/taskmp.c
index 5f29f20..9eaee45 100644
--- a/cpukit/rtems/src/taskmp.c
+++ b/cpukit/rtems/src/taskmp.c
@@ -80,7 +80,7 @@ void _RTEMS_tasks_MP_Send_process_packet (
 rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
   RTEMS_tasks_MP_Remote_operations operation,
   Objects_Id                       task_id,
-  rtems_task_priority                 new_priority,
+  rtems_task_priority              new_priority,
   uint32_t                         notepad,
   uint32_t                         note
 )
diff --git a/cpukit/rtems/src/tasksetpriority.c b/cpukit/rtems/src/tasksetpriority.c
index 385990c..8c1b88b 100644
--- a/cpukit/rtems/src/tasksetpriority.c
+++ b/cpukit/rtems/src/tasksetpriority.c
@@ -42,9 +42,13 @@ rtems_status_code rtems_task_set_priority(
 
     case OBJECTS_LOCAL:
       /* XXX need helper to "convert" from core priority */
-      *old_priority = the_thread->current_priority;
+      *old_priority = _RTEMS_tasks_Priority_from_Core(
+                        the_thread->current_priority
+                      );
       if ( new_priority != RTEMS_CURRENT_PRIORITY ) {
-        the_thread->real_priority = new_priority;
+        the_thread->real_priority = _RTEMS_tasks_Priority_to_Core(
+                                      new_priority
+                                    );
         if ( the_thread->resource_count == 0 ||
              the_thread->current_priority > new_priority )
           _Thread_Change_priority( the_thread, new_priority, false );




More information about the vc mailing list