summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-09-01 18:13:54 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-09-01 18:13:54 +0000
commitac9d2ecc46ea40b6da0ccaeeabd16e8c19ff47e0 (patch)
tree4f87d546461e9cc7cfd18ccc187073161fb333b7 /cpukit/score/include
parent2011-09-01 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-ac9d2ecc46ea40b6da0ccaeeabd16e8c19ff47e0.tar.bz2
2011-09-01 Petr Benes <benesp16@fel.cvut.cz>
PR 1895/cpukit * rtems/src/ratemoncancel.c, rtems/src/ratemondelete.c, rtems/src/ratemonperiod.c, sapi/include/confdefs.h, score/Makefile.am, score/include/rtems/score/scheduler.h, score/include/rtems/score/schedulerpriority.h, score/include/rtems/score/schedulersimple.h, score/include/rtems/score/schedulersimplesmp.h, score/inline/rtems/score/scheduler.inl, score/inline/rtems/score/schedulerpriority.inl, score/src/coremutexseize.c: Add priority_compare and release_job hooks interfaces to scheduler interface. * score/src/schedulerpriorityprioritycompare.c, score/src/schedulerpriorityreleasejob.c: New files.
Diffstat (limited to 'cpukit/score/include')
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h24
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h50
-rw-r--r--cpukit/score/include/rtems/score/schedulersimple.h26
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h27
4 files changed, 91 insertions, 36 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 26ccdc9a6a..f899391128 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -77,8 +77,18 @@ typedef struct {
/** extract a thread from the ready set */
void ( *extract )(Thread_Control *);
+ /**
+ * Compares two priorities (returns >0 for higher priority, 0 for equal
+ * and <0 for lower priority).
+ */
+ int ( *priority_compare )(Priority_Control, Priority_Control);
+
+ /** This routine is called upon release of a new job. */
+ void ( *release_job ) (Thread_Control *, uint32_t);
+
/** perform scheduler update actions required at each clock tick */
void ( *tick )(void);
+
} Scheduler_Operations;
/**
@@ -107,6 +117,20 @@ typedef struct {
extern Scheduler_Control _Scheduler;
/**
+ * Macro testing whether @a p1 has lower priority than @a p2
+ * in the intuitive sense of priority.
+ */
+#define _Scheduler_Is_priority_lower_than( _p1, _p2 ) \
+ (_Scheduler_Priority_compare(_p1,_p2) < 0)
+
+/**
+ * Macro testing whether @a p1 has higher priority than @a p2
+ * in the intuitive sense of priority.
+ */
+#define _Scheduler_Is_priority_higher_than( _p1, _p2 ) \
+ (_Scheduler_Priority_compare(_p1,_p2) > 0)
+
+/**
* This routine initializes the scheduler to the policy chosen by the user
* through confdefs, or to the priority scheduler with ready chains by
* default.
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 2f164b7635..eaea71bd17 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -38,18 +38,20 @@ extern "C" {
*/
#define SCHEDULER_PRIORITY_ENTRY_POINTS \
{ \
- _Scheduler_priority_Initialize, /* initialize entry point */ \
- _Scheduler_priority_Schedule, /* schedule entry point */ \
- _Scheduler_priority_Yield, /* yield entry point */ \
- _Scheduler_priority_Block, /* block entry point */ \
- _Scheduler_priority_Unblock, /* unblock entry point */ \
- _Scheduler_priority_Allocate, /* allocate entry point */ \
- _Scheduler_priority_Free, /* free entry point */ \
- _Scheduler_priority_Update, /* update entry point */ \
- _Scheduler_priority_Enqueue, /* enqueue entry point */ \
- _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \
- _Scheduler_priority_Extract, /* extract entry point */ \
- _Scheduler_priority_Tick /* tick entry point */ \
+ _Scheduler_priority_Initialize, /* initialize entry point */ \
+ _Scheduler_priority_Schedule, /* schedule entry point */ \
+ _Scheduler_priority_Yield, /* yield entry point */ \
+ _Scheduler_priority_Block, /* block entry point */ \
+ _Scheduler_priority_Unblock, /* unblock entry point */ \
+ _Scheduler_priority_Allocate, /* allocate entry point */ \
+ _Scheduler_priority_Free, /* free entry point */ \
+ _Scheduler_priority_Update, /* update entry point */ \
+ _Scheduler_priority_Enqueue, /* enqueue entry point */ \
+ _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \
+ _Scheduler_priority_Extract, /* extract entry point */ \
+ _Scheduler_priority_Priority_compare, /* compares two priorities */ \
+ _Scheduler_priority_Release_job, /* new period of task */ \
+ _Scheduler_priority_Tick /* tick entry point */ \
}
/**
@@ -172,6 +174,30 @@ void _Scheduler_priority_Extract(
);
/**
+ * @brief Scheduler priority Priority compare
+ *
+ * This routine compares two priorities.
+ */
+int _Scheduler_priority_Priority_compare(
+ Priority_Control p1,
+ Priority_Control p2
+);
+
+/**
+ * @brief Scheduler priority Release job
+ *
+ * This routine is called when a new job of task is released.
+ *
+ * @param[in] the_thread is the owner of the job.
+ * @param[in] deadline of the new job from now. If equal to 0,
+ * the job was cancelled or deleted.
+ */
+void _Scheduler_priority_Release_job (
+ Thread_Control *the_thread,
+ uint32_t deadline
+);
+
+/**
* @brief Deterministic Priority Scheduler Tick Method
*
* This routine is invoked as part of processing each clock tick.
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 902349adfb..5f8dbf3f17 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -35,18 +35,20 @@ extern "C" {
*/
#define SCHEDULER_SIMPLE_ENTRY_POINTS \
{ \
- _Scheduler_simple_Initialize, /* initialize entry point */ \
- _Scheduler_simple_Schedule, /* schedule entry point */ \
- _Scheduler_simple_Yield, /* yield entry point */ \
- _Scheduler_simple_Block, /* block entry point */ \
- _Scheduler_simple_Unblock, /* unblock entry point */ \
- _Scheduler_simple_Allocate, /* allocate entry point */ \
- _Scheduler_simple_Free, /* free entry point */ \
- _Scheduler_simple_Update, /* update entry point */ \
- _Scheduler_simple_Enqueue, /* enqueue entry point */ \
- _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
- _Scheduler_simple_Extract, /* extract entry point */ \
- _Scheduler_priority_Tick /* tick entry point */ \
+ _Scheduler_simple_Initialize, /* initialize entry point */ \
+ _Scheduler_simple_Schedule, /* schedule entry point */ \
+ _Scheduler_simple_Yield, /* yield entry point */ \
+ _Scheduler_simple_Block, /* block entry point */ \
+ _Scheduler_simple_Unblock, /* unblock entry point */ \
+ _Scheduler_simple_Allocate, /* allocate entry point */ \
+ _Scheduler_simple_Free, /* free entry point */ \
+ _Scheduler_simple_Update, /* update entry point */ \
+ _Scheduler_simple_Enqueue, /* enqueue entry point */ \
+ _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
+ _Scheduler_simple_Extract, /* extract entry point */ \
+ _Scheduler_priority_Priority_compare, /* compares two priorities */ \
+ _Scheduler_priority_Release_job, /* new period of task */ \
+ _Scheduler_priority_Tick /* tick entry point */ \
}
/**
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index ad6074a637..6672ac51a0 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -40,24 +40,27 @@ extern "C" {
#include <rtems/score/scheduler.h>
#include <rtems/score/schedulersimple.h>
+#include <rtems/score/schedulerpriority.h>
/**
* Entry points for Scheduler Simple SMP
*/
#define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \
{ \
- _Scheduler_simple_Initialize, /* initialize entry point */ \
- _Scheduler_simple_smp_Schedule, /* schedule entry point */ \
- _Scheduler_simple_Yield, /* yield entry point */ \
- _Scheduler_simple_smp_Block, /* block entry point */ \
- _Scheduler_simple_smp_Unblock, /* unblock entry point */ \
- _Scheduler_simple_Allocate, /* allocate entry point */ \
- _Scheduler_simple_Free, /* free entry point */ \
- _Scheduler_simple_Update, /* update entry point */ \
- _Scheduler_simple_Enqueue, /* enqueue entry point */ \
- _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
- _Scheduler_simple_Extract, /* extract entry point */ \
- _Scheduler_simple_smp_Tick /* tick entry point */ \
+ _Scheduler_simple_Initialize, /* initialize entry point */ \
+ _Scheduler_simple_smp_Schedule, /* schedule entry point */ \
+ _Scheduler_simple_Yield, /* yield entry point */ \
+ _Scheduler_simple_smp_Block, /* block entry point */ \
+ _Scheduler_simple_smp_Unblock, /* unblock entry point */ \
+ _Scheduler_simple_Allocate, /* allocate entry point */ \
+ _Scheduler_simple_Free, /* free entry point */ \
+ _Scheduler_simple_Update, /* update entry point */ \
+ _Scheduler_simple_Enqueue, /* enqueue entry point */ \
+ _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
+ _Scheduler_simple_Extract, /* extract entry point */ \
+ _Scheduler_priority_Priority_compare, /* compares two priorities */ \
+ _Scheduler_priority_Release_job, /* new period of task */ \
+ _Scheduler_simple_smp_Tick /* tick entry point */ \
}
/**