source: rtems-schedsim/schedsim/shell/shared/main_dispatch.c @ 246b81f

Last change on this file since 246b81f was 246b81f, checked in by Joel Sherrill <joel.sherrill@…>, on 05/26/14 at 17:55:18

dispatch is now a shared SMP command

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file
3 *  @brief Invoke Dispatch on all Cores Command
4 */
5
6/*
7 *  COPYRIGHT (c) 1989-2014.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 */
14
15#include <newlib/getopt.h>
16#include <stdio.h>
17#include <stdlib.h>
18#include <string.h>
19#include <ctype.h>
20
21#include "shell.h"
22#include "rtems_sched.h"
23
24#include <rtems.h>
25#include <rtems/score/percpu.h>
26#include <rtems/score/smp.h>
27#include <rtems/score/schedulersimplesmp.h>
28#include <rtems/score/threaddispatch.h>
29
30extern uint32_t Schedsim_Current_cpu;
31
32int rtems_shell_main_dispatch(int argc, char **argv)
33{
34  uint32_t   cpu;
35  uint32_t   current_cpu;
36
37  current_cpu = Schedsim_Current_cpu;
38  for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
39    if ( _Per_CPU_Information[cpu].per_cpu.dispatch_necessary ) {
40      printf( "=== Invoke Thread Dispatch on CPU %d\n", cpu );
41       Schedsim_Current_cpu = cpu;
42      _Thread_Dispatch();
43    }
44  }
45
46  Schedsim_Current_cpu = current_cpu;
47  return 0;
48}
49
50rtems_shell_cmd_t rtems_shell_DISPATCH_Command = {
51  "dispatch",                    /* name */
52  "dispatch",                    /* usage */
53  "rtems",                       /* topic */
54  rtems_shell_main_dispatch,     /* command */
55  NULL,                          /* alias */
56  NULL                           /* next */
57};
Note: See TracBrowser for help on using the repository browser.