[rtems-schedsim commit] shared/smp_stub.c: Only one shared version now

Joel Sherrill joel at rtems.org
Mon May 26 17:08:18 UTC 2014


Module:    rtems-schedsim
Branch:    master
Commit:    87c69f3abbdbb987d664159629b39625e822252d
Changeset: http://git.rtems.org/rtems-schedsim/commit/?id=87c69f3abbdbb987d664159629b39625e822252d

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Mon May 26 12:15:11 2014 -0500

shared/smp_stub.c: Only one shared version now

---

 schedsim/shell/schedsim_priority/Makefile.am       |    3 -
 schedsim/shell/schedsim_priority/smp_stub.c        |   46 --------------------
 schedsim/shell/schedsim_smppriority/Makefile.am    |    1 -
 .../schedsim_smppriority_affinity/Makefile.am      |    1 -
 schedsim/shell/schedsim_smpsimple/Makefile.am      |    1 -
 schedsim/shell/shared/Makefile.am                  |    1 +
 .../{schedsim_smpsimple => shared}/smp_stub.c      |   29 ++++++++++--
 7 files changed, 25 insertions(+), 57 deletions(-)

diff --git a/schedsim/shell/schedsim_priority/Makefile.am b/schedsim/shell/schedsim_priority/Makefile.am
index 2480c5e..ba584bf 100644
--- a/schedsim/shell/schedsim_priority/Makefile.am
+++ b/schedsim/shell/schedsim_priority/Makefile.am
@@ -4,9 +4,6 @@ schedsim_priority_SOURCES += wrap_thread_dispatch.c
 schedsim_priority_SOURCES += printheir_executing.c
 schedsim_priority_SOURCES += $(srcdir)/../shared/add_commands_stub.c
 
-if HAS_SMP
-schedsim_priority_SOURCES += smp_stub.c
-endif
 cpukitdir=@rtems_srcdir@/cpukit
 schedsim_priority_CPPFLAGS  = -I$(top_builddir)/score/include
 schedsim_priority_CPPFLAGS += -I$(srcdir)/sched_cpu
diff --git a/schedsim/shell/schedsim_priority/smp_stub.c b/schedsim/shell/schedsim_priority/smp_stub.c
deleted file mode 100644
index f8dbe19..0000000
--- a/schedsim/shell/schedsim_priority/smp_stub.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  RTEMS SMP Support for Single Core
- *
- *  COPYRIGHT (c) 1989-2013.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.com/license/LICENSE.
- */
-
-#include <rtems.h>
-#include <rtems/bspIo.h>
-#include <stdlib.h>
-
-uint32_t _CPU_SMP_Initialize( void )
-{
-  /* return the number of CPUs */
-  return 1; /* XXX */
-}
-
-bool _CPU_SMP_Start_processor( uint32_t cpu_index )
-{
-  return true;
-}
-
-void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
-{
-}
-
-void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
-{
-}
-
-void _CPU_SMP_Processor_event_broadcast( void )
-{
-}
-
-void _CPU_SMP_Processor_event_receive( void )
-{
-}
-
-uint32_t _CPU_SMP_Get_current_processor( void )
-{
-  return 0;
-}
diff --git a/schedsim/shell/schedsim_smppriority/Makefile.am b/schedsim/shell/schedsim_smppriority/Makefile.am
index a775004..fb63c09 100644
--- a/schedsim/shell/schedsim_smppriority/Makefile.am
+++ b/schedsim/shell/schedsim_smppriority/Makefile.am
@@ -6,7 +6,6 @@ SOURCES += $(srcdir)/../schedsim_smpsimple/main_current_cpu.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/main_dispatch.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/main_dump_ready_tasks.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/printheir_executing.c
-SOURCES += $(srcdir)/../schedsim_smpsimple/smp_stub.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/wrap_thread_dispatch.c
 schedsim_smppriority_SOURCES = $(SOURCES)
 
diff --git a/schedsim/shell/schedsim_smppriority_affinity/Makefile.am b/schedsim/shell/schedsim_smppriority_affinity/Makefile.am
index 8b87ed5..986be66 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/Makefile.am
+++ b/schedsim/shell/schedsim_smppriority_affinity/Makefile.am
@@ -6,7 +6,6 @@ SOURCES += $(srcdir)/../schedsim_smpsimple/main_current_cpu.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/main_dispatch.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/main_dump_ready_tasks.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/printheir_executing.c
-SOURCES += $(srcdir)/../schedsim_smpsimple/smp_stub.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/wrap_thread_dispatch.c
 schedsim_smppriority_affinity_SOURCES = $(SOURCES)
 
diff --git a/schedsim/shell/schedsim_smpsimple/Makefile.am b/schedsim/shell/schedsim_smpsimple/Makefile.am
index bc058fe..d85d554 100644
--- a/schedsim/shell/schedsim_smpsimple/Makefile.am
+++ b/schedsim/shell/schedsim_smpsimple/Makefile.am
@@ -6,7 +6,6 @@ schedsim_smpsimple_SOURCES += main_current_cpu.c
 schedsim_smpsimple_SOURCES += main_dispatch.c
 schedsim_smpsimple_SOURCES += main_dump_ready_tasks.c
 schedsim_smpsimple_SOURCES += printheir_executing.c
-schedsim_smpsimple_SOURCES += smp_stub.c
 schedsim_smpsimple_SOURCES += wrap_thread_dispatch.c
 
 cpukitdir=@rtems_srcdir@/cpukit
diff --git a/schedsim/shell/shared/Makefile.am b/schedsim/shell/shared/Makefile.am
index 5bbb770..846497f 100644
--- a/schedsim/shell/shared/Makefile.am
+++ b/schedsim/shell/shared/Makefile.am
@@ -52,6 +52,7 @@ libschedsim_a_SOURCES += schedsim_disable_dispatch.c
 libschedsim_a_SOURCES += shell_cmdset.c
 libschedsim_a_SOURCES += shell_makeargs.c 
 if HAS_SMP
+libschedsim_a_SOURCES += smp_stub.c
 libschedsim_a_SOURCES += main_taskgetaffinity.c
 libschedsim_a_SOURCES += main_tasksetaffinity.c
 endif
diff --git a/schedsim/shell/schedsim_smpsimple/smp_stub.c b/schedsim/shell/shared/smp_stub.c
similarity index 78%
rename from schedsim/shell/schedsim_smpsimple/smp_stub.c
rename to schedsim/shell/shared/smp_stub.c
index 37befbd..11cbc7a 100644
--- a/schedsim/shell/schedsim_smpsimple/smp_stub.c
+++ b/schedsim/shell/shared/smp_stub.c
@@ -1,7 +1,10 @@
+/**
+ *  @file
+ *  RTEMS SMP Support for Scheduler Simulator
+ */
+
 /*
- *  RTEMS SMP Support for Single Core
- *
- *  COPYRIGHT (c) 1989-2013.
+ *  COPYRIGHT (c) 1989-2014.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -9,17 +12,27 @@
  *  http://www.rtems.com/license/LICENSE.
  */
 
+#if HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
 #include <rtems.h>
 #include <rtems/bspIo.h>
 #include <stdlib.h>
 
-uint32_t Schedsim_Current_cpu;
-extern uint32_t Schedsim_Maximum_CPUs_From_Command_Line;
+#if RTEMS_SMP
+  uint32_t Schedsim_Current_cpu;
+  extern uint32_t Schedsim_Maximum_CPUs_From_Command_Line;
+#endif
 
 uint32_t _CPU_SMP_Initialize( void )
 {
+#if RTEMS_SMP
   /* return the number of CPUs */
   return Schedsim_Maximum_CPUs_From_Command_Line;
+#else
+  return 1;
+#endif
 }
 
 bool _CPU_SMP_Start_processor( uint32_t cpu_index )
@@ -37,6 +50,7 @@ void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
 
 void _CPU_SMP_Processor_event_broadcast( void )
 {
+#if RTEMS_SMP
   Per_CPU_Control  *cpu = _Per_CPU_Get();
   uint32_t         cpu_count = _SMP_Get_processor_count();
   uint32_t         cpu_index;
@@ -50,6 +64,7 @@ void _CPU_SMP_Processor_event_broadcast( void )
          cpu->state = PER_CPU_STATE_READY_TO_START_MULTITASKING;
     }
   }
+#endif
 }
 
 
@@ -59,5 +74,9 @@ void _CPU_SMP_Processor_event_receive( void )
 
 uint32_t _CPU_SMP_Get_current_processor( void )
 {
+#if RTEMS_SMP
+  return 0;
+#else
   return Schedsim_Current_cpu;
+#endif
 }




More information about the vc mailing list