score: _Scheduler_priority_Ready_queue_initialize()

Move workspace allocation to _Scheduler_priority_Initialize().
This commit is contained in:
Sebastian Huber
2013-08-09 14:16:59 +02:00
parent e00b04383b
commit a78e575ba5
3 changed files with 14 additions and 11 deletions

View File

@@ -25,7 +25,6 @@
#include <rtems/score/prioritybitmapimpl.h> #include <rtems/score/prioritybitmapimpl.h>
#include <rtems/score/schedulerimpl.h> #include <rtems/score/schedulerimpl.h>
#include <rtems/score/thread.h> #include <rtems/score/thread.h>
#include <rtems/score/wkspace.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -47,18 +46,13 @@ _Scheduler_priority_Get_ready_queues( void )
* *
* This routine initializes @a the_ready_queue for priority-based scheduling. * 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; 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)
);
/* initialize ready queue structures */ /* initialize ready queue structures */
ready_queues = _Scheduler_priority_Get_ready_queues();
for( index=0; index <= PRIORITY_MAXIMUM; index++) for( index=0; index <= PRIORITY_MAXIMUM; index++)
_Chain_Initialize_empty( &ready_queues[index] ); _Chain_Initialize_empty( &ready_queues[index] );
} }

View File

@@ -19,6 +19,7 @@
#endif #endif
#include <rtems/score/schedulerpriorityimpl.h> #include <rtems/score/schedulerpriorityimpl.h>
#include <rtems/score/wkspace.h>
/* Instantiate any global variables needed by the priority scheduler */ /* Instantiate any global variables needed by the priority scheduler */
volatile Priority_bit_map_Control _Priority_Major_bit_map; 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) 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(); _Priority_bit_map_Handler_initialization();
_Scheduler.information = ready_queues;
} }

View File

@@ -19,6 +19,7 @@
#endif #endif
#include <rtems/score/schedulerpriority.h> #include <rtems/score/schedulerpriority.h>
#include <rtems/score/thread.h>
#include <rtems/score/wkspace.h> #include <rtems/score/wkspace.h>
void *_Scheduler_priority_Allocate ( void *_Scheduler_priority_Allocate (