[PATCH 1/8] score: Static scheduler configuration
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Apr 11 15:11:41 UTC 2014
Do not allocate the scheduler control structures from the workspace.
This is a preparation step for configuration of clustered/partitioned
schedulers on SMP.
---
cpukit/sapi/Makefile.am | 1 +
cpukit/sapi/include/confdefs.h | 129 +++++++++-------
cpukit/sapi/include/rtems/scheduler.h | 160 ++++++++++++++++++++
cpukit/sapi/preinstall.am | 4 +
cpukit/score/include/rtems/score/scheduler.h | 126 +++++++++------
cpukit/score/include/rtems/score/schedulercbs.h | 26 ++-
cpukit/score/include/rtems/score/scheduleredf.h | 55 ++++---
.../score/include/rtems/score/scheduleredfimpl.h | 18 +-
cpukit/score/include/rtems/score/schedulerimpl.h | 131 +++++++++--------
.../score/include/rtems/score/schedulerpriority.h | 51 ++++---
.../rtems/score/schedulerpriorityaffinitysmp.h | 20 ++--
.../include/rtems/score/schedulerpriorityimpl.h | 30 ++--
.../include/rtems/score/schedulerprioritysmp.h | 24 ++-
cpukit/score/include/rtems/score/schedulersimple.h | 47 +++---
.../include/rtems/score/schedulersimpleimpl.h | 22 ++--
.../score/include/rtems/score/schedulersimplesmp.h | 21 ++-
cpukit/score/include/rtems/score/schedulersmp.h | 18 +--
.../score/include/rtems/score/schedulersmpimpl.h | 28 ++--
cpukit/score/src/scheduler.c | 9 +-
cpukit/score/src/schedulercbs.c | 10 --
cpukit/score/src/schedulercbsallocate.c | 4 +-
cpukit/score/src/schedulercbsattachthread.c | 8 +-
cpukit/score/src/schedulercbscleanup.c | 3 +-
cpukit/score/src/schedulercbscreateserver.c | 11 +-
cpukit/score/src/schedulercbsdestroyserver.c | 7 +-
cpukit/score/src/schedulercbsdetachthread.c | 6 +-
cpukit/score/src/schedulercbsgetapprovedbudget.c | 4 +-
cpukit/score/src/schedulercbsgetexecutiontime.c | 10 +-
cpukit/score/src/schedulercbsgetparameters.c | 4 +-
cpukit/score/src/schedulercbsgetremainingbudget.c | 8 +-
cpukit/score/src/schedulercbsgetserverid.c | 4 +-
cpukit/score/src/schedulercbsreleasejob.c | 6 +-
cpukit/score/src/schedulercbssetparameters.c | 4 +-
cpukit/score/src/schedulercbsunblock.c | 4 +-
cpukit/score/src/schedulerdefaultallocatefree.c | 8 +-
cpukit/score/src/schedulerdefaultgetaffinity.c | 8 +-
cpukit/score/src/schedulerdefaultreleasejob.c | 6 +-
cpukit/score/src/schedulerdefaultsetaffinity.c | 8 +-
cpukit/score/src/schedulerdefaultstartidle.c | 6 +-
cpukit/score/src/schedulerdefaulttick.c | 6 +-
cpukit/score/src/schedulerdefaultupdate.c | 4 +-
cpukit/score/src/scheduleredf.c | 15 +--
cpukit/score/src/scheduleredfallocate.c | 4 +-
cpukit/score/src/scheduleredfblock.c | 4 +-
cpukit/score/src/scheduleredfenqueue.c | 10 +-
cpukit/score/src/scheduleredfenqueuefirst.c | 4 +-
cpukit/score/src/scheduleredfextract.c | 10 +-
cpukit/score/src/scheduleredffree.c | 4 +-
cpukit/score/src/scheduleredfreleasejob.c | 6 +-
cpukit/score/src/scheduleredfschedule.c | 4 +-
cpukit/score/src/scheduleredfunblock.c | 4 +-
cpukit/score/src/scheduleredfupdate.c | 4 +-
cpukit/score/src/scheduleredfyield.c | 14 +-
cpukit/score/src/schedulerpriority.c | 13 +-
cpukit/score/src/schedulerpriorityaffinitysmp.c | 20 ++--
cpukit/score/src/schedulerpriorityallocate.c | 4 +-
cpukit/score/src/schedulerpriorityblock.c | 4 +-
cpukit/score/src/schedulerpriorityenqueue.c | 10 +-
cpukit/score/src/schedulerpriorityenqueuefirst.c | 10 +-
cpukit/score/src/schedulerpriorityextract.c | 6 +-
cpukit/score/src/schedulerpriorityfree.c | 6 +-
cpukit/score/src/schedulerpriorityschedule.c | 6 +-
cpukit/score/src/schedulerprioritysmp.c | 97 ++++++------
cpukit/score/src/schedulerpriorityunblock.c | 10 +-
cpukit/score/src/schedulerpriorityupdate.c | 12 +-
cpukit/score/src/schedulerpriorityyield.c | 6 +-
cpukit/score/src/schedulersimple.c | 13 +-
cpukit/score/src/schedulersimpleblock.c | 4 +-
cpukit/score/src/schedulersimpleenqueue.c | 10 +-
cpukit/score/src/schedulersimpleenqueuefirst.c | 7 +-
cpukit/score/src/schedulersimpleextract.c | 8 +-
.../score/src/schedulersimplereadyqueueenqueue.c | 10 +-
.../src/schedulersimplereadyqueueenqueuefirst.c | 10 +-
cpukit/score/src/schedulersimpleschedule.c | 4 +-
cpukit/score/src/schedulersimplesmp.c | 86 +++++------
cpukit/score/src/schedulersimpleunblock.c | 8 +-
cpukit/score/src/schedulersimpleyield.c | 5 +-
cpukit/score/src/threadchangepriority.c | 6 +-
cpukit/score/src/threadrestart.c | 8 +-
doc/user/conf.t | 16 +-
testsuites/rhealstone/rhilatency/ilatency.c | 6 +-
testsuites/sptests/spinternalerror01/init.c | 6 +-
testsuites/sptests/spsize/size.c | 10 +-
testsuites/tmtests/tm26/task1.c | 31 ++--
testsuites/tmtests/tm27/task1.c | 20 ++-
85 files changed, 911 insertions(+), 703 deletions(-)
create mode 100644 cpukit/sapi/include/rtems/scheduler.h
diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am
index 37a2fa4..4a2b6ca 100644
--- a/cpukit/sapi/Makefile.am
+++ b/cpukit/sapi/Makefile.am
@@ -17,6 +17,7 @@ include_rtems_HEADERS += include/rtems/cbs.h
include_rtems_HEADERS += include/rtems/profiling.h
include_rtems_HEADERS += include/rtems/rbheap.h
include_rtems_HEADERS += include/rtems/rbtree.h
+include_rtems_HEADERS += include/rtems/scheduler.h
include_rtems_HEADERS += include/rtems/sptables.h
include_rtems_HEADERS += include/rtems/test.h
include_rtems_HEADERS += include/rtems/timespec.h
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 53a8699..959514f 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -639,15 +639,10 @@ 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_MEMORY_FOR_SCHEDULER - base memory
+ * - CONFIGURE_SCHEDULER_CONTEXT
+ * - CONFIGURE_SCHEDULER_CONTROLS
* - CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER - per task memory
*/
-#include <rtems/score/scheduler.h>
-
-#if !defined(RTEMS_SMP)
- #undef CONFIGURE_SCHEDULER_SIMPLE_SMP
-#endif
/* If no scheduler is specified, the priority scheduler is default. */
#if !defined(CONFIGURE_SCHEDULER_USER) && \
@@ -665,21 +660,26 @@ const rtems_libio_helper rtems_fs_init_helper =
#endif
#endif
+#include <rtems/scheduler.h>
+
/*
* If the Priority Scheduler is selected, then configure for it.
*/
#if defined(CONFIGURE_SCHEDULER_PRIORITY)
- #include <rtems/score/schedulerpriority.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_ENTRY_POINTS
+ #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
+ #define CONFIGURE_SCHEDULER_CONTEXT \
+ RTEMS_SCHEDULER_CONTEXT_PRIORITY( \
+ dflt, \
+ CONFIGURE_MAXIMUM_PRIORITY + 1 \
+ )
+
+ #define CONFIGURE_SCHEDULER_CONTROLS \
+ RTEMS_SCHEDULER_CONTROL_PRIORITY(dflt)
+ #endif
/**
* This defines the memory used by the priority scheduler.
*/
- #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
- _Configure_From_workspace( \
- sizeof(Scheduler_priority_Control) + \
- ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
- )
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
_Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
#endif
@@ -689,17 +689,20 @@ const rtems_libio_helper rtems_fs_init_helper =
* it.
*/
#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
- #include <rtems/score/schedulerprioritysmp.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_SMP_ENTRY_POINTS
+ #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
+ #define CONFIGURE_SCHEDULER_CONTEXT \
+ RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( \
+ dflt, \
+ CONFIGURE_MAXIMUM_PRIORITY + 1 \
+ )
+
+ #define CONFIGURE_SCHEDULER_CONTROLS \
+ RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(dflt)
+ #endif
/**
* This defines the memory used by the priority scheduler.
*/
- #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
- _Configure_From_workspace( \
- sizeof(Scheduler_priority_SMP_Control) + \
- ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
- )
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
_Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
#endif
@@ -709,17 +712,20 @@ const rtems_libio_helper rtems_fs_init_helper =
* it.
*/
#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP)
- #include <rtems/score/schedulerpriorityaffinitysmp.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS
+ #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
+ #define CONFIGURE_SCHEDULER_CONTEXT \
+ RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( \
+ dflt, \
+ CONFIGURE_MAXIMUM_PRIORITY + 1 \
+ )
+
+ #define CONFIGURE_SCHEDULER_CONTROLS \
+ RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP(dflt)
+ #endif
/**
* This defines the memory used by the priority scheduler.
*/
- #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
- _Configure_From_workspace( \
- sizeof(Scheduler_SMP_Control) + \
- ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
- )
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
_Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
#endif
@@ -728,15 +734,15 @@ const rtems_libio_helper rtems_fs_init_helper =
* If the Simple Priority Scheduler is selected, then configure for it.
*/
#if defined(CONFIGURE_SCHEDULER_SIMPLE)
- #include <rtems/score/schedulersimple.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_ENTRY_POINTS
+ #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
+ #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_SIMPLE(dflt)
+
+ #define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_SIMPLE(dflt)
+ #endif
/**
* define the memory used by the simple scheduler
*/
- #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
- _Configure_From_workspace( sizeof( Scheduler_simple_Control ) ) \
- )
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
#endif
@@ -744,17 +750,19 @@ const rtems_libio_helper rtems_fs_init_helper =
* If the Simple SMP Priority Scheduler is selected, then configure for it.
*/
#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP)
- #include <rtems/score/schedulersimplesmp.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_SMP_ENTRY_POINTS
+ #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
+ #define CONFIGURE_SCHEDULER_CONTEXT \
+ RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(dflt)
+
+ #define CONFIGURE_SCHEDULER_CONTROLS \
+ RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(dflt)
+ #endif
/**
* Define the memory used by the Simple SMP Scheduler
*
* NOTE: This is the same as the Simple Scheduler
*/
- #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
- _Configure_From_workspace( sizeof( Scheduler_simple_SMP_Control ) ) \
- )
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
#endif
@@ -762,14 +770,15 @@ const rtems_libio_helper rtems_fs_init_helper =
* If the EDF Scheduler is selected, then configure for it.
*/
#if defined(CONFIGURE_SCHEDULER_EDF)
- #include <rtems/score/scheduleredf.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_EDF_ENTRY_POINTS
+ #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
+ #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_EDF(dflt)
+
+ #define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_EDF(dflt)
+ #endif
/**
* define the memory used by the EDF scheduler
*/
- #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
- _Configure_From_workspace(sizeof(Scheduler_EDF_Control)))
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
_Configure_From_workspace(sizeof(Scheduler_EDF_Per_thread)))
#endif
@@ -778,26 +787,27 @@ const rtems_libio_helper rtems_fs_init_helper =
* If the CBS Scheduler is selected, then configure for it.
*/
#if defined(CONFIGURE_SCHEDULER_CBS)
- #include <rtems/score/schedulercbs.h>
- #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_CBS_ENTRY_POINTS
+ #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
+ #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_CBS(dflt)
+
+ #define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_CBS(dflt)
+ #endif
#ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
#define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS
#endif
#ifdef CONFIGURE_INIT
- uint32_t _Scheduler_CBS_Maximum_servers = CONFIGURE_CBS_MAXIMUM_SERVERS;
+ const uint32_t _Scheduler_CBS_Maximum_servers =
+ CONFIGURE_CBS_MAXIMUM_SERVERS;
+
+ Scheduler_CBS_Server
+ _Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ];
#endif
/**
* define the memory used by the CBS scheduler
*/
- #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
- _Configure_From_workspace(sizeof(Scheduler_EDF_Control)) + \
- _Configure_From_workspace(CONFIGURE_CBS_MAXIMUM_SERVERS * \
- sizeof(Scheduler_CBS_Server *)) + \
- CONFIGURE_CBS_MAXIMUM_SERVERS * \
- _Configure_From_workspace(sizeof(Scheduler_CBS_Server)))
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
_Configure_From_workspace(sizeof(Scheduler_CBS_Per_thread)))
#endif
@@ -807,11 +817,17 @@ const rtems_libio_helper rtems_fs_init_helper =
* this code to know which scheduler is configured by the user.
*/
#ifdef CONFIGURE_INIT
- Scheduler_Control _Scheduler = {
- NULL, /* Scheduler Specific Data Pointer */
- CONFIGURE_SCHEDULER_ENTRY_POINTS /* Scheduler Operations */
+ CONFIGURE_SCHEDULER_CONTEXT;
+
+ const Scheduler_Control _Scheduler_Table[] = {
+ CONFIGURE_SCHEDULER_CONTROLS
};
+ #if defined(RTEMS_SMP)
+ const size_t _Scheduler_Count =
+ RTEMS_ARRAY_SIZE( _Scheduler_Table );
+ #endif
+
#if defined(CONFIGURE_SCHEDULER_EDF)
const bool _Scheduler_FIXME_thread_priority_queues_are_broken = true;
#else
@@ -2207,7 +2223,6 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
( CONFIGURE_MEMORY_FOR_IDLE_TASK + /* IDLE and stack */ \
- CONFIGURE_MEMORY_FOR_SCHEDULER + /* Scheduler */ \
CONFIGURE_INTERRUPT_VECTOR_TABLE + /* interrupt vectors */ \
CONFIGURE_INTERRUPT_STACK_MEMORY + /* interrupt stack */ \
CONFIGURE_API_MUTEX_MEMORY /* allocation mutex */ \
@@ -2475,7 +2490,7 @@ const rtems_libio_helper rtems_fs_init_helper =
CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */
#endif
#ifdef RTEMS_SMP
- CONFIGURE_SMP_MAXIMUM_PROCESSORS
+ CONFIGURE_SMP_MAXIMUM_PROCESSORS,
#endif
};
#endif
@@ -2557,7 +2572,6 @@ const rtems_libio_helper rtems_fs_init_helper =
uint32_t INTERRUPT_VECTOR_TABLE;
uint32_t INTERRUPT_STACK_MEMORY;
uint32_t MEMORY_FOR_IDLE_TASK;
- uint32_t MEMORY_FOR_SCHEDULER;
uint32_t MEMORY_PER_TASK_FOR_SCHEDULER;
/* Classic API Pieces */
@@ -2614,7 +2628,6 @@ const rtems_libio_helper rtems_fs_init_helper =
CONFIGURE_INTERRUPT_VECTOR_TABLE,
CONFIGURE_INTERRUPT_STACK_MEMORY,
CONFIGURE_MEMORY_FOR_IDLE_TASK,
- CONFIGURE_MEMORY_FOR_SCHEDULER,
CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER,
/* Classic API Pieces */
diff --git a/cpukit/sapi/include/rtems/scheduler.h b/cpukit/sapi/include/rtems/scheduler.h
new file mode 100644
index 0000000..5d6b2ec
--- /dev/null
+++ b/cpukit/sapi/include/rtems/scheduler.h
@@ -0,0 +1,160 @@
+/**
+ * @file
+ *
+ * @brief Scheduler Configuration API
+ */
+
+/*
+ * 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.
+ */
+
+#ifndef _RTEMS_SAPI_SCHEDULER_H
+#define _RTEMS_SAPI_SCHEDULER_H
+
+#include <rtems/score/scheduler.h>
+
+#define RTEMS_SCHEDULER_CONTEXT_NAME( name ) \
+ _Configuration_Scheduler_ ## name
+
+/*
+ * This file should be only included in the context of <rtems/confdefs.h>.
+ * Define the scheduler configuration macros only in case the corresponding
+ * configure symbol is defined. This is necessary to prevent invalid workspace
+ * size estimates since we have to account for the per-thread scheduler
+ * information.
+ */
+
+#ifdef CONFIGURE_SCHEDULER_CBS
+ #include <rtems/score/schedulercbs.h>
+
+ #define RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ) \
+ RTEMS_SCHEDULER_CONTEXT_NAME( CBS_ ## name )
+
+ #define RTEMS_SCHEDULER_CONTEXT_CBS( name ) \
+ static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name )
+
+ #define RTEMS_SCHEDULER_CONTROL_CBS( name ) \
+ { \
+ &RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ).Base, \
+ SCHEDULER_CBS_ENTRY_POINTS \
+ }
+#endif
+
+#ifdef CONFIGURE_SCHEDULER_EDF
+ #include <rtems/score/scheduleredf.h>
+
+ #define RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ) \
+ RTEMS_SCHEDULER_CONTEXT_NAME( EDF_ ## name )
+
+ #define RTEMS_SCHEDULER_CONTEXT_EDF( name ) \
+ static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name )
+
+ #define RTEMS_SCHEDULER_CONTROL_EDF( name ) \
+ { \
+ &RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ).Base, \
+ SCHEDULER_EDF_ENTRY_POINTS \
+ }
+#endif
+
+#ifdef CONFIGURE_SCHEDULER_PRIORITY
+ #include <rtems/score/schedulerpriority.h>
+
+ #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ) \
+ RTEMS_SCHEDULER_CONTEXT_NAME( priority_ ## name )
+
+ #define RTEMS_SCHEDULER_CONTEXT_PRIORITY( name, prio_count ) \
+ static struct { \
+ Scheduler_priority_Context Base; \
+ Chain_Control Ready[ ( prio_count ) ]; \
+ } RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name )
+
+ #define RTEMS_SCHEDULER_CONTROL_PRIORITY( name ) \
+ { \
+ &RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Base.Base, \
+ SCHEDULER_PRIORITY_ENTRY_POINTS \
+ }
+#endif
+
+#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
+ #include <rtems/score/schedulerpriorityaffinitysmp.h>
+
+ #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ) \
+ RTEMS_SCHEDULER_CONTEXT_NAME( priority_affinity_SMP_ ## name )
+
+ #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( name, prio_count ) \
+ static struct { \
+ Scheduler_priority_SMP_Context Base; \
+ Chain_Control Ready[ ( prio_count ) ]; \
+ } RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name )
+
+ #define RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( name ) \
+ { \
+ &RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Base.Base, \
+ SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS \
+ }
+#endif
+
+#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
+ #include <rtems/score/schedulerprioritysmp.h>
+
+ #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ) \
+ RTEMS_SCHEDULER_CONTEXT_NAME( priority_SMP_ ## name )
+
+ #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( name, prio_count ) \
+ static struct { \
+ Scheduler_priority_SMP_Context Base; \
+ Chain_Control Ready[ ( prio_count ) ]; \
+ } RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name )
+
+ #define RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( name ) \
+ { \
+ &RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Base.Base, \
+ SCHEDULER_PRIORITY_SMP_ENTRY_POINTS \
+ }
+#endif
+
+#ifdef CONFIGURE_SCHEDULER_SIMPLE
+ #include <rtems/score/schedulersimple.h>
+
+ #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ) \
+ RTEMS_SCHEDULER_CONTEXT_NAME( simple_ ## name )
+
+ #define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \
+ static Scheduler_simple_Context \
+ RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name )
+
+ #define RTEMS_SCHEDULER_CONTROL_SIMPLE( name ) \
+ { \
+ &RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ).Base, \
+ SCHEDULER_SIMPLE_ENTRY_POINTS \
+ }
+#endif
+
+#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
+ #include <rtems/score/schedulersimplesmp.h>
+
+ #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ) \
+ RTEMS_SCHEDULER_CONTEXT_NAME( simple_SMP_ ## name )
+
+ #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP( name ) \
+ static Scheduler_simple_SMP_Context \
+ RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name )
+
+ #define RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP( name ) \
+ { \
+ &RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ).Base, \
+ SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \
+ }
+#endif
+
+#endif /* _RTEMS_SAPI_SCHEDULER_H */
diff --git a/cpukit/sapi/preinstall.am b/cpukit/sapi/preinstall.am
index 7e18d3a..57c5b97 100644
--- a/cpukit/sapi/preinstall.am
+++ b/cpukit/sapi/preinstall.am
@@ -84,6 +84,10 @@ $(PROJECT_INCLUDE)/rtems/rbtree.h: include/rtems/rbtree.h $(PROJECT_INCLUDE)/rte
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rbtree.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rbtree.h
+$(PROJECT_INCLUDE)/rtems/scheduler.h: include/rtems/scheduler.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/scheduler.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/scheduler.h
+
$(PROJECT_INCLUDE)/rtems/sptables.h: include/rtems/sptables.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/sptables.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/sptables.h
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index b975fc4..ee604a5 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -20,8 +20,8 @@
#define _RTEMS_SCORE_SCHEDULER_H
#include <rtems/score/percpu.h>
-#include <rtems/score/chain.h>
#include <rtems/score/priority.h>
+#include <rtems/score/thread.h>
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
#include <sys/cpuset.h>
#endif
@@ -48,42 +48,42 @@ typedef struct Scheduler_Control Scheduler_Control;
*/
typedef struct {
/** Implements the scheduling decision logic (policy). */
- void ( *initialize )(void);
+ void ( *initialize )( const Scheduler_Control * );
/** Implements the scheduling decision logic (policy). */
- void ( *schedule )( Scheduler_Control *, Thread_Control *);
+ void ( *schedule )( const Scheduler_Control *, Thread_Control *);
/**
* @brief Voluntarily yields the processor per the scheduling policy.
*
* @see _Scheduler_Yield().
*/
- void ( *yield )( Scheduler_Control *, Thread_Control *);
+ void ( *yield )( const Scheduler_Control *, Thread_Control *);
/** Removes the given thread from scheduling decisions. */
- void ( *block )( Scheduler_Control *, Thread_Control * );
+ void ( *block )( const Scheduler_Control *, Thread_Control * );
/** Adds the given thread to scheduling decisions. */
- void ( *unblock )( Scheduler_Control *, Thread_Control * );
+ void ( *unblock )( const Scheduler_Control *, Thread_Control * );
/** allocates the scheduler field of the given thread */
- void * ( *allocate )( Scheduler_Control *, Thread_Control * );
+ void * ( *allocate )( const Scheduler_Control *, Thread_Control * );
/** frees the scheduler field of the given thread */
- void ( *free )( Scheduler_Control *, Thread_Control * );
+ void ( *free )( const 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 * );
+ void ( *update )( const Scheduler_Control *, Thread_Control * );
/** enqueue a thread as the last of its priority group */
- void ( *enqueue )( Scheduler_Control *, Thread_Control * );
+ void ( *enqueue )( const Scheduler_Control *, Thread_Control * );
/** enqueue a thread as the first of its priority group */
- void ( *enqueue_first )( Scheduler_Control *, Thread_Control * );
+ void ( *enqueue_first )( const Scheduler_Control *, Thread_Control * );
/** extract a thread from the ready set */
- void ( *extract )( Scheduler_Control *, Thread_Control * );
+ void ( *extract )( const Scheduler_Control *, Thread_Control * );
/**
* Compares two priorities (returns >0 for higher priority, 0 for equal
@@ -95,10 +95,14 @@ typedef struct {
);
/** This routine is called upon release of a new job. */
- void ( *release_job ) ( Scheduler_Control *, Thread_Control *, uint32_t );
+ void ( *release_job ) (
+ const Scheduler_Control *,
+ Thread_Control *,
+ uint32_t
+ );
/** perform scheduler update actions required at each clock tick */
- void ( *tick )( Scheduler_Control * );
+ void ( *tick )( const Scheduler_Control * );
/**
* @brief Starts the idle thread for a particular processor.
@@ -106,7 +110,7 @@ typedef struct {
* @see _Scheduler_Start_idle().
*/
void ( *start_idle )(
- Scheduler_Control *,
+ const Scheduler_Control *,
Thread_Control *,
Per_CPU_Control *
);
@@ -118,7 +122,7 @@ typedef struct {
* @see _Scheduler_Get_affinity().
*/
bool ( *get_affinity )(
- Scheduler_Control *,
+ const Scheduler_Control *,
Thread_Control *,
size_t,
cpu_set_t *
@@ -130,7 +134,7 @@ typedef struct {
* @see _Scheduler_Set_affinity().
*/
bool ( *set_affinity )(
- Scheduler_Control *,
+ const Scheduler_Control *,
Thread_Control *,
size_t,
const cpu_set_t *
@@ -139,29 +143,51 @@ typedef struct {
} Scheduler_Operations;
/**
- * This is the structure used to manage the scheduler.
+ * @brief Scheduler context.
+ *
+ * The scheduler context of a particular scheduler implementation must place
+ * this structure at the begin of its context structure.
+ */
+typedef struct {
+ /* No fields yet */
+} Scheduler_Context;
+
+/**
+ * @brief Scheduler control.
*/
struct Scheduler_Control {
/**
- * This points to the data structure used to manage the ready set of
- * tasks. The pointer varies based upon the type of
- * ready queue required by the scheduler.
+ * @brief Reference to a statically allocated scheduler context.
*/
- void *information;
+ Scheduler_Context *context;
- /** The jump table for scheduler-specific functions */
- Scheduler_Operations Operations;
+ /**
+ * @brief The scheduler operations.
+ */
+ Scheduler_Operations Operations;
};
/**
- * The _Scheduler holds the structures used to manage the
- * scheduler.
+ * @brief Registered schedulers.
*
- * @note Can we make this per-cpu? then _Scheduler will be a macro.
+ * Application provided via <rtems/confdefs.h>.
*
- * @note This is instantiated and initialized in confdefs.h.
+ * @see _Scheduler_Count.
*/
-extern Scheduler_Control _Scheduler;
+extern const Scheduler_Control _Scheduler_Table[];
+
+/**
+ * @brief Count of registered schedulers.
+ *
+ * Application provided via <rtems/confdefs.h> on SMP configurations.
+ *
+ * @see _Scheduler_Table.
+ */
+#if defined(RTEMS_SMP)
+ extern const size_t _Scheduler_Count;
+#else
+ #define _Scheduler_Count ( (size_t) 1 )
+#endif
/**
* @brief Returns an arbitrary non-NULL value.
@@ -172,8 +198,8 @@ extern Scheduler_Control _Scheduler;
* @return An arbitrary non-NULL value.
*/
void *_Scheduler_default_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -183,8 +209,8 @@ void *_Scheduler_default_Allocate(
* @param[in] the_thread Unused.
*/
void _Scheduler_default_Free(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -194,8 +220,8 @@ void _Scheduler_default_Free(
* @param[in] the_thread Unused.
*/
void _Scheduler_default_Update(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -206,9 +232,9 @@ void _Scheduler_default_Update(
* @param[in] deadline Unused.
*/
void _Scheduler_default_Release_job(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t deadline
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
);
/**
@@ -219,7 +245,7 @@ void _Scheduler_default_Release_job(
*
* @param[in] scheduler The scheduler.
*/
-void _Scheduler_default_Tick( Scheduler_Control *scheduler );
+void _Scheduler_default_Tick( const Scheduler_Control *scheduler );
/**
* @brief Starts an idle thread.
@@ -229,9 +255,9 @@ void _Scheduler_default_Tick( Scheduler_Control *scheduler );
* @param[in] cpu This parameter is unused.
*/
void _Scheduler_default_Start_idle(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- Per_CPU_Control *cpu
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Per_CPU_Control *cpu
);
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
@@ -246,10 +272,10 @@ void _Scheduler_default_Start_idle(
* @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
+ const Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
);
/**
@@ -265,10 +291,10 @@ void _Scheduler_default_Start_idle(
* the cpuset.
*/
bool _Scheduler_default_Set_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ const Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ const cpu_set_t *cpuset
);
#endif
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index f654225..3abfdc5 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -81,7 +81,7 @@ extern "C" {
#define SCHEDULER_CBS_ERROR_NOSERVER SCHEDULER_CBS_ERROR_NOT_FOUND
/** Maximum number of simultaneous servers. */
-extern uint32_t _Scheduler_CBS_Maximum_servers;
+extern const uint32_t _Scheduler_CBS_Maximum_servers;
/** Server id. */
typedef uint32_t Scheduler_CBS_Server_id;
@@ -115,6 +115,13 @@ typedef struct {
Scheduler_CBS_Parameters parameters;
/** Callback function invoked when a budget overrun occurs. */
Scheduler_CBS_Budget_overrun cbs_budget_overrun;
+
+ /**
+ * @brief Indicates if this CBS server is initialized.
+ *
+ * @see _Scheduler_CBS_Create_server() and _Scheduler_CBS_Destroy_server().
+ */
+ bool initialized;
} Scheduler_CBS_Server;
/**
@@ -132,7 +139,7 @@ typedef struct {
* 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;
+extern Scheduler_CBS_Server _Scheduler_CBS_Server_list[];
/**
* @brief Unblocks a thread from the queue.
@@ -148,8 +155,8 @@ extern Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
* @note This has to be asessed as missed deadline of the current job.
*/
void _Scheduler_CBS_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -165,9 +172,9 @@ void _Scheduler_CBS_Unblock(
*/
void _Scheduler_CBS_Release_job (
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t length
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t length
);
/**
@@ -338,9 +345,10 @@ void _Scheduler_CBS_Budget_callout(
* management memory for.
*/
void *_Scheduler_CBS_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 16d46a4..c6aba2d 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -68,10 +68,15 @@ extern "C" {
typedef struct {
/**
+ * @brief Basic scheduler context.
+ */
+ Scheduler_Context Base;
+
+ /**
* Top of the ready queue.
*/
RBTree_Control Ready;
-} Scheduler_EDF_Control;
+} Scheduler_EDF_Context;
/**
* @typedef Scheduler_EDF_Queue_state
@@ -108,7 +113,7 @@ typedef struct {
*
* This routine initializes the EDF scheduler.
*/
-void _Scheduler_EDF_Initialize( void );
+void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler );
/**
* @brief Removes thread from ready queue.
@@ -121,8 +126,8 @@ void _Scheduler_EDF_Initialize( void );
* @param[in] the_thread is the thread to be blocked.
*/
void _Scheduler_EDF_Block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -133,8 +138,8 @@ void _Scheduler_EDF_Block(
* in the rbtree ready queue.
*/
void _Scheduler_EDF_Schedule(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -146,8 +151,8 @@ void _Scheduler_EDF_Schedule(
* management memory for.
*/
void *_Scheduler_EDF_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -159,8 +164,8 @@ void *_Scheduler_EDF_Allocate(
* will be deallocated.
*/
void _Scheduler_EDF_Free(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -172,8 +177,8 @@ void _Scheduler_EDF_Free(
* structure updated.
*/
void _Scheduler_EDF_Update(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -186,8 +191,8 @@ void _Scheduler_EDF_Update(
* @param[in] the_thread will be unblocked.
*/
void _Scheduler_EDF_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -206,8 +211,8 @@ void _Scheduler_EDF_Unblock(
* @param[in,out] thread The yielding thread.
*/
void _Scheduler_EDF_Yield(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -218,8 +223,8 @@ void _Scheduler_EDF_Yield(
* @param[in] the_thread will be enqueued to the ready queue.
*/
void _Scheduler_EDF_Enqueue(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -231,8 +236,8 @@ void _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
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -245,8 +250,8 @@ void _Scheduler_EDF_Enqueue_first(
* @param[in] the_thread will be extracted from the ready set.
*/
void _Scheduler_EDF_Extract(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -275,9 +280,9 @@ int _Scheduler_EDF_Priority_compare (
* has to be suspended.
*/
void _Scheduler_EDF_Release_job (
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t deadline
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
);
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h
index bfeff63..d4b197e 100644
--- a/cpukit/score/include/rtems/score/scheduleredfimpl.h
+++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h
@@ -31,21 +31,21 @@ extern "C" {
* @{
*/
-RTEMS_INLINE_ROUTINE Scheduler_EDF_Control *
- _Scheduler_EDF_Self_from_base( Scheduler_Control *scheduler_base )
+RTEMS_INLINE_ROUTINE Scheduler_EDF_Context *
+ _Scheduler_EDF_Get_context( const Scheduler_Control *scheduler )
{
- return (Scheduler_EDF_Control *) scheduler_base->information;
+ return (Scheduler_EDF_Context *) scheduler->context;
}
RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body(
- Scheduler_Control *scheduler_base,
- Thread_Control *the_thread,
- bool force_dispatch
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ bool force_dispatch
)
{
- Scheduler_EDF_Control *scheduler =
- _Scheduler_EDF_Self_from_base( scheduler_base );
- RBTree_Node *first = _RBTree_First(&scheduler->Ready, RBT_LEFT);
+ Scheduler_EDF_Context *context =
+ _Scheduler_EDF_Get_context( scheduler );
+ RBTree_Node *first = _RBTree_First( &context->Ready, RBT_LEFT );
Scheduler_EDF_Per_thread *sched_info =
_RBTree_Container_of(first, Scheduler_EDF_Per_thread, Node);
Thread_Control *heir = (Thread_Control *) sched_info->thread;
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 6687fcf..25866e5 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -64,8 +64,8 @@ void _Scheduler_Handler_initialization( void );
* @param[in] the_thread The thread which state changed previously.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Schedule(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( *scheduler->Operations.schedule )( scheduler, the_thread );
@@ -80,8 +80,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Schedule(
* @param[in] the_thread The yielding thread.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( *scheduler->Operations.yield )( scheduler, the_thread );
@@ -96,8 +96,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
* including the selection of a new heir thread.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( *scheduler->Operations.block )( scheduler, the_thread );
@@ -112,8 +112,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Block(
* scheduling variables, for example the heir thread.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( *scheduler->Operations.unblock )( scheduler, the_thread );
@@ -125,8 +125,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
* This routine allocates @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
return ( *scheduler->Operations.allocate )( scheduler, the_thread );
@@ -138,8 +138,8 @@ RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate(
* This routine frees @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Free(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( *scheduler->Operations.free )( scheduler, the_thread );
@@ -151,8 +151,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Free(
* This routine updates @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Update(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( *scheduler->Operations.update )( scheduler, the_thread );
@@ -164,8 +164,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update(
* This routine enqueue @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( *scheduler->Operations.enqueue )( scheduler, the_thread );
@@ -177,8 +177,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(
* This routine enqueue_first @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( *scheduler->Operations.enqueue_first )( scheduler, the_thread );
@@ -190,8 +190,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(
* This routine extract @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( *scheduler->Operations.extract )( scheduler, the_thread );
@@ -203,9 +203,9 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
* This routine compares two priorities.
*/
RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
- Scheduler_Control *scheduler,
- Priority_Control p1,
- Priority_Control p2
+ const Scheduler_Control *scheduler,
+ Priority_Control p1,
+ Priority_Control p2
)
{
return ( *scheduler->Operations.priority_compare )( p1, p2 );
@@ -217,9 +217,9 @@ RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
* This routine is called when a new period of task is issued.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t length
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t length
)
{
( *scheduler->Operations.release_job )( scheduler, the_thread, length );
@@ -233,7 +233,9 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
* scheduler which support standard RTEMS features, this includes
* time-slicing management.
*/
-RTEMS_INLINE_ROUTINE void _Scheduler_Tick( Scheduler_Control *scheduler )
+RTEMS_INLINE_ROUTINE void _Scheduler_Tick(
+ const Scheduler_Control *scheduler
+)
{
( *scheduler->Operations.tick )( scheduler );
}
@@ -247,9 +249,9 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Tick( Scheduler_Control *scheduler )
* @see _Thread_Create_idle().
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- Per_CPU_Control *cpu
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Per_CPU_Control *cpu
)
{
( *scheduler->Operations.start_idle )( scheduler, the_thread, cpu );
@@ -263,15 +265,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
* @parma[out] cpuset The processor affinity for this thread
*/
RTEMS_INLINE_ROUTINE int _Scheduler_Get_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
)
{
return ( *scheduler->Operations.get_affinity )(
scheduler,
- thread,
+ the_thread,
cpusetsize,
cpuset
);
@@ -284,15 +286,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
* @parma[in] cpuset The processor affinity for this thread
*/
RTEMS_INLINE_ROUTINE int _Scheduler_Set_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ size_t cpusetsize,
+ const cpu_set_t *cpuset
)
{
return ( *scheduler->Operations.set_affinity )(
scheduler,
- thread,
+ the_thread,
cpusetsize,
cpuset
);
@@ -313,10 +315,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_heir(
}
RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- void ( *extract )( Scheduler_Control *, Thread_Control * ),
- void ( *schedule )( Scheduler_Control *, Thread_Control *, bool )
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ void ( *extract )(
+ const Scheduler_Control *,
+ Thread_Control * ),
+ void ( *schedule )(
+ const Scheduler_Control *,
+ Thread_Control *,
+ bool )
)
{
( *extract )( scheduler, the_thread );
@@ -333,9 +340,9 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
* intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
- Scheduler_Control *scheduler,
- Priority_Control p1,
- Priority_Control p2
+ const Scheduler_Control *scheduler,
+ Priority_Control p1,
+ Priority_Control p2
)
{
return _Scheduler_Priority_compare( scheduler, p1, p2 ) < 0;
@@ -346,9 +353,9 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
* intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
- Scheduler_Control *scheduler,
- Priority_Control p1,
- Priority_Control p2
+ const Scheduler_Control *scheduler,
+ Priority_Control p1,
+ Priority_Control p2
)
{
return _Scheduler_Priority_compare( scheduler, p1, p2 ) > 0;
@@ -359,9 +366,9 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
* in the intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Highest_priority_of_two(
- Scheduler_Control *scheduler,
- Priority_Control p1,
- Priority_Control p2
+ const Scheduler_Control *scheduler,
+ Priority_Control p1,
+ Priority_Control p2
)
{
return _Scheduler_Is_priority_higher_than( scheduler, p1, p2 ) ? p1 : p2;
@@ -372,9 +379,9 @@ RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Highest_priority_of_two(
* current priority of the thread in the intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Set_priority_if_higher(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- Priority_Control priority
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Priority_Control priority
)
{
Priority_Control current = the_thread->current_priority;
@@ -389,10 +396,10 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Set_priority_if_higher(
* current priority of the thread in the intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority_if_higher(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- Priority_Control priority,
- bool prepend_it
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Priority_Control priority,
+ bool prepend_it
)
{
Priority_Control current = the_thread->current_priority;
@@ -402,13 +409,13 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority_if_higher(
}
}
-RTEMS_INLINE_ROUTINE Scheduler_Control *_Scheduler_Get(
+RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get(
Thread_Control *the_thread
)
{
(void) the_thread;
- return &_Scheduler;
+ return &_Scheduler_Table[ 0 ];
}
/** @} */
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 1e4e91b..7706bf3 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -67,6 +67,11 @@ extern "C" {
typedef struct {
/**
+ * @brief Basic scheduler context.
+ */
+ Scheduler_Context Base;
+
+ /**
* @brief Bit map to indicate non-empty ready queues.
*/
Priority_bit_map_Control Bit_map;
@@ -74,8 +79,8 @@ typedef struct {
/**
* @brief One ready queue per priority level.
*/
- Chain_Control Ready[ 1 ];
-} Scheduler_priority_Control;
+ Chain_Control Ready[ 0 ];
+} Scheduler_priority_Context;
/**
* Per-thread data related to the _Scheduler_PRIORITY scheduling policy.
@@ -92,7 +97,7 @@ typedef struct {
* @brief Initializes the priority scheduler.
* This routine initializes the priority scheduler.
*/
-void _Scheduler_priority_Initialize(void);
+void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler );
/**
* @brief Removes @a the_thread from the scheduling decision.
@@ -105,8 +110,8 @@ void _Scheduler_priority_Initialize(void);
* @param[in] the_thread is the thread to be blocked
*/
void _Scheduler_priority_Block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -116,8 +121,8 @@ void _Scheduler_priority_Block(
* by invoking the_scheduler->ready_queue->operations->first().
*/
void _Scheduler_priority_Schedule(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -129,8 +134,8 @@ void _Scheduler_priority_Schedule(
* management memory for
*/
void * _Scheduler_priority_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -142,8 +147,8 @@ void * _Scheduler_priority_Allocate(
* will be deallocated.
*/
void _Scheduler_priority_Free(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -155,8 +160,8 @@ void _Scheduler_priority_Free(
* structure updated.
*/
void _Scheduler_priority_Update(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -169,8 +174,8 @@ void _Scheduler_priority_Update(
* @param[in] the_thread will be unblocked
*/
void _Scheduler_priority_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -193,8 +198,8 @@ void _Scheduler_priority_Unblock(
* @param[in,out] thread The yielding thread.
*/
void _Scheduler_priority_Yield(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -205,8 +210,8 @@ void _Scheduler_priority_Yield(
* @param[in] the_thread will be enqueued at the TAIL of its priority.
*/
void _Scheduler_priority_Enqueue(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -219,8 +224,8 @@ void _Scheduler_priority_Enqueue(
* @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
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -232,8 +237,8 @@ void _Scheduler_priority_Enqueue_first(
* @param[in] the_thread will be extracted from the ready set.
*/
void _Scheduler_priority_Extract(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index 9716b12..54fca12 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -78,8 +78,8 @@ extern "C" {
* management memory for.
*/
void * _Scheduler_priority_affinity_SMP_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -94,10 +94,10 @@ void * _Scheduler_priority_affinity_SMP_Allocate(
* @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
+ const Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
);
/**
@@ -111,10 +111,10 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
* @retval 0 Successful
*/
bool _Scheduler_priority_affinity_SMP_Set_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ const Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index 7861df5..bdd7e6f 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -35,10 +35,10 @@ extern "C" {
*/
/**@{**/
-RTEMS_INLINE_ROUTINE Scheduler_priority_Control *
- _Scheduler_priority_Self_from_base( Scheduler_Control *scheduler_base )
+RTEMS_INLINE_ROUTINE Scheduler_priority_Context *
+ _Scheduler_priority_Get_context( const Scheduler_Control *scheduler )
{
- return (Scheduler_priority_Control *) scheduler_base->information;
+ return (Scheduler_priority_Context *) scheduler->context;
}
/**
@@ -134,14 +134,14 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract(
}
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body(
- Scheduler_Control *scheduler_base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_priority_Control *scheduler =
- _Scheduler_priority_Self_from_base( scheduler_base );
+ Scheduler_priority_Context *context =
+ _Scheduler_priority_Get_context( scheduler );
- _Scheduler_priority_Ready_queue_extract( the_thread, &scheduler->Bit_map );
+ _Scheduler_priority_Ready_queue_extract( the_thread, &context->Bit_map );
}
/**
@@ -193,16 +193,16 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_requeue(
* for priority-based scheduling.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(
- Scheduler_Control *scheduler_base,
- Thread_Control *the_thread,
- bool force_dispatch
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ bool force_dispatch
)
{
- Scheduler_priority_Control *scheduler =
- _Scheduler_priority_Self_from_base( scheduler_base );
+ Scheduler_priority_Context *context =
+ _Scheduler_priority_Get_context( scheduler );
Thread_Control *heir = _Scheduler_priority_Ready_queue_first(
- &scheduler->Bit_map,
- &scheduler->Ready[ 0 ]
+ &context->Bit_map,
+ &context->Ready[ 0 ]
);
( void ) the_thread;
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index 905549d..df8af18 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -47,6 +47,12 @@ extern "C" {
* @{
*/
+typedef struct {
+ Scheduler_SMP_Context Base;
+ Priority_bit_map_Control Bit_map;
+ Chain_Control Ready[ 0 ];
+} Scheduler_priority_SMP_Context;
+
/**
* @brief Entry points for the Priority SMP Scheduler.
*/
@@ -71,45 +77,45 @@ extern "C" {
_Scheduler_default_Set_affinity \
}
-void _Scheduler_priority_SMP_Initialize( void );
+void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler );
void _Scheduler_priority_SMP_Schedule(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_priority_SMP_Block(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_priority_SMP_Update(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_priority_SMP_Enqueue_fifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_priority_SMP_Enqueue_lifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_priority_SMP_Extract(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_priority_SMP_Yield(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_priority_SMP_Start_idle(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread,
Per_CPU_Control *cpu
);
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 889c5a7..213bbb2 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -55,21 +55,26 @@ extern "C" {
}
/**
- * @brief Simple scheduler control.
+ * @brief Simple scheduler context.
*/
typedef struct {
/**
+ * @brief Basic scheduler context.
+ */
+ Scheduler_Context Base;
+
+ /**
* @brief One ready queue for all ready threads.
*/
Chain_Control Ready;
-} Scheduler_simple_Control;
+} Scheduler_simple_Context;
/**
* @brief Initialize simple scheduler.
*
* This routine initializes the simple scheduler.
*/
-void _Scheduler_simple_Initialize( void );
+void _Scheduler_simple_Initialize( const Scheduler_Control *scheduler );
/**
* This routine sets the heir thread to be the next ready thread
@@ -77,8 +82,8 @@ void _Scheduler_simple_Initialize( void );
* information.
*/
void _Scheduler_simple_Schedule(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -98,8 +103,8 @@ void _Scheduler_simple_Schedule(
* @param[in,out] thread The yielding thread.
*/
void _Scheduler_simple_Yield(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -113,8 +118,8 @@ void _Scheduler_simple_Yield(
* @param[in] the_thread is the thread that is to be blocked
*/
void _Scheduler_simple_Block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -127,8 +132,8 @@ void _Scheduler_simple_Block(
* @param[in] the_thread is the thread that is to be unblocked
*/
void _Scheduler_simple_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -140,8 +145,8 @@ void _Scheduler_simple_Unblock(
* @param[in] the_thread is the thread to be blocked
*/
void _Scheduler_simple_Extract(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -152,8 +157,8 @@ void _Scheduler_simple_Extract(
* @param[in] the_thread is the thread to be enqueued
*/
void _Scheduler_simple_Enqueue(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -166,8 +171,8 @@ void _Scheduler_simple_Enqueue(
* @param[in] the_thread is the thread to be blocked
*/
void _Scheduler_simple_Enqueue_first(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -179,8 +184,8 @@ void _Scheduler_simple_Enqueue_first(
* @param[in] the_thread - pointer to a thread control block
*/
void _Scheduler_simple_Ready_queue_enqueue(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -193,8 +198,8 @@ void _Scheduler_simple_Ready_queue_enqueue(
* @param[in] the_thread - pointer to a thread control block
*/
void _Scheduler_simple_Ready_queue_enqueue_first(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**@}*/
diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
index 8ad142f..f436134 100644
--- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
@@ -32,10 +32,10 @@ extern "C" {
*/
/**@{**/
-RTEMS_INLINE_ROUTINE Scheduler_simple_Control *
- _Scheduler_simple_Self_from_base( Scheduler_Control *scheduler_base )
+RTEMS_INLINE_ROUTINE Scheduler_simple_Context *
+ _Scheduler_simple_Get_context( const Scheduler_Control *scheduler )
{
- return (Scheduler_simple_Control *) scheduler_base->information;
+ return (Scheduler_simple_Context *) scheduler->context;
}
/**
@@ -45,8 +45,8 @@ RTEMS_INLINE_ROUTINE Scheduler_simple_Control *
* @param[in] the_thread is the thread to be blocked
*/
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_requeue(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
/* extract */
@@ -103,14 +103,14 @@ RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo(
}
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body(
- Scheduler_Control *scheduler_base,
- Thread_Control *the_thread,
- bool force_dispatch
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ bool force_dispatch
)
{
- Scheduler_simple_Control *scheduler =
- _Scheduler_simple_Self_from_base( scheduler_base );
- Thread_Control *heir = (Thread_Control *) _Chain_First( &scheduler->Ready );
+ Scheduler_simple_Context *context =
+ _Scheduler_simple_Get_context( scheduler );
+ Thread_Control *heir = (Thread_Control *) _Chain_First( &context->Ready );
( void ) the_thread;
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index a6d8262..dcdc681 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -49,6 +49,11 @@ extern "C" {
* @{
*/
+typedef struct {
+ Scheduler_SMP_Context Base;
+ Chain_Control Ready;
+} Scheduler_simple_SMP_Context;
+
/**
* @brief Entry points for the Simple SMP Scheduler.
*/
@@ -73,40 +78,40 @@ extern "C" {
_Scheduler_default_Set_affinity \
}
-void _Scheduler_simple_smp_Initialize( void );
+void _Scheduler_simple_smp_Initialize( const Scheduler_Control *scheduler );
void _Scheduler_simple_smp_Block(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_simple_smp_Enqueue_priority_fifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_simple_smp_Enqueue_priority_lifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_simple_smp_Extract(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_simple_smp_Yield(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_simple_smp_Schedule(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
);
void _Scheduler_simple_smp_Start_idle(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread,
Per_CPU_Control *cpu
);
diff --git a/cpukit/score/include/rtems/score/schedulersmp.h b/cpukit/score/include/rtems/score/schedulersmp.h
index 458a312..8f5a390 100644
--- a/cpukit/score/include/rtems/score/schedulersmp.h
+++ b/cpukit/score/include/rtems/score/schedulersmp.h
@@ -41,19 +41,13 @@ extern "C" {
*/
typedef struct {
- Chain_Control Scheduled;
-} Scheduler_SMP_Control;
-
-typedef struct {
- Scheduler_SMP_Control Base;
- Chain_Control Ready;
-} Scheduler_simple_SMP_Control;
+ /**
+ * @brief Basic scheduler context.
+ */
+ Scheduler_Context Base;
-typedef struct {
- Scheduler_SMP_Control Base;
- Priority_bit_map_Control Bit_map;
- Chain_Control Ready[ 1 ];
-} Scheduler_priority_SMP_Control;
+ Chain_Control Scheduled;
+} Scheduler_SMP_Context;
/** @} */
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index df2a85b..61fbff5 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -39,26 +39,26 @@ extern "C" {
*/
typedef Thread_Control *( *Scheduler_SMP_Get_highest_ready )(
- Scheduler_SMP_Control *self
+ Scheduler_SMP_Context *self
);
typedef void ( *Scheduler_SMP_Extract )(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread
);
typedef void ( *Scheduler_SMP_Insert )(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread_to_insert
);
typedef void ( *Scheduler_SMP_Move )(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread_to_move
);
static inline void _Scheduler_SMP_Initialize(
- Scheduler_SMP_Control *self
+ Scheduler_SMP_Context *self
)
{
_Chain_Initialize_empty( &self->Scheduled );
@@ -107,7 +107,7 @@ static inline void _Scheduler_SMP_Allocate_processor(
}
static inline Thread_Control *_Scheduler_SMP_Get_lowest_scheduled(
- Scheduler_SMP_Control *self
+ Scheduler_SMP_Context *self
)
{
Thread_Control *lowest_ready = NULL;
@@ -121,7 +121,7 @@ static inline Thread_Control *_Scheduler_SMP_Get_lowest_scheduled(
}
static inline void _Scheduler_SMP_Enqueue_ordered(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread,
Chain_Node_order order,
Scheduler_SMP_Get_highest_ready get_highest_ready,
@@ -177,7 +177,7 @@ static inline void _Scheduler_SMP_Enqueue_ordered(
}
static inline void _Scheduler_SMP_Schedule_highest_ready(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *victim,
Scheduler_SMP_Get_highest_ready get_highest_ready,
Scheduler_SMP_Move move_from_ready_to_scheduled
@@ -191,7 +191,7 @@ static inline void _Scheduler_SMP_Schedule_highest_ready(
}
static inline void _Scheduler_SMP_Block(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread,
Scheduler_SMP_Extract extract,
Scheduler_SMP_Get_highest_ready get_highest_ready,
@@ -213,7 +213,7 @@ static inline void _Scheduler_SMP_Block(
}
static inline void _Scheduler_SMP_Extract(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread,
Scheduler_SMP_Extract extract
)
@@ -222,7 +222,7 @@ static inline void _Scheduler_SMP_Extract(
}
static inline void _Scheduler_SMP_Schedule(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread,
Scheduler_SMP_Get_highest_ready get_highest_ready,
Scheduler_SMP_Move move_from_ready_to_scheduled
@@ -241,7 +241,7 @@ static inline void _Scheduler_SMP_Schedule(
}
static inline void _Scheduler_SMP_Insert_scheduled_lifo(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread
)
{
@@ -253,7 +253,7 @@ static inline void _Scheduler_SMP_Insert_scheduled_lifo(
}
static inline void _Scheduler_SMP_Insert_scheduled_fifo(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread
)
{
@@ -265,7 +265,7 @@ static inline void _Scheduler_SMP_Insert_scheduled_fifo(
}
static inline void _Scheduler_SMP_Start_idle(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread,
Per_CPU_Control *cpu
)
diff --git a/cpukit/score/src/scheduler.c b/cpukit/score/src/scheduler.c
index 7705472..ef5a0a9 100644
--- a/cpukit/score/src/scheduler.c
+++ b/cpukit/score/src/scheduler.c
@@ -22,5 +22,12 @@
void _Scheduler_Handler_initialization(void)
{
- (*_Scheduler.Operations.initialize)();
+ size_t n = _Scheduler_Count;
+ size_t i;
+
+ for ( i = 0 ; i < n ; ++i ) {
+ const Scheduler_Control *scheduler = &_Scheduler_Table[ i ];
+
+ ( *scheduler->Operations.initialize )( scheduler );
+ }
}
diff --git a/cpukit/score/src/schedulercbs.c b/cpukit/score/src/schedulercbs.c
index c427c52..54312b2 100644
--- a/cpukit/score/src/schedulercbs.c
+++ b/cpukit/score/src/schedulercbs.c
@@ -22,8 +22,6 @@
#include <rtems/score/threadimpl.h>
#include <rtems/score/wkspace.h>
-Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
-
void _Scheduler_CBS_Budget_callout(
Thread_Control *the_thread
)
@@ -52,13 +50,5 @@ void _Scheduler_CBS_Budget_callout(
int _Scheduler_CBS_Initialize(void)
{
- unsigned int i;
- _Scheduler_CBS_Server_list = (Scheduler_CBS_Server **) _Workspace_Allocate(
- _Scheduler_CBS_Maximum_servers * sizeof(Scheduler_CBS_Server*) );
- if ( !_Scheduler_CBS_Server_list )
- return SCHEDULER_CBS_ERROR_NO_MEMORY;
- for (i = 0; i<_Scheduler_CBS_Maximum_servers; i++) {
- _Scheduler_CBS_Server_list[i] = NULL;
- }
return SCHEDULER_CBS_OK;
}
diff --git a/cpukit/score/src/schedulercbsallocate.c b/cpukit/score/src/schedulercbsallocate.c
index 908ea90..1190b84 100644
--- a/cpukit/score/src/schedulercbsallocate.c
+++ b/cpukit/score/src/schedulercbsallocate.c
@@ -26,8 +26,8 @@
#include <rtems/score/wkspace.h>
void *_Scheduler_CBS_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
void *sched;
diff --git a/cpukit/score/src/schedulercbsattachthread.c b/cpukit/score/src/schedulercbsattachthread.c
index ad92791..43bf92d 100644
--- a/cpukit/score/src/schedulercbsattachthread.c
+++ b/cpukit/score/src/schedulercbsattachthread.c
@@ -33,11 +33,11 @@ int _Scheduler_CBS_Attach_thread (
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
/* Server is not valid. */
- if ( !_Scheduler_CBS_Server_list[server_id] )
+ if ( !_Scheduler_CBS_Server_list[server_id].initialized )
return SCHEDULER_CBS_ERROR_NOSERVER;
/* Server is already attached to a thread. */
- if ( _Scheduler_CBS_Server_list[server_id]->task_id != -1 )
+ if ( _Scheduler_CBS_Server_list[server_id].task_id != -1 )
return SCHEDULER_CBS_ERROR_FULL;
the_thread = _Thread_Get(task_id, &location);
@@ -53,8 +53,8 @@ int _Scheduler_CBS_Attach_thread (
return SCHEDULER_CBS_ERROR_FULL;
}
- _Scheduler_CBS_Server_list[server_id]->task_id = task_id;
- sched_info->cbs_server = (void *) _Scheduler_CBS_Server_list[server_id];
+ _Scheduler_CBS_Server_list[server_id].task_id = task_id;
+ sched_info->cbs_server = &_Scheduler_CBS_Server_list[server_id];
the_thread->budget_callout = _Scheduler_CBS_Budget_callout;
the_thread->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_CALLOUT;
diff --git a/cpukit/score/src/schedulercbscleanup.c b/cpukit/score/src/schedulercbscleanup.c
index 795b16a..01dd0d8 100644
--- a/cpukit/score/src/schedulercbscleanup.c
+++ b/cpukit/score/src/schedulercbscleanup.c
@@ -26,9 +26,8 @@ int _Scheduler_CBS_Cleanup (void)
unsigned int i;
for ( i = 0; i<_Scheduler_CBS_Maximum_servers; i++ ) {
- if ( _Scheduler_CBS_Server_list[ i ] )
+ if ( _Scheduler_CBS_Server_list[ i ].initialized )
_Scheduler_CBS_Destroy_server( i );
}
- _Workspace_Free( _Scheduler_CBS_Server_list );
return SCHEDULER_CBS_OK;
}
diff --git a/cpukit/score/src/schedulercbscreateserver.c b/cpukit/score/src/schedulercbscreateserver.c
index 85ed6d4..486329c 100644
--- a/cpukit/score/src/schedulercbscreateserver.c
+++ b/cpukit/score/src/schedulercbscreateserver.c
@@ -19,7 +19,6 @@
#endif
#include <rtems/score/schedulercbs.h>
-#include <rtems/score/wkspace.h>
int _Scheduler_CBS_Create_server (
Scheduler_CBS_Parameters *params,
@@ -37,7 +36,7 @@ int _Scheduler_CBS_Create_server (
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
for ( i = 0; i<_Scheduler_CBS_Maximum_servers; i++ ) {
- if ( !_Scheduler_CBS_Server_list[i] )
+ if ( !_Scheduler_CBS_Server_list[i].initialized )
break;
}
@@ -45,14 +44,10 @@ int _Scheduler_CBS_Create_server (
return SCHEDULER_CBS_ERROR_FULL;
*server_id = i;
- _Scheduler_CBS_Server_list[*server_id] = (Scheduler_CBS_Server *)
- _Workspace_Allocate( sizeof(Scheduler_CBS_Server) );
- the_server = _Scheduler_CBS_Server_list[*server_id];
- if ( !the_server )
- return SCHEDULER_CBS_ERROR_NO_MEMORY;
-
+ the_server = &_Scheduler_CBS_Server_list[*server_id];
the_server->parameters = *params;
the_server->task_id = -1;
the_server->cbs_budget_overrun = budget_overrun_callback;
+ the_server->initialized = true;
return SCHEDULER_CBS_OK;
}
diff --git a/cpukit/score/src/schedulercbsdestroyserver.c b/cpukit/score/src/schedulercbsdestroyserver.c
index d8885a8..2407a48 100644
--- a/cpukit/score/src/schedulercbsdestroyserver.c
+++ b/cpukit/score/src/schedulercbsdestroyserver.c
@@ -32,13 +32,12 @@ int _Scheduler_CBS_Destroy_server (
if ( server_id >= _Scheduler_CBS_Maximum_servers )
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
- if ( !_Scheduler_CBS_Server_list[server_id] )
+ if ( !_Scheduler_CBS_Server_list[server_id].initialized )
return SCHEDULER_CBS_ERROR_NOSERVER;
- if ( (tid = _Scheduler_CBS_Server_list[server_id]->task_id) != -1 )
+ if ( (tid = _Scheduler_CBS_Server_list[server_id].task_id) != -1 )
ret = _Scheduler_CBS_Detach_thread ( server_id, tid );
- _Workspace_Free( _Scheduler_CBS_Server_list[server_id] );
- _Scheduler_CBS_Server_list[server_id] = NULL;
+ _Scheduler_CBS_Server_list[server_id].initialized = false;
return ret;
}
diff --git a/cpukit/score/src/schedulercbsdetachthread.c b/cpukit/score/src/schedulercbsdetachthread.c
index f8a5e32..0f77cdf 100644
--- a/cpukit/score/src/schedulercbsdetachthread.c
+++ b/cpukit/score/src/schedulercbsdetachthread.c
@@ -34,16 +34,16 @@ int _Scheduler_CBS_Detach_thread (
if ( server_id >= _Scheduler_CBS_Maximum_servers )
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
/* Server is not valid. */
- if ( !_Scheduler_CBS_Server_list[server_id] )
+ if ( !_Scheduler_CBS_Server_list[server_id].initialized )
return SCHEDULER_CBS_ERROR_NOSERVER;
/* Thread and server are not attached. */
- if ( _Scheduler_CBS_Server_list[server_id]->task_id != task_id )
+ if ( _Scheduler_CBS_Server_list[server_id].task_id != task_id )
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
the_thread = _Thread_Get(task_id, &location);
/* The routine _Thread_Get may disable dispatch and not enable again. */
if ( the_thread ) {
- _Scheduler_CBS_Server_list[server_id]->task_id = -1;
+ _Scheduler_CBS_Server_list[server_id].task_id = -1;
sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
sched_info->cbs_server = NULL;
diff --git a/cpukit/score/src/schedulercbsgetapprovedbudget.c b/cpukit/score/src/schedulercbsgetapprovedbudget.c
index 560849e..d1ea5ce 100644
--- a/cpukit/score/src/schedulercbsgetapprovedbudget.c
+++ b/cpukit/score/src/schedulercbsgetapprovedbudget.c
@@ -30,9 +30,9 @@ int _Scheduler_CBS_Get_approved_budget (
{
if ( server_id >= _Scheduler_CBS_Maximum_servers )
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
- if ( !_Scheduler_CBS_Server_list[server_id] )
+ if ( !_Scheduler_CBS_Server_list[server_id].initialized )
return SCHEDULER_CBS_ERROR_NOSERVER;
- *approved_budget = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
+ *approved_budget = _Scheduler_CBS_Server_list[server_id].parameters.budget;
return SCHEDULER_CBS_OK;
}
diff --git a/cpukit/score/src/schedulercbsgetexecutiontime.c b/cpukit/score/src/schedulercbsgetexecutiontime.c
index 325c759..ee139e6 100644
--- a/cpukit/score/src/schedulercbsgetexecutiontime.c
+++ b/cpukit/score/src/schedulercbsgetexecutiontime.c
@@ -33,25 +33,25 @@ int _Scheduler_CBS_Get_execution_time (
if ( server_id >= _Scheduler_CBS_Maximum_servers )
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
- if ( !_Scheduler_CBS_Server_list[server_id] )
+ if ( !_Scheduler_CBS_Server_list[server_id].initialized )
return SCHEDULER_CBS_ERROR_NOSERVER;
- if ( _Scheduler_CBS_Server_list[server_id]->task_id == -1 ) {
+ if ( _Scheduler_CBS_Server_list[server_id].task_id == -1 ) {
*exec_time = 0;
return SCHEDULER_CBS_OK;
}
the_thread = _Thread_Get(
- _Scheduler_CBS_Server_list[server_id]->task_id,
+ _Scheduler_CBS_Server_list[server_id].task_id,
&location
);
/* The routine _Thread_Get may disable dispatch and not enable again. */
if ( the_thread ) {
- *exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget -
+ *exec_time = _Scheduler_CBS_Server_list[server_id].parameters.budget -
the_thread->cpu_time_budget;
_Objects_Put( &the_thread->Object );
}
else {
- *exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
+ *exec_time = _Scheduler_CBS_Server_list[server_id].parameters.budget;
}
return SCHEDULER_CBS_OK;
}
diff --git a/cpukit/score/src/schedulercbsgetparameters.c b/cpukit/score/src/schedulercbsgetparameters.c
index 12c9489..18dbc0e 100644
--- a/cpukit/score/src/schedulercbsgetparameters.c
+++ b/cpukit/score/src/schedulercbsgetparameters.c
@@ -30,9 +30,9 @@ int _Scheduler_CBS_Get_parameters (
{
if ( server_id >= _Scheduler_CBS_Maximum_servers )
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
- if ( !_Scheduler_CBS_Server_list[server_id] )
+ if ( !_Scheduler_CBS_Server_list[server_id].initialized )
return SCHEDULER_CBS_ERROR_NOSERVER;
- *params = _Scheduler_CBS_Server_list[server_id]->parameters;
+ *params = _Scheduler_CBS_Server_list[server_id].parameters;
return SCHEDULER_CBS_OK;
}
diff --git a/cpukit/score/src/schedulercbsgetremainingbudget.c b/cpukit/score/src/schedulercbsgetremainingbudget.c
index df4709d..a031ba4 100644
--- a/cpukit/score/src/schedulercbsgetremainingbudget.c
+++ b/cpukit/score/src/schedulercbsgetremainingbudget.c
@@ -31,15 +31,15 @@ int _Scheduler_CBS_Get_remaining_budget (
if ( server_id >= _Scheduler_CBS_Maximum_servers )
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
- if ( !_Scheduler_CBS_Server_list[server_id] )
+ if ( !_Scheduler_CBS_Server_list[server_id].initialized )
return SCHEDULER_CBS_ERROR_NOSERVER;
- if ( _Scheduler_CBS_Server_list[server_id]->task_id == -1 ) {
- *remaining_budget = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
+ if ( _Scheduler_CBS_Server_list[server_id].task_id == -1 ) {
+ *remaining_budget = _Scheduler_CBS_Server_list[server_id].parameters.budget;
return SCHEDULER_CBS_OK;
}
the_thread = _Thread_Get(
- _Scheduler_CBS_Server_list[server_id]->task_id,
+ _Scheduler_CBS_Server_list[server_id].task_id,
&location
);
/* The routine _Thread_Get may disable dispatch and not enable again. */
diff --git a/cpukit/score/src/schedulercbsgetserverid.c b/cpukit/score/src/schedulercbsgetserverid.c
index 0711bae..235b559 100644
--- a/cpukit/score/src/schedulercbsgetserverid.c
+++ b/cpukit/score/src/schedulercbsgetserverid.c
@@ -30,8 +30,8 @@ int _Scheduler_CBS_Get_server_id (
{
unsigned int i;
for ( i = 0; i<_Scheduler_CBS_Maximum_servers; i++ ) {
- if ( _Scheduler_CBS_Server_list[i] &&
- _Scheduler_CBS_Server_list[i]->task_id == task_id ) {
+ if ( _Scheduler_CBS_Server_list[i].initialized &&
+ _Scheduler_CBS_Server_list[i].task_id == task_id ) {
*server_id = i;
return SCHEDULER_CBS_OK;
}
diff --git a/cpukit/score/src/schedulercbsreleasejob.c b/cpukit/score/src/schedulercbsreleasejob.c
index f4fc1a8..c5ac572 100644
--- a/cpukit/score/src/schedulercbsreleasejob.c
+++ b/cpukit/score/src/schedulercbsreleasejob.c
@@ -24,9 +24,9 @@
#include <rtems/score/watchdogimpl.h>
void _Scheduler_CBS_Release_job(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t deadline
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
)
{
Priority_Control new_priority;
diff --git a/cpukit/score/src/schedulercbssetparameters.c b/cpukit/score/src/schedulercbssetparameters.c
index 8c45232..6ddaf3d 100644
--- a/cpukit/score/src/schedulercbssetparameters.c
+++ b/cpukit/score/src/schedulercbssetparameters.c
@@ -38,9 +38,9 @@ int _Scheduler_CBS_Set_parameters (
params->deadline >= SCHEDULER_EDF_PRIO_MSB )
return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
- if ( !_Scheduler_CBS_Server_list[server_id] )
+ if ( !_Scheduler_CBS_Server_list[server_id].initialized )
return SCHEDULER_CBS_ERROR_NOSERVER;
- _Scheduler_CBS_Server_list[server_id]->parameters = *params;
+ _Scheduler_CBS_Server_list[server_id].parameters = *params;
return SCHEDULER_CBS_OK;
}
diff --git a/cpukit/score/src/schedulercbsunblock.c b/cpukit/score/src/schedulercbsunblock.c
index 11465f2..030cc85 100644
--- a/cpukit/score/src/schedulercbsunblock.c
+++ b/cpukit/score/src/schedulercbsunblock.c
@@ -25,8 +25,8 @@
#include <rtems/score/watchdogimpl.h>
void _Scheduler_CBS_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
Scheduler_CBS_Per_thread *sched_info;
diff --git a/cpukit/score/src/schedulerdefaultallocatefree.c b/cpukit/score/src/schedulerdefaultallocatefree.c
index 7ffade2..4efed5b 100644
--- a/cpukit/score/src/schedulerdefaultallocatefree.c
+++ b/cpukit/score/src/schedulerdefaultallocatefree.c
@@ -22,8 +22,8 @@
#include <rtems/score/scheduler.h>
void *_Scheduler_default_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( void ) scheduler;
@@ -33,8 +33,8 @@ void *_Scheduler_default_Allocate(
}
void _Scheduler_default_Free(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( void ) scheduler;
diff --git a/cpukit/score/src/schedulerdefaultgetaffinity.c b/cpukit/score/src/schedulerdefaultgetaffinity.c
index b4a1d1a..367fc25 100644
--- a/cpukit/score/src/schedulerdefaultgetaffinity.c
+++ b/cpukit/score/src/schedulerdefaultgetaffinity.c
@@ -23,10 +23,10 @@
#include <rtems/score/cpusetimpl.h>
bool _Scheduler_default_Get_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ const Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
)
{
const CPU_set_Control *ctl;
diff --git a/cpukit/score/src/schedulerdefaultreleasejob.c b/cpukit/score/src/schedulerdefaultreleasejob.c
index 10ebf84..90593ab 100644
--- a/cpukit/score/src/schedulerdefaultreleasejob.c
+++ b/cpukit/score/src/schedulerdefaultreleasejob.c
@@ -22,9 +22,9 @@
#include <rtems/score/scheduler.h>
void _Scheduler_default_Release_job(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t deadline
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
)
{
( void ) scheduler;
diff --git a/cpukit/score/src/schedulerdefaultsetaffinity.c b/cpukit/score/src/schedulerdefaultsetaffinity.c
index 1115f3a..33be12b 100644
--- a/cpukit/score/src/schedulerdefaultsetaffinity.c
+++ b/cpukit/score/src/schedulerdefaultsetaffinity.c
@@ -23,10 +23,10 @@
#include <rtems/score/cpusetimpl.h>
bool _Scheduler_default_Set_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ const Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ const cpu_set_t *cpuset
)
{
(void) scheduler;
diff --git a/cpukit/score/src/schedulerdefaultstartidle.c b/cpukit/score/src/schedulerdefaultstartidle.c
index caddb7f..eeed928 100644
--- a/cpukit/score/src/schedulerdefaultstartidle.c
+++ b/cpukit/score/src/schedulerdefaultstartidle.c
@@ -13,9 +13,9 @@
#include <rtems/score/schedulerimpl.h>
void _Scheduler_default_Start_idle(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- Per_CPU_Control *cpu
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Per_CPU_Control *cpu
)
{
(void) cpu;
diff --git a/cpukit/score/src/schedulerdefaulttick.c b/cpukit/score/src/schedulerdefaulttick.c
index 3b3d9a0..6e7ed37 100644
--- a/cpukit/score/src/schedulerdefaulttick.c
+++ b/cpukit/score/src/schedulerdefaulttick.c
@@ -25,8 +25,8 @@
#include <rtems/config.h>
static void _Scheduler_default_Tick_for_executing(
- Scheduler_Control *scheduler,
- Thread_Control *executing
+ const Scheduler_Control *scheduler,
+ Thread_Control *executing
)
{
#ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__
@@ -84,7 +84,7 @@ static void _Scheduler_default_Tick_for_executing(
}
}
-void _Scheduler_default_Tick( Scheduler_Control *scheduler )
+void _Scheduler_default_Tick( const Scheduler_Control *scheduler )
{
uint32_t processor_count = _SMP_Get_processor_count();
uint32_t processor;
diff --git a/cpukit/score/src/schedulerdefaultupdate.c b/cpukit/score/src/schedulerdefaultupdate.c
index c1b62b2..28d7e1d 100644
--- a/cpukit/score/src/schedulerdefaultupdate.c
+++ b/cpukit/score/src/schedulerdefaultupdate.c
@@ -22,8 +22,8 @@
#include <rtems/score/scheduler.h>
void _Scheduler_default_Update(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
( void ) scheduler;
diff --git a/cpukit/score/src/scheduleredf.c b/cpukit/score/src/scheduleredf.c
index 502a2a1..4d1aa62 100644
--- a/cpukit/score/src/scheduleredf.c
+++ b/cpukit/score/src/scheduleredf.c
@@ -18,10 +18,7 @@
#include "config.h"
#endif
-#include <rtems/score/scheduleredf.h>
-#include <rtems/score/schedulerimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
+#include <rtems/score/scheduleredfimpl.h>
static int _Scheduler_EDF_RBTree_compare_function
(
@@ -41,16 +38,14 @@ static int _Scheduler_EDF_RBTree_compare_function
return (-1)*_Scheduler_EDF_Priority_compare(value1, value2);
}
-void _Scheduler_EDF_Initialize(void)
+void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler )
{
- Scheduler_EDF_Control *scheduler =
- _Workspace_Allocate_or_fatal_error( sizeof( *scheduler ) );
+ Scheduler_EDF_Context *context =
+ _Scheduler_EDF_Get_context( scheduler );
_RBTree_Initialize_empty(
- &scheduler->Ready,
+ &context->Ready,
_Scheduler_EDF_RBTree_compare_function,
0
);
-
- _Scheduler.information = scheduler;
}
diff --git a/cpukit/score/src/scheduleredfallocate.c b/cpukit/score/src/scheduleredfallocate.c
index 73df5b8..68ae124 100644
--- a/cpukit/score/src/scheduleredfallocate.c
+++ b/cpukit/score/src/scheduleredfallocate.c
@@ -25,8 +25,8 @@
#include <rtems/score/wkspace.h>
void *_Scheduler_EDF_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
void *sched;
diff --git a/cpukit/score/src/scheduleredfblock.c b/cpukit/score/src/scheduleredfblock.c
index 9ea5fc9..aaa9c12 100644
--- a/cpukit/score/src/scheduleredfblock.c
+++ b/cpukit/score/src/scheduleredfblock.c
@@ -22,8 +22,8 @@
#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_Generic_block(
diff --git a/cpukit/score/src/scheduleredfenqueue.c b/cpukit/score/src/scheduleredfenqueue.c
index 2e7365b..38e67eb 100644
--- a/cpukit/score/src/scheduleredfenqueue.c
+++ b/cpukit/score/src/scheduleredfenqueue.c
@@ -21,16 +21,16 @@
#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Enqueue(
- Scheduler_Control *scheduler_base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_EDF_Control *scheduler =
- _Scheduler_EDF_Self_from_base( scheduler_base );
+ Scheduler_EDF_Context *context =
+ _Scheduler_EDF_Get_context( scheduler );
Scheduler_EDF_Per_thread *sched_info =
(Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
RBTree_Node *node = &(sched_info->Node);
- _RBTree_Insert( &scheduler->Ready, node );
+ _RBTree_Insert( &context->Ready, node );
sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_YES;
}
diff --git a/cpukit/score/src/scheduleredfenqueuefirst.c b/cpukit/score/src/scheduleredfenqueuefirst.c
index bcf70b4..aafc9b4 100644
--- a/cpukit/score/src/scheduleredfenqueuefirst.c
+++ b/cpukit/score/src/scheduleredfenqueuefirst.c
@@ -24,8 +24,8 @@
#include <rtems/score/scheduleredf.h>
void _Scheduler_EDF_Enqueue_first(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_EDF_Enqueue( scheduler, the_thread );
diff --git a/cpukit/score/src/scheduleredfextract.c b/cpukit/score/src/scheduleredfextract.c
index ec634e0..02c47af 100644
--- a/cpukit/score/src/scheduleredfextract.c
+++ b/cpukit/score/src/scheduleredfextract.c
@@ -21,16 +21,16 @@
#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Extract(
- Scheduler_Control *scheduler_base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_EDF_Control *scheduler =
- _Scheduler_EDF_Self_from_base( scheduler_base );
+ Scheduler_EDF_Context *context =
+ _Scheduler_EDF_Get_context( scheduler );
Scheduler_EDF_Per_thread *sched_info =
(Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
RBTree_Node *node = &(sched_info->Node);
- _RBTree_Extract( &scheduler->Ready, node );
+ _RBTree_Extract( &context->Ready, node );
sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY;
}
diff --git a/cpukit/score/src/scheduleredffree.c b/cpukit/score/src/scheduleredffree.c
index d9493cc..3529ac9 100644
--- a/cpukit/score/src/scheduleredffree.c
+++ b/cpukit/score/src/scheduleredffree.c
@@ -26,8 +26,8 @@
#include <rtems/score/wkspace.h>
void _Scheduler_EDF_Free(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
(void) scheduler;
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c
index 37ff2d5..6c1b642 100644
--- a/cpukit/score/src/scheduleredfreleasejob.c
+++ b/cpukit/score/src/scheduleredfreleasejob.c
@@ -23,9 +23,9 @@
#include <rtems/score/watchdogimpl.h>
void _Scheduler_EDF_Release_job(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- uint32_t deadline
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
)
{
Priority_Control new_priority;
diff --git a/cpukit/score/src/scheduleredfschedule.c b/cpukit/score/src/scheduleredfschedule.c
index f7acde3..7840eed 100644
--- a/cpukit/score/src/scheduleredfschedule.c
+++ b/cpukit/score/src/scheduleredfschedule.c
@@ -21,8 +21,8 @@
#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Schedule(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_EDF_Schedule_body( scheduler, the_thread, false );
diff --git a/cpukit/score/src/scheduleredfunblock.c b/cpukit/score/src/scheduleredfunblock.c
index 0640e8c..7418b64 100644
--- a/cpukit/score/src/scheduleredfunblock.c
+++ b/cpukit/score/src/scheduleredfunblock.c
@@ -23,8 +23,8 @@
#include <rtems/score/thread.h>
void _Scheduler_EDF_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_EDF_Enqueue( scheduler, the_thread);
diff --git a/cpukit/score/src/scheduleredfupdate.c b/cpukit/score/src/scheduleredfupdate.c
index 3069068..88d6d9d 100644
--- a/cpukit/score/src/scheduleredfupdate.c
+++ b/cpukit/score/src/scheduleredfupdate.c
@@ -26,8 +26,8 @@
#include <rtems/score/thread.h>
void _Scheduler_EDF_Update(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
Scheduler_EDF_Per_thread *sched_info =
diff --git a/cpukit/score/src/scheduleredfyield.c b/cpukit/score/src/scheduleredfyield.c
index 5b14cad..8f8786a 100644
--- a/cpukit/score/src/scheduleredfyield.c
+++ b/cpukit/score/src/scheduleredfyield.c
@@ -22,12 +22,12 @@
#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Yield(
- Scheduler_Control *scheduler_base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_EDF_Control *scheduler =
- _Scheduler_EDF_Self_from_base( scheduler_base );
+ Scheduler_EDF_Context *context =
+ _Scheduler_EDF_Get_context( scheduler );
ISR_Level level;
Scheduler_EDF_Per_thread *thread_info =
@@ -40,12 +40,12 @@ void _Scheduler_EDF_Yield(
* The RBTree has more than one node, enqueue behind the tasks
* with the same priority in case there are such ones.
*/
- _RBTree_Extract( &scheduler->Ready, thread_node );
- _RBTree_Insert( &scheduler->Ready, thread_node );
+ _RBTree_Extract( &context->Ready, thread_node );
+ _RBTree_Insert( &context->Ready, thread_node );
_ISR_Flash( level );
- _Scheduler_EDF_Schedule_body( scheduler_base, the_thread, false );
+ _Scheduler_EDF_Schedule_body( scheduler, the_thread, false );
_ISR_Enable( level );
}
diff --git a/cpukit/score/src/schedulerpriority.c b/cpukit/score/src/schedulerpriority.c
index 9d1755d..6dc055a 100644
--- a/cpukit/score/src/schedulerpriority.c
+++ b/cpukit/score/src/schedulerpriority.c
@@ -21,14 +21,11 @@
#include <rtems/score/schedulerpriorityimpl.h>
#include <rtems/score/wkspace.h>
-void _Scheduler_priority_Initialize(void)
+void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler )
{
- Scheduler_priority_Control *self = _Workspace_Allocate_or_fatal_error(
- sizeof( *self ) + PRIORITY_MAXIMUM * sizeof( Chain_Control )
- );
+ Scheduler_priority_Context *context =
+ _Scheduler_priority_Get_context( scheduler );
- _Priority_bit_map_Initialize( &self->Bit_map );
- _Scheduler_priority_Ready_queue_initialize( &self->Ready[ 0 ] );
-
- _Scheduler.information = self;
+ _Priority_bit_map_Initialize( &context->Bit_map );
+ _Scheduler_priority_Ready_queue_initialize( &context->Ready[ 0 ] );
}
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 08b6e82..2ab12b4 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -32,8 +32,8 @@ _Scheduler_priority_affinity_Get_scheduler_info( Thread_Control *thread )
}
void * _Scheduler_priority_affinity_SMP_Allocate(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
Scheduler_priority_affinity_SMP_Per_thread *info =
@@ -48,10 +48,10 @@ void * _Scheduler_priority_affinity_SMP_Allocate(
}
bool _Scheduler_priority_affinity_SMP_Get_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ const Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
)
{
Scheduler_priority_affinity_SMP_Per_thread *info =
@@ -68,10 +68,10 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
}
bool _Scheduler_priority_affinity_SMP_Set_affinity(
- Scheduler_Control *scheduler,
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ const Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
)
{
Scheduler_priority_affinity_SMP_Per_thread *info =
diff --git a/cpukit/score/src/schedulerpriorityallocate.c b/cpukit/score/src/schedulerpriorityallocate.c
index 2225d3d..32feabb 100644
--- a/cpukit/score/src/schedulerpriorityallocate.c
+++ b/cpukit/score/src/schedulerpriorityallocate.c
@@ -23,8 +23,8 @@
#include <rtems/score/wkspace.h>
void *_Scheduler_priority_Allocate (
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
Scheduler_priority_Per_thread *sched_info_of_thread =
diff --git a/cpukit/score/src/schedulerpriorityblock.c b/cpukit/score/src/schedulerpriorityblock.c
index 02d7387..ba3c825 100644
--- a/cpukit/score/src/schedulerpriorityblock.c
+++ b/cpukit/score/src/schedulerpriorityblock.c
@@ -23,8 +23,8 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_Generic_block(
diff --git a/cpukit/score/src/schedulerpriorityenqueue.c b/cpukit/score/src/schedulerpriorityenqueue.c
index 9d62c2c..e3f2be6 100644
--- a/cpukit/score/src/schedulerpriorityenqueue.c
+++ b/cpukit/score/src/schedulerpriorityenqueue.c
@@ -21,12 +21,12 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Enqueue(
- Scheduler_Control *base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_priority_Control *scheduler =
- _Scheduler_priority_Self_from_base( base );
+ Scheduler_priority_Context *context =
+ _Scheduler_priority_Get_context( scheduler );
- _Scheduler_priority_Ready_queue_enqueue( the_thread, &scheduler->Bit_map );
+ _Scheduler_priority_Ready_queue_enqueue( the_thread, &context->Bit_map );
}
diff --git a/cpukit/score/src/schedulerpriorityenqueuefirst.c b/cpukit/score/src/schedulerpriorityenqueuefirst.c
index 1f0605d..0d19706 100644
--- a/cpukit/score/src/schedulerpriorityenqueuefirst.c
+++ b/cpukit/score/src/schedulerpriorityenqueuefirst.c
@@ -21,16 +21,16 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Enqueue_first(
- Scheduler_Control *base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_priority_Control *self =
- _Scheduler_priority_Self_from_base( base );
+ Scheduler_priority_Context *context =
+ _Scheduler_priority_Get_context( scheduler );
_Scheduler_priority_Ready_queue_enqueue_first(
the_thread,
- &self->Bit_map
+ &context->Bit_map
);
}
diff --git a/cpukit/score/src/schedulerpriorityextract.c b/cpukit/score/src/schedulerpriorityextract.c
index 492c537..84dbaa4 100644
--- a/cpukit/score/src/schedulerpriorityextract.c
+++ b/cpukit/score/src/schedulerpriorityextract.c
@@ -22,9 +22,9 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Extract(
- Scheduler_Control *base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- _Scheduler_priority_Extract_body( base, the_thread );
+ _Scheduler_priority_Extract_body( scheduler, the_thread );
}
diff --git a/cpukit/score/src/schedulerpriorityfree.c b/cpukit/score/src/schedulerpriorityfree.c
index 5529f78..b2daa26 100644
--- a/cpukit/score/src/schedulerpriorityfree.c
+++ b/cpukit/score/src/schedulerpriorityfree.c
@@ -25,11 +25,11 @@
#include <rtems/score/wkspace.h>
void _Scheduler_priority_Free (
- Scheduler_Control *base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- (void) base;
+ (void) scheduler;
_Workspace_Free( the_thread->scheduler_info );
}
diff --git a/cpukit/score/src/schedulerpriorityschedule.c b/cpukit/score/src/schedulerpriorityschedule.c
index aa6c09a..ffc1351 100644
--- a/cpukit/score/src/schedulerpriorityschedule.c
+++ b/cpukit/score/src/schedulerpriorityschedule.c
@@ -21,9 +21,9 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Schedule(
- Scheduler_Control *base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- _Scheduler_priority_Schedule_body( base, the_thread, false );
+ _Scheduler_priority_Schedule_body( scheduler, the_thread, false );
}
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 5361023..025d960 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -29,40 +29,37 @@
#include <rtems/score/schedulersmpimpl.h>
#include <rtems/score/wkspace.h>
-static Scheduler_priority_SMP_Control *
-_Scheduler_priority_SMP_Self_from_base( Scheduler_Control *base )
+static Scheduler_priority_SMP_Context *
+_Scheduler_priority_SMP_Get_context( const Scheduler_Control *scheduler )
{
- return (Scheduler_priority_SMP_Control *) base->information;
+ return (Scheduler_priority_SMP_Context *) scheduler->context;
}
-static Scheduler_priority_SMP_Control *
-_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
+static Scheduler_priority_SMP_Context *
+_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Context *smp_base )
{
- return (Scheduler_priority_SMP_Control *)
+ return (Scheduler_priority_SMP_Context *)
( (char *) smp_base
- - offsetof( Scheduler_priority_SMP_Control, Base ) );
+ - offsetof( Scheduler_priority_SMP_Context, Base ) );
}
-void _Scheduler_priority_SMP_Initialize( void )
+void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler )
{
- Scheduler_priority_SMP_Control *self = _Workspace_Allocate_or_fatal_error(
- sizeof( *self ) + PRIORITY_MAXIMUM * sizeof( Chain_Control )
- );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Initialize( &self->Base );
_Priority_bit_map_Initialize( &self->Bit_map );
_Scheduler_priority_Ready_queue_initialize( &self->Ready[ 0 ] );
-
- _Scheduler.information = self;
}
void _Scheduler_priority_SMP_Update(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_priority_Update_body(
thread,
@@ -72,10 +69,10 @@ void _Scheduler_priority_SMP_Update(
}
static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
- Scheduler_SMP_Control *smp_base
+ Scheduler_SMP_Context *smp_base
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
Thread_Control *highest_ready = NULL;
@@ -90,11 +87,11 @@ static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
}
static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *scheduled_to_ready
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
@@ -105,11 +102,11 @@ static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
}
static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *ready_to_scheduled
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Scheduler_priority_Ready_queue_extract(
@@ -123,33 +120,33 @@ static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
}
static void _Scheduler_priority_SMP_Insert_ready_lifo(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Scheduler_priority_Ready_queue_enqueue( thread, &self->Bit_map );
}
static void _Scheduler_priority_SMP_Insert_ready_fifo(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Scheduler_priority_Ready_queue_enqueue_first( thread, &self->Bit_map );
}
static void _Scheduler_priority_SMP_Do_extract(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
bool is_scheduled = thread->is_scheduled;
@@ -164,12 +161,12 @@ static void _Scheduler_priority_SMP_Do_extract(
}
void _Scheduler_priority_SMP_Block(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Block(
&self->Base,
@@ -181,7 +178,7 @@ void _Scheduler_priority_SMP_Block(
}
static void _Scheduler_priority_SMP_Enqueue_ordered(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
@@ -201,12 +198,12 @@ static void _Scheduler_priority_SMP_Enqueue_ordered(
}
void _Scheduler_priority_SMP_Enqueue_lifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_priority_SMP_Enqueue_ordered(
&self->Base,
@@ -218,12 +215,12 @@ void _Scheduler_priority_SMP_Enqueue_lifo(
}
void _Scheduler_priority_SMP_Enqueue_fifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_priority_SMP_Enqueue_ordered(
&self->Base,
@@ -235,12 +232,12 @@ void _Scheduler_priority_SMP_Enqueue_fifo(
}
void _Scheduler_priority_SMP_Extract(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Extract(
&self->Base,
@@ -250,7 +247,7 @@ void _Scheduler_priority_SMP_Extract(
}
void _Scheduler_priority_SMP_Yield(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
@@ -258,19 +255,19 @@ void _Scheduler_priority_SMP_Yield(
_ISR_Disable( level );
- _Scheduler_priority_SMP_Extract( base, thread );
- _Scheduler_priority_SMP_Enqueue_fifo( base, thread );
+ _Scheduler_priority_SMP_Extract( scheduler, thread );
+ _Scheduler_priority_SMP_Enqueue_fifo( scheduler, thread );
_ISR_Enable( level );
}
void _Scheduler_priority_SMP_Schedule(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Schedule(
&self->Base,
@@ -281,13 +278,13 @@ void _Scheduler_priority_SMP_Schedule(
}
void _Scheduler_priority_SMP_Start_idle(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread,
Per_CPU_Control *cpu
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
}
diff --git a/cpukit/score/src/schedulerpriorityunblock.c b/cpukit/score/src/schedulerpriorityunblock.c
index c84111c..f5482a8 100644
--- a/cpukit/score/src/schedulerpriorityunblock.c
+++ b/cpukit/score/src/schedulerpriorityunblock.c
@@ -23,14 +23,14 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Unblock (
- Scheduler_Control *base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_priority_Control *self =
- _Scheduler_priority_Self_from_base( base );
+ Scheduler_priority_Context *context =
+ _Scheduler_priority_Get_context( scheduler );
- _Scheduler_priority_Ready_queue_enqueue( the_thread, &self->Bit_map );
+ _Scheduler_priority_Ready_queue_enqueue( the_thread, &context->Bit_map );
/* TODO: flash critical section? */
diff --git a/cpukit/score/src/schedulerpriorityupdate.c b/cpukit/score/src/schedulerpriorityupdate.c
index 0e7032a..c906c34 100644
--- a/cpukit/score/src/schedulerpriorityupdate.c
+++ b/cpukit/score/src/schedulerpriorityupdate.c
@@ -21,16 +21,16 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Update(
- Scheduler_Control *base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_priority_Control *self =
- _Scheduler_priority_Self_from_base( base );
+ Scheduler_priority_Context *context =
+ _Scheduler_priority_Get_context( scheduler );
_Scheduler_priority_Update_body(
the_thread,
- &self->Bit_map,
- &self->Ready[ 0 ]
+ &context->Bit_map,
+ &context->Ready[ 0 ]
);
}
diff --git a/cpukit/score/src/schedulerpriorityyield.c b/cpukit/score/src/schedulerpriorityyield.c
index 2bcefa5..63b344a 100644
--- a/cpukit/score/src/schedulerpriorityyield.c
+++ b/cpukit/score/src/schedulerpriorityyield.c
@@ -23,8 +23,8 @@
#include <rtems/score/threadimpl.h>
void _Scheduler_priority_Yield(
- Scheduler_Control *base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
Scheduler_priority_Per_thread *sched_info_of_thread =
@@ -32,7 +32,7 @@ void _Scheduler_priority_Yield(
Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
ISR_Level level;
- (void) base;
+ (void) scheduler;
_ISR_Disable( level );
if ( !_Chain_Has_only_one_node( ready_chain ) ) {
diff --git a/cpukit/score/src/schedulersimple.c b/cpukit/score/src/schedulersimple.c
index b825b29..38fb194 100644
--- a/cpukit/score/src/schedulersimple.c
+++ b/cpukit/score/src/schedulersimple.c
@@ -19,16 +19,13 @@
#include "config.h"
#endif
-#include <rtems/score/schedulersimple.h>
+#include <rtems/score/schedulersimpleimpl.h>
#include <rtems/score/chainimpl.h>
-#include <rtems/score/wkspace.h>
-void _Scheduler_simple_Initialize ( void )
+void _Scheduler_simple_Initialize( const Scheduler_Control *scheduler )
{
- Scheduler_simple_Control *scheduler =
- _Workspace_Allocate_or_fatal_error( sizeof( *scheduler ) );
+ Scheduler_simple_Context *context =
+ _Scheduler_simple_Get_context( scheduler );
- _Chain_Initialize_empty( &scheduler->Ready );
-
- _Scheduler.information = scheduler;
+ _Chain_Initialize_empty( &context->Ready );
}
diff --git a/cpukit/score/src/schedulersimpleblock.c b/cpukit/score/src/schedulersimpleblock.c
index 8bfab69..ad409bb 100644
--- a/cpukit/score/src/schedulersimpleblock.c
+++ b/cpukit/score/src/schedulersimpleblock.c
@@ -22,8 +22,8 @@
#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Block(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_Generic_block(
diff --git a/cpukit/score/src/schedulersimpleenqueue.c b/cpukit/score/src/schedulersimpleenqueue.c
index b0d4992..5dc8894 100644
--- a/cpukit/score/src/schedulersimpleenqueue.c
+++ b/cpukit/score/src/schedulersimpleenqueue.c
@@ -19,15 +19,11 @@
#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,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_simple_Ready_queue_enqueue( scheduler, the_thread );
diff --git a/cpukit/score/src/schedulersimpleenqueuefirst.c b/cpukit/score/src/schedulersimpleenqueuefirst.c
index b9005a7..2ea0a15 100644
--- a/cpukit/score/src/schedulersimpleenqueuefirst.c
+++ b/cpukit/score/src/schedulersimpleenqueuefirst.c
@@ -18,14 +18,11 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/thread.h>
#include <rtems/score/schedulersimple.h>
void _Scheduler_simple_Enqueue_first(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_simple_Ready_queue_enqueue_first( scheduler, the_thread );
diff --git a/cpukit/score/src/schedulersimpleextract.c b/cpukit/score/src/schedulersimpleextract.c
index 7bb4339..6b89c99 100644
--- a/cpukit/score/src/schedulersimpleextract.c
+++ b/cpukit/score/src/schedulersimpleextract.c
@@ -19,13 +19,11 @@
#include "config.h"
#endif
-#include <rtems/score/schedulersimple.h>
-#include <rtems/score/chainimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Extract(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
(void) scheduler;
diff --git a/cpukit/score/src/schedulersimplereadyqueueenqueue.c b/cpukit/score/src/schedulersimplereadyqueueenqueue.c
index 3e06a26..8e5f12d 100644
--- a/cpukit/score/src/schedulersimplereadyqueueenqueue.c
+++ b/cpukit/score/src/schedulersimplereadyqueueenqueue.c
@@ -21,12 +21,12 @@
#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Ready_queue_enqueue(
- Scheduler_Control *scheduler_base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_simple_Control *scheduler =
- _Scheduler_simple_Self_from_base( scheduler_base );
+ Scheduler_simple_Context *context =
+ _Scheduler_simple_Get_context( scheduler );
- _Scheduler_simple_Insert_priority_fifo( &scheduler->Ready, the_thread );
+ _Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread );
}
diff --git a/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c b/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
index dd3379f..c5f1e68 100644
--- a/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
+++ b/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
@@ -21,12 +21,12 @@
#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Ready_queue_enqueue_first(
- Scheduler_Control *scheduler_base,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- Scheduler_simple_Control *scheduler =
- _Scheduler_simple_Self_from_base( scheduler_base );
+ Scheduler_simple_Context *context =
+ _Scheduler_simple_Get_context( scheduler );
- _Scheduler_simple_Insert_priority_lifo( &scheduler->Ready, the_thread );
+ _Scheduler_simple_Insert_priority_lifo( &context->Ready, the_thread );
}
diff --git a/cpukit/score/src/schedulersimpleschedule.c b/cpukit/score/src/schedulersimpleschedule.c
index d3574b0..fcc1398 100644
--- a/cpukit/score/src/schedulersimpleschedule.c
+++ b/cpukit/score/src/schedulersimpleschedule.c
@@ -21,8 +21,8 @@
#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Schedule(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_simple_Schedule_body( scheduler, the_thread, false );
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index 20a35af..5448d5d 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -22,35 +22,33 @@
#include <rtems/score/schedulersmpimpl.h>
#include <rtems/score/wkspace.h>
-static Scheduler_simple_SMP_Control *
-_Scheduler_simple_SMP_Self_from_base( Scheduler_Control *base )
+static Scheduler_simple_SMP_Context *
+_Scheduler_simple_SMP_Get_context( const Scheduler_Control *scheduler )
{
- return (Scheduler_simple_SMP_Control *) base->information;
+ return (Scheduler_simple_SMP_Context *) scheduler->context;
}
-static Scheduler_simple_SMP_Control *
-_Scheduler_simple_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
+static Scheduler_simple_SMP_Context *
+_Scheduler_simple_SMP_Self_from_SMP_base( Scheduler_SMP_Context *smp_base )
{
- return (Scheduler_simple_SMP_Control *)
- ( (char *) smp_base - offsetof( Scheduler_simple_SMP_Control, Base ) );
+ return (Scheduler_simple_SMP_Context *)
+ ( (char *) smp_base - offsetof( Scheduler_simple_SMP_Context, Base ) );
}
-void _Scheduler_simple_smp_Initialize( void )
+void _Scheduler_simple_smp_Initialize( const Scheduler_Control *scheduler )
{
- Scheduler_simple_SMP_Control *self =
- _Workspace_Allocate_or_fatal_error( sizeof( *self ) );
+ Scheduler_simple_SMP_Context *self =
+ _Scheduler_simple_SMP_Get_context( scheduler );
_Scheduler_SMP_Initialize( &self->Base );
_Chain_Initialize_empty( &self->Ready );
-
- _Scheduler.information = self;
}
static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
- Scheduler_SMP_Control *smp_base
+ Scheduler_SMP_Context *smp_base
)
{
- Scheduler_simple_SMP_Control *self =
+ Scheduler_simple_SMP_Context *self =
_Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
Thread_Control *highest_ready = NULL;
Chain_Control *ready = &self->Ready;
@@ -63,11 +61,11 @@ static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
}
static void _Scheduler_simple_smp_Move_from_scheduled_to_ready(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *scheduled_to_ready
)
{
- Scheduler_simple_SMP_Control *self =
+ Scheduler_simple_SMP_Context *self =
_Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
_Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
@@ -78,7 +76,7 @@ static void _Scheduler_simple_smp_Move_from_scheduled_to_ready(
}
static void _Scheduler_simple_smp_Move_from_ready_to_scheduled(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *ready_to_scheduled
)
{
@@ -90,11 +88,11 @@ static void _Scheduler_simple_smp_Move_from_ready_to_scheduled(
}
static void _Scheduler_simple_smp_Insert_ready_lifo(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread
)
{
- Scheduler_simple_SMP_Control *self =
+ Scheduler_simple_SMP_Context *self =
_Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
_Chain_Insert_ordered_unprotected(
@@ -105,11 +103,11 @@ static void _Scheduler_simple_smp_Insert_ready_lifo(
}
static void _Scheduler_simple_smp_Insert_ready_fifo(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread
)
{
- Scheduler_simple_SMP_Control *self =
+ Scheduler_simple_SMP_Context *self =
_Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
_Chain_Insert_ordered_unprotected(
@@ -120,7 +118,7 @@ static void _Scheduler_simple_smp_Insert_ready_fifo(
}
static void _Scheduler_simple_smp_Do_extract(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread
)
{
@@ -133,12 +131,12 @@ static void _Scheduler_simple_smp_Do_extract(
}
void _Scheduler_simple_smp_Block(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_base( base );
+ Scheduler_simple_SMP_Context *self =
+ _Scheduler_simple_SMP_Get_context( scheduler );
_Scheduler_SMP_Block(
&self->Base,
@@ -150,7 +148,7 @@ void _Scheduler_simple_smp_Block(
}
static void _Scheduler_simple_smp_Enqueue_ordered(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
@@ -170,12 +168,12 @@ static void _Scheduler_simple_smp_Enqueue_ordered(
}
void _Scheduler_simple_smp_Enqueue_priority_lifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_base( base );
+ Scheduler_simple_SMP_Context *self =
+ _Scheduler_simple_SMP_Get_context( scheduler );
_Scheduler_simple_smp_Enqueue_ordered(
&self->Base,
@@ -187,12 +185,12 @@ void _Scheduler_simple_smp_Enqueue_priority_lifo(
}
void _Scheduler_simple_smp_Enqueue_priority_fifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_base( base );
+ Scheduler_simple_SMP_Context *self =
+ _Scheduler_simple_SMP_Get_context( scheduler );
_Scheduler_simple_smp_Enqueue_ordered(
&self->Base,
@@ -204,12 +202,12 @@ void _Scheduler_simple_smp_Enqueue_priority_fifo(
}
void _Scheduler_simple_smp_Extract(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_base( base );
+ Scheduler_simple_SMP_Context *self =
+ _Scheduler_simple_SMP_Get_context( scheduler );
_Scheduler_SMP_Extract(
&self->Base,
@@ -219,7 +217,7 @@ void _Scheduler_simple_smp_Extract(
}
void _Scheduler_simple_smp_Yield(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
@@ -227,19 +225,19 @@ 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( scheduler, thread );
+ _Scheduler_simple_smp_Enqueue_priority_fifo( scheduler, thread );
_ISR_Enable( level );
}
void _Scheduler_simple_smp_Schedule(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_base( base );
+ Scheduler_simple_SMP_Context *self =
+ _Scheduler_simple_SMP_Get_context( scheduler );
_Scheduler_SMP_Schedule(
&self->Base,
@@ -250,13 +248,13 @@ void _Scheduler_simple_smp_Schedule(
}
void _Scheduler_simple_smp_Start_idle(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread,
Per_CPU_Control *cpu
)
{
- Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_base( base );
+ Scheduler_simple_SMP_Context *self =
+ _Scheduler_simple_SMP_Get_context( scheduler );
_Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
}
diff --git a/cpukit/score/src/schedulersimpleunblock.c b/cpukit/score/src/schedulersimpleunblock.c
index c669a9b..3a9528f 100644
--- a/cpukit/score/src/schedulersimpleunblock.c
+++ b/cpukit/score/src/schedulersimpleunblock.c
@@ -18,14 +18,12 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/schedulersimple.h>
+#include <rtems/score/schedulersimpleimpl.h>
#include <rtems/score/thread.h>
void _Scheduler_simple_Unblock(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_simple_Ready_queue_enqueue( scheduler, the_thread );
diff --git a/cpukit/score/src/schedulersimpleyield.c b/cpukit/score/src/schedulersimpleyield.c
index 664fa31..ea41892 100644
--- a/cpukit/score/src/schedulersimpleyield.c
+++ b/cpukit/score/src/schedulersimpleyield.c
@@ -20,11 +20,10 @@
#include <rtems/score/schedulersimpleimpl.h>
#include <rtems/score/isr.h>
-#include <rtems/score/threadimpl.h>
void _Scheduler_simple_Yield(
- Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
ISR_Level level;
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index fab0c9e..68eb3e8 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -29,9 +29,9 @@ void _Thread_Change_priority(
bool prepend_it
)
{
- Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
- ISR_Level level;
- States_Control state, original_state;
+ const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
+ ISR_Level level;
+ States_Control state, original_state;
/*
* Save original state
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index fcf9d6c..47c2792 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -216,9 +216,9 @@ void _Thread_Life_action_handler(
}
static void _Thread_Start_life_change(
- Thread_Control *the_thread,
- Scheduler_Control *scheduler,
- Priority_Control priority
+ Thread_Control *the_thread,
+ const Scheduler_Control *scheduler,
+ Priority_Control priority
)
{
the_thread->is_preemptible = the_thread->Start.is_preemptible;
@@ -245,7 +245,7 @@ static void _Thread_Request_life_change(
Thread_Life_state previous_life_state;
Per_CPU_Control *cpu;
ISR_Level level;
- Scheduler_Control *scheduler;
+ const Scheduler_Control *scheduler;
cpu = _Thread_Action_ISR_disable_and_acquire( the_thread, &level );
previous_life_state = the_thread->Life.state;
diff --git a/doc/user/conf.t b/doc/user/conf.t
index c0bb35a..afecef1 100644
--- a/doc/user/conf.t
+++ b/doc/user/conf.t
@@ -3716,10 +3716,10 @@ support enabled.
@code{CONFIGURE_SCHEDULER_USER}
@item DATA TYPE:
-Entry points for scheduler
+Boolean feature macro.
@item RANGE:
-Undefined or scheduler entry set
+Defined or undefined.
@item DEFAULT VALUE:
This is not defined by default.
@@ -3734,12 +3734,14 @@ own scheduling algorithm. If @code{CONFIGURE_SCHEDULER_USER} is defined
then the following additional macros must be defined:
@itemize @bullet
- at item @code{CONFIGURE_MEMORY_FOR_SCHEDULER} must be defined with the
-amount of memory required as a base amount for the scheduler.
+ at item @code{CONFIGURE_SCHEDULER_CONTEXT} must be defined to a static definition
+of the scheduler context of the user scheduler.
+
+ at item @code{CONFIGURE_SCHEDULER_CONTROLS} must be defined to a scheduler
+control initializer for the user scheduler.
- at item @code{CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER(_tasks)} must be
-defined as a formula which computes the amount of memory required based
-upon the number of tasks configured.
+ at item @code{CONFIGURE_SCHEDULER_USER_PER_THREAD} must be defined to the type of
+the per-thread information of the user scheduler.
@end itemize
diff --git a/testsuites/rhealstone/rhilatency/ilatency.c b/testsuites/rhealstone/rhilatency/ilatency.c
index b7f5a1a..5024a73 100644
--- a/testsuites/rhealstone/rhilatency/ilatency.c
+++ b/testsuites/rhealstone/rhilatency/ilatency.c
@@ -15,6 +15,7 @@
#define CONFIGURE_INIT
#include <timesys.h>
+#include <rtems/score/schedulerpriorityimpl.h>
#include <rtems/timerdrv.h>
#include <coverhd.h>
@@ -58,7 +59,10 @@ rtems_task Init(
puts( "*** START OF RHILATENCY ***" );
- if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
+ if (
+ _Scheduler_Table[ 0 ].Operations.initialize
+ != _Scheduler_priority_Initialize
+ ) {
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..a1ddc14 100644
--- a/testsuites/sptests/spinternalerror01/init.c
+++ b/testsuites/sptests/spinternalerror01/init.c
@@ -70,11 +70,11 @@ static void *idle_body(uintptr_t ignored)
#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
-#define CONFIGURE_SCHEDULER_ENTRY_POINTS NULL
-
#define CONFIGURE_SCHEDULER_USER
-#define CONFIGURE_MEMORY_FOR_SCHEDULER 0
+#define CONFIGURE_SCHEDULER_CONTEXT
+
+#define CONFIGURE_SCHEDULER_CONTROLS { }
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER 0
diff --git a/testsuites/sptests/spsize/size.c b/testsuites/sptests/spsize/size.c
index a6e6047..dc1e55b 100644
--- a/testsuites/sptests/spsize/size.c
+++ b/testsuites/sptests/spsize/size.c
@@ -84,9 +84,6 @@ void print_formula(void);
#include <rtems/score/prioritybitmapimpl.h>
#include <rtems/score/schedulerpriority.h>
-/* Priority scheduling uninitialized (globals) consumption */
-#define SCHEDULER_OVHD (sizeof _Scheduler)
-
/* Priority scheduling per-thread consumption. Gets
* included in the PER_TASK consumption.
*/
@@ -94,11 +91,10 @@ void print_formula(void);
/* Priority scheduling workspace consumption
*
- * Include allocation of ready queue. Pointers are already counted by
- * including _Scheduler in SCHEDULER_OVHD.
+ * Include allocation of ready queue.
*/
#define SCHEDULER_WKSP_SIZE \
- (sizeof(Scheduler_priority_Control) + \
+ (sizeof(Scheduler_priority_Context) + \
RTEMS_MAXIMUM_PRIORITY * sizeof(Chain_Control ))
/****** END OF MEMORY USAGE OF DEFAULT PRIORITY SCHEDULER ******/
@@ -352,8 +348,6 @@ uninitialized =
/*rtems.h*/ /* Not applicable */
-/*scheduler.h*/ SCHEDULER_OVHD +
-
/*semimpl.h*/ (sizeof _Semaphore_Information) +
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/testsuites/tmtests/tm26/task1.c b/testsuites/tmtests/tm26/task1.c
index 6325516..6b2572e 100644
--- a/testsuites/tmtests/tm26/task1.c
+++ b/testsuites/tmtests/tm26/task1.c
@@ -223,7 +223,10 @@ rtems_task Init(
TEST_BEGIN();
- if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
+ if (
+ _Scheduler_Table[ 0 ].Operations.initialize
+ != _Scheduler_priority_Initialize
+ ) {
puts(" Error ==> " );
puts("Test only supported for deterministic priority scheduler\n" );
TEST_END();
@@ -371,8 +374,8 @@ rtems_task Middle_task(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler =
- _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
+ Scheduler_priority_Context *scheduler_context =
+ _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
thread_dispatch_no_fp_time = benchmark_timer_read();
@@ -381,7 +384,7 @@ rtems_task Middle_task(
Middle_tcb = _Thread_Get_executing();
set_thread_executing(
- (Thread_Control *) _Chain_First(&scheduler->Ready[LOW_PRIORITY])
+ (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY])
);
/* do not force context switch */
@@ -404,8 +407,8 @@ rtems_task Low_task(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler =
- _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
+ Scheduler_priority_Context *scheduler_context =
+ _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
Thread_Control *executing;
context_switch_no_fp_time = benchmark_timer_read();
@@ -424,7 +427,7 @@ rtems_task Low_task(
context_switch_another_task_time = benchmark_timer_read();
set_thread_executing(
- (Thread_Control *) _Chain_First(&scheduler->Ready[FP1_PRIORITY])
+ (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP1_PRIORITY])
);
/* do not force context switch */
@@ -447,8 +450,8 @@ rtems_task Floating_point_task_1(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler =
- _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
+ Scheduler_priority_Context *scheduler_context =
+ _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
Thread_Control *executing;
FP_DECLARE;
@@ -457,7 +460,7 @@ rtems_task Floating_point_task_1(
executing = _Thread_Get_executing();
set_thread_executing(
- (Thread_Control *) _Chain_First(&scheduler->Ready[FP2_PRIORITY])
+ (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP2_PRIORITY])
);
/* do not force context switch */
@@ -484,7 +487,7 @@ rtems_task Floating_point_task_1(
executing = _Thread_Get_executing();
set_thread_executing(
- (Thread_Control *) _Chain_First(&scheduler->Ready[FP2_PRIORITY])
+ (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP2_PRIORITY])
);
benchmark_timer_initialize();
@@ -503,8 +506,8 @@ rtems_task Floating_point_task_2(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler =
- _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
+ Scheduler_priority_Context *scheduler_context =
+ _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
Thread_Control *executing;
FP_DECLARE;
@@ -513,7 +516,7 @@ rtems_task Floating_point_task_2(
executing = _Thread_Get_executing();
set_thread_executing(
- (Thread_Control *) _Chain_First(&scheduler->Ready[FP1_PRIORITY])
+ (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP1_PRIORITY])
);
FP_LOAD( 1.0 );
diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c
index a639327..3d02e91 100644
--- a/testsuites/tmtests/tm27/task1.c
+++ b/testsuites/tmtests/tm27/task1.c
@@ -20,8 +20,8 @@
#define CONFIGURE_INIT
#include "system.h"
-#include <rtems/score/schedulerpriorityimpl.h>
#include <bsp.h>
+#include <rtems/score/schedulerpriorityimpl.h>
#define _RTEMS_TMTEST27
#include <tm27.h>
@@ -55,7 +55,11 @@ rtems_task Init(
Print_Warning();
TEST_BEGIN();
- if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
+
+ if (
+ _Scheduler_Table[ 0 ].Operations.initialize
+ != _Scheduler_priority_Initialize
+ ) {
puts(" Error ==> " );
puts("Test only supported for deterministic priority scheduler\n" );
TEST_END();
@@ -102,8 +106,8 @@ rtems_task Task_1(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler =
- _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
+ Scheduler_priority_Context *scheduler_context =
+ _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
#if defined(RTEMS_SMP)
rtems_interrupt_level level;
#endif
@@ -188,7 +192,7 @@ rtems_task Task_1(
#endif
_Thread_Executing =
- (Thread_Control *) _Chain_First(&scheduler->Ready[LOW_PRIORITY]);
+ (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]);
_Thread_Dispatch_necessary = 1;
@@ -220,8 +224,8 @@ rtems_task Task_2(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler =
- _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
+ Scheduler_priority_Context *scheduler_context =
+ _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
#if defined(RTEMS_SMP)
rtems_interrupt_level level;
#endif
@@ -258,7 +262,7 @@ rtems_task Task_2(
#endif
_Thread_Executing =
- (Thread_Control *) _Chain_First(&scheduler->Ready[LOW_PRIORITY]);
+ (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]);
_Thread_Dispatch_necessary = 1;
--
1.7.7
More information about the devel
mailing list