summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/scheduleredf.c
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 /cpukit/score/src/scheduleredf.c
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.
Diffstat (limited to 'cpukit/score/src/scheduleredf.c')
-rw-r--r--cpukit/score/src/scheduleredf.c22
1 files changed, 22 insertions, 0 deletions
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