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 05/26/14 at 17:15:11

shared/smp_stub.c: Only one shared version now

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[87c69f3]1/**
2 *  @file
3 *  RTEMS SMP Support for Scheduler Simulator
4 */
5
[f40778b]6/*
[87c69f3]7 *  COPYRIGHT (c) 1989-2014.
[f40778b]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
[87c69f3]15#if HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
[f40778b]19#include <rtems.h>
20#include <rtems/bspIo.h>
21#include <stdlib.h>
22
[87c69f3]23#if RTEMS_SMP
24  uint32_t Schedsim_Current_cpu;
25  extern uint32_t Schedsim_Maximum_CPUs_From_Command_Line;
26#endif
[f40778b]27
[2d51251]28uint32_t _CPU_SMP_Initialize( void )
[f40778b]29{
[87c69f3]30#if RTEMS_SMP
[f40778b]31  /* return the number of CPUs */
[726b27c]32  return Schedsim_Maximum_CPUs_From_Command_Line;
[87c69f3]33#else
34  return 1;
35#endif
[f40778b]36}
37
[2d51251]38bool _CPU_SMP_Start_processor( uint32_t cpu_index )
[f40778b]39{
[2d51251]40  return true;
[f40778b]41}
42
[2d51251]43void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
[f40778b]44{
45}
46
[2d51251]47void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
[f40778b]48{
[b38dbcc]49}
[f40778b]50
[2d51251]51void _CPU_SMP_Processor_event_broadcast( void )
[f40778b]52{
[87c69f3]53#if RTEMS_SMP
[2d51251]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  }
[87c69f3]67#endif
[f40778b]68}
69
70
[2d51251]71void _CPU_SMP_Processor_event_receive( void )
72{
[f40778b]73}
74
[2d51251]75uint32_t _CPU_SMP_Get_current_processor( void )
76{
[87c69f3]77#if RTEMS_SMP
78  return 0;
79#else
[2d51251]80  return Schedsim_Current_cpu;
[87c69f3]81#endif
[2d51251]82}
Note: See TracBrowser for help on using the repository browser.