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

Last change on this file since 2d51251 was 2d51251, checked in by Jennifer Averett <jennifer.averett@…>, on May 9, 2014 at 1:35:58 PM

schedsim: Add smp support.

  • Property mode set to 100644
File size: 990 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
23extern uint32_t Schedsim_Current_cpu;
24
25int main_set_current_cpu(int argc, char **argv)
26{
27  long cpu;
28
29  if ( argc >= 2 ) {
30    if ( rtems_string_to_long(argv[1], &cpu, NULL, 0) ) {
31      printf( "CPU argument (%s) is not a number\n", argv[1] );
32      return -1;
33    }
34    printf(
35      "Changing current CPU from %d to %d\n",
36      Schedsim_Current_cpu,
37      cpu
38    );
39    Schedsim_Current_cpu = cpu;
40  } else {
41    printf( "Current CPU is %d\n", Schedsim_Current_cpu );
42  }
43
44  return 0;
45}
Note: See TracBrowser for help on using the repository browser.