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

Last change on this file since 2d51251 was 2d51251, checked in by Jennifer Averett <jennifer.averett@…>, on 05/09/14 at 13:35:58

schedsim: Add smp support.

  • Property mode set to 100644
File size: 1003 bytes
RevLine 
[f40778b]1/*
[a2aad55]2 *  COPYRIGHT (c) 1989-2013.
[f40778b]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/smp.h>
22#include <rtems/score/schedulersimplesmp.h>
23
24extern uint32_t Schedsim_Current_cpu;
25
26int main_dispatch(int argc, char **argv)
27{
28  uint32_t   cpu;
29  uint32_t   current_cpu;
30
31  current_cpu = Schedsim_Current_cpu;
32  for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
[726b27c]33    if ( _Per_CPU_Information[cpu].per_cpu.dispatch_necessary ) {
[f40778b]34      printf( "=== Invoke Thread Dispatch on CPU %d\n", cpu );
35       Schedsim_Current_cpu = cpu;
36      _Thread_Dispatch();
37    }
38  }
39 
40  Schedsim_Current_cpu = current_cpu;
41  return 0;
42}
Note: See TracBrowser for help on using the repository browser.