summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-02-18 15:12:44 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-02-18 15:12:44 +0000
commit108c4b085ccf88e9644fccbf5cec1b79c39e67e4 (patch)
treedf0df1d699d02955750d1691e75ef26fe0c8e1b1 /cpukit/score/include
parent2011-02-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-108c4b085ccf88e9644fccbf5cec1b79c39e67e4.tar.bz2
2011-02-18 Joel Sherrill <joel.sherrill@oarcorp.com>
* sapi/include/confdefs.h, score/Makefile.am, score/include/rtems/score/scheduler.h, score/include/rtems/score/schedulerpriority.h, score/include/rtems/score/thread.h, score/inline/rtems/score/scheduler.inl, score/inline/rtems/score/schedulerpriority.inl, score/src/scheduler.c, score/src/schedulerpriority.c, score/src/schedulerpriorityblock.c, score/src/schedulerpriorityschedule.c, score/src/schedulerpriorityunblock.c, score/src/schedulerpriorityyield.c, score/src/threadchangepriority.c, score/src/threadclose.c, score/src/threadinitialize.c, score/src/threadsetpriority.c, score/src/threadsettransient.c: Significant clean up on Scheduler Plugin Interface. Names were shortened. Missing operations added. Many scheduler files had unneeded includes removed. Made pointer to scheduler information in Thread_Control and Scheduler_Control a void * pointer because the thread and scheduler wrapper should be unaware of scheduler types AND this is broken for user provided schedulers. * score/src/schedulerpriorityallocate.c, score/src/schedulerpriorityenqueue.c, score/src/schedulerpriorityenqueuefirst.c, score/src/schedulerpriorityextract.c, score/src/schedulerpriorityfree.c, score/src/schedulerpriorityupdate.c: New files. * score/src/schedulerprioritythreadschedulerallocate.c, score/src/schedulerprioritythreadschedulerfree.c, score/src/schedulerprioritythreadschedulerupdate.c: Removed.
Diffstat (limited to 'cpukit/score/include')
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h63
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h89
-rw-r--r--cpukit/score/include/rtems/score/thread.h10
3 files changed, 95 insertions, 67 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 2ca6c4a0fe..c094b9400a 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -36,35 +36,6 @@ extern "C" {
*/
/**@{*/
-typedef struct Scheduler_Control_struct Scheduler_Control;
-
-/*
- * This type defines the scheduler initialization table entry, which is set up
- * by confdefs.h based on the user's choice of scheduler policy.
- */
-typedef struct {
- void ( *scheduler_init )( Scheduler_Control * );
-} Scheduler_Table_entry;
-
-/**
- * The following Scheduler_Per_thread_xxx structures are used to
- * hold per-thread data used by the scheduler. Thread_Control->scheduler is a
- * union of pointers, one for each of the following structures. The
- * scheduler->xxx field points to an instantion of one of these structures,
- * which is allocated from the workspace during _Thread_Start.
- */
-
-/**
- * Per-thread data related to the _Scheduler_PRIORITY scheduling policy.
- */
-typedef struct {
- /** This field points to the Ready FIFO for this thread's priority. */
- Chain_Control *ready_chain;
-
- /** This field contains precalculated priority map indices. */
- Priority_bit_map_Information Priority_map;
-} Scheduler_priority_Per_thread;
-
/**
* function jump table that holds pointers to the functions that
* implement specific schedulers.
@@ -86,37 +57,39 @@ typedef struct {
void ( *unblock )(Thread_Control *);
/** allocates the scheduler field of the given thread */
- void * ( *scheduler_allocate )(Thread_Control *);
+ void * ( *allocate )(Thread_Control *);
/** frees the scheduler field of the given thread */
- void ( *scheduler_free )(Thread_Control *);
+ void ( *free )(Thread_Control *);
/** updates the scheduler field of the given thread -- primarily used
* when changing the thread's priority. */
- void ( *scheduler_update )(Thread_Control *);
+ void ( *update )(Thread_Control *);
+
+ /** enqueue a thread as the last of its priority group */
+ void ( *enqueue )(Thread_Control *);
+
+ /** enqueue a thread as the first of its priority group */
+ void ( *enqueue_first )(Thread_Control *);
+
+ /** extract a thread from the ready set */
+ void ( *extract )(Thread_Control *);
} Scheduler_Operations;
/**
* This is the structure used to manage the scheduler.
*/
-struct Scheduler_Control_struct {
+typedef struct {
/**
- * This union contains the pointer to the data structure used to manage
- * the ready set of tasks. The pointer varies based upon the type of
+ * This points to the data structure used to manage the ready set of
+ * tasks. The pointer varies based upon the type of
* ready queue required by the scheduler.
*/
- union {
- /**
- * This is the set of lists (an array of Chain_Control) for
- * priority scheduling.
- */
- Chain_Control *priority;
-
- } Ready_queues;
+ void *information;
/** The jump table for scheduler-specific functions */
- Scheduler_Operations Operations;
-};
+ Scheduler_Operations Operations;
+} Scheduler_Control;
/**
* The _Scheduler holds the structures used to manage the
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 162cb7011a..767e8425d5 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -21,9 +21,7 @@
#include <rtems/score/chain.h>
#include <rtems/score/priority.h>
-#include <rtems/score/percpu.h>
#include <rtems/score/scheduler.h>
-#include <rtems/score/wkspace.h>
#ifdef __cplusplus
extern "C" {
@@ -40,17 +38,31 @@ extern "C" {
*/
#define SCHEDULER_PRIORITY_ENTRY_POINTS \
{ \
- .initialize = _Scheduler_priority_Initialize, \
- .schedule = _Scheduler_priority_Schedule, \
- .yield = _Scheduler_priority_Yield, \
- .block = _Scheduler_priority_Block, \
- .unblock = _Scheduler_priority_Unblock, \
- .scheduler_allocate = _Scheduler_priority_Thread_scheduler_allocate, \
- .scheduler_free = _Scheduler_priority_Thread_scheduler_free, \
- .scheduler_update = _Scheduler_priority_Thread_scheduler_update \
+ .initialize = _Scheduler_priority_Initialize, \
+ .schedule = _Scheduler_priority_Schedule, \
+ .yield = _Scheduler_priority_Yield, \
+ .block = _Scheduler_priority_Block, \
+ .unblock = _Scheduler_priority_Unblock, \
+ .allocate = _Scheduler_priority_Allocate, \
+ .free = _Scheduler_priority_Free, \
+ .update = _Scheduler_priority_Update, \
+ .enqueue = _Scheduler_priority_Enqueue, \
+ .enqueue_first = _Scheduler_priority_Enqueue_first, \
+ .extract = _Scheduler_priority_Extract \
}
/**
+ * Per-thread data related to the _Scheduler_PRIORITY scheduling policy.
+ */
+typedef struct {
+ /** This field points to the Ready FIFO for this thread's priority. */
+ Chain_Control *ready_chain;
+
+ /** This field contains precalculated priority map indices. */
+ Priority_bit_map_Information Priority_map;
+} Scheduler_priority_Per_thread;
+
+/**
* This routine initializes the priority scheduler.
*/
void _Scheduler_priority_Initialize(void);
@@ -60,6 +72,8 @@ void _Scheduler_priority_Initialize(void);
* that is, removes it from the ready queue. It performs
* any necessary scheduling operations including the selection of
* a new heir thread.
+ *
+ * @param[in] the_thread is the thread to be blocked
*/
void _Scheduler_priority_Block(
Thread_Control *the_thread
@@ -72,24 +86,33 @@ void _Scheduler_priority_Block(
void _Scheduler_priority_Schedule(void);
/**
- * This routine allocates @a the_thread->scheduler.
+ * This routine allocates @a the_thread->scheduler.
+ *
+ * @param[in] the_thread is the thread the scheduler is allocating
+ * management memory for
*/
-void * _Scheduler_priority_Thread_scheduler_allocate(
+void * _Scheduler_priority_Allocate(
Thread_Control *the_thread
);
/**
- * This routine frees @a the_thread->scheduler.
+ * This routine frees @a the_thread->scheduler.
+ *
+ * @param[in] the_thread is the thread whose scheduler specific information
+ * will be deallocated.
*/
-void _Scheduler_priority_Thread_scheduler_free(
+void _Scheduler_priority_Free(
Thread_Control *the_thread
);
/**
- * This routine updates @a the_thread->scheduler based on @a the_scheduler
- * structures and thread state
+ * This routine updates @a the_thread->scheduler based on @a the_scheduler
+ * structures and thread state.
+ *
+ * @param[in] the_thread will have its scheduler specific information
+ * structure updated.
*/
-void _Scheduler_priority_Thread_scheduler_update(
+void _Scheduler_priority_Update(
Thread_Control *the_thread
);
@@ -97,6 +120,8 @@ void _Scheduler_priority_Thread_scheduler_update(
* This routine adds @a the_thread to the scheduling decision,
* that is, adds it to the ready queue and
* updates any appropriate scheduling variables, for example the heir thread.
+ *
+ * @param[in] the_thread will be unblocked
*/
void _Scheduler_priority_Unblock(
Thread_Control *the_thread
@@ -115,6 +140,36 @@ void _Scheduler_priority_Unblock(
*/
void _Scheduler_priority_Yield( void );
+/**
+ * This routine puts @a the_thread on to the priority-based ready queue.
+ *
+ * @param[in] the_thread will be enqueued at the TAIL of its priority.
+ */
+void _Scheduler_priority_Enqueue(
+ Thread_Control *the_thread
+);
+
+/**
+ * This routine puts @a the_thread to the head of the ready queue.
+ * For priority-based ready queues, the thread will be the first thread
+ * at its priority level.
+ *
+ * @param[in] the_thread will be enqueued at the HEAD of its priority.
+ */
+void _Scheduler_priority_Enqueue_first(
+ Thread_Control *the_thread
+);
+
+/**
+ * This routine removes a specific thread from the scheduler's set
+ * of ready threads.
+ *
+ * @param[in] the_thread will be extracted from the ready set.
+ */
+void _Scheduler_priority_Extract(
+ Thread_Control *the_thread
+);
+
#ifndef __RTEMS_APPLICATION__
#include <rtems/score/schedulerpriority.inl>
#endif
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 370d5491a3..73203eacc3 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2009.
+ * COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -390,10 +390,10 @@ struct Thread_Control_struct {
* since it was created.
*/
Thread_CPU_usage_t cpu_time_used;
- /** This union holds per-thread data for the scheduler and ready queue. */
- union {
- Scheduler_priority_Per_thread *priority;
- } scheduler;
+
+ /** This pointer holds per-thread data for the scheduler and ready queue. */
+ void *scheduler_info;
+
/** This field contains information about the starting state of
* this thread.
*/