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

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

_Thread_Dispatch wrapper is now shared between uniprocessor and SMP configurations

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