diff options
author | Daniel Ramirez <javamonn@gmail.com> | 2013-12-20 21:44:12 -0600 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2013-12-21 20:09:02 -0500 |
commit | 2bafb96037ae80be736e6df05fa3d91aeb4a4063 (patch) | |
tree | f1e1605c0e407d0d789d108ca7ef98c533dc16ff /cpukit | |
parent | psxtests/psxfatal01: add doc file (diff) | |
download | rtems-2bafb96037ae80be736e6df05fa3d91aeb4a4063.tar.bz2 |
rtems: classic api to/from core priority conversions
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libmisc/capture/capture.c | 5 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/tasksimpl.h | 12 | ||||
-rw-r--r-- | cpukit/rtems/src/semcreate.c | 5 | ||||
-rw-r--r-- | cpukit/rtems/src/taskmp.c | 2 | ||||
-rw-r--r-- | 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 5ebc967d08..3f81a1d20d 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 379b1bcfbb..982572ea21 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 5ac57dc568..517dc7f3a0 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 5f29f20186..9eaee45805 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 385990c635..8c1b88b1ed 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 ); |