rtems: classic api to/from core priority conversions

This commit is contained in:
Daniel Ramirez
2013-12-20 21:44:12 -06:00
committed by Gedare Bloom
parent 1464599482
commit 2bafb96037
5 changed files with 27 additions and 5 deletions

View File

@@ -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;

View File

@@ -115,6 +115,18 @@ RTEMS_INLINE_ROUTINE Priority_Control _RTEMS_tasks_Priority_to_Core(
return (Priority_Control) priority;
}
/**
* @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.
*

View File

@@ -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;

View File

@@ -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
)

View File

@@ -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 );