[rtems-schedsim commit] current_cpu is now a shared SMP command

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


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

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

current_cpu is now a shared SMP command

---

 schedsim/shell/schedsim_smppriority/Makefile.am    |    1 -
 .../schedsim_smppriority_affinity/Makefile.am      |    1 -
 schedsim/shell/schedsim_smpsimple/Makefile.am      |    1 -
 schedsim/shell/schedsim_smpsimple/add_commands.c   |    9 ---------
 schedsim/shell/shared/Makefile.am                  |    1 +
 schedsim/shell/shared/commands.c                   |    2 ++
 .../main_currentcpu.c}                             |   18 ++++++++++++++++--
 7 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/schedsim/shell/schedsim_smppriority/Makefile.am b/schedsim/shell/schedsim_smppriority/Makefile.am
index fb63c09..16bba41 100644
--- a/schedsim/shell/schedsim_smppriority/Makefile.am
+++ b/schedsim/shell/schedsim_smppriority/Makefile.am
@@ -2,7 +2,6 @@ bin_PROGRAMS = schedsim_smppriority
 
 SOURCES  = config.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/add_commands.c
-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
diff --git a/schedsim/shell/schedsim_smppriority_affinity/Makefile.am b/schedsim/shell/schedsim_smppriority_affinity/Makefile.am
index 986be66..839d9d4 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/Makefile.am
+++ b/schedsim/shell/schedsim_smppriority_affinity/Makefile.am
@@ -2,7 +2,6 @@ bin_PROGRAMS = schedsim_smppriority_affinity
 
 SOURCES  = config.c
 SOURCES += $(srcdir)/../schedsim_smpsimple/add_commands.c
-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
diff --git a/schedsim/shell/schedsim_smpsimple/Makefile.am b/schedsim/shell/schedsim_smpsimple/Makefile.am
index d85d554..a7c7237 100644
--- a/schedsim/shell/schedsim_smpsimple/Makefile.am
+++ b/schedsim/shell/schedsim_smpsimple/Makefile.am
@@ -2,7 +2,6 @@ bin_PROGRAMS = schedsim_smpsimple
 schedsim_smpsimple_SOURCES =
 schedsim_smpsimple_SOURCES += add_commands.c
 schedsim_smpsimple_SOURCES += config.c
-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
diff --git a/schedsim/shell/schedsim_smpsimple/add_commands.c b/schedsim/shell/schedsim_smpsimple/add_commands.c
index ad1dde2..f975da7 100644
--- a/schedsim/shell/schedsim_smpsimple/add_commands.c
+++ b/schedsim/shell/schedsim_smpsimple/add_commands.c
@@ -18,7 +18,6 @@
 #include "rtems_sched.h"
 
 extern int main_dump_ready_tasks(int argc, char **argv);
-extern int main_set_current_cpu(int argc, char **argv);
 extern int main_dispatch(int argc, char **argv);
 
 void add_commands(void)
@@ -34,14 +33,6 @@ void add_commands(void)
   assert( cmd );
 
   cmd = rtems_shell_add_cmd(
-    "current_cpu",
-    "rtems",
-    "number",
-    main_set_current_cpu
-  );
-  assert( cmd );
-
-  cmd = rtems_shell_add_cmd(
     "dispatch",
     "rtems",
     "",
diff --git a/schedsim/shell/shared/Makefile.am b/schedsim/shell/shared/Makefile.am
index 846497f..c90824e 100644
--- a/schedsim/shell/shared/Makefile.am
+++ b/schedsim/shell/shared/Makefile.am
@@ -53,6 +53,7 @@ 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_currentcpu.c
 libschedsim_a_SOURCES += main_taskgetaffinity.c
 libschedsim_a_SOURCES += main_tasksetaffinity.c
 endif
diff --git a/schedsim/shell/shared/commands.c b/schedsim/shell/shared/commands.c
index 457ec9f..483c7ef 100644
--- a/schedsim/shell/shared/commands.c
+++ b/schedsim/shell/shared/commands.c
@@ -34,6 +34,7 @@ extern rtems_shell_cmd_t rtems_shell_TASK_WAKE_AFTER_Command;
 #if RTEMS_SMP
   extern rtems_shell_cmd_t rtems_shell_TASK_GET_AFFINITY_Command;
   extern rtems_shell_cmd_t rtems_shell_TASK_SET_AFFINITY_Command;
+  extern rtems_shell_cmd_t rtems_shell_CURRENT_CPU_Command;
 #endif
 
 extern rtems_shell_cmd_t rtems_shell_CLOCK_TICK_Command;
@@ -65,6 +66,7 @@ rtems_shell_cmd_t *rtems_shell_Initial_commands[] = {
   #if RTEMS_SMP
     &rtems_shell_TASK_GET_AFFINITY_Command,
     &rtems_shell_TASK_SET_AFFINITY_Command,
+    &rtems_shell_CURRENT_CPU_Command,
   #endif
 
   &rtems_shell_CLOCK_TICK_Command,
diff --git a/schedsim/shell/schedsim_smpsimple/main_current_cpu.c b/schedsim/shell/shared/main_currentcpu.c
similarity index 65%
rename from schedsim/shell/schedsim_smpsimple/main_current_cpu.c
rename to schedsim/shell/shared/main_currentcpu.c
index 8a4a6cc..06a031a 100644
--- a/schedsim/shell/schedsim_smpsimple/main_current_cpu.c
+++ b/schedsim/shell/shared/main_currentcpu.c
@@ -1,5 +1,10 @@
+/**
+ *  @file
+ *  @brief current_cpu Command in Scheduler Simulator
+ */
+
 /*
- *  COPYRIGHT (c) 1989-2013.
+ *  COPYRIGHT (c) 1989-2014.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -23,7 +28,7 @@
 
 extern uint32_t Schedsim_Current_cpu;
 
-int main_set_current_cpu(int argc, char **argv)
+int rtems_shell_main_current_cpu(int argc, char **argv)
 {
   long cpu;
 
@@ -44,3 +49,12 @@ int main_set_current_cpu(int argc, char **argv)
 
   return 0;
 }
+
+rtems_shell_cmd_t rtems_shell_CURRENT_CPU_Command = {
+  "current_cpu",                 /* name */
+  "current_cpu [cpu]",           /* usage */
+  "rtems",                       /* topic */
+  rtems_shell_main_current_cpu,  /* command */
+  NULL,                          /* alias */
+  NULL                           /* next */
+};




More information about the vc mailing list