summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-03 12:02:09 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-04 11:01:18 +0200
commit439c494fe20f474984c22a333613c33fac5585eb (patch)
tree6923313f5eb446e2bdbb7b9a340c7b32205b93d7
parentscore: Add and use Scheduler_EDF_Control (diff)
downloadrtems-439c494fe20f474984c22a333613c33fac5585eb.tar.bz2
score: Add and use Scheduler_simple_Control
-rw-r--r--cpukit/sapi/include/confdefs.h2
-rw-r--r--cpukit/score/include/rtems/score/schedulersimple.h10
-rw-r--r--cpukit/score/include/rtems/score/schedulersimpleimpl.h10
-rw-r--r--cpukit/score/src/schedulersimple.c14
-rw-r--r--cpukit/score/src/schedulersimplereadyqueueenqueue.c5
-rw-r--r--cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c5
6 files changed, 28 insertions, 18 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 16049f9d4b..4bfe4e88ff 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -736,7 +736,7 @@ const rtems_libio_helper rtems_fs_init_helper =
* define the memory used by the simple scheduler
*/
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
- _Configure_From_workspace( sizeof(Chain_Control) ) \
+ _Configure_From_workspace( sizeof( Scheduler_simple_Control ) ) \
)
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
#endif
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index db9c8f3834..54b0801872 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -55,6 +55,16 @@ extern "C" {
}
/**
+ * @brief Simple scheduler control.
+ */
+typedef struct {
+ /**
+ * @brief One ready queue for all ready threads.
+ */
+ Chain_Control Ready;
+} Scheduler_simple_Control;
+
+/**
* @brief Initialize simple scheduler.
*
* This routine initializes the simple scheduler.
diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
index 25fbbc7b3c..c51c6c3f0e 100644
--- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
@@ -32,6 +32,11 @@ extern "C" {
*/
/**@{**/
+RTEMS_INLINE_ROUTINE Scheduler_simple_Control *_Scheduler_simple_Instance( void )
+{
+ return _Scheduler.information;
+}
+
/**
* This routine puts @a the_thread on to the ready queue.
*
@@ -101,9 +106,8 @@ RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body(
bool force_dispatch
)
{
- Thread_Control *heir = (Thread_Control *) _Chain_First(
- (Chain_Control *) _Scheduler.information
- );
+ Scheduler_simple_Control *scheduler = _Scheduler_simple_Instance();
+ Thread_Control *heir = (Thread_Control *) _Chain_First( &scheduler->Ready );
( void ) thread;
diff --git a/cpukit/score/src/schedulersimple.c b/cpukit/score/src/schedulersimple.c
index 8ea8b538dc..b825b29014 100644
--- a/cpukit/score/src/schedulersimple.c
+++ b/cpukit/score/src/schedulersimple.c
@@ -25,16 +25,10 @@
void _Scheduler_simple_Initialize ( void )
{
- void *f;
+ Scheduler_simple_Control *scheduler =
+ _Workspace_Allocate_or_fatal_error( sizeof( *scheduler ) );
- /*
- * Initialize Ready Queue
- */
+ _Chain_Initialize_empty( &scheduler->Ready );
- /* allocate ready queue structures */
- f = _Workspace_Allocate_or_fatal_error( sizeof(Chain_Control) );
- _Scheduler.information = f;
-
- /* initialize ready queue structure */
- _Chain_Initialize_empty( (Chain_Control *)f );
+ _Scheduler.information = scheduler;
}
diff --git a/cpukit/score/src/schedulersimplereadyqueueenqueue.c b/cpukit/score/src/schedulersimplereadyqueueenqueue.c
index 67a2d51e84..134f6e8a7a 100644
--- a/cpukit/score/src/schedulersimplereadyqueueenqueue.c
+++ b/cpukit/score/src/schedulersimplereadyqueueenqueue.c
@@ -24,7 +24,8 @@ void _Scheduler_simple_Ready_queue_enqueue(
Thread_Control *the_thread
)
{
- Chain_Control *ready = (Chain_Control *) _Scheduler.information;
+ Scheduler_simple_Control *scheduler =
+ _Scheduler_simple_Instance();
- _Scheduler_simple_Insert_priority_fifo( ready, the_thread );
+ _Scheduler_simple_Insert_priority_fifo( &scheduler->Ready, the_thread );
}
diff --git a/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c b/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
index 7b8d3382b6..841bcd1a64 100644
--- a/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
+++ b/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
@@ -24,7 +24,8 @@ void _Scheduler_simple_Ready_queue_enqueue_first(
Thread_Control *the_thread
)
{
- Chain_Control *ready = (Chain_Control *) _Scheduler.information;
+ Scheduler_simple_Control *scheduler =
+ _Scheduler_simple_Instance();
- _Scheduler_simple_Insert_priority_lifo( ready, the_thread );
+ _Scheduler_simple_Insert_priority_lifo( &scheduler->Ready, the_thread );
}