source: rtems-schedsim/schedsim/shell/schedsim_smpsimple/main_current_cpu.c @ 2ba4b25

Last change on this file since 2ba4b25 was 2ba4b25, checked in by Jennifer Averett <jennifer.averett@…>, on May 20, 2014 at 4:40:44 PM

schedsim_smpsimple: Fix warnings.

  • Property mode set to 100644
File size: 1018 bytes
Line 
1/*
2 *  COPYRIGHT (c) 1989-2013.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#include <newlib/getopt.h>
11#include <stdio.h>
12#include <stdlib.h>
13#include <string.h>
14#include <ctype.h>
15
16#include "shell.h"
17#include "rtems_sched.h"
18
19#include <rtems.h>
20#include <rtems/score/percpu.h>
21#include <rtems/score/schedulerpriority.h>
22#include <rtems/stringto.h>
23
24extern uint32_t Schedsim_Current_cpu;
25
26int main_set_current_cpu(int argc, char **argv)
27{
28  long cpu;
29
30  if ( argc >= 2 ) {
31    if ( rtems_string_to_long(argv[1], &cpu, NULL, 0) ) {
32      printf( "CPU argument (%s) is not a number\n", argv[1] );
33      return -1;
34    }
35    printf(
36      "Changing current CPU from %d to %d\n",
37      Schedsim_Current_cpu,
38      cpu
39    );
40    Schedsim_Current_cpu = cpu;
41  } else {
42    printf( "Current CPU is %d\n", Schedsim_Current_cpu );
43  }
44
45  return 0;
46}
Note: See TracBrowser for help on using the repository browser.