[PATCH 3/5] score: Use const scheduler operations
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Apr 4 15:07:39 UTC 2014
This helps to hide implementation details of the scheduler from the
application configuration. The scheduler operations table is now
read-only and thus can reside in flash memory. The run-time overhead
due to this indirection is negligible. On SMP configurations with
clustered/partitioned scheduling this reduces also the memory overhead.
---
cpukit/sapi/include/confdefs.h | 18 +-
cpukit/score/Makefile.am | 6 +
cpukit/score/include/rtems/score/scheduler.h | 216 +----------------
cpukit/score/include/rtems/score/schedulercbs.h | 239 +------------------
.../score/include/rtems/score/schedulercbsimpl.h | 246 +++++++++++++++++++
cpukit/score/include/rtems/score/scheduleredf.h | 202 +----------------
.../score/include/rtems/score/scheduleredfimpl.h | 177 ++++++++++++++
cpukit/score/include/rtems/score/schedulerimpl.h | 252 ++++++++++++++++++--
.../score/include/rtems/score/schedulerpriority.h | 189 +---------------
.../rtems/score/schedulerpriorityaffinitysmp.h | 74 +------
.../include/rtems/score/schedulerpriorityimpl.h | 158 ++++++++++++
.../include/rtems/score/schedulerprioritysmp.h | 76 +------
.../include/rtems/score/schedulerprioritysmpimpl.h | 87 +++++++
cpukit/score/include/rtems/score/schedulersimple.h | 157 +------------
.../include/rtems/score/schedulersimpleimpl.h | 133 ++++++++++
.../score/include/rtems/score/schedulersimplesmp.h | 65 +-----
cpukit/score/include/rtems/score/schedulersmp.h | 15 +-
cpukit/score/preinstall.am | 8 +
cpukit/score/src/scheduler.c | 2 +-
cpukit/score/src/schedulercbs.c | 2 +-
cpukit/score/src/schedulercbsallocate.c | 6 +-
cpukit/score/src/schedulercbsattachthread.c | 2 +-
cpukit/score/src/schedulercbscleanup.c | 2 +-
cpukit/score/src/schedulercbscreateserver.c | 2 +-
cpukit/score/src/schedulercbsdestroyserver.c | 2 +-
cpukit/score/src/schedulercbsdetachthread.c | 2 +-
cpukit/score/src/schedulercbsgetapprovedbudget.c | 5 +-
cpukit/score/src/schedulercbsgetexecutiontime.c | 2 +-
cpukit/score/src/schedulercbsgetparameters.c | 5 +-
cpukit/score/src/schedulercbsgetremainingbudget.c | 2 +-
cpukit/score/src/schedulercbsgetserverid.c | 5 +-
cpukit/score/src/schedulercbsops.c | 38 +++
cpukit/score/src/schedulercbssetparameters.c | 5 +-
cpukit/score/src/schedulercbsunblock.c | 4 +-
cpukit/score/src/schedulerdefaultallocatefree.c | 2 +-
cpukit/score/src/schedulerdefaultreleasejob.c | 2 +-
cpukit/score/src/schedulerdefaultupdate.c | 2 +-
cpukit/score/src/scheduleredf.c | 4 +-
cpukit/score/src/scheduleredfallocate.c | 5 +-
cpukit/score/src/scheduleredfenqueuefirst.c | 4 +-
cpukit/score/src/scheduleredffree.c | 5 +-
cpukit/score/src/scheduleredfops.c | 38 +++
cpukit/score/src/scheduleredfprioritycompare.c | 4 +-
cpukit/score/src/scheduleredfreleasejob.c | 2 +-
cpukit/score/src/scheduleredfunblock.c | 3 +-
cpukit/score/src/scheduleredfupdate.c | 7 +-
cpukit/score/src/schedulerpriorityaffinitysmp.c | 34 ++-
cpukit/score/src/schedulerpriorityallocate.c | 3 +-
cpukit/score/src/schedulerpriorityops.c | 38 +++
cpukit/score/src/schedulerprioritysmp.c | 20 ++
cpukit/score/src/schedulersimple.c | 2 +-
cpukit/score/src/schedulersimpleenqueue.c | 6 +-
cpukit/score/src/schedulersimpleenqueuefirst.c | 5 +-
cpukit/score/src/schedulersimpleextract.c | 3 +-
cpukit/score/src/schedulersimpleops.c | 39 +++
cpukit/score/src/schedulersimplesmp.c | 80 ++++---
cpukit/score/src/schedulersimpleunblock.c | 5 +-
testsuites/rhealstone/rhilatency/ilatency.c | 2 +-
testsuites/sptests/spinternalerror01/init.c | 2 +-
testsuites/tmtests/tm26/task1.c | 2 +-
testsuites/tmtests/tm27/task1.c | 2 +-
61 files changed, 1372 insertions(+), 1353 deletions(-)
create mode 100644 cpukit/score/include/rtems/score/schedulercbsimpl.h
create mode 100644 cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h
create mode 100644 cpukit/score/src/schedulercbsops.c
create mode 100644 cpukit/score/src/scheduleredfops.c
create mode 100644 cpukit/score/src/schedulerpriorityops.c
create mode 100644 cpukit/score/src/schedulersimpleops.c
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 1ee3b21..2a94654 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -640,7 +640,7 @@ const rtems_libio_helper rtems_fs_init_helper =
*
* An application can define its own scheduling policy by defining
* CONFIGURE_SCHEDULER_USER and the following:
- * - CONFIGURE_SCHEDULER_ENTRY_POINTS
+ * - CONFIGURE_SCHEDULER_OPERATIONS
* - CONFIGURE_MEMORY_FOR_SCHEDULER - base memory
* - CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER - per task memory
*/
@@ -671,7 +671,7 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#if defined(CONFIGURE_SCHEDULER_PRIORITY)
#include <rtems/score/schedulerpriority.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_ENTRY_POINTS
+ #define CONFIGURE_SCHEDULER_OPERATIONS &_Scheduler_priority_Operations
/**
* This defines the memory used by the priority scheduler.
@@ -691,7 +691,7 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
#include <rtems/score/schedulerprioritysmp.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_SMP_ENTRY_POINTS
+ #define CONFIGURE_SCHEDULER_OPERATIONS &_Scheduler_priority_SMP_Operations
/**
* This defines the memory used by the priority scheduler.
@@ -711,7 +711,7 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP)
#include <rtems/score/schedulerpriorityaffinitysmp.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS
+ #define CONFIGURE_SCHEDULER_OPERATIONS &_Scheduler_priority_affinity_SMP_Operations
/**
* This defines the memory used by the priority scheduler.
@@ -730,7 +730,7 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#if defined(CONFIGURE_SCHEDULER_SIMPLE)
#include <rtems/score/schedulersimple.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_ENTRY_POINTS
+ #define CONFIGURE_SCHEDULER_OPERATIONS &_Scheduler_simple_Operations
/**
* define the memory used by the simple scheduler
@@ -746,7 +746,7 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP)
#include <rtems/score/schedulersimplesmp.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_SMP_ENTRY_POINTS
+ #define CONFIGURE_SCHEDULER_OPERATIONS &_Scheduler_simple_SMP_Operations
/**
* Define the memory used by the Simple SMP Scheduler
@@ -764,7 +764,7 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#if defined(CONFIGURE_SCHEDULER_EDF)
#include <rtems/score/scheduleredf.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_EDF_ENTRY_POINTS
+ #define CONFIGURE_SCHEDULER_OPERATIONS &_Scheduler_EDF_Operations
/**
* define the memory used by the EDF scheduler
@@ -780,7 +780,7 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#if defined(CONFIGURE_SCHEDULER_CBS)
#include <rtems/score/schedulercbs.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_CBS_ENTRY_POINTS
+ #define CONFIGURE_SCHEDULER_OPERATIONS &_Scheduler_CBS_Operations
#ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
#define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS
@@ -810,7 +810,7 @@ const rtems_libio_helper rtems_fs_init_helper =
#ifdef CONFIGURE_INIT
Scheduler_Control _Scheduler = {
NULL, /* Scheduler Specific Data Pointer */
- CONFIGURE_SCHEDULER_ENTRY_POINTS /* Scheduler Operations */
+ CONFIGURE_SCHEDULER_OPERATIONS /* Scheduler Operations */
};
#if defined(CONFIGURE_SCHEDULER_EDF)
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 07cb520..9db4295 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -52,11 +52,13 @@ include_rtems_score_HEADERS += include/rtems/score/rbtreeimpl.h
include_rtems_score_HEADERS += include/rtems/score/scheduler.h
include_rtems_score_HEADERS += include/rtems/score/schedulerimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulercbs.h
+include_rtems_score_HEADERS += include/rtems/score/schedulercbsimpl.h
include_rtems_score_HEADERS += include/rtems/score/scheduleredf.h
include_rtems_score_HEADERS += include/rtems/score/scheduleredfimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulerpriority.h
include_rtems_score_HEADERS += include/rtems/score/schedulerpriorityimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulerprioritysmp.h
+include_rtems_score_HEADERS += include/rtems/score/schedulerprioritysmpimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulersimple.h
include_rtems_score_HEADERS += include/rtems/score/schedulersimpleimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulersmp.h
@@ -209,6 +211,7 @@ libscore_a_SOURCES += src/schedulerpriority.c \
src/schedulerpriorityenqueuefirst.c \
src/schedulerpriorityextract.c \
src/schedulerpriorityfree.c \
+ src/schedulerpriorityops.c \
src/schedulerpriorityprioritycompare.c \
src/schedulerpriorityschedule.c \
src/schedulerpriorityunblock.c \
@@ -224,6 +227,7 @@ libscore_a_SOURCES += src/schedulersimple.c \
src/schedulersimplereadyqueueenqueue.c \
src/schedulersimplereadyqueueenqueuefirst.c \
src/schedulersimpleschedule.c \
+ src/schedulersimpleops.c \
src/schedulersimpleunblock.c \
src/schedulersimpleyield.c
@@ -235,6 +239,7 @@ libscore_a_SOURCES += src/scheduleredf.c \
src/scheduleredfenqueuefirst.c \
src/scheduleredfextract.c \
src/scheduleredffree.c \
+ src/scheduleredfops.c \
src/scheduleredfprioritycompare.c \
src/scheduleredfreleasejob.c \
src/scheduleredfschedule.c \
@@ -255,6 +260,7 @@ libscore_a_SOURCES += src/schedulercbs.c \
src/schedulercbsgetparameters.c \
src/schedulercbsgetremainingbudget.c \
src/schedulercbsgetserverid.c \
+ src/schedulercbsops.c \
src/schedulercbssetparameters.c \
src/schedulercbsreleasejob.c \
src/schedulercbsunblock.c
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index b975fc4..e16bab6 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -19,12 +19,7 @@
#ifndef _RTEMS_SCORE_SCHEDULER_H
#define _RTEMS_SCORE_SCHEDULER_H
-#include <rtems/score/percpu.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/priority.h>
-#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
- #include <sys/cpuset.h>
-#endif
+#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
@@ -40,103 +35,11 @@ extern "C" {
*/
/**@{*/
-typedef struct Scheduler_Control Scheduler_Control;
-
-/**
- * function jump table that holds pointers to the functions that
- * implement specific schedulers.
- */
-typedef struct {
- /** Implements the scheduling decision logic (policy). */
- void ( *initialize )(void);
-
- /** Implements the scheduling decision logic (policy). */
- void ( *schedule )( Scheduler_Control *, Thread_Control *);
-
- /**
- * @brief Voluntarily yields the processor per the scheduling policy.
- *
- * @see _Scheduler_Yield().
- */
- void ( *yield )( Scheduler_Control *, Thread_Control *);
-
- /** Removes the given thread from scheduling decisions. */
- void ( *block )( Scheduler_Control *, Thread_Control * );
-
- /** Adds the given thread to scheduling decisions. */
- void ( *unblock )( Scheduler_Control *, Thread_Control * );
-
- /** allocates the scheduler field of the given thread */
- void * ( *allocate )( Scheduler_Control *, Thread_Control * );
-
- /** frees the scheduler field of the given thread */
- void ( *free )( Scheduler_Control *, Thread_Control * );
-
- /** updates the scheduler field of the given thread -- primarily used
- * when changing the thread's priority. */
- void ( *update )( Scheduler_Control *, Thread_Control * );
-
- /** enqueue a thread as the last of its priority group */
- void ( *enqueue )( Scheduler_Control *, Thread_Control * );
-
- /** enqueue a thread as the first of its priority group */
- void ( *enqueue_first )( Scheduler_Control *, Thread_Control * );
+/* Allow forward declarations */
- /** extract a thread from the ready set */
- void ( *extract )( Scheduler_Control *, 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 ) ( Scheduler_Control *, Thread_Control *, uint32_t );
-
- /** perform scheduler update actions required at each clock tick */
- void ( *tick )( Scheduler_Control * );
-
- /**
- * @brief Starts the idle thread for a particular processor.
- *
- * @see _Scheduler_Start_idle().
- */
- void ( *start_idle )(
- Scheduler_Control *,
- Thread_Control *,
- Per_CPU_Control *
- );
+typedef struct Scheduler_Control Scheduler_Control;
-#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
- /**
- * @brief Obtain the processor affinity for a thread.
- *
- * @see _Scheduler_Get_affinity().
- */
- bool ( *get_affinity )(
- Scheduler_Control *,
- Thread_Control *,
- size_t,
- cpu_set_t *
- );
-
- /**
- * @brief Set the processor affinity for a thread.
- *
- * @see _Scheduler_Set_affinity().
- */
- bool ( *set_affinity )(
- Scheduler_Control *,
- Thread_Control *,
- size_t,
- const cpu_set_t *
- );
-#endif
-} Scheduler_Operations;
+typedef struct Scheduler_Operations Scheduler_Operations;
/**
* This is the structure used to manage the scheduler.
@@ -150,7 +53,7 @@ struct Scheduler_Control {
void *information;
/** The jump table for scheduler-specific functions */
- Scheduler_Operations Operations;
+ const Scheduler_Operations *operations;
};
/**
@@ -163,115 +66,6 @@ struct Scheduler_Control {
*/
extern Scheduler_Control _Scheduler;
-/**
- * @brief Returns an arbitrary non-NULL value.
- *
- * @param[in] scheduler Unused.
- * @param[in] the_thread Unused.
- *
- * @return An arbitrary non-NULL value.
- */
-void *_Scheduler_default_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Does nothing.
- *
- * @param[in] scheduler Unused.
- * @param[in] the_thread Unused.
- */
-void _Scheduler_default_Free(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Does nothing.
- *
- * @param[in] scheduler Unused.
- * @param[in] the_thread Unused.
- */
-void _Scheduler_default_Update(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Does nothing.
- *
- * @param[in] scheduler Unused.
- * @param[in] the_thread Unused.
- * @param[in] deadline Unused.
- */
-void _Scheduler_default_Release_job(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t deadline
-);
-
-/**
- * @brief Performs tick operations depending on the CPU budget algorithm for
- * each executing thread.
- *
- * This routine is invoked as part of processing each clock tick.
- *
- * @param[in] scheduler The scheduler.
- */
-void _Scheduler_default_Tick( Scheduler_Control *scheduler );
-
-/**
- * @brief Starts an idle thread.
- *
- * @param[in] scheduler The scheduler.
- * @param[in] the_thread An idle thread.
- * @param[in] cpu This parameter is unused.
- */
-void _Scheduler_default_Start_idle(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- Per_CPU_Control *cpu
-);
-
-#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
- /**
- * @brief Get affinity for the default scheduler.
- *
- * @param[in] thread The associated thread.
- * @param[in] cpusetsize The size of the cpuset.
- * @param[out] cpuset Affinity set containing all CPUs.
- *
- * @retval 0 Successfully got cpuset
- * @retval -1 The cpusetsize is invalid for the system
- */
- bool _Scheduler_default_Get_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
- );
-
- /**
- * @brief Set affinity for the default scheduler.
- *
- * @param[in] thread The associated thread.
- * @param[in] cpusetsize The size of the cpuset.
- * @param[in] cpuset Affinity new affinity set.
- *
- * @retval 0 Successful
- *
- * This method always returns successful and does not save
- * the cpuset.
- */
- bool _Scheduler_default_Set_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
- );
-#endif
-
/*
* See also PR2174: Memory corruption with EDF scheduler and thread priority
* queues.
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index f654225..8217d55 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -39,31 +39,6 @@ extern "C" {
*/
/**@{*/
-/**
- * Entry points for the Constant Bandwidth Server Scheduler.
- *
- * @note: The CBS scheduler is an enhancement of EDF scheduler,
- * therefor some routines are similar.
- */
-#define SCHEDULER_CBS_ENTRY_POINTS \
- { \
- _Scheduler_EDF_Initialize, /* initialize entry point */ \
- _Scheduler_EDF_Schedule, /* schedule entry point */ \
- _Scheduler_EDF_Yield, /* yield entry point */ \
- _Scheduler_EDF_Block, /* block entry point */ \
- _Scheduler_CBS_Unblock, /* unblock entry point */ \
- _Scheduler_CBS_Allocate, /* allocate entry point */ \
- _Scheduler_EDF_Free, /* free entry point */ \
- _Scheduler_EDF_Update, /* update entry point */ \
- _Scheduler_EDF_Enqueue, /* enqueue entry point */ \
- _Scheduler_EDF_Enqueue_first, /* enqueue_first entry point */ \
- _Scheduler_EDF_Extract, /* extract 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 */ \
- }
-
/* Return values for CBS server. */
#define SCHEDULER_CBS_OK 0
#define SCHEDULER_CBS_ERROR_GENERIC -16
@@ -127,220 +102,8 @@ typedef struct {
Scheduler_CBS_Server *cbs_server;
} Scheduler_CBS_Per_thread;
+extern const Scheduler_Operations _Scheduler_CBS_Operations;
-/**
- * List of servers. The @a Scheduler_CBS_Server is the index to the array
- * of pointers to @a _Scheduler_CBS_Server_list.
- */
-extern Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
-
-/**
- * @brief Unblocks a thread from the queue.
- *
- * 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. It is checked whether the
- * remaining budget is sufficient. If not, the thread continues as a
- * new job in order to protect concurrent threads.
- *
- * @param[in] the_thread will be unblocked.
- *
- * @note This has to be asessed as missed deadline of the current job.
- */
-void _Scheduler_CBS_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Called when a new job of task is released.
- *
- * This routine is called when a new job of task is released.
- * It is called only from Rate Monotonic manager in the beginning
- * of new period. Deadline has to be shifted and budget replenished.
- *
- * @param[in] the_thread is the owner of the job.
- * @param[in] length of the new job from now. If equal to 0,
- * the job was cancelled or deleted.
- */
-
-void _Scheduler_CBS_Release_job (
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t length
-);
-
-/**
- * @brief _Scheduler_CBS_Initialize
- *
- * Initializes the CBS library.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Initialize(void);
-
-/**
- * @brief Attach a task to an already existing server.
- *
- * Attach a task to an already existing server.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Attach_thread (
- Scheduler_CBS_Server_id server_id,
- rtems_id task_id
-);
-
-/**
- * @brief Detach from the CBS Server.
- *
- * Detach from the CBS Server.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Detach_thread (
- Scheduler_CBS_Server_id server_id,
- rtems_id task_id
-);
-
-/**
- * @brief Cleanup resources associated to the CBS Library.
- *
- * Cleanup resources associated to the CBS Library.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Cleanup (void);
-
-/**
- * @brief Create a new server with specified parameters.
- *
- * Create a new server with specified parameters.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Create_server (
- Scheduler_CBS_Parameters *params,
- Scheduler_CBS_Budget_overrun budget_overrun_callback,
- rtems_id *server_id
-);
-
-/**
- * @brief Detach all tasks from a server and destroy it.
- *
- * Detach all tasks from a server and destroy it.
- *
- * @param[in] server_id is the ID of the server
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Destroy_server (
- Scheduler_CBS_Server_id server_id
-);
-
-/**
- * @brief Retrieve the approved budget.
- *
- * Retrieve the budget that has been approved for the subsequent
- * server instances.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Get_approved_budget (
- Scheduler_CBS_Server_id server_id,
- time_t *approved_budget
-);
-
-/**
- * @brief Retrieve remaining budget for the current server instance.
- *
- * Retrieve remaining budget for the current server instance.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Get_remaining_budget (
- Scheduler_CBS_Server_id server_id,
- time_t *remaining_budget
-);
-
-/**
- * @brief Get relative time info.
- *
- * Retrieve time info relative to @a server_id. The server status code is returned.
- *
- * @param[in] server_id is the server to get the status code from.
- * @param[in] exec_time is the execution time.
- * @param[in] abs_time is not apparently used.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Get_execution_time (
- Scheduler_CBS_Server_id server_id,
- time_t *exec_time,
- time_t *abs_time
-);
-
-/**
- * @brief Retrieve CBS scheduling parameters.
- *
- * Retrieve CBS scheduling parameters.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Get_parameters (
- Scheduler_CBS_Server_id server_id,
- Scheduler_CBS_Parameters *params
-);
-
-/**
- * @brief Get a thread server id.
- *
- * Get a thread server id, or SCHEDULER_CBS_ERROR_NOT_FOUND if it is not
- * attached to any server.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Get_server_id (
- rtems_id task_id,
- Scheduler_CBS_Server_id *server_id
-);
-
-/**
- * @brief Set parameters for CBS scheduling.
- *
- * Change CBS scheduling parameters.
- *
- * @param[in] server_id is the ID of the server.
- * @param[in] parameters are the parameters to set.
- *
- * @retval status code.
- */
-int _Scheduler_CBS_Set_parameters (
- Scheduler_CBS_Server_id server_id,
- Scheduler_CBS_Parameters *parameters
-);
-
-/**
- * @brief Invoked when a limited time quantum is exceeded.
- *
- * This routine is invoked when a limited time quantum is exceeded.
- */
-void _Scheduler_CBS_Budget_callout(
- Thread_Control *the_thread
-);
-
-/**
- * @brief Allocates CBS specific information of @a the_thread.
- *
- * This routine allocates CBS specific information of @a the_thread.
- *
- * @param[in] the_thread is the thread the scheduler is allocating
- * management memory for.
- */
-void *_Scheduler_CBS_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/include/rtems/score/schedulercbsimpl.h b/cpukit/score/include/rtems/score/schedulercbsimpl.h
new file mode 100644
index 0000000..c1ed4df
--- /dev/null
+++ b/cpukit/score/include/rtems/score/schedulercbsimpl.h
@@ -0,0 +1,246 @@
+/**
+ * @file
+ *
+ * @ingroup ScoreSchedulerPrioritySMP
+ *
+ * @brief Deterministic Priority SMP Scheduler API
+ */
+
+/*
+ * Copryight (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.
+ */
+
+#ifndef _RTEMS_SCORE_SCHEDULERCBSIMPL_H
+#define _RTEMS_SCORE_SCHEDULERCBSIMPL_H
+
+#include <rtems/score/schedulercbs.h>
+#include <rtems/score/scheduleredfimpl.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * List of servers. The @a Scheduler_CBS_Server is the index to the array
+ * of pointers to @a _Scheduler_CBS_Server_list.
+ */
+extern Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
+
+/**
+ * @brief Unblocks a thread from the queue.
+ *
+ * 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. It is checked whether the
+ * remaining budget is sufficient. If not, the thread continues as a
+ * new job in order to protect concurrent threads.
+ *
+ * @param[in] the_thread will be unblocked.
+ *
+ * @note This has to be asessed as missed deadline of the current job.
+ */
+void _Scheduler_CBS_Unblock(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Called when a new job of task is released.
+ *
+ * This routine is called when a new job of task is released.
+ * It is called only from Rate Monotonic manager in the beginning
+ * of new period. Deadline has to be shifted and budget replenished.
+ *
+ * @param[in] the_thread is the owner of the job.
+ * @param[in] length of the new job from now. If equal to 0,
+ * the job was cancelled or deleted.
+ */
+
+void _Scheduler_CBS_Release_job (
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t length
+);
+
+/**
+ * @brief _Scheduler_CBS_Initialize
+ *
+ * Initializes the CBS library.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Initialize(void);
+
+/**
+ * @brief Attach a task to an already existing server.
+ *
+ * Attach a task to an already existing server.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Attach_thread (
+ Scheduler_CBS_Server_id server_id,
+ rtems_id task_id
+);
+
+/**
+ * @brief Detach from the CBS Server.
+ *
+ * Detach from the CBS Server.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Detach_thread (
+ Scheduler_CBS_Server_id server_id,
+ rtems_id task_id
+);
+
+/**
+ * @brief Cleanup resources associated to the CBS Library.
+ *
+ * Cleanup resources associated to the CBS Library.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Cleanup (void);
+
+/**
+ * @brief Create a new server with specified parameters.
+ *
+ * Create a new server with specified parameters.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Create_server (
+ Scheduler_CBS_Parameters *params,
+ Scheduler_CBS_Budget_overrun budget_overrun_callback,
+ rtems_id *server_id
+);
+
+/**
+ * @brief Detach all tasks from a server and destroy it.
+ *
+ * Detach all tasks from a server and destroy it.
+ *
+ * @param[in] server_id is the ID of the server
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Destroy_server (
+ Scheduler_CBS_Server_id server_id
+);
+
+/**
+ * @brief Retrieve the approved budget.
+ *
+ * Retrieve the budget that has been approved for the subsequent
+ * server instances.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Get_approved_budget (
+ Scheduler_CBS_Server_id server_id,
+ time_t *approved_budget
+);
+
+/**
+ * @brief Retrieve remaining budget for the current server instance.
+ *
+ * Retrieve remaining budget for the current server instance.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Get_remaining_budget (
+ Scheduler_CBS_Server_id server_id,
+ time_t *remaining_budget
+);
+
+/**
+ * @brief Get relative time info.
+ *
+ * Retrieve time info relative to @a server_id. The server status code is returned.
+ *
+ * @param[in] server_id is the server to get the status code from.
+ * @param[in] exec_time is the execution time.
+ * @param[in] abs_time is not apparently used.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Get_execution_time (
+ Scheduler_CBS_Server_id server_id,
+ time_t *exec_time,
+ time_t *abs_time
+);
+
+/**
+ * @brief Retrieve CBS scheduling parameters.
+ *
+ * Retrieve CBS scheduling parameters.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Get_parameters (
+ Scheduler_CBS_Server_id server_id,
+ Scheduler_CBS_Parameters *params
+);
+
+/**
+ * @brief Get a thread server id.
+ *
+ * Get a thread server id, or SCHEDULER_CBS_ERROR_NOT_FOUND if it is not
+ * attached to any server.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Get_server_id (
+ rtems_id task_id,
+ Scheduler_CBS_Server_id *server_id
+);
+
+/**
+ * @brief Set parameters for CBS scheduling.
+ *
+ * Change CBS scheduling parameters.
+ *
+ * @param[in] server_id is the ID of the server.
+ * @param[in] parameters are the parameters to set.
+ *
+ * @retval status code.
+ */
+int _Scheduler_CBS_Set_parameters (
+ Scheduler_CBS_Server_id server_id,
+ Scheduler_CBS_Parameters *parameters
+);
+
+/**
+ * @brief Invoked when a limited time quantum is exceeded.
+ *
+ * This routine is invoked when a limited time quantum is exceeded.
+ */
+void _Scheduler_CBS_Budget_callout(
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Allocates CBS specific information of @a the_thread.
+ *
+ * This routine allocates CBS specific information of @a the_thread.
+ *
+ * @param[in] the_thread is the thread the scheduler is allocating
+ * management memory for.
+ */
+void *_Scheduler_CBS_Allocate(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_SCHEDULERCBSIMPL_H */
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 16d46a4..8ccf60f 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -19,10 +19,9 @@
#ifndef _RTEMS_SCORE_SCHEDULEREDF_H
#define _RTEMS_SCORE_SCHEDULEREDF_H
-#include <rtems/score/priority.h>
#include <rtems/score/scheduler.h>
-#include <rtems/score/schedulerpriority.h>
#include <rtems/score/rbtree.h>
+#include <rtems/score/thread.h>
#ifdef __cplusplus
extern "C" {
@@ -36,28 +35,6 @@ extern "C" {
/**@{*/
/**
- * Entry points for the Earliest Deadline First Scheduler.
- */
-#define SCHEDULER_EDF_ENTRY_POINTS \
- { \
- _Scheduler_EDF_Initialize, /* initialize entry point */ \
- _Scheduler_EDF_Schedule, /* schedule entry point */ \
- _Scheduler_EDF_Yield, /* yield entry point */ \
- _Scheduler_EDF_Block, /* block entry point */ \
- _Scheduler_EDF_Unblock, /* unblock entry point */ \
- _Scheduler_EDF_Allocate, /* allocate entry point */ \
- _Scheduler_EDF_Free, /* free entry point */ \
- _Scheduler_EDF_Update, /* update entry point */ \
- _Scheduler_EDF_Enqueue, /* enqueue entry point */ \
- _Scheduler_EDF_Enqueue_first, /* enqueue_first entry point */ \
- _Scheduler_EDF_Extract, /* extract 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 */ \
- }
-
-/**
* This is just a most significant bit of Priority_Control type. It
* distinguishes threads which are deadline driven (priority
* represented by a lower number than @a SCHEDULER_EDF_PRIO_MSB) from those
@@ -103,182 +80,7 @@ typedef struct {
Scheduler_EDF_Queue_state queue_state;
} Scheduler_EDF_Per_thread;
-/**
- * @brief Initialize EDF scheduler.
- *
- * This routine initializes the EDF scheduler.
- */
-void _Scheduler_EDF_Initialize( void );
-
-/**
- * @brief Removes thread from ready queue.
- *
- * This routine removes @a the_thread from the scheduling decision,
- * 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_EDF_Block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Sets the heir thread to be the next ready thread
- * in the rbtree ready queue.
- *
- * This kernel routine sets the heir thread to be the next ready thread
- * in the rbtree ready queue.
- */
-void _Scheduler_EDF_Schedule(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Allocates EDF specific information of @a the_thread.
- *
- * This routine allocates EDF specific information of @a the_thread.
- *
- * @param[in] the_thread is the thread the scheduler is allocating
- * management memory for.
- */
-void *_Scheduler_EDF_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Frees EDF information of a thread.
- *
- * This routine frees the EDF specific information of @a the_thread.
- *
- * @param[in] the_thread is the thread whose scheduler specific information
- * will be deallocated.
- */
-void _Scheduler_EDF_Free(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Updates position in the ready queue of @a the_thread.
- *
- * This routine updates position in the ready queue of @a the_thread.
- *
- * @param[in] the_thread will have its scheduler specific information
- * structure updated.
- */
-void _Scheduler_EDF_Update(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Adds @a the_thread to the scheduling decision.
- *
- * 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_EDF_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread
- * with equal deadline.
- *
- * This routine is invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread in the queue with
- * equal deadline. This does not have to happen very often.
- *
- * This routine will remove the specified THREAD from the ready queue
- * and place it back. The rbtree ready queue is responsible for FIFO ordering
- * in such a case.
- *
- * @param[in,out] thread The yielding thread.
- */
-void _Scheduler_EDF_Yield(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Put @a the_thread to the rbtree ready queue.
- *
- * This routine puts @a the_thread to the rbtree ready queue.
- *
- * @param[in] the_thread will be enqueued to the ready queue.
- */
-void _Scheduler_EDF_Enqueue(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Enqueue a thread to the ready queue.
- *
- * This routine puts @a the_thread to the rbtree ready queue.
- * For the EDF scheduler this is the same as @a _Scheduler_EDF_Enqueue.
- *
- * @param[in] the_thread will be enqueued to the ready queue.
- */
-void _Scheduler_EDF_Enqueue_first(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Remove a specific thread from the scheduler's set
- * of ready threads.
- *
- * 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_EDF_Extract(
- Scheduler_Control *scheduler,
- 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.
- *
- * This routine is called when a new job of task is released.
- * It is called only from Rate Monotonic manager in the beginning
- * of new period.
- *
- * @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, thus a running task
- * has to be suspended.
- */
-void _Scheduler_EDF_Release_job (
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t deadline
-);
+extern const Scheduler_Operations _Scheduler_EDF_Operations;
#ifdef __cplusplus
}
diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h
index bfeff63..d36f322 100644
--- a/cpukit/score/include/rtems/score/scheduleredfimpl.h
+++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h
@@ -31,6 +31,183 @@ extern "C" {
* @{
*/
+/**
+ * @brief Initialize EDF scheduler.
+ *
+ * This routine initializes the EDF scheduler.
+ */
+void _Scheduler_EDF_Initialize( void );
+
+/**
+ * @brief Removes thread from ready queue.
+ *
+ * This routine removes @a the_thread from the scheduling decision,
+ * 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_EDF_Block(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Sets the heir thread to be the next ready thread
+ * in the rbtree ready queue.
+ *
+ * This kernel routine sets the heir thread to be the next ready thread
+ * in the rbtree ready queue.
+ */
+void _Scheduler_EDF_Schedule(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Allocates EDF specific information of @a the_thread.
+ *
+ * This routine allocates EDF specific information of @a the_thread.
+ *
+ * @param[in] the_thread is the thread the scheduler is allocating
+ * management memory for.
+ */
+void *_Scheduler_EDF_Allocate(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Frees EDF information of a thread.
+ *
+ * This routine frees the EDF specific information of @a the_thread.
+ *
+ * @param[in] the_thread is the thread whose scheduler specific information
+ * will be deallocated.
+ */
+void _Scheduler_EDF_Free(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Updates position in the ready queue of @a the_thread.
+ *
+ * This routine updates position in the ready queue of @a the_thread.
+ *
+ * @param[in] the_thread will have its scheduler specific information
+ * structure updated.
+ */
+void _Scheduler_EDF_Update(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Adds @a the_thread to the scheduling decision.
+ *
+ * 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_EDF_Unblock(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief invoked when a thread wishes to voluntarily
+ * transfer control of the processor to another thread
+ * with equal deadline.
+ *
+ * This routine is invoked when a thread wishes to voluntarily
+ * transfer control of the processor to another thread in the queue with
+ * equal deadline. This does not have to happen very often.
+ *
+ * This routine will remove the specified THREAD from the ready queue
+ * and place it back. The rbtree ready queue is responsible for FIFO ordering
+ * in such a case.
+ *
+ * @param[in,out] thread The yielding thread.
+ */
+void _Scheduler_EDF_Yield(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Put @a the_thread to the rbtree ready queue.
+ *
+ * This routine puts @a the_thread to the rbtree ready queue.
+ *
+ * @param[in] the_thread will be enqueued to the ready queue.
+ */
+void _Scheduler_EDF_Enqueue(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Enqueue a thread to the ready queue.
+ *
+ * This routine puts @a the_thread to the rbtree ready queue.
+ * For the EDF scheduler this is the same as @a _Scheduler_EDF_Enqueue.
+ *
+ * @param[in] the_thread will be enqueued to the ready queue.
+ */
+void _Scheduler_EDF_Enqueue_first(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Remove a specific thread from the scheduler's set
+ * of ready threads.
+ *
+ * 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_EDF_Extract(
+ Scheduler_Control *scheduler,
+ 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.
+ *
+ * This routine is called when a new job of task is released.
+ * It is called only from Rate Monotonic manager in the beginning
+ * of new period.
+ *
+ * @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, thus a running task
+ * has to be suspended.
+ */
+void _Scheduler_EDF_Release_job (
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
+);
+
RTEMS_INLINE_ROUTINE Scheduler_EDF_Control *
_Scheduler_EDF_Self_from_base( Scheduler_Control *scheduler_base )
{
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 6687fcf..32b4535 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -20,7 +20,12 @@
#define _RTEMS_SCORE_SCHEDULERIMPL_H
#include <rtems/score/scheduler.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/priority.h>
#include <rtems/score/threadimpl.h>
+#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
+ #include <sys/cpuset.h>
+#endif
#ifdef __cplusplus
extern "C" {
@@ -32,6 +37,102 @@ extern "C" {
/**@{**/
/**
+ * function jump table that holds pointers to the functions that
+ * implement specific schedulers.
+ */
+struct Scheduler_Operations {
+ /** Implements the scheduling decision logic (policy). */
+ void ( *initialize )(void);
+
+ /** Implements the scheduling decision logic (policy). */
+ void ( *schedule )( Scheduler_Control *, Thread_Control *);
+
+ /**
+ * @brief Voluntarily yields the processor per the scheduling policy.
+ *
+ * @see _Scheduler_Yield().
+ */
+ void ( *yield )( Scheduler_Control *, Thread_Control *);
+
+ /** Removes the given thread from scheduling decisions. */
+ void ( *block )( Scheduler_Control *, Thread_Control * );
+
+ /** Adds the given thread to scheduling decisions. */
+ void ( *unblock )( Scheduler_Control *, Thread_Control * );
+
+ /** allocates the scheduler field of the given thread */
+ void * ( *allocate )( Scheduler_Control *, Thread_Control * );
+
+ /** frees the scheduler field of the given thread */
+ void ( *free )( Scheduler_Control *, Thread_Control * );
+
+ /** updates the scheduler field of the given thread -- primarily used
+ * when changing the thread's priority. */
+ void ( *update )( Scheduler_Control *, Thread_Control * );
+
+ /** enqueue a thread as the last of its priority group */
+ void ( *enqueue )( Scheduler_Control *, Thread_Control * );
+
+ /** enqueue a thread as the first of its priority group */
+ void ( *enqueue_first )( Scheduler_Control *, Thread_Control * );
+
+ /** extract a thread from the ready set */
+ void ( *extract )( Scheduler_Control *, 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 ) ( Scheduler_Control *, Thread_Control *, uint32_t );
+
+ /** perform scheduler update actions required at each clock tick */
+ void ( *tick )( Scheduler_Control * );
+
+ /**
+ * @brief Starts the idle thread for a particular processor.
+ *
+ * @see _Scheduler_Start_idle().
+ */
+ void ( *start_idle )(
+ Scheduler_Control *,
+ Thread_Control *,
+ Per_CPU_Control *
+ );
+
+#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
+ /**
+ * @brief Obtain the processor affinity for a thread.
+ *
+ * @see _Scheduler_Get_affinity().
+ */
+ bool ( *get_affinity )(
+ Scheduler_Control *,
+ Thread_Control *,
+ size_t,
+ cpu_set_t *
+ );
+
+ /**
+ * @brief Set the processor affinity for a thread.
+ *
+ * @see _Scheduler_Set_affinity().
+ */
+ bool ( *set_affinity )(
+ Scheduler_Control *,
+ Thread_Control *,
+ size_t,
+ const cpu_set_t *
+ );
+#endif
+};
+
+/**
* @brief Initializes the scheduler to the policy chosen by the user.
*
* This routine initializes the scheduler to the policy chosen by the user
@@ -68,7 +169,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Schedule(
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.schedule )( scheduler, the_thread );
+ ( *scheduler->operations->schedule )( scheduler, the_thread );
}
/**
@@ -84,7 +185,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.yield )( scheduler, the_thread );
+ ( *scheduler->operations->yield )( scheduler, the_thread );
}
/**
@@ -100,7 +201,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Block(
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.block )( scheduler, the_thread );
+ ( *scheduler->operations->block )( scheduler, the_thread );
}
/**
@@ -116,7 +217,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.unblock )( scheduler, the_thread );
+ ( *scheduler->operations->unblock )( scheduler, the_thread );
}
/**
@@ -129,7 +230,7 @@ RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate(
Thread_Control *the_thread
)
{
- return ( *scheduler->Operations.allocate )( scheduler, the_thread );
+ return ( *scheduler->operations->allocate )( scheduler, the_thread );
}
/**
@@ -142,7 +243,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Free(
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.free )( scheduler, the_thread );
+ ( *scheduler->operations->free )( scheduler, the_thread );
}
/**
@@ -155,7 +256,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update(
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.update )( scheduler, the_thread );
+ ( *scheduler->operations->update )( scheduler, the_thread );
}
/**
@@ -168,7 +269,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.enqueue )( scheduler, the_thread );
+ ( *scheduler->operations->enqueue )( scheduler, the_thread );
}
/**
@@ -181,7 +282,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.enqueue_first )( scheduler, the_thread );
+ ( *scheduler->operations->enqueue_first )( scheduler, the_thread );
}
/**
@@ -194,7 +295,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.extract )( scheduler, the_thread );
+ ( *scheduler->operations->extract )( scheduler, the_thread );
}
/**
@@ -208,7 +309,7 @@ RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
Priority_Control p2
)
{
- return ( *scheduler->Operations.priority_compare )( p1, p2 );
+ return ( *scheduler->operations->priority_compare )( p1, p2 );
}
/**
@@ -222,7 +323,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
uint32_t length
)
{
- ( *scheduler->Operations.release_job )( scheduler, the_thread, length );
+ ( *scheduler->operations->release_job )( scheduler, the_thread, length );
}
/**
@@ -235,7 +336,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Tick( Scheduler_Control *scheduler )
{
- ( *scheduler->Operations.tick )( scheduler );
+ ( *scheduler->operations->tick )( scheduler );
}
/**
@@ -252,7 +353,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
Per_CPU_Control *cpu
)
{
- ( *scheduler->Operations.start_idle )( scheduler, the_thread, cpu );
+ ( *scheduler->operations->start_idle )( scheduler, the_thread, cpu );
}
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
@@ -262,14 +363,14 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
* @param[in,out] thread The thread.
* @parma[out] cpuset The processor affinity for this thread
*/
- RTEMS_INLINE_ROUTINE int _Scheduler_Get_affinity(
+ RTEMS_INLINE_ROUTINE bool _Scheduler_Get_affinity(
Scheduler_Control *scheduler,
Thread_Control *thread,
size_t cpusetsize,
cpu_set_t *cpuset
)
{
- return ( *scheduler->Operations.get_affinity )(
+ return ( *scheduler->operations->get_affinity )(
scheduler,
thread,
cpusetsize,
@@ -283,14 +384,14 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
* @param[in,out] thread The thread.
* @parma[in] cpuset The processor affinity for this thread
*/
- RTEMS_INLINE_ROUTINE int _Scheduler_Set_affinity(
+ RTEMS_INLINE_ROUTINE bool _Scheduler_Set_affinity(
Scheduler_Control *scheduler,
Thread_Control *thread,
size_t cpusetsize,
const cpu_set_t *cpuset
)
{
- return ( *scheduler->Operations.set_affinity )(
+ return ( *scheduler->operations->set_affinity )(
scheduler,
thread,
cpusetsize,
@@ -411,6 +512,121 @@ RTEMS_INLINE_ROUTINE Scheduler_Control *_Scheduler_Get(
return &_Scheduler;
}
+/**
+ * @brief Returns an arbitrary non-NULL value.
+ *
+ * @param[in] scheduler Unused.
+ * @param[in] the_thread Unused.
+ *
+ * @return An arbitrary non-NULL value.
+ */
+void *_Scheduler_default_Allocate(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Does nothing.
+ *
+ * @param[in] scheduler Unused.
+ * @param[in] the_thread Unused.
+ */
+void _Scheduler_default_Free(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Does nothing.
+ *
+ * @param[in] scheduler Unused.
+ * @param[in] the_thread Unused.
+ */
+void _Scheduler_default_Update(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Does nothing.
+ *
+ * @param[in] scheduler Unused.
+ * @param[in] the_thread Unused.
+ * @param[in] deadline Unused.
+ */
+void _Scheduler_default_Release_job(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
+);
+
+/**
+ * @brief Performs tick operations depending on the CPU budget algorithm for
+ * each executing thread.
+ *
+ * This routine is invoked as part of processing each clock tick.
+ *
+ * @param[in] scheduler The scheduler.
+ */
+void _Scheduler_default_Tick( Scheduler_Control *scheduler );
+
+/**
+ * @brief Starts an idle thread.
+ *
+ * @param[in] scheduler The scheduler.
+ * @param[in] the_thread An idle thread.
+ * @param[in] cpu This parameter is unused.
+ */
+void _Scheduler_default_Start_idle(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Per_CPU_Control *cpu
+);
+
+#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
+ /**
+ * @brief Get affinity for the default scheduler.
+ *
+ * @param[in] thread The associated thread.
+ * @param[in] cpusetsize The size of the cpuset.
+ * @param[out] cpuset Affinity set containing all CPUs.
+ *
+ * @retval 0 Successfully got cpuset
+ * @retval -1 The cpusetsize is invalid for the system
+ */
+ bool _Scheduler_default_Get_affinity(
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
+ );
+
+ /**
+ * @brief Set affinity for the default scheduler.
+ *
+ * @param[in] thread The associated thread.
+ * @param[in] cpusetsize The size of the cpuset.
+ * @param[in] cpuset Affinity new affinity set.
+ *
+ * @retval 0 Successful
+ *
+ * This method always returns successful and does not save
+ * the cpuset.
+ */
+ bool _Scheduler_default_Set_affinity(
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ const cpu_set_t *cpuset
+ );
+
+ #define SCHEDULER_DEFAULT_AFFINITY_OPERATIONS \
+ .get_affinity = _Scheduler_default_Get_affinity, \
+ .set_affinity = _Scheduler_default_Set_affinity,
+#else
+ #define SCHEDULER_DEFAULT_AFFINITY_OPERATIONS
+#endif
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 1e4e91b..33a7710 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -34,37 +34,6 @@ extern "C" {
*/
/**@{*/
-#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
- #define SCHEDULER_PRIORITY_ADDITIONAL_SMP_ENTRY_POINTS \
- _Scheduler_default_Get_affinity, /* get affinity entry point */ \
- _Scheduler_default_Set_affinity /* set affinity entry point */
-#else
- #define SCHEDULER_PRIORITY_ADDITIONAL_SMP_ENTRY_POINTS
-#endif
-
-/**
- * Entry points for the Deterministic Priority Based Scheduler.
- */
-#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_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 */ \
- SCHEDULER_PRIORITY_ADDITIONAL_SMP_ENTRY_POINTS \
- }
-
typedef struct {
/**
* @brief Bit map to indicate non-empty ready queues.
@@ -88,163 +57,7 @@ typedef struct {
Priority_bit_map_Information Priority_map;
} Scheduler_priority_Per_thread;
-/**
- * @brief Initializes the priority scheduler.
- * This routine initializes the priority scheduler.
- */
-void _Scheduler_priority_Initialize(void);
-
-/**
- * @brief Removes @a the_thread from the scheduling decision.
- *
- * This routine removes @a the_thread from the scheduling decision,
- * 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(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Sets the heir thread to be the next ready thread.
- *
- * This kernel routine sets the heir thread to be the next ready thread
- * by invoking the_scheduler->ready_queue->operations->first().
- */
-void _Scheduler_priority_Schedule(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief 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_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief 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_Free(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Update the scheduler priority.
- * 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_Update(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Add @a the_thread to the scheduling decision.
- *
- * 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(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief The specified THREAD yields.
- *
- * This routine is invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread in the queue.
- *
- * This routine will remove the specified THREAD from the ready queue
- * and place it immediately at the rear of this chain. Reset timeslice
- * and yield the processor functions both use this routine, therefore if
- * reset is true and this is the only thread on the queue then the
- * timeslice counter is reset. The heir THREAD will be updated if the
- * running is also the currently the heir.
- *
- * - INTERRUPT LATENCY:
- * + ready chain
- * + select heir
- *
- * @param[in,out] thread The yielding thread.
- */
-void _Scheduler_priority_Yield(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Puts @a the_thread on to the priority-based ready queue.
- *
- * 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(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Puts @a the_thread to the head of the ready queue.
- *
- * 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(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Remove a specific thread from scheduler.
- *
- * 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(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Compare two priorities.
- *
- * This routine compares two priorities.
- */
-int _Scheduler_priority_Priority_compare(
- Priority_Control p1,
- Priority_Control p2
-);
+extern const Scheduler_Operations _Scheduler_priority_Operations;
/**@}*/
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index 8f9d081..1d9602e 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -18,9 +18,6 @@
#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H
#define _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H
-#include <rtems/score/scheduler.h>
-#include <rtems/score/schedulerpriority.h>
-#include <rtems/score/schedulersmp.h>
#include <rtems/score/schedulerprioritysmp.h>
#include <rtems/score/cpuset.h>
@@ -45,75 +42,6 @@ extern "C" {
*/
/**
- * @brief Entry points for the Deterministic Priority Affinity SMP Scheduler.
- */
-#define SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS \
- { \
- _Scheduler_priority_SMP_Initialize, \
- _Scheduler_priority_SMP_Schedule, \
- _Scheduler_priority_SMP_Yield, \
- _Scheduler_priority_SMP_Block, \
- _Scheduler_priority_SMP_Enqueue_fifo, \
- _Scheduler_priority_affinity_SMP_Allocate, \
- _Scheduler_priority_Free, \
- _Scheduler_priority_SMP_Update, \
- _Scheduler_priority_SMP_Enqueue_fifo, \
- _Scheduler_priority_SMP_Enqueue_lifo, \
- _Scheduler_priority_SMP_Extract, \
- _Scheduler_priority_Priority_compare, \
- _Scheduler_default_Release_job, \
- _Scheduler_default_Tick, \
- _Scheduler_priority_SMP_Start_idle, \
- _Scheduler_priority_affinity_SMP_Get_affinity, \
- _Scheduler_priority_affinity_SMP_Set_affinity \
- }
-
-/**
- * @brief 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_affinity_SMP_Allocate( Thread_Control *the_thread );
-
-/**
- * @brief Get affinity for the priority affinity smp scheduler.
- *
- * @param[in] scheduler The scheduler of the thread.
- * @param[in] thread The associated thread.
- * @param[in] cpusetsize The size of the cpuset.
- * @param[in,out] cpuset The associated affinity set.
- *
- * @retval 0 Successfully got cpuset
- * @retval -1 The cpusetsize is invalid for the system
- */
-bool _Scheduler_priority_affinity_SMP_Get_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
-);
-
-/**
- * @brief Set affinity for the priority affinity smp scheduler.
- *
- * @param[in] scheduler The scheduler of the thread.
- * @param[in] thread The associated thread.
- * @param[in] cpusetsize The size of the cpuset.
- * @param[in] cpuset Affinity new affinity set.
- *
- * @retval 0 Successful
- */
-bool _Scheduler_priority_affinity_SMP_Set_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
-);
-
-/**
* This structure handles affinity specific data of a thread.
*
* @note The attribute priority_sched_info must remain
@@ -134,6 +62,8 @@ typedef struct {
CPU_set_Control Affinity;
} Scheduler_priority_affinity_SMP_Per_thread;
+extern const Scheduler_Operations _Scheduler_priority_affinity_SMP_Operations;
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index 7861df5..ceda148 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -35,6 +35,164 @@ extern "C" {
*/
/**@{**/
+/**
+ * @brief Initializes the priority scheduler.
+ * This routine initializes the priority scheduler.
+ */
+void _Scheduler_priority_Initialize(void);
+
+/**
+ * @brief Removes @a the_thread from the scheduling decision.
+ *
+ * This routine removes @a the_thread from the scheduling decision,
+ * 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(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Sets the heir thread to be the next ready thread.
+ *
+ * This kernel routine sets the heir thread to be the next ready thread
+ * by invoking the_scheduler->ready_queue->operations->first().
+ */
+void _Scheduler_priority_Schedule(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief 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_Allocate(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief 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_Free(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Update the scheduler priority.
+ * 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_Update(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Add @a the_thread to the scheduling decision.
+ *
+ * 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(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief The specified THREAD yields.
+ *
+ * This routine is invoked when a thread wishes to voluntarily
+ * transfer control of the processor to another thread in the queue.
+ *
+ * This routine will remove the specified THREAD from the ready queue
+ * and place it immediately at the rear of this chain. Reset timeslice
+ * and yield the processor functions both use this routine, therefore if
+ * reset is true and this is the only thread on the queue then the
+ * timeslice counter is reset. The heir THREAD will be updated if the
+ * running is also the currently the heir.
+ *
+ * - INTERRUPT LATENCY:
+ * + ready chain
+ * + select heir
+ *
+ * @param[in,out] thread The yielding thread.
+ */
+void _Scheduler_priority_Yield(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Puts @a the_thread on to the priority-based ready queue.
+ *
+ * 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(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Puts @a the_thread to the head of the ready queue.
+ *
+ * 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(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Remove a specific thread from scheduler.
+ *
+ * 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(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Compare two priorities.
+ *
+ * This routine compares two priorities.
+ */
+int _Scheduler_priority_Priority_compare(
+ Priority_Control p1,
+ Priority_Control p2
+);
+
RTEMS_INLINE_ROUTINE Scheduler_priority_Control *
_Scheduler_priority_Self_from_base( Scheduler_Control *scheduler_base )
{
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index 905549d..88c5985 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -7,7 +7,7 @@
*/
/*
- * Copyright (c) 2013 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -23,9 +23,8 @@
#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H
#define _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H
-#include <rtems/score/scheduler.h>
-#include <rtems/score/schedulerpriority.h>
#include <rtems/score/schedulersmp.h>
+#include <rtems/score/schedulerpriority.h>
#ifdef __cplusplus
extern "C" {
@@ -47,72 +46,13 @@ extern "C" {
* @{
*/
-/**
- * @brief Entry points for the Priority SMP Scheduler.
- */
-#define SCHEDULER_PRIORITY_SMP_ENTRY_POINTS \
- { \
- _Scheduler_priority_SMP_Initialize, \
- _Scheduler_priority_SMP_Schedule, \
- _Scheduler_priority_SMP_Yield, \
- _Scheduler_priority_SMP_Block, \
- _Scheduler_priority_SMP_Enqueue_fifo, \
- _Scheduler_priority_Allocate, \
- _Scheduler_priority_Free, \
- _Scheduler_priority_SMP_Update, \
- _Scheduler_priority_SMP_Enqueue_fifo, \
- _Scheduler_priority_SMP_Enqueue_lifo, \
- _Scheduler_priority_SMP_Extract, \
- _Scheduler_priority_Priority_compare, \
- _Scheduler_default_Release_job, \
- _Scheduler_default_Tick, \
- _Scheduler_priority_SMP_Start_idle, \
- _Scheduler_default_Get_affinity, \
- _Scheduler_default_Set_affinity \
- }
-
-void _Scheduler_priority_SMP_Initialize( void );
-
-void _Scheduler_priority_SMP_Schedule(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_priority_SMP_Block(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_priority_SMP_Update(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_priority_SMP_Enqueue_fifo(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_priority_SMP_Enqueue_lifo(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_priority_SMP_Extract(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_priority_SMP_Yield(
- Scheduler_Control *base,
- Thread_Control *thread
-);
+typedef struct {
+ Scheduler_SMP_Control Base;
+ Priority_bit_map_Control Bit_map;
+ Chain_Control Ready[ 1 ];
+} Scheduler_priority_SMP_Control;
-void _Scheduler_priority_SMP_Start_idle(
- Scheduler_Control *base,
- Thread_Control *thread,
- Per_CPU_Control *cpu
-);
+extern const Scheduler_Operations _Scheduler_priority_SMP_Operations;
/** @} */
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h b/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h
new file mode 100644
index 0000000..eb8c569
--- /dev/null
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h
@@ -0,0 +1,87 @@
+/**
+ * @file
+ *
+ * @ingroup ScoreSchedulerPrioritySMP
+ *
+ * @brief Deterministic Priority SMP Scheduler API
+ */
+
+/*
+ * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * 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.
+ */
+
+#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H
+#define _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H
+
+#include <rtems/score/schedulerimpl.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @addtogroup ScoreSchedulerPrioritySMP
+ *
+ * @{
+ */
+
+void _Scheduler_priority_SMP_Initialize( void );
+
+void _Scheduler_priority_SMP_Schedule(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
+
+void _Scheduler_priority_SMP_Block(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
+
+void _Scheduler_priority_SMP_Update(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
+
+void _Scheduler_priority_SMP_Enqueue_fifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
+
+void _Scheduler_priority_SMP_Enqueue_lifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
+
+void _Scheduler_priority_SMP_Extract(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
+
+void _Scheduler_priority_SMP_Yield(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
+
+void _Scheduler_priority_SMP_Start_idle(
+ Scheduler_Control *base,
+ Thread_Control *thread,
+ Per_CPU_Control *cpu
+);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H */
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 889c5a7..e27c41c 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -18,8 +18,8 @@
#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_H
#define _RTEMS_SCORE_SCHEDULERSIMPLE_H
+#include <rtems/score/chain.h>
#include <rtems/score/scheduler.h>
-#include <rtems/score/schedulerpriority.h>
#ifdef __cplusplus
extern "C" {
@@ -33,28 +33,6 @@ extern "C" {
/**@{*/
/**
- * Entry points for Scheduler Simple
- */
-#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_default_Allocate, /* allocate entry point */ \
- _Scheduler_default_Free, /* free entry point */ \
- _Scheduler_default_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_default_Release_job, /* new period of task */ \
- _Scheduler_default_Tick, /* tick entry point */ \
- _Scheduler_default_Start_idle /* start idle entry point */ \
- }
-
-/**
* @brief Simple scheduler control.
*/
typedef struct {
@@ -64,138 +42,7 @@ typedef struct {
Chain_Control Ready;
} Scheduler_simple_Control;
-/**
- * @brief Initialize simple scheduler.
- *
- * This routine initializes the simple scheduler.
- */
-void _Scheduler_simple_Initialize( void );
-
-/**
- * This routine sets the heir thread to be the next ready thread
- * on the ready queue by getting the first node in the scheduler
- * information.
- */
-void _Scheduler_simple_Schedule(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread in the queue.
- *
- * This routine is invoked when a thread wishes to voluntarily
- * transfer control of the processor to another thread in the queue.
- * It will remove the specified THREAD from the scheduler.informaiton
- * (where the ready queue is stored) and place it immediately at the
- * between the last entry of its priority and the next priority thread.
- * Reset timeslice and yield the processor functions both use this routine,
- * therefore if reset is true and this is the only thread on the queue then
- * the timeslice counter is reset. The heir THREAD will be updated if the
- * running is also the currently the heir.
- *
- * @param[in,out] thread The yielding thread.
- */
-void _Scheduler_simple_Yield(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Remove a simple-priority-based thread from the queue.
- *
- * This routine removes @a the_thread from the scheduling decision,
- * 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 that is to be blocked
- */
-void _Scheduler_simple_Block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Unblock a simple-priority-based thread.
- *
- * 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 is the thread that is to be unblocked
- */
-void _Scheduler_simple_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Removes a simple-priority-based thread from a simple queue.
- *
- * This routine removes a specific thread from the specified
- * simple-based ready queue.
- *
- * @param[in] the_thread is the thread to be blocked
- */
-void _Scheduler_simple_Extract(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Puts simple-priority-based thread onto the ready queue.
- *
- * This routine puts @a the_thread on to the ready queue.
- *
- * @param[in] the_thread is the thread to be enqueued
- */
-void _Scheduler_simple_Enqueue(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Put simple-priority-based @a the_thread to
- * the head of the ready queue.
- *
- * This routine puts @a the_thread to the head of the ready queue.
- * The thread will be the first thread at its priority level.
- *
- * @param[in] the_thread is the thread to be blocked
- */
-void _Scheduler_simple_Enqueue_first(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * _Scheduler_simple_Ready_queue_enqueue
- *
- * This routine puts @a the_thread on the ready queue
- * at the end of its priority group.
- *
- * @param[in] the_thread - pointer to a thread control block
- */
-void _Scheduler_simple_Ready_queue_enqueue(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
-
-/**
- * @brief Puts simple-priority-based @a the_thread on to the ready queue
- * at the beginning of its priority group.
- *
- * This routine puts @a the_thread on to the ready queue
- * at the beginning of its priority group.
- *
- * @param[in] the_thread - pointer to a thread control block
- */
-void _Scheduler_simple_Ready_queue_enqueue_first(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
-);
+extern const Scheduler_Operations _Scheduler_simple_Operations;
/**@}*/
diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
index 8ad142f..0834e43 100644
--- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
@@ -32,6 +32,139 @@ extern "C" {
*/
/**@{**/
+/**
+ * @brief Initialize simple scheduler.
+ *
+ * This routine initializes the simple scheduler.
+ */
+void _Scheduler_simple_Initialize( void );
+
+/**
+ * This routine sets the heir thread to be the next ready thread
+ * on the ready queue by getting the first node in the scheduler
+ * information.
+ */
+void _Scheduler_simple_Schedule(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Invoked when a thread wishes to voluntarily
+ * transfer control of the processor to another thread in the queue.
+ *
+ * This routine is invoked when a thread wishes to voluntarily
+ * transfer control of the processor to another thread in the queue.
+ * It will remove the specified THREAD from the scheduler.informaiton
+ * (where the ready queue is stored) and place it immediately at the
+ * between the last entry of its priority and the next priority thread.
+ * Reset timeslice and yield the processor functions both use this routine,
+ * therefore if reset is true and this is the only thread on the queue then
+ * the timeslice counter is reset. The heir THREAD will be updated if the
+ * running is also the currently the heir.
+ *
+ * @param[in,out] thread The yielding thread.
+ */
+void _Scheduler_simple_Yield(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Remove a simple-priority-based thread from the queue.
+ *
+ * This routine removes @a the_thread from the scheduling decision,
+ * 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 that is to be blocked
+ */
+void _Scheduler_simple_Block(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Unblock a simple-priority-based thread.
+ *
+ * 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 is the thread that is to be unblocked
+ */
+void _Scheduler_simple_Unblock(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Removes a simple-priority-based thread from a simple queue.
+ *
+ * This routine removes a specific thread from the specified
+ * simple-based ready queue.
+ *
+ * @param[in] the_thread is the thread to be blocked
+ */
+void _Scheduler_simple_Extract(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Puts simple-priority-based thread onto the ready queue.
+ *
+ * This routine puts @a the_thread on to the ready queue.
+ *
+ * @param[in] the_thread is the thread to be enqueued
+ */
+void _Scheduler_simple_Enqueue(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Put simple-priority-based @a the_thread to
+ * the head of the ready queue.
+ *
+ * This routine puts @a the_thread to the head of the ready queue.
+ * The thread will be the first thread at its priority level.
+ *
+ * @param[in] the_thread is the thread to be blocked
+ */
+void _Scheduler_simple_Enqueue_first(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * _Scheduler_simple_Ready_queue_enqueue
+ *
+ * This routine puts @a the_thread on the ready queue
+ * at the end of its priority group.
+ *
+ * @param[in] the_thread - pointer to a thread control block
+ */
+void _Scheduler_simple_Ready_queue_enqueue(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief Puts simple-priority-based @a the_thread on to the ready queue
+ * at the beginning of its priority group.
+ *
+ * This routine puts @a the_thread on to the ready queue
+ * at the beginning of its priority group.
+ *
+ * @param[in] the_thread - pointer to a thread control block
+ */
+void _Scheduler_simple_Ready_queue_enqueue_first(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
+
RTEMS_INLINE_ROUTINE Scheduler_simple_Control *
_Scheduler_simple_Self_from_base( Scheduler_Control *scheduler_base )
{
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index a6d8262..bdf5471 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -49,67 +49,12 @@ extern "C" {
* @{
*/
-/**
- * @brief Entry points for the Simple SMP Scheduler.
- */
-#define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \
- { \
- _Scheduler_simple_smp_Initialize, \
- _Scheduler_simple_smp_Schedule, \
- _Scheduler_simple_smp_Yield, \
- _Scheduler_simple_smp_Block, \
- _Scheduler_simple_smp_Enqueue_priority_fifo, \
- _Scheduler_default_Allocate, \
- _Scheduler_default_Free, \
- _Scheduler_default_Update, \
- _Scheduler_simple_smp_Enqueue_priority_fifo, \
- _Scheduler_simple_smp_Enqueue_priority_lifo, \
- _Scheduler_simple_smp_Extract, \
- _Scheduler_priority_Priority_compare, \
- _Scheduler_default_Release_job, \
- _Scheduler_default_Tick, \
- _Scheduler_simple_smp_Start_idle, \
- _Scheduler_default_Get_affinity, \
- _Scheduler_default_Set_affinity \
- }
-
-void _Scheduler_simple_smp_Initialize( void );
-
-void _Scheduler_simple_smp_Block(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_simple_smp_Enqueue_priority_fifo(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_simple_smp_Enqueue_priority_lifo(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_simple_smp_Extract(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_simple_smp_Yield(
- Scheduler_Control *base,
- Thread_Control *thread
-);
-
-void _Scheduler_simple_smp_Schedule(
- Scheduler_Control *base,
- Thread_Control *thread
-);
+typedef struct {
+ Scheduler_SMP_Control Base;
+ Chain_Control Ready;
+} Scheduler_simple_SMP_Control;
-void _Scheduler_simple_smp_Start_idle(
- Scheduler_Control *base,
- Thread_Control *thread,
- Per_CPU_Control *cpu
-);
+extern const Scheduler_Operations _Scheduler_simple_SMP_Operations;
/** @} */
diff --git a/cpukit/score/include/rtems/score/schedulersmp.h b/cpukit/score/include/rtems/score/schedulersmp.h
index 458a312..214d157 100644
--- a/cpukit/score/include/rtems/score/schedulersmp.h
+++ b/cpukit/score/include/rtems/score/schedulersmp.h
@@ -24,9 +24,7 @@
#define _RTEMS_SCORE_SCHEDULERSMP_H
#include <rtems/score/chain.h>
-#include <rtems/score/percpu.h>
-#include <rtems/score/prioritybitmap.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/scheduler.h>
#ifdef __cplusplus
extern "C" {
@@ -44,17 +42,6 @@ typedef struct {
Chain_Control Scheduled;
} Scheduler_SMP_Control;
-typedef struct {
- Scheduler_SMP_Control Base;
- Chain_Control Ready;
-} Scheduler_simple_SMP_Control;
-
-typedef struct {
- Scheduler_SMP_Control Base;
- Priority_bit_map_Control Bit_map;
- Chain_Control Ready[ 1 ];
-} Scheduler_priority_SMP_Control;
-
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index efbe37d..e357eaf 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -191,6 +191,10 @@ $(PROJECT_INCLUDE)/rtems/score/schedulercbs.h: include/rtems/score/schedulercbs.
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulercbs.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulercbs.h
+$(PROJECT_INCLUDE)/rtems/score/schedulercbsimpl.h: include/rtems/score/schedulercbsimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulercbsimpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulercbsimpl.h
+
$(PROJECT_INCLUDE)/rtems/score/scheduleredf.h: include/rtems/score/scheduleredf.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/scheduleredf.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/scheduleredf.h
@@ -211,6 +215,10 @@ $(PROJECT_INCLUDE)/rtems/score/schedulerprioritysmp.h: include/rtems/score/sched
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerprioritysmp.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerprioritysmp.h
+$(PROJECT_INCLUDE)/rtems/score/schedulerprioritysmpimpl.h: include/rtems/score/schedulerprioritysmpimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerprioritysmpimpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerprioritysmpimpl.h
+
$(PROJECT_INCLUDE)/rtems/score/schedulersimple.h: include/rtems/score/schedulersimple.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersimple.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersimple.h
diff --git a/cpukit/score/src/scheduler.c b/cpukit/score/src/scheduler.c
index 7705472..70e2f42 100644
--- a/cpukit/score/src/scheduler.c
+++ b/cpukit/score/src/scheduler.c
@@ -22,5 +22,5 @@
void _Scheduler_Handler_initialization(void)
{
- (*_Scheduler.Operations.initialize)();
+ ( *_Scheduler.operations->initialize )();
}
diff --git a/cpukit/score/src/schedulercbs.c b/cpukit/score/src/schedulercbs.c
index c427c52..105015c 100644
--- a/cpukit/score/src/schedulercbs.c
+++ b/cpukit/score/src/schedulercbs.c
@@ -18,7 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/wkspace.h>
diff --git a/cpukit/score/src/schedulercbsallocate.c b/cpukit/score/src/schedulercbsallocate.c
index 908ea90..b94ac9a 100644
--- a/cpukit/score/src/schedulercbsallocate.c
+++ b/cpukit/score/src/schedulercbsallocate.c
@@ -18,11 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/scheduleredf.h>
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
#include <rtems/score/wkspace.h>
void *_Scheduler_CBS_Allocate(
diff --git a/cpukit/score/src/schedulercbsattachthread.c b/cpukit/score/src/schedulercbsattachthread.c
index ad92791..f0745d5 100644
--- a/cpukit/score/src/schedulercbsattachthread.c
+++ b/cpukit/score/src/schedulercbsattachthread.c
@@ -18,7 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
#include <rtems/score/threadimpl.h>
int _Scheduler_CBS_Attach_thread (
diff --git a/cpukit/score/src/schedulercbscleanup.c b/cpukit/score/src/schedulercbscleanup.c
index 795b16a..f19930d 100644
--- a/cpukit/score/src/schedulercbscleanup.c
+++ b/cpukit/score/src/schedulercbscleanup.c
@@ -18,7 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
#include <rtems/score/wkspace.h>
int _Scheduler_CBS_Cleanup (void)
diff --git a/cpukit/score/src/schedulercbscreateserver.c b/cpukit/score/src/schedulercbscreateserver.c
index 85ed6d4..c9aff91 100644
--- a/cpukit/score/src/schedulercbscreateserver.c
+++ b/cpukit/score/src/schedulercbscreateserver.c
@@ -18,7 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
#include <rtems/score/wkspace.h>
int _Scheduler_CBS_Create_server (
diff --git a/cpukit/score/src/schedulercbsdestroyserver.c b/cpukit/score/src/schedulercbsdestroyserver.c
index d8885a8..f221ef7 100644
--- a/cpukit/score/src/schedulercbsdestroyserver.c
+++ b/cpukit/score/src/schedulercbsdestroyserver.c
@@ -19,7 +19,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
#include <rtems/score/wkspace.h>
int _Scheduler_CBS_Destroy_server (
diff --git a/cpukit/score/src/schedulercbsdetachthread.c b/cpukit/score/src/schedulercbsdetachthread.c
index f8a5e32..f9c3847 100644
--- a/cpukit/score/src/schedulercbsdetachthread.c
+++ b/cpukit/score/src/schedulercbsdetachthread.c
@@ -19,7 +19,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
#include <rtems/score/threadimpl.h>
int _Scheduler_CBS_Detach_thread (
diff --git a/cpukit/score/src/schedulercbsgetapprovedbudget.c b/cpukit/score/src/schedulercbsgetapprovedbudget.c
index 560849e..c73ec44 100644
--- a/cpukit/score/src/schedulercbsgetapprovedbudget.c
+++ b/cpukit/score/src/schedulercbsgetapprovedbudget.c
@@ -18,10 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
int _Scheduler_CBS_Get_approved_budget (
Scheduler_CBS_Server_id server_id,
diff --git a/cpukit/score/src/schedulercbsgetexecutiontime.c b/cpukit/score/src/schedulercbsgetexecutiontime.c
index 325c759..49083d5 100644
--- a/cpukit/score/src/schedulercbsgetexecutiontime.c
+++ b/cpukit/score/src/schedulercbsgetexecutiontime.c
@@ -19,7 +19,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
#include <rtems/score/threadimpl.h>
int _Scheduler_CBS_Get_execution_time (
diff --git a/cpukit/score/src/schedulercbsgetparameters.c b/cpukit/score/src/schedulercbsgetparameters.c
index 12c9489..74241ef 100644
--- a/cpukit/score/src/schedulercbsgetparameters.c
+++ b/cpukit/score/src/schedulercbsgetparameters.c
@@ -18,10 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
int _Scheduler_CBS_Get_parameters (
Scheduler_CBS_Server_id server_id,
diff --git a/cpukit/score/src/schedulercbsgetremainingbudget.c b/cpukit/score/src/schedulercbsgetremainingbudget.c
index df4709d..624fc38 100644
--- a/cpukit/score/src/schedulercbsgetremainingbudget.c
+++ b/cpukit/score/src/schedulercbsgetremainingbudget.c
@@ -18,7 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
#include <rtems/score/threadimpl.h>
int _Scheduler_CBS_Get_remaining_budget (
diff --git a/cpukit/score/src/schedulercbsgetserverid.c b/cpukit/score/src/schedulercbsgetserverid.c
index 0711bae..7665ebb 100644
--- a/cpukit/score/src/schedulercbsgetserverid.c
+++ b/cpukit/score/src/schedulercbsgetserverid.c
@@ -18,10 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
int _Scheduler_CBS_Get_server_id (
rtems_id task_id,
diff --git a/cpukit/score/src/schedulercbsops.c b/cpukit/score/src/schedulercbsops.c
new file mode 100644
index 0000000..6d943e3
--- /dev/null
+++ b/cpukit/score/src/schedulercbsops.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * 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/schedulercbsimpl.h>
+
+const Scheduler_Operations _Scheduler_CBS_Operations = {
+ SCHEDULER_DEFAULT_AFFINITY_OPERATIONS
+ .initialize = _Scheduler_EDF_Initialize,
+ .schedule = _Scheduler_EDF_Schedule,
+ .yield = _Scheduler_EDF_Yield,
+ .block = _Scheduler_EDF_Block,
+ .unblock = _Scheduler_CBS_Unblock,
+ .allocate = _Scheduler_CBS_Allocate,
+ .free = _Scheduler_EDF_Free,
+ .update = _Scheduler_EDF_Update,
+ .enqueue = _Scheduler_EDF_Enqueue,
+ .enqueue_first = _Scheduler_EDF_Enqueue_first,
+ .extract = _Scheduler_EDF_Extract,
+ .priority_compare = _Scheduler_EDF_Priority_compare,
+ .release_job = _Scheduler_CBS_Release_job,
+ .tick = _Scheduler_default_Tick,
+ .start_idle = _Scheduler_default_Start_idle
+};
diff --git a/cpukit/score/src/schedulercbssetparameters.c b/cpukit/score/src/schedulercbssetparameters.c
index 8c45232..4c5fa25 100644
--- a/cpukit/score/src/schedulercbssetparameters.c
+++ b/cpukit/score/src/schedulercbssetparameters.c
@@ -19,10 +19,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/schedulercbs.h>
+#include <rtems/score/schedulercbsimpl.h>
int _Scheduler_CBS_Set_parameters (
Scheduler_CBS_Server_id server_id,
diff --git a/cpukit/score/src/schedulercbsunblock.c b/cpukit/score/src/schedulercbsunblock.c
index 11465f2..5ba49a3 100644
--- a/cpukit/score/src/schedulercbsunblock.c
+++ b/cpukit/score/src/schedulercbsunblock.c
@@ -19,8 +19,8 @@
#include "config.h"
#endif
-#include <rtems/score/schedulercbs.h>
-#include <rtems/score/schedulerimpl.h>
+#include <rtems/score/schedulercbsimpl.h>
+#include <rtems/score/scheduleredfimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/watchdogimpl.h>
diff --git a/cpukit/score/src/schedulerdefaultallocatefree.c b/cpukit/score/src/schedulerdefaultallocatefree.c
index 7ffade2..46cbe81 100644
--- a/cpukit/score/src/schedulerdefaultallocatefree.c
+++ b/cpukit/score/src/schedulerdefaultallocatefree.c
@@ -19,7 +19,7 @@
#include "config.h"
#endif
-#include <rtems/score/scheduler.h>
+#include <rtems/score/schedulerimpl.h>
void *_Scheduler_default_Allocate(
Scheduler_Control *scheduler,
diff --git a/cpukit/score/src/schedulerdefaultreleasejob.c b/cpukit/score/src/schedulerdefaultreleasejob.c
index 10ebf84..81c0fd8 100644
--- a/cpukit/score/src/schedulerdefaultreleasejob.c
+++ b/cpukit/score/src/schedulerdefaultreleasejob.c
@@ -19,7 +19,7 @@
#include "config.h"
#endif
-#include <rtems/score/scheduler.h>
+#include <rtems/score/schedulerimpl.h>
void _Scheduler_default_Release_job(
Scheduler_Control *scheduler,
diff --git a/cpukit/score/src/schedulerdefaultupdate.c b/cpukit/score/src/schedulerdefaultupdate.c
index c1b62b2..435bc1c 100644
--- a/cpukit/score/src/schedulerdefaultupdate.c
+++ b/cpukit/score/src/schedulerdefaultupdate.c
@@ -19,7 +19,7 @@
#include "config.h"
#endif
-#include <rtems/score/scheduler.h>
+#include <rtems/score/schedulerimpl.h>
void _Scheduler_default_Update(
Scheduler_Control *scheduler,
diff --git a/cpukit/score/src/scheduleredf.c b/cpukit/score/src/scheduleredf.c
index 502a2a1..fb317cb 100644
--- a/cpukit/score/src/scheduleredf.c
+++ b/cpukit/score/src/scheduleredf.c
@@ -18,9 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/scheduleredf.h>
-#include <rtems/score/schedulerimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/scheduleredfimpl.h>
#include <rtems/score/wkspace.h>
static int _Scheduler_EDF_RBTree_compare_function
diff --git a/cpukit/score/src/scheduleredfallocate.c b/cpukit/score/src/scheduleredfallocate.c
index 73df5b8..a8c65c5 100644
--- a/cpukit/score/src/scheduleredfallocate.c
+++ b/cpukit/score/src/scheduleredfallocate.c
@@ -18,10 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/scheduleredf.h>
+#include <rtems/score/scheduleredfimpl.h>
#include <rtems/score/wkspace.h>
void *_Scheduler_EDF_Allocate(
diff --git a/cpukit/score/src/scheduleredfenqueuefirst.c b/cpukit/score/src/scheduleredfenqueuefirst.c
index bcf70b4..5761f4c 100644
--- a/cpukit/score/src/scheduleredfenqueuefirst.c
+++ b/cpukit/score/src/scheduleredfenqueuefirst.c
@@ -19,9 +19,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduleredf.h>
+#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Enqueue_first(
Scheduler_Control *scheduler,
diff --git a/cpukit/score/src/scheduleredffree.c b/cpukit/score/src/scheduleredffree.c
index d9493cc..a612121 100644
--- a/cpukit/score/src/scheduleredffree.c
+++ b/cpukit/score/src/scheduleredffree.c
@@ -19,10 +19,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/scheduleredf.h>
+#include <rtems/score/scheduleredfimpl.h>
#include <rtems/score/wkspace.h>
void _Scheduler_EDF_Free(
diff --git a/cpukit/score/src/scheduleredfops.c b/cpukit/score/src/scheduleredfops.c
new file mode 100644
index 0000000..03d1827
--- /dev/null
+++ b/cpukit/score/src/scheduleredfops.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * 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/scheduleredfimpl.h>
+
+const Scheduler_Operations _Scheduler_EDF_Operations = {
+ SCHEDULER_DEFAULT_AFFINITY_OPERATIONS
+ .initialize = _Scheduler_EDF_Initialize,
+ .schedule = _Scheduler_EDF_Schedule,
+ .yield = _Scheduler_EDF_Yield,
+ .block = _Scheduler_EDF_Block,
+ .unblock = _Scheduler_EDF_Unblock,
+ .allocate = _Scheduler_EDF_Allocate,
+ .free = _Scheduler_EDF_Free,
+ .update = _Scheduler_EDF_Update,
+ .enqueue = _Scheduler_EDF_Enqueue,
+ .enqueue_first = _Scheduler_EDF_Enqueue_first,
+ .extract = _Scheduler_EDF_Extract,
+ .priority_compare = _Scheduler_EDF_Priority_compare,
+ .release_job = _Scheduler_EDF_Release_job,
+ .tick = _Scheduler_default_Tick,
+ .start_idle = _Scheduler_default_Start_idle
+};
diff --git a/cpukit/score/src/scheduleredfprioritycompare.c b/cpukit/score/src/scheduleredfprioritycompare.c
index 0fbfaa6..d34edeb 100644
--- a/cpukit/score/src/scheduleredfprioritycompare.c
+++ b/cpukit/score/src/scheduleredfprioritycompare.c
@@ -19,9 +19,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduleredf.h>
+#include <rtems/score/scheduleredfimpl.h>
#include <rtems/score/watchdogimpl.h>
int _Scheduler_EDF_Priority_compare (
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c
index 37ff2d5..c2592b9 100644
--- a/cpukit/score/src/scheduleredfreleasejob.c
+++ b/cpukit/score/src/scheduleredfreleasejob.c
@@ -18,7 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/scheduleredf.h>
+#include <rtems/score/scheduleredfimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/watchdogimpl.h>
diff --git a/cpukit/score/src/scheduleredfunblock.c b/cpukit/score/src/scheduleredfunblock.c
index 0640e8c..387a78a 100644
--- a/cpukit/score/src/scheduleredfunblock.c
+++ b/cpukit/score/src/scheduleredfunblock.c
@@ -18,8 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/scheduleredf.h>
-#include <rtems/score/schedulerimpl.h>
+#include <rtems/score/scheduleredfimpl.h>
#include <rtems/score/thread.h>
void _Scheduler_EDF_Unblock(
diff --git a/cpukit/score/src/scheduleredfupdate.c b/cpukit/score/src/scheduleredfupdate.c
index 3069068..1a5ce13 100644
--- a/cpukit/score/src/scheduleredfupdate.c
+++ b/cpukit/score/src/scheduleredfupdate.c
@@ -18,12 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/scheduleredf.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Update(
Scheduler_Control *scheduler,
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 08b6e82..2f8fe42 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -20,18 +20,18 @@
#endif
#include <rtems/score/schedulerpriorityaffinitysmp.h>
+#include <rtems/score/cpusetimpl.h>
#include <rtems/score/schedulerpriorityimpl.h>
-#include <rtems/score/schedulersmpimpl.h>
+#include <rtems/score/schedulerprioritysmpimpl.h>
#include <rtems/score/wkspace.h>
-#include <rtems/score/cpusetimpl.h>
-RTEMS_INLINE_ROUTINE Scheduler_priority_affinity_SMP_Per_thread *
+static Scheduler_priority_affinity_SMP_Per_thread *
_Scheduler_priority_affinity_Get_scheduler_info( Thread_Control *thread )
{
return ( Scheduler_priority_affinity_SMP_Per_thread * ) thread->scheduler_info;
}
-void * _Scheduler_priority_affinity_SMP_Allocate(
+static void * _Scheduler_priority_affinity_SMP_Allocate(
Scheduler_Control *scheduler,
Thread_Control *the_thread
)
@@ -47,7 +47,7 @@ void * _Scheduler_priority_affinity_SMP_Allocate(
return info;
}
-bool _Scheduler_priority_affinity_SMP_Get_affinity(
+static bool _Scheduler_priority_affinity_SMP_Get_affinity(
Scheduler_Control *scheduler,
Thread_Control *thread,
size_t cpusetsize,
@@ -67,11 +67,11 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
return true;
}
-bool _Scheduler_priority_affinity_SMP_Set_affinity(
+static bool _Scheduler_priority_affinity_SMP_Set_affinity(
Scheduler_Control *scheduler,
Thread_Control *thread,
size_t cpusetsize,
- cpu_set_t *cpuset
+ const cpu_set_t *cpuset
)
{
Scheduler_priority_affinity_SMP_Per_thread *info =
@@ -87,3 +87,23 @@ bool _Scheduler_priority_affinity_SMP_Set_affinity(
return true;
}
+
+const Scheduler_Operations _Scheduler_priority_affinity_SMP_Operations = {
+ .initialize = _Scheduler_priority_SMP_Initialize,
+ .schedule = _Scheduler_priority_SMP_Schedule,
+ .yield = _Scheduler_priority_SMP_Yield,
+ .block = _Scheduler_priority_SMP_Block,
+ .unblock = _Scheduler_priority_SMP_Enqueue_fifo,
+ .allocate = _Scheduler_priority_affinity_SMP_Allocate,
+ .free = _Scheduler_priority_Free,
+ .update = _Scheduler_priority_SMP_Update,
+ .enqueue = _Scheduler_priority_SMP_Enqueue_fifo,
+ .enqueue_first = _Scheduler_priority_SMP_Enqueue_lifo,
+ .extract = _Scheduler_priority_SMP_Extract,
+ .priority_compare = _Scheduler_priority_Priority_compare,
+ .release_job = _Scheduler_default_Release_job,
+ .tick = _Scheduler_default_Tick,
+ .start_idle = _Scheduler_priority_SMP_Start_idle,
+ .get_affinity = _Scheduler_priority_affinity_SMP_Get_affinity,
+ .set_affinity = _Scheduler_priority_affinity_SMP_Set_affinity
+};
diff --git a/cpukit/score/src/schedulerpriorityallocate.c b/cpukit/score/src/schedulerpriorityallocate.c
index 2225d3d..db362e7 100644
--- a/cpukit/score/src/schedulerpriorityallocate.c
+++ b/cpukit/score/src/schedulerpriorityallocate.c
@@ -18,8 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulerpriority.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/schedulerpriorityimpl.h>
#include <rtems/score/wkspace.h>
void *_Scheduler_priority_Allocate (
diff --git a/cpukit/score/src/schedulerpriorityops.c b/cpukit/score/src/schedulerpriorityops.c
new file mode 100644
index 0000000..9d16aeb
--- /dev/null
+++ b/cpukit/score/src/schedulerpriorityops.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * 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>
+
+const Scheduler_Operations _Scheduler_priority_Operations = {
+ SCHEDULER_DEFAULT_AFFINITY_OPERATIONS
+ .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,
+ .priority_compare = _Scheduler_priority_Priority_compare,
+ .release_job = _Scheduler_default_Release_job,
+ .tick = _Scheduler_default_Tick,
+ .start_idle = _Scheduler_default_Start_idle
+};
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 5361023..d19a570 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -26,6 +26,7 @@
#include <rtems/score/schedulerprioritysmp.h>
#include <rtems/score/schedulerpriorityimpl.h>
+#include <rtems/score/schedulerprioritysmpimpl.h>
#include <rtems/score/schedulersmpimpl.h>
#include <rtems/score/wkspace.h>
@@ -291,3 +292,22 @@ void _Scheduler_priority_SMP_Start_idle(
_Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
}
+
+const Scheduler_Operations _Scheduler_priority_SMP_Operations = {
+ SCHEDULER_DEFAULT_AFFINITY_OPERATIONS
+ .initialize = _Scheduler_priority_SMP_Initialize,
+ .schedule = _Scheduler_priority_SMP_Schedule,
+ .yield = _Scheduler_priority_SMP_Yield,
+ .block = _Scheduler_priority_SMP_Block,
+ .unblock = _Scheduler_priority_SMP_Enqueue_fifo,
+ .allocate = _Scheduler_priority_Allocate,
+ .free = _Scheduler_priority_Free,
+ .update = _Scheduler_priority_SMP_Update,
+ .enqueue = _Scheduler_priority_SMP_Enqueue_fifo,
+ .enqueue_first = _Scheduler_priority_SMP_Enqueue_lifo,
+ .extract = _Scheduler_priority_SMP_Extract,
+ .priority_compare = _Scheduler_priority_Priority_compare,
+ .release_job = _Scheduler_default_Release_job,
+ .tick = _Scheduler_default_Tick,
+ .start_idle = _Scheduler_priority_SMP_Start_idle
+};
diff --git a/cpukit/score/src/schedulersimple.c b/cpukit/score/src/schedulersimple.c
index b825b29..b425e55 100644
--- a/cpukit/score/src/schedulersimple.c
+++ b/cpukit/score/src/schedulersimple.c
@@ -19,7 +19,7 @@
#include "config.h"
#endif
-#include <rtems/score/schedulersimple.h>
+#include <rtems/score/schedulersimpleimpl.h>
#include <rtems/score/chainimpl.h>
#include <rtems/score/wkspace.h>
diff --git a/cpukit/score/src/schedulersimpleenqueue.c b/cpukit/score/src/schedulersimpleenqueue.c
index b0d4992..843a2c3 100644
--- a/cpukit/score/src/schedulersimpleenqueue.c
+++ b/cpukit/score/src/schedulersimpleenqueue.c
@@ -19,11 +19,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/schedulersimple.h>
+#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Enqueue(
Scheduler_Control *scheduler,
diff --git a/cpukit/score/src/schedulersimpleenqueuefirst.c b/cpukit/score/src/schedulersimpleenqueuefirst.c
index b9005a7..84c41b5 100644
--- a/cpukit/score/src/schedulersimpleenqueuefirst.c
+++ b/cpukit/score/src/schedulersimpleenqueuefirst.c
@@ -18,10 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/schedulersimple.h>
+#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Enqueue_first(
Scheduler_Control *scheduler,
diff --git a/cpukit/score/src/schedulersimpleextract.c b/cpukit/score/src/schedulersimpleextract.c
index 7bb4339..5b5cde7 100644
--- a/cpukit/score/src/schedulersimpleextract.c
+++ b/cpukit/score/src/schedulersimpleextract.c
@@ -19,9 +19,8 @@
#include "config.h"
#endif
-#include <rtems/score/schedulersimple.h>
+#include <rtems/score/schedulersimpleimpl.h>
#include <rtems/score/chainimpl.h>
-#include <rtems/score/thread.h>
void _Scheduler_simple_Extract(
Scheduler_Control *scheduler,
diff --git a/cpukit/score/src/schedulersimpleops.c b/cpukit/score/src/schedulersimpleops.c
new file mode 100644
index 0000000..3dd36b5
--- /dev/null
+++ b/cpukit/score/src/schedulersimpleops.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * 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/schedulersimpleimpl.h>
+#include <rtems/score/schedulerpriorityimpl.h>
+
+const Scheduler_Operations _Scheduler_simple_Operations = {
+ SCHEDULER_DEFAULT_AFFINITY_OPERATIONS
+ .initialize = _Scheduler_simple_Initialize,
+ .schedule = _Scheduler_simple_Schedule,
+ .yield = _Scheduler_simple_Yield,
+ .block = _Scheduler_simple_Block,
+ .unblock = _Scheduler_simple_Unblock,
+ .allocate = _Scheduler_default_Allocate,
+ .free = _Scheduler_default_Free,
+ .update = _Scheduler_default_Update,
+ .enqueue = _Scheduler_simple_Enqueue,
+ .enqueue_first = _Scheduler_simple_Enqueue_first,
+ .extract = _Scheduler_simple_Extract,
+ .priority_compare = _Scheduler_priority_Priority_compare,
+ .release_job = _Scheduler_default_Release_job,
+ .tick = _Scheduler_default_Tick,
+ .start_idle = _Scheduler_default_Start_idle
+};
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index 20a35af..7ea5f6f 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/score/schedulersimplesmp.h>
+#include <rtems/score/schedulerpriorityimpl.h>
#include <rtems/score/schedulersmpimpl.h>
#include <rtems/score/wkspace.h>
@@ -35,7 +36,7 @@ _Scheduler_simple_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
( (char *) smp_base - offsetof( Scheduler_simple_SMP_Control, Base ) );
}
-void _Scheduler_simple_smp_Initialize( void )
+static void _Scheduler_simple_SMP_Initialize( void )
{
Scheduler_simple_SMP_Control *self =
_Workspace_Allocate_or_fatal_error( sizeof( *self ) );
@@ -46,7 +47,7 @@ void _Scheduler_simple_smp_Initialize( void )
_Scheduler.information = self;
}
-static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
+static Thread_Control *_Scheduler_simple_SMP_Get_highest_ready(
Scheduler_SMP_Control *smp_base
)
{
@@ -62,7 +63,7 @@ static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
return highest_ready;
}
-static void _Scheduler_simple_smp_Move_from_scheduled_to_ready(
+static void _Scheduler_simple_SMP_Move_from_scheduled_to_ready(
Scheduler_SMP_Control *smp_base,
Thread_Control *scheduled_to_ready
)
@@ -77,7 +78,7 @@ static void _Scheduler_simple_smp_Move_from_scheduled_to_ready(
);
}
-static void _Scheduler_simple_smp_Move_from_ready_to_scheduled(
+static void _Scheduler_simple_SMP_Move_from_ready_to_scheduled(
Scheduler_SMP_Control *smp_base,
Thread_Control *ready_to_scheduled
)
@@ -89,7 +90,7 @@ static void _Scheduler_simple_smp_Move_from_ready_to_scheduled(
);
}
-static void _Scheduler_simple_smp_Insert_ready_lifo(
+static void _Scheduler_simple_SMP_Insert_ready_lifo(
Scheduler_SMP_Control *smp_base,
Thread_Control *thread
)
@@ -104,7 +105,7 @@ static void _Scheduler_simple_smp_Insert_ready_lifo(
);
}
-static void _Scheduler_simple_smp_Insert_ready_fifo(
+static void _Scheduler_simple_SMP_Insert_ready_fifo(
Scheduler_SMP_Control *smp_base,
Thread_Control *thread
)
@@ -119,7 +120,7 @@ static void _Scheduler_simple_smp_Insert_ready_fifo(
);
}
-static void _Scheduler_simple_smp_Do_extract(
+static void _Scheduler_simple_SMP_Do_extract(
Scheduler_SMP_Control *smp_base,
Thread_Control *thread
)
@@ -132,7 +133,7 @@ static void _Scheduler_simple_smp_Do_extract(
_Chain_Extract_unprotected( &thread->Object.Node );
}
-void _Scheduler_simple_smp_Block(
+static void _Scheduler_simple_SMP_Block(
Scheduler_Control *base,
Thread_Control *thread
)
@@ -143,13 +144,13 @@ void _Scheduler_simple_smp_Block(
_Scheduler_SMP_Block(
&self->Base,
thread,
- _Scheduler_simple_smp_Do_extract,
- _Scheduler_simple_smp_Get_highest_ready,
- _Scheduler_simple_smp_Move_from_ready_to_scheduled
+ _Scheduler_simple_SMP_Do_extract,
+ _Scheduler_simple_SMP_Get_highest_ready,
+ _Scheduler_simple_SMP_Move_from_ready_to_scheduled
);
}
-static void _Scheduler_simple_smp_Enqueue_ordered(
+static void _Scheduler_simple_SMP_Enqueue_ordered(
Scheduler_SMP_Control *smp_base,
Thread_Control *thread,
Chain_Node_order order,
@@ -161,15 +162,15 @@ static void _Scheduler_simple_smp_Enqueue_ordered(
smp_base,
thread,
order,
- _Scheduler_simple_smp_Get_highest_ready,
+ _Scheduler_simple_SMP_Get_highest_ready,
insert_ready,
insert_scheduled,
- _Scheduler_simple_smp_Move_from_ready_to_scheduled,
- _Scheduler_simple_smp_Move_from_scheduled_to_ready
+ _Scheduler_simple_SMP_Move_from_ready_to_scheduled,
+ _Scheduler_simple_SMP_Move_from_scheduled_to_ready
);
}
-void _Scheduler_simple_smp_Enqueue_priority_lifo(
+static void _Scheduler_simple_SMP_Enqueue_priority_lifo(
Scheduler_Control *base,
Thread_Control *thread
)
@@ -177,16 +178,16 @@ void _Scheduler_simple_smp_Enqueue_priority_lifo(
Scheduler_simple_SMP_Control *self =
_Scheduler_simple_SMP_Self_from_base( base );
- _Scheduler_simple_smp_Enqueue_ordered(
+ _Scheduler_simple_SMP_Enqueue_ordered(
&self->Base,
thread,
_Scheduler_simple_Insert_priority_lifo_order,
- _Scheduler_simple_smp_Insert_ready_lifo,
+ _Scheduler_simple_SMP_Insert_ready_lifo,
_Scheduler_SMP_Insert_scheduled_lifo
);
}
-void _Scheduler_simple_smp_Enqueue_priority_fifo(
+static void _Scheduler_simple_SMP_Enqueue_priority_fifo(
Scheduler_Control *base,
Thread_Control *thread
)
@@ -194,16 +195,16 @@ void _Scheduler_simple_smp_Enqueue_priority_fifo(
Scheduler_simple_SMP_Control *self =
_Scheduler_simple_SMP_Self_from_base( base );
- _Scheduler_simple_smp_Enqueue_ordered(
+ _Scheduler_simple_SMP_Enqueue_ordered(
&self->Base,
thread,
_Scheduler_simple_Insert_priority_fifo_order,
- _Scheduler_simple_smp_Insert_ready_fifo,
+ _Scheduler_simple_SMP_Insert_ready_fifo,
_Scheduler_SMP_Insert_scheduled_fifo
);
}
-void _Scheduler_simple_smp_Extract(
+static void _Scheduler_simple_SMP_Extract(
Scheduler_Control *base,
Thread_Control *thread
)
@@ -214,11 +215,11 @@ void _Scheduler_simple_smp_Extract(
_Scheduler_SMP_Extract(
&self->Base,
thread,
- _Scheduler_simple_smp_Do_extract
+ _Scheduler_simple_SMP_Do_extract
);
}
-void _Scheduler_simple_smp_Yield(
+static void _Scheduler_simple_SMP_Yield(
Scheduler_Control *base,
Thread_Control *thread
)
@@ -227,13 +228,13 @@ void _Scheduler_simple_smp_Yield(
_ISR_Disable( level );
- _Scheduler_simple_smp_Extract( base, thread );
- _Scheduler_simple_smp_Enqueue_priority_fifo( base, thread );
+ _Scheduler_simple_SMP_Extract( base, thread );
+ _Scheduler_simple_SMP_Enqueue_priority_fifo( base, thread );
_ISR_Enable( level );
}
-void _Scheduler_simple_smp_Schedule(
+static void _Scheduler_simple_SMP_Schedule(
Scheduler_Control *base,
Thread_Control *thread
)
@@ -244,12 +245,12 @@ void _Scheduler_simple_smp_Schedule(
_Scheduler_SMP_Schedule(
&self->Base,
thread,
- _Scheduler_simple_smp_Get_highest_ready,
- _Scheduler_simple_smp_Move_from_ready_to_scheduled
+ _Scheduler_simple_SMP_Get_highest_ready,
+ _Scheduler_simple_SMP_Move_from_ready_to_scheduled
);
}
-void _Scheduler_simple_smp_Start_idle(
+static void _Scheduler_simple_SMP_Start_idle(
Scheduler_Control *base,
Thread_Control *thread,
Per_CPU_Control *cpu
@@ -260,3 +261,22 @@ void _Scheduler_simple_smp_Start_idle(
_Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
}
+
+const Scheduler_Operations _Scheduler_simple_SMP_Operations = {
+ SCHEDULER_DEFAULT_AFFINITY_OPERATIONS
+ .initialize = _Scheduler_simple_SMP_Initialize,
+ .schedule = _Scheduler_simple_SMP_Schedule,
+ .yield = _Scheduler_simple_SMP_Yield,
+ .block = _Scheduler_simple_SMP_Block,
+ .unblock = _Scheduler_simple_SMP_Enqueue_priority_fifo,
+ .allocate = _Scheduler_default_Allocate,
+ .free = _Scheduler_default_Free,
+ .update = _Scheduler_default_Update,
+ .enqueue = _Scheduler_simple_SMP_Enqueue_priority_fifo,
+ .enqueue_first = _Scheduler_simple_SMP_Enqueue_priority_lifo,
+ .extract = _Scheduler_simple_SMP_Extract,
+ .priority_compare = _Scheduler_priority_Priority_compare,
+ .release_job = _Scheduler_default_Release_job,
+ .tick = _Scheduler_default_Tick,
+ .start_idle = _Scheduler_simple_SMP_Start_idle
+};
diff --git a/cpukit/score/src/schedulersimpleunblock.c b/cpukit/score/src/schedulersimpleunblock.c
index c669a9b..94d9694 100644
--- a/cpukit/score/src/schedulersimpleunblock.c
+++ b/cpukit/score/src/schedulersimpleunblock.c
@@ -18,10 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/schedulersimple.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Unblock(
Scheduler_Control *scheduler,
diff --git a/testsuites/rhealstone/rhilatency/ilatency.c b/testsuites/rhealstone/rhilatency/ilatency.c
index b7f5a1a..b028ada 100644
--- a/testsuites/rhealstone/rhilatency/ilatency.c
+++ b/testsuites/rhealstone/rhilatency/ilatency.c
@@ -58,7 +58,7 @@ rtems_task Init(
puts( "*** START OF RHILATENCY ***" );
- if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
+ if (_Scheduler.operations != &_Scheduler_priority_Operations) {
puts( " Error ==> " );
puts( "Test only supported for deterministic priority scheduler\n" );
rtems_test_exit( 0 );
diff --git a/testsuites/sptests/spinternalerror01/init.c b/testsuites/sptests/spinternalerror01/init.c
index 15a2315..71f9f68 100644
--- a/testsuites/sptests/spinternalerror01/init.c
+++ b/testsuites/sptests/spinternalerror01/init.c
@@ -70,7 +70,7 @@ static void *idle_body(uintptr_t ignored)
#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
-#define CONFIGURE_SCHEDULER_ENTRY_POINTS NULL
+#define CONFIGURE_SCHEDULER_OPERATIONS NULL
#define CONFIGURE_SCHEDULER_USER
diff --git a/testsuites/tmtests/tm26/task1.c b/testsuites/tmtests/tm26/task1.c
index 6325516..41c62a2 100644
--- a/testsuites/tmtests/tm26/task1.c
+++ b/testsuites/tmtests/tm26/task1.c
@@ -223,7 +223,7 @@ rtems_task Init(
TEST_BEGIN();
- if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
+ if (_Scheduler.operations != &_Scheduler_priority_Operations) {
puts(" Error ==> " );
puts("Test only supported for deterministic priority scheduler\n" );
TEST_END();
diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c
index a639327..13b878f 100644
--- a/testsuites/tmtests/tm27/task1.c
+++ b/testsuites/tmtests/tm27/task1.c
@@ -55,7 +55,7 @@ rtems_task Init(
Print_Warning();
TEST_BEGIN();
- if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
+ if (_Scheduler.operations != &_Scheduler_priority_Operations) {
puts(" Error ==> " );
puts("Test only supported for deterministic priority scheduler\n" );
TEST_END();
--
1.7.7
More information about the devel
mailing list