diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-05-17 19:31:12 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-05-17 19:31:12 +0000 |
commit | f40778b48660b589278898593c62cf2250d3fbab (patch) | |
tree | 09d84495b8a489f65e58819c8d77ec488da30571 /schedsim/shell/schedsim_smpsimple/main_current_cpu.c | |
parent | 2011-05-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-schedsim-f40778b48660b589278898593c62cf2250d3fbab.tar.bz2 |
2011-05-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* .cvsignore, ChangeLog, Makefile.am, README, TODO, add_commands.c,
config.c, main_current_cpu.c, main_dispatch.c, main_dump_all_cpus.c,
main_dump_ready_tasks.c, printheir_executing.c, schedsim.cc,
smp_stub.c, wrap_thread_dispatch.c, scenarios/.cvsignore,
scenarios/cpus1_mode.expected, scenarios/cpus1_mode.scen,
scenarios/cpus1_priority.expected, scenarios/cpus1_priority.scen,
scenarios/cpus1_resume_on_primary.expected,
scenarios/cpus1_resume_on_primary.scen,
scenarios/cpus1_suspend_on_primary.expected,
scenarios/cpus1_suspend_on_primary.scen,
scenarios/cpus4_mode_case1.expected, scenarios/cpus4_mode_case1.scen,
scenarios/cpus4_mode_case2.expected, scenarios/cpus4_mode_case2.scen,
scenarios/cpus4_nonpreempt_case1.expected,
scenarios/cpus4_nonpreempt_case1.scen,
scenarios/cpus4_pick_older.expected, scenarios/cpus4_pick_older.scen,
scenarios/cpus4_priority.expected, scenarios/cpus4_priority.scen,
scenarios/cpus4_simple_nopreempt.expected,
scenarios/cpus4_simple_nopreempt.scen,
scenarios/cpus4_simple_preemption.expected,
scenarios/cpus4_simple_preemption.scen,
scenarios/cpus4_suspend_on_all.expected,
scenarios/cpus4_suspend_on_all.scen,
scenarios/cpus4_suspend_on_primary.expected,
scenarios/cpus4_suspend_on_primary.scen,
scenarios/cpus4_suspend_on_secondary.expected,
scenarios/cpus4_suspend_on_secondary.scen: New files.
Diffstat (limited to 'schedsim/shell/schedsim_smpsimple/main_current_cpu.c')
-rw-r--r-- | schedsim/shell/schedsim_smpsimple/main_current_cpu.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/schedsim/shell/schedsim_smpsimple/main_current_cpu.c b/schedsim/shell/schedsim_smpsimple/main_current_cpu.c new file mode 100644 index 0000000..cb8ceb4 --- /dev/null +++ b/schedsim/shell/schedsim_smpsimple/main_current_cpu.c @@ -0,0 +1,48 @@ +/* + * COPYRIGHT (c) 1989-2011. + * 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. + * + * $Id$ + */ + +#include <newlib/getopt.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include "shell.h" +#include "rtems_sched.h" + +#include <rtems.h> +#include <rtems/bspsmp.h> +#include <rtems/score/percpu.h> +#include <rtems/score/schedulerpriority.h> + +extern uint32_t Schedsim_Current_cpu; + +int main_set_current_cpu(int argc, char **argv) +{ + long cpu; + + if ( argc >= 2 ) { + if ( rtems_string_to_long(argv[1], &cpu, NULL, 0) ) { + printf( "CPU argument (%s) is not a number\n", argv[1] ); + return -1; + } + printf( + "Changing current CPU from %d to %d\n", + Schedsim_Current_cpu, + cpu + ); + Schedsim_Current_cpu = cpu; + } else { + printf( "Current CPU is %d\n", Schedsim_Current_cpu ); + } + + return 0; +} |