forked from Imagelibrary/rtems
score: Delete unused _Scheduler_Priority_compare()
By convention, thread priorities must be integers in RTEMS. Smaller values represent more important threads.
This commit is contained in:
@@ -239,7 +239,6 @@ libscore_a_SOURCES += src/schedulerdefaultupdate.c
|
||||
libscore_a_SOURCES += src/schedulerpriority.c \
|
||||
src/schedulerpriorityblock.c \
|
||||
src/schedulerprioritychangepriority.c \
|
||||
src/schedulerpriorityprioritycompare.c \
|
||||
src/schedulerpriorityschedule.c \
|
||||
src/schedulerpriorityunblock.c \
|
||||
src/schedulerpriorityupdate.c \
|
||||
@@ -258,7 +257,6 @@ libscore_a_SOURCES += src/scheduleredf.c \
|
||||
src/scheduleredfnodeinit.c \
|
||||
src/scheduleredfblock.c \
|
||||
src/scheduleredfchangepriority.c \
|
||||
src/scheduleredfprioritycompare.c \
|
||||
src/scheduleredfreleasejob.c \
|
||||
src/scheduleredfschedule.c \
|
||||
src/scheduleredfunblock.c \
|
||||
|
||||
@@ -129,12 +129,6 @@ typedef struct {
|
||||
Priority_Control
|
||||
);
|
||||
|
||||
/** @see _Scheduler_Priority_compare() */
|
||||
int ( *priority_compare )(
|
||||
Priority_Control,
|
||||
Priority_Control
|
||||
);
|
||||
|
||||
/** @see _Scheduler_Release_job() */
|
||||
void ( *release_job ) (
|
||||
const Scheduler_Control *,
|
||||
|
||||
@@ -59,7 +59,6 @@ extern "C" {
|
||||
_Scheduler_CBS_Node_initialize, /* node initialize entry point */ \
|
||||
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
|
||||
_Scheduler_EDF_Update_priority, /* update priority entry point */ \
|
||||
_Scheduler_EDF_Priority_compare, /* compares two priorities */ \
|
||||
_Scheduler_CBS_Release_job, /* new period of task */ \
|
||||
_Scheduler_default_Tick, /* tick entry point */ \
|
||||
_Scheduler_default_Start_idle /* start idle entry point */ \
|
||||
|
||||
@@ -52,7 +52,6 @@ extern "C" {
|
||||
_Scheduler_EDF_Node_initialize, /* node initialize entry point */ \
|
||||
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
|
||||
_Scheduler_EDF_Update_priority, /* update priority entry point */ \
|
||||
_Scheduler_EDF_Priority_compare, /* compares two priorities */ \
|
||||
_Scheduler_EDF_Release_job, /* new period of task */ \
|
||||
_Scheduler_default_Tick, /* tick entry point */ \
|
||||
_Scheduler_default_Start_idle /* start idle entry point */ \
|
||||
@@ -225,19 +224,6 @@ Scheduler_Void_or_thread _Scheduler_EDF_Yield(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Explicitly compare absolute dedlines (priorities) of threads.
|
||||
*
|
||||
* This routine explicitly compares absolute dedlines (priorities) of threads.
|
||||
* In case of EDF scheduling time overflow is taken into account.
|
||||
*
|
||||
* @retval >0 for p1 > p2; 0 for p1 == p2; <0 for p1 < p2.
|
||||
*/
|
||||
int _Scheduler_EDF_Priority_compare (
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Called when a new job of task is released.
|
||||
*
|
||||
|
||||
@@ -44,6 +44,11 @@ RTEMS_INLINE_ROUTINE Scheduler_EDF_Node *_Scheduler_EDF_Thread_get_node(
|
||||
return (Scheduler_EDF_Node *) _Scheduler_Thread_get_node( the_thread );
|
||||
}
|
||||
|
||||
int _Scheduler_EDF_Priority_compare (
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
);
|
||||
|
||||
RBTree_Compare_result _Scheduler_EDF_Compare(
|
||||
const RBTree_Node* n1,
|
||||
const RBTree_Node* n2
|
||||
|
||||
@@ -481,31 +481,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority(
|
||||
_Scheduler_Release_critical( scheduler, &lock_context );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compares two priority values.
|
||||
*
|
||||
* @param[in] scheduler The scheduler instance.
|
||||
* @param[in] p1 The first priority value.
|
||||
* @param[in] p2 The second priority value.
|
||||
*
|
||||
* @retval negative The value @a p1 encodes a lower priority than @a p2 in the
|
||||
* intuitive sense of priority.
|
||||
* @retval 0 The priorities @a p1 and @a p2 are equal.
|
||||
* @retval positive The value @a p1 encodes a higher priority than @a p2 in the
|
||||
* intuitive sense of priority.
|
||||
*
|
||||
* @see _Scheduler_Is_priority_lower_than() and
|
||||
* _Scheduler_Is_priority_higher_than().
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
|
||||
const Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
return ( *scheduler->Operations.priority_compare )( p1, p2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Releases a job of a thread with respect to the scheduler.
|
||||
*
|
||||
@@ -746,32 +721,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns true if @a p1 encodes a lower priority than @a p2 in the
|
||||
* intuitive sense of priority.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
|
||||
const Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
return _Scheduler_Priority_compare( scheduler, p1, p2 ) < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns true if @a p1 encodes a higher priority than @a p2 in the
|
||||
* intuitive sense of priority.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
|
||||
const Scheduler_Control *scheduler,
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
return _Scheduler_Priority_compare( scheduler, p1, p2 ) > 0;
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE uint32_t _Scheduler_Get_processor_count(
|
||||
const Scheduler_Control *scheduler
|
||||
)
|
||||
|
||||
@@ -49,7 +49,6 @@ extern "C" {
|
||||
_Scheduler_default_Node_initialize, /* node initialize entry point */ \
|
||||
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
|
||||
_Scheduler_priority_Update_priority, /* update priority entry point */ \
|
||||
_Scheduler_priority_Priority_compare, /* compares two priorities */ \
|
||||
_Scheduler_default_Release_job, /* new period of task */ \
|
||||
_Scheduler_default_Tick, /* tick entry point */ \
|
||||
_Scheduler_default_Start_idle /* start idle entry point */ \
|
||||
@@ -189,18 +188,6 @@ Scheduler_Void_or_thread _Scheduler_priority_Yield(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Compare two priorities.
|
||||
*
|
||||
* This routine compares two priorities.
|
||||
*
|
||||
* @retval >0 for p1 > p2; 0 for p1 == p2; <0 for p1 < p2.
|
||||
*/
|
||||
int _Scheduler_priority_Priority_compare(
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
);
|
||||
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -59,7 +59,6 @@ extern "C" {
|
||||
_Scheduler_priority_affinity_SMP_Node_initialize, \
|
||||
_Scheduler_default_Node_destroy, \
|
||||
_Scheduler_priority_SMP_Update_priority, \
|
||||
_Scheduler_priority_Priority_compare, \
|
||||
_Scheduler_default_Release_job, \
|
||||
_Scheduler_default_Tick, \
|
||||
_Scheduler_SMP_Start_idle, \
|
||||
|
||||
@@ -219,23 +219,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Priority comparison.
|
||||
*
|
||||
* This routine implements priority comparison for priority-based
|
||||
* scheduling.
|
||||
*
|
||||
* @return >0 for higher priority, 0 for equal and <0 for lower priority.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body(
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
/* High priority in priority scheduler is represented by low numbers. */
|
||||
return ( p2 - p1 );
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -88,7 +88,6 @@ typedef struct {
|
||||
_Scheduler_priority_SMP_Node_initialize, \
|
||||
_Scheduler_default_Node_destroy, \
|
||||
_Scheduler_priority_SMP_Update_priority, \
|
||||
_Scheduler_priority_Priority_compare, \
|
||||
_Scheduler_default_Release_job, \
|
||||
_Scheduler_default_Tick, \
|
||||
_Scheduler_SMP_Start_idle \
|
||||
|
||||
@@ -49,7 +49,6 @@ extern "C" {
|
||||
_Scheduler_default_Node_initialize, /* node initialize entry point */ \
|
||||
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
|
||||
_Scheduler_default_Update_priority, /* update priority entry point */ \
|
||||
_Scheduler_priority_Priority_compare, /* compares two priorities */ \
|
||||
_Scheduler_default_Release_job, /* new period of task */ \
|
||||
_Scheduler_default_Tick, /* tick entry point */ \
|
||||
_Scheduler_default_Start_idle /* start idle entry point */ \
|
||||
|
||||
@@ -71,7 +71,6 @@ typedef struct {
|
||||
_Scheduler_simple_SMP_Node_initialize, \
|
||||
_Scheduler_default_Node_destroy, \
|
||||
_Scheduler_simple_SMP_Update_priority, \
|
||||
_Scheduler_priority_Priority_compare, \
|
||||
_Scheduler_default_Release_job, \
|
||||
_Scheduler_default_Tick, \
|
||||
_Scheduler_SMP_Start_idle \
|
||||
|
||||
@@ -88,7 +88,6 @@ typedef struct {
|
||||
_Scheduler_strong_APA_Node_initialize, \
|
||||
_Scheduler_default_Node_destroy, \
|
||||
_Scheduler_strong_APA_Update_priority, \
|
||||
_Scheduler_priority_Priority_compare, \
|
||||
_Scheduler_default_Release_job, \
|
||||
_Scheduler_default_Tick, \
|
||||
_Scheduler_SMP_Start_idle \
|
||||
|
||||
@@ -79,11 +79,10 @@ Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
|
||||
* a pseudo-ISR system task, we need to do a context switch.
|
||||
*/
|
||||
if (
|
||||
_Scheduler_Is_priority_higher_than(
|
||||
scheduler,
|
||||
the_thread->current_priority,
|
||||
_Thread_Heir->current_priority
|
||||
)
|
||||
_Scheduler_EDF_Priority_compare(
|
||||
the_thread->current_priority,
|
||||
_Thread_Heir->current_priority
|
||||
) == 1
|
||||
) {
|
||||
_Scheduler_Update_heir(
|
||||
the_thread,
|
||||
|
||||
@@ -20,6 +20,28 @@
|
||||
|
||||
#include <rtems/score/scheduleredfimpl.h>
|
||||
|
||||
int _Scheduler_EDF_Priority_compare (
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
Watchdog_Interval time = _Watchdog_Ticks_since_boot;
|
||||
|
||||
/*
|
||||
* Reorder priorities to separate deadline driven and background tasks.
|
||||
*
|
||||
* The background tasks have p1 or p2 > SCHEDULER_EDF_PRIO_MSB.
|
||||
* The deadline driven tasks need to have subtracted current time in order
|
||||
* to see which deadline is closer wrt. current time.
|
||||
*/
|
||||
if (!(p1 & SCHEDULER_EDF_PRIO_MSB))
|
||||
p1 = (p1 - time) & ~SCHEDULER_EDF_PRIO_MSB;
|
||||
if (!(p2 & SCHEDULER_EDF_PRIO_MSB))
|
||||
p2 = (p2 - time) & ~SCHEDULER_EDF_PRIO_MSB;
|
||||
|
||||
return ((p1<p2) - (p1>p2));
|
||||
}
|
||||
|
||||
RBTree_Compare_result _Scheduler_EDF_Compare(
|
||||
const RBTree_Node* n1,
|
||||
const RBTree_Node* n2
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Compares Priorities of Threads
|
||||
*
|
||||
* @ingroup ScoreScheduler
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 Petr Benes.
|
||||
* Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/config.h>
|
||||
#include <rtems/score/scheduleredf.h>
|
||||
#include <rtems/score/watchdogimpl.h>
|
||||
|
||||
int _Scheduler_EDF_Priority_compare (
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
Watchdog_Interval time = _Watchdog_Ticks_since_boot;
|
||||
|
||||
/*
|
||||
* Reorder priorities to separate deadline driven and background tasks.
|
||||
*
|
||||
* The background tasks have p1 or p2 > SCHEDULER_EDF_PRIO_MSB.
|
||||
* The deadline driven tasks need to have subtracted current time in order
|
||||
* to see which deadline is closer wrt. current time.
|
||||
*/
|
||||
if (!(p1 & SCHEDULER_EDF_PRIO_MSB))
|
||||
p1 = (p1 - time) & ~SCHEDULER_EDF_PRIO_MSB;
|
||||
if (!(p2 & SCHEDULER_EDF_PRIO_MSB))
|
||||
p2 = (p2 - time) & ~SCHEDULER_EDF_PRIO_MSB;
|
||||
|
||||
return ((p1<p2) - (p1>p2));
|
||||
}
|
||||
@@ -42,10 +42,12 @@ Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
|
||||
* Even if the thread isn't preemptible, if the new heir is
|
||||
* a pseudo-ISR system task, we need to do a context switch.
|
||||
*/
|
||||
if ( _Scheduler_Is_priority_lower_than(
|
||||
scheduler,
|
||||
_Thread_Heir->current_priority,
|
||||
the_thread->current_priority )) {
|
||||
if (
|
||||
_Scheduler_EDF_Priority_compare(
|
||||
the_thread->current_priority,
|
||||
_Thread_Heir->current_priority
|
||||
) == 1
|
||||
) {
|
||||
_Scheduler_Update_heir(
|
||||
the_thread,
|
||||
the_thread->current_priority == PRIORITY_PSEUDO_ISR
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Scheduler Priority Compare Two Priorities
|
||||
* @ingroup ScoreScheduler
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
|
||||
int _Scheduler_priority_Priority_compare(
|
||||
Priority_Control p1,
|
||||
Priority_Control p2
|
||||
)
|
||||
{
|
||||
return _Scheduler_priority_Priority_compare_body( p1, p2 );
|
||||
}
|
||||
Reference in New Issue
Block a user