source: rtems-schedsim/schedsim/shell/shared/smp_stub.c @ 87c69f3

Last change on this file since 87c69f3 was 87c69f3, checked in by Joel Sherrill <joel.sherrill@…>, on May 26, 2014 at 5:15:11 PM

shared/smp_stub.c: Only one shared version now

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 *  @file
3 *  RTEMS SMP Support for Scheduler Simulator
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#if HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include <rtems.h>
20#include <rtems/bspIo.h>
21#include <stdlib.h>
22
23#if RTEMS_SMP
24  uint32_t Schedsim_Current_cpu;
25  extern uint32_t Schedsim_Maximum_CPUs_From_Command_Line;
26#endif
27
28uint32_t _CPU_SMP_Initialize( void )
29{
30#if RTEMS_SMP
31  /* return the number of CPUs */
32  return Schedsim_Maximum_CPUs_From_Command_Line;
33#else
34  return 1;
35#endif
36}
37
38bool _CPU_SMP_Start_processor( uint32_t cpu_index )
39{
40  return true;
41}
42
43void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
44{
45}
46
47void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
48{
49}
50
51void _CPU_SMP_Processor_event_broadcast( void )
52{
53#if RTEMS_SMP
54  Per_CPU_Control  *cpu = _Per_CPU_Get();
55  uint32_t         cpu_count = _SMP_Get_processor_count();
56  uint32_t         cpu_index;
57  Per_CPU_State    state = cpu->state;
58
59  if (state == PER_CPU_STATE_REQUEST_START_MULTITASKING) {
60    for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
61      cpu = _Per_CPU_Get_by_index( cpu_index );
62      state = cpu->state;
63      if (state == PER_CPU_STATE_INITIAL )
64         cpu->state = PER_CPU_STATE_READY_TO_START_MULTITASKING;
65    }
66  }
67#endif
68}
69
70
71void _CPU_SMP_Processor_event_receive( void )
72{
73}
74
75uint32_t _CPU_SMP_Get_current_processor( void )
76{
77#if RTEMS_SMP
78  return 0;
79#else
80  return Schedsim_Current_cpu;
81#endif
82}
Note: See TracBrowser for help on using the repository browser.