[rtems commit] score: _Scheduler_priority_Ready_queue_initialize()

Sebastian Huber sebh at rtems.org
Tue Aug 20 08:14:18 UTC 2013


Module:    rtems
Branch:    master
Commit:    a78e575ba58250b35787bfa19a8770c075db5e8b
Changeset: http://git.rtems.org/rtems/commit/?id=a78e575ba58250b35787bfa19a8770c075db5e8b

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Aug  9 14:16:59 2013 +0200

score: _Scheduler_priority_Ready_queue_initialize()

Move workspace allocation to _Scheduler_priority_Initialize().

---

 .../include/rtems/score/schedulerpriorityimpl.h    |   14 ++++----------
 cpukit/score/src/schedulerpriority.c               |   10 +++++++++-
 cpukit/score/src/schedulerpriorityallocate.c       |    1 +
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index 5983c74..9f45f21 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -25,7 +25,6 @@
 #include <rtems/score/prioritybitmapimpl.h>
 #include <rtems/score/schedulerimpl.h>
 #include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -47,18 +46,13 @@ _Scheduler_priority_Get_ready_queues( void )
  *
  * This routine initializes @a the_ready_queue for priority-based scheduling.
  */
-RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize(void)
+RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize(
+  Chain_Control *ready_queues
+)
 {
-  size_t         index;
-  Chain_Control *ready_queues;
-
-  /* allocate ready queue structures */
-  _Scheduler.information = _Workspace_Allocate_or_fatal_error(
-    ((size_t) PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
-  );
+  size_t index;
 
   /* initialize ready queue structures */
-  ready_queues = _Scheduler_priority_Get_ready_queues();
   for( index=0; index <= PRIORITY_MAXIMUM; index++)
     _Chain_Initialize_empty( &ready_queues[index] );
 }
diff --git a/cpukit/score/src/schedulerpriority.c b/cpukit/score/src/schedulerpriority.c
index 7314da4..ab17063 100644
--- a/cpukit/score/src/schedulerpriority.c
+++ b/cpukit/score/src/schedulerpriority.c
@@ -19,6 +19,7 @@
 #endif
 
 #include <rtems/score/schedulerpriorityimpl.h>
+#include <rtems/score/wkspace.h>
 
 /* Instantiate any global variables needed by the priority scheduler */
 volatile Priority_bit_map_Control _Priority_Major_bit_map;
@@ -27,6 +28,13 @@ Priority_bit_map_Control          _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
 
 void _Scheduler_priority_Initialize(void)
 {
-  _Scheduler_priority_Ready_queue_initialize();
+  /* allocate ready queue structures */
+  Chain_Control *ready_queues = _Workspace_Allocate_or_fatal_error(
+    ((size_t) PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
+  );
+
+  _Scheduler_priority_Ready_queue_initialize( ready_queues );
   _Priority_bit_map_Handler_initialization();
+
+  _Scheduler.information = ready_queues;
 }
diff --git a/cpukit/score/src/schedulerpriorityallocate.c b/cpukit/score/src/schedulerpriorityallocate.c
index ec0f210..ef6322e 100644
--- a/cpukit/score/src/schedulerpriorityallocate.c
+++ b/cpukit/score/src/schedulerpriorityallocate.c
@@ -19,6 +19,7 @@
 #endif
 
 #include <rtems/score/schedulerpriority.h>
+#include <rtems/score/thread.h>
 #include <rtems/score/wkspace.h>
 
 void *_Scheduler_priority_Allocate (




More information about the vc mailing list