[rtems commit] score: Add and use _Scheduler_Get_context()

Sebastian Huber sebh at rtems.org
Wed May 14 15:03:52 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed May 14 16:04:10 2014 +0200

score: Add and use _Scheduler_Get_context()

---

 .../score/include/rtems/score/scheduleredfimpl.h   |    2 +-
 cpukit/score/include/rtems/score/schedulerimpl.h   |    9 ++++++++-
 .../include/rtems/score/schedulerpriorityimpl.h    |    2 +-
 .../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 708557f..8c4cd2c 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 c972ef5..2129493 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 ffcc2d3..ae0cd1a 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 cc79c15..c256071 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 98ff454..8133956 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 9861cb8..8436659 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 af0eb18..b9d4b0a 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;
     }
   }
 }




More information about the vc mailing list