[rtems commit] smp: Replace Scheduler_simple_smp_Control
Sebastian Huber
sebh at rtems.org
Tue Aug 20 08:14:19 UTC 2013
Module: rtems
Branch: master
Commit: 9d83f58ab8208b49a4e27d4ff077cf526f902477
Changeset: http://git.rtems.org/rtems/commit/?id=9d83f58ab8208b49a4e27d4ff077cf526f902477
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Aug 12 10:32:32 2013 +0200
smp: Replace Scheduler_simple_smp_Control
Replace Scheduler_simple_smp_Control with Scheduler_SMP_Control. Rename
_Scheduler_simple_smp_Instance() to _Scheduler_SMP_Instance().
---
cpukit/sapi/include/confdefs.h | 2 +-
cpukit/score/Makefile.am | 2 +
.../score/include/rtems/score/schedulersimplesmp.h | 6 +--
cpukit/score/include/rtems/score/schedulersmp.h | 51 +++++++++++++++++++
.../score/include/rtems/score/schedulersmpimpl.h | 52 ++++++++++++++++++++
cpukit/score/preinstall.am | 8 +++
cpukit/score/src/schedulersimplesmp.c | 22 +++-----
7 files changed, 124 insertions(+), 19 deletions(-)
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 2a3af15..31d28ac 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -687,7 +687,7 @@ const rtems_libio_helper rtems_fs_init_helper =
* NOTE: This is the same as the Simple Scheduler
*/
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
- _Configure_From_workspace( sizeof( Scheduler_simple_smp_Control ) ) \
+ _Configure_From_workspace( sizeof( Scheduler_SMP_Control ) ) \
)
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
#endif
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index c6954f6..5136d81 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -55,6 +55,8 @@ include_rtems_score_HEADERS += include/rtems/score/schedulerpriority.h
include_rtems_score_HEADERS += include/rtems/score/schedulerpriorityimpl.h
include_rtems_score_HEADERS += include/rtems/score/schedulersimple.h
include_rtems_score_HEADERS += include/rtems/score/schedulersimpleimpl.h
+include_rtems_score_HEADERS += include/rtems/score/schedulersmp.h
+include_rtems_score_HEADERS += include/rtems/score/schedulersmpimpl.h
include_rtems_score_HEADERS += include/rtems/score/smp.h
include_rtems_score_HEADERS += include/rtems/score/smplock.h
include_rtems_score_HEADERS += include/rtems/score/stack.h
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 6cc87f3..5329610 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -25,6 +25,7 @@ extern "C" {
#include <rtems/score/scheduler.h>
#include <rtems/score/schedulerpriority.h>
+#include <rtems/score/schedulersmp.h>
/**
* @defgroup ScoreSchedulerSMP Simple SMP Scheduler
@@ -48,11 +49,6 @@ extern "C" {
* @{
*/
-typedef struct {
- Chain_Control ready;
- Chain_Control scheduled;
-} Scheduler_simple_smp_Control;
-
/**
* @brief Entry points for the Simple SMP Scheduler.
*/
diff --git a/cpukit/score/include/rtems/score/schedulersmp.h b/cpukit/score/include/rtems/score/schedulersmp.h
new file mode 100644
index 0000000..8b649b7
--- /dev/null
+++ b/cpukit/score/include/rtems/score/schedulersmp.h
@@ -0,0 +1,51 @@
+/**
+ * @file
+ *
+ * @brief SMP Scheduler API
+ *
+ * @ingroup ScoreSchedulerSMP
+ */
+
+/*
+ * Copyright (c) 2013 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.com/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_SCHEDULERSMP_H
+#define _RTEMS_SCORE_SCHEDULERSMP_H
+
+#include <rtems/score/chain.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @defgroup ScoreSchedulerSMP SMP Scheduler
+ *
+ * @ingroup ScoreScheduler
+ *
+ * @{
+ */
+
+typedef struct {
+ Chain_Control scheduled;
+ Chain_Control ready[ 1 ];
+} Scheduler_SMP_Control;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_SCHEDULERSMP_H */
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
new file mode 100644
index 0000000..7736d2b
--- /dev/null
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -0,0 +1,52 @@
+/**
+ * @file
+ *
+ * @brief SMP Scheduler Implementation
+ *
+ * @ingroup ScoreSchedulerSMP
+ */
+
+/*
+ * Copyright (c) 2013 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.com/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_SCHEDULERSMPIMPL_H
+#define _RTEMS_SCORE_SCHEDULERSMPIMPL_H
+
+#include <rtems/score/schedulersmp.h>
+#include <rtems/score/scheduler.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/percpu.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @addtogroup ScoreSchedulerSMP
+ *
+ * @{
+ */
+
+static inline Scheduler_SMP_Control *_Scheduler_SMP_Instance( void )
+{
+ return _Scheduler.information;
+}
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_SCHEDULERSMPIMPL_H */
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index 14d873c..4e645f4 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -203,6 +203,14 @@ $(PROJECT_INCLUDE)/rtems/score/schedulersimpleimpl.h: include/rtems/score/schedu
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersimpleimpl.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersimpleimpl.h
+$(PROJECT_INCLUDE)/rtems/score/schedulersmp.h: include/rtems/score/schedulersmp.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersmp.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersmp.h
+
+$(PROJECT_INCLUDE)/rtems/score/schedulersmpimpl.h: include/rtems/score/schedulersmpimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersmpimpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersmpimpl.h
+
$(PROJECT_INCLUDE)/rtems/score/smp.h: include/rtems/score/smp.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/smp.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/smp.h
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index e261510..0905723 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -20,19 +20,15 @@
#include <rtems/score/schedulersimplesmp.h>
#include <rtems/score/schedulersimpleimpl.h>
+#include <rtems/score/schedulersmpimpl.h>
#include <rtems/score/wkspace.h>
-static Scheduler_simple_smp_Control *_Scheduler_simple_smp_Instance( void )
-{
- return _Scheduler.information;
-}
-
void _Scheduler_simple_smp_Initialize( void )
{
- Scheduler_simple_smp_Control *self =
+ Scheduler_SMP_Control *self =
_Workspace_Allocate_or_fatal_error( sizeof( *self ) );
- _Chain_Initialize_empty( &self->ready );
+ _Chain_Initialize_empty( &self->ready[ 0 ] );
_Chain_Initialize_empty( &self->scheduled );
_Scheduler.information = self;
@@ -112,7 +108,7 @@ static void _Scheduler_simple_smp_Enqueue_ordered(
Chain_Node_order order
)
{
- Scheduler_simple_smp_Control *self = _Scheduler_simple_smp_Instance();
+ Scheduler_SMP_Control *self = _Scheduler_SMP_Instance();
/*
* The scheduled chain has exactly processor count nodes after
@@ -127,11 +123,11 @@ static void _Scheduler_simple_smp_Enqueue_ordered(
_Scheduler_simple_smp_Insert( &self->scheduled, thread, order );
_Scheduler_simple_smp_Move_from_scheduled_to_ready(
- &self->ready,
+ &self->ready[ 0 ],
lowest_scheduled
);
} else {
- _Scheduler_simple_smp_Insert( &self->ready, thread, order );
+ _Scheduler_simple_smp_Insert( &self->ready[ 0 ], thread, order );
}
}
@@ -153,13 +149,13 @@ void _Scheduler_simple_smp_Enqueue_priority_fifo( Thread_Control *thread )
void _Scheduler_simple_smp_Extract( Thread_Control *thread )
{
- Scheduler_simple_smp_Control *self = _Scheduler_simple_smp_Instance();
+ Scheduler_SMP_Control *self = _Scheduler_SMP_Instance();
_Chain_Extract_unprotected( &thread->Object.Node );
if ( thread->is_scheduled ) {
Thread_Control *highest_ready =
- (Thread_Control *) _Chain_First( &self->ready );
+ (Thread_Control *) _Chain_First( &self->ready[ 0 ] );
_Scheduler_simple_smp_Allocate_processor( highest_ready, thread );
@@ -192,7 +188,7 @@ void _Scheduler_simple_smp_Start_idle(
Per_CPU_Control *cpu
)
{
- Scheduler_simple_smp_Control *self = _Scheduler_simple_smp_Instance();
+ Scheduler_SMP_Control *self = _Scheduler_SMP_Instance();
thread->is_scheduled = true;
thread->cpu = cpu;
More information about the vc
mailing list