forked from Imagelibrary/rtems
score: Add and use _Thread_Get_unmapped_priority().
Add and use _Thread_Get_unmapped_real_priority().
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/rtems/tasksimpl.h>
|
||||
#include <rtems/score/schedulerimpl.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -890,7 +889,7 @@ rtems_capture_task_start_priority (rtems_tcb* tcb)
|
||||
static inline rtems_task_priority
|
||||
rtems_capture_task_real_priority (rtems_tcb* tcb)
|
||||
{
|
||||
return SCHEDULER_PRIORITY_UNMAP (tcb->Real_priority.priority);
|
||||
return _Thread_Get_unmapped_real_priority (tcb);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -905,7 +904,7 @@ rtems_capture_task_real_priority (rtems_tcb* tcb)
|
||||
static inline rtems_task_priority
|
||||
rtems_capture_task_curr_priority (rtems_tcb* tcb)
|
||||
{
|
||||
return SCHEDULER_PRIORITY_UNMAP (_Thread_Get_priority (tcb));
|
||||
return _Thread_Get_unmapped_priority (tcb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,36 +39,6 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Maps a priority value to support the append indicator.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_MAP( priority ) ( ( priority ) << 1 )
|
||||
|
||||
/**
|
||||
* @brief Returns the plain priority value.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_UNMAP( priority ) ( ( priority ) >> 1 )
|
||||
|
||||
/**
|
||||
* @brief Clears the priority append indicator bit.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_PURIFY( priority ) \
|
||||
( ( priority ) & ~( (Priority_Control) SCHEDULER_PRIORITY_APPEND_FLAG ) )
|
||||
|
||||
/**
|
||||
* @brief Returns the priority control with the append indicator bit set.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_APPEND( priority ) \
|
||||
( ( priority ) | SCHEDULER_PRIORITY_APPEND_FLAG )
|
||||
|
||||
/**
|
||||
* @brief Returns true, if the item should be appended to its priority group,
|
||||
* otherwise returns false and the item should be prepended to its priority
|
||||
* group.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_IS_APPEND( priority ) \
|
||||
( ( ( priority ) & SCHEDULER_PRIORITY_APPEND_FLAG ) != 0 )
|
||||
|
||||
/**
|
||||
* @brief Initializes the scheduler to the policy chosen by the user.
|
||||
*
|
||||
|
||||
@@ -50,6 +50,36 @@ extern "C" {
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_APPEND_FLAG 1
|
||||
|
||||
/**
|
||||
* @brief Maps a priority value to support the append indicator.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_MAP( priority ) ( ( priority ) << 1 )
|
||||
|
||||
/**
|
||||
* @brief Returns the plain priority value.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_UNMAP( priority ) ( ( priority ) >> 1 )
|
||||
|
||||
/**
|
||||
* @brief Clears the priority append indicator bit.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_PURIFY( priority ) \
|
||||
( ( priority ) & ~( (Priority_Control) SCHEDULER_PRIORITY_APPEND_FLAG ) )
|
||||
|
||||
/**
|
||||
* @brief Returns the priority control with the append indicator bit set.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_APPEND( priority ) \
|
||||
( ( priority ) | SCHEDULER_PRIORITY_APPEND_FLAG )
|
||||
|
||||
/**
|
||||
* @brief Returns true, if the item should be appended to its priority group,
|
||||
* otherwise returns false and the item should be prepended to its priority
|
||||
* group.
|
||||
*/
|
||||
#define SCHEDULER_PRIORITY_IS_APPEND( priority ) \
|
||||
( ( ( priority ) & SCHEDULER_PRIORITY_APPEND_FLAG ) != 0 )
|
||||
|
||||
/**
|
||||
* @brief Initializes a node.
|
||||
*
|
||||
|
||||
@@ -1600,6 +1600,34 @@ RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_priority(
|
||||
return _Priority_Get_priority( &scheduler_node->Wait.Priority );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the unmapped priority of the thread.
|
||||
*
|
||||
* @param the_thread The thread of which to get the unmapped priority.
|
||||
*
|
||||
* @return The unmapped priority of the thread.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_priority(
|
||||
const Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
return SCHEDULER_PRIORITY_UNMAP( _Thread_Get_priority( the_thread ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the unmapped real priority of the thread.
|
||||
*
|
||||
* @param the_thread The thread of which to get the unmapped real priority.
|
||||
*
|
||||
* @return The unmapped real priority of the thread.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_real_priority(
|
||||
const Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
return SCHEDULER_PRIORITY_UNMAP( the_thread->Real_priority.priority );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Acquires the thread wait default lock inside a critical section
|
||||
* (interrupts disabled).
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/assoc.h>
|
||||
#include <rtems/score/schedulerimpl.h>
|
||||
#include <rtems/score/threadimpl.h>
|
||||
|
||||
#include <rtems/debugger/rtems-debugger-server.h>
|
||||
@@ -504,13 +503,13 @@ rtems_debugger_thread_is_stepping(rtems_id id, DB_UINT pc)
|
||||
int
|
||||
rtems_debugger_thread_current_priority(rtems_debugger_thread* thread)
|
||||
{
|
||||
return SCHEDULER_PRIORITY_UNMAP(_Thread_Get_priority(thread->tcb));
|
||||
return _Thread_Get_unmapped_priority(thread->tcb);
|
||||
}
|
||||
|
||||
int
|
||||
rtems_debugger_thread_real_priority(rtems_debugger_thread* thread)
|
||||
{
|
||||
return SCHEDULER_PRIORITY_UNMAP(thread->tcb->Real_priority.priority);
|
||||
return _Thread_Get_unmapped_real_priority(thread->tcb);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -448,8 +448,8 @@ rtems_cpuusage_top_thread (rtems_task_argument arg)
|
||||
" 0x%08" PRIx32 " | %-19s | %3" PRId64 " | %3" PRId64 " | ",
|
||||
thread->Object.id,
|
||||
name,
|
||||
thread->Real_priority.priority,
|
||||
_Thread_Get_priority(thread));
|
||||
_Thread_Get_unmapped_real_priority(thread),
|
||||
_Thread_Get_unmapped_priority(thread));
|
||||
|
||||
usage = data->usage[i];
|
||||
current_usage = data->current_usage[i];
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/monitor.h>
|
||||
#include <rtems/rtems/tasksdata.h>
|
||||
#include <rtems/score/schedulerimpl.h>
|
||||
#include <rtems/score/threadimpl.h>
|
||||
#include <rtems/score/threadqimpl.h>
|
||||
|
||||
@@ -112,9 +111,7 @@ rtems_monitor_task_canonical(
|
||||
canonical_task->entry = rtems_thread->Start.Entry;
|
||||
canonical_task->stack = rtems_thread->Start.Initial_stack.area;
|
||||
canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
|
||||
canonical_task->priority = SCHEDULER_PRIORITY_UNMAP(
|
||||
_Thread_Get_priority( rtems_thread )
|
||||
);
|
||||
canonical_task->priority = _Thread_Get_unmapped_priority( rtems_thread );
|
||||
canonical_task->events = api->Event.pending_events;
|
||||
/*
|
||||
* FIXME: make this optionally cpu_time_executed
|
||||
|
||||
Reference in New Issue
Block a user