From 2369b10a71d4a0aa0be3bbfc51f1fb402d8427a7 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 14 May 2014 16:04:10 +0200 Subject: score: Add and use _Scheduler_Get_context() --- cpukit/score/include/rtems/score/scheduleredfimpl.h | 2 +- cpukit/score/include/rtems/score/schedulerimpl.h | 9 ++++++++- cpukit/score/include/rtems/score/schedulerpriorityimpl.h | 2 +- cpukit/score/include/rtems/score/schedulersimpleimpl.h | 2 +- cpukit/score/src/schedulerprioritysmp.c | 2 +- cpukit/score/src/schedulersimplesmp.c | 2 +- cpukit/score/src/smp.c | 7 ++++--- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h index 708557f78e..8c4cd2c4bd 100644 --- a/cpukit/score/include/rtems/score/scheduleredfimpl.h +++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h @@ -34,7 +34,7 @@ extern "C" { RTEMS_INLINE_ROUTINE Scheduler_EDF_Context * _Scheduler_EDF_Get_context( const Scheduler_Control *scheduler ) { - return (Scheduler_EDF_Context *) scheduler->context; + return (Scheduler_EDF_Context *) _Scheduler_Get_context( scheduler ); } RTEMS_INLINE_ROUTINE Scheduler_EDF_Node *_Scheduler_EDF_Node_get( diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index c972ef57bd..2129493b0a 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -578,12 +578,19 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority_if_higher( } } +RTEMS_INLINE_ROUTINE Scheduler_Context *_Scheduler_Get_context( + const Scheduler_Control *scheduler +) +{ + return scheduler->context; +} + RTEMS_INLINE_ROUTINE uint32_t _Scheduler_Get_processor_count( const Scheduler_Control *scheduler ) { #if defined(RTEMS_SMP) - return scheduler->context->processor_count; + return _Scheduler_Get_context( scheduler )->processor_count; #else (void) scheduler; diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h index ffcc2d32cf..ae0cd1ad9b 100644 --- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h +++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h @@ -38,7 +38,7 @@ extern "C" { RTEMS_INLINE_ROUTINE Scheduler_priority_Context * _Scheduler_priority_Get_context( const Scheduler_Control *scheduler ) { - return (Scheduler_priority_Context *) scheduler->context; + return (Scheduler_priority_Context *) _Scheduler_Get_context( scheduler ); } RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Node_get( diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h index cc79c15376..c256071a8f 100644 --- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h +++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h @@ -35,7 +35,7 @@ extern "C" { RTEMS_INLINE_ROUTINE Scheduler_simple_Context * _Scheduler_simple_Get_context( const Scheduler_Control *scheduler ) { - return (Scheduler_simple_Context *) scheduler->context; + return (Scheduler_simple_Context *) _Scheduler_Get_context( scheduler ); } /** diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c index 98ff454564..8133956fbd 100644 --- a/cpukit/score/src/schedulerprioritysmp.c +++ b/cpukit/score/src/schedulerprioritysmp.c @@ -32,7 +32,7 @@ static Scheduler_priority_SMP_Context * _Scheduler_priority_SMP_Get_context( const Scheduler_Control *scheduler ) { - return (Scheduler_priority_SMP_Context *) scheduler->context; + return (Scheduler_priority_SMP_Context *) _Scheduler_Get_context( scheduler ); } static Scheduler_priority_SMP_Context * diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c index 9861cb877d..8436659df4 100644 --- a/cpukit/score/src/schedulersimplesmp.c +++ b/cpukit/score/src/schedulersimplesmp.c @@ -25,7 +25,7 @@ static Scheduler_simple_SMP_Context * _Scheduler_simple_SMP_Get_context( const Scheduler_Control *scheduler ) { - return (Scheduler_simple_SMP_Context *) scheduler->context; + return (Scheduler_simple_SMP_Context *) _Scheduler_Get_context( scheduler ); } static Scheduler_simple_SMP_Context * diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index af0eb183e1..b9d4b0a6cc 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -58,10 +58,11 @@ static void _SMP_Start_processors( uint32_t cpu_count ) cpu->started = started; if ( started ) { - Scheduler_Context *scheduler_context = assignment->scheduler->context; + Scheduler_Context *context = + _Scheduler_Get_context( assignment->scheduler ); - ++scheduler_context->processor_count; - cpu->scheduler_context = scheduler_context; + ++context->processor_count; + cpu->scheduler_context = context; } } } -- cgit v1.2.3