summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-09 16:55:50 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-22 14:00:29 +0200
commitb8f76fa28e1e7258fbf9b15894fbf1be5b1fbe15 (patch)
treed780b7d2003db61829f9663499a16936b7e32ace
parentrtems: Rework RTEMS API to SuperCore priority (diff)
downloadrtems-b8f76fa28e1e7258fbf9b15894fbf1be5b1fbe15.tar.bz2
score: Delete unused _Scheduler_Priority_compare()
By convention, thread priorities must be integers in RTEMS. Smaller values represent more important threads.
-rw-r--r--cpukit/score/Makefile.am2
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h6
-rw-r--r--cpukit/score/include/rtems/score/schedulercbs.h1
-rw-r--r--cpukit/score/include/rtems/score/scheduleredf.h14
-rw-r--r--cpukit/score/include/rtems/score/scheduleredfimpl.h5
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h51
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h13
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h1
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityimpl.h17
-rw-r--r--cpukit/score/include/rtems/score/schedulerprioritysmp.h1
-rw-r--r--cpukit/score/include/rtems/score/schedulersimple.h1
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h1
-rw-r--r--cpukit/score/include/rtems/score/schedulerstrongapa.h1
-rw-r--r--cpukit/score/src/schedulercbsunblock.c9
-rw-r--r--cpukit/score/src/scheduleredf.c22
-rw-r--r--cpukit/score/src/scheduleredfprioritycompare.c47
-rw-r--r--cpukit/score/src/scheduleredfunblock.c10
-rw-r--r--cpukit/score/src/schedulerpriorityprioritycompare.c29
18 files changed, 37 insertions, 194 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 537cf60c1a..7166d72750 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -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 \
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 1e6236fa4d..2e9aba5072 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -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 *,
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index e390532343..397488fc40 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -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 */ \
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 137ea3abde..7d513ca416 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -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 */ \
@@ -226,19 +225,6 @@ Scheduler_Void_or_thread _Scheduler_EDF_Yield(
);
/**
- * @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.
*
* This routine is called when a new job of task is released.
diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h
index 4feea71e51..e831caf9f9 100644
--- a/cpukit/score/include/rtems/score/scheduleredfimpl.h
+++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h
@@ -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
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index bfc6df330a..50061fbe67 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -482,31 +482,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority(
}
/**
- * @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.
*
* @param[in] the_thread The thread.
@@ -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
)
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 5859af12f3..07599416d6 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -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
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index dd0085a681..e2d6f3b1c7 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -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, \
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index a18840fb4c..d709818473 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -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
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index d8ce7dc1dd..d550c78836 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -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 \
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index a546ed629f..9e40c4ac44 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -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 */ \
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 342a574174..b9433534c6 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -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 \
diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h
index 5222cd0605..4f95aac8fb 100644
--- a/cpukit/score/include/rtems/score/schedulerstrongapa.h
+++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h
@@ -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 \
diff --git a/cpukit/score/src/schedulercbsunblock.c b/cpukit/score/src/schedulercbsunblock.c
index 7898588bf2..05e155a4c3 100644
--- a/cpukit/score/src/schedulercbsunblock.c
+++ b/cpukit/score/src/schedulercbsunblock.c
@@ -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,
diff --git a/cpukit/score/src/scheduleredf.c b/cpukit/score/src/scheduleredf.c
index 00b6181e59..372612819a 100644
--- a/cpukit/score/src/scheduleredf.c
+++ b/cpukit/score/src/scheduleredf.c
@@ -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
diff --git a/cpukit/score/src/scheduleredfprioritycompare.c b/cpukit/score/src/scheduleredfprioritycompare.c
deleted file mode 100644
index 0fbfaa621f..0000000000
--- a/cpukit/score/src/scheduleredfprioritycompare.c
+++ /dev/null
@@ -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));
-}
diff --git a/cpukit/score/src/scheduleredfunblock.c b/cpukit/score/src/scheduleredfunblock.c
index 977534214c..43d9753d34 100644
--- a/cpukit/score/src/scheduleredfunblock.c
+++ b/cpukit/score/src/scheduleredfunblock.c
@@ -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
diff --git a/cpukit/score/src/schedulerpriorityprioritycompare.c b/cpukit/score/src/schedulerpriorityprioritycompare.c
deleted file mode 100644
index 6879d01ee4..0000000000
--- a/cpukit/score/src/schedulerpriorityprioritycompare.c
+++ /dev/null
@@ -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 );
-}