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

Last change on this file since 2d51251 was 2d51251, checked in by Jennifer Averett <jennifer.averett@…>, on May 9, 2014 at 1:35:58 PM

schedsim: Add smp support.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  RTEMS SMP Support for Single Core
3 *
4 *  COPYRIGHT (c) 1989-2013.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#include <rtems.h>
13#include <rtems/bspIo.h>
14#include <stdlib.h>
15
16uint32_t Schedsim_Current_cpu;
17extern uint32_t Schedsim_Maximum_CPUs_From_Command_Line;
18
19uint32_t _CPU_SMP_Initialize( void )
20{
21  if ( configured_cpu_count < Schedsim_Maximum_CPUs_From_Command_Line ) {
22    printf(
23      "ERROR - Maximum cores per confdefs.h is %d\n",
24      configured_cpu_count
25    );
26    exit( 1 );
27  }
28
29  /* return the number of CPUs */
30  return Schedsim_Maximum_CPUs_From_Command_Line;
31}
32
33bool _CPU_SMP_Start_processor( uint32_t cpu_index )
34{
35  return true;
36}
37
38void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
39{
40}
41
42void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
43{
44} 
45
46void _CPU_SMP_Processor_event_broadcast( void )
47{
48  Per_CPU_Control  *cpu = _Per_CPU_Get();
49  uint32_t         cpu_count = _SMP_Get_processor_count();
50  uint32_t         cpu_index;
51  Per_CPU_State    state = cpu->state;
52
53  if (state == PER_CPU_STATE_REQUEST_START_MULTITASKING) {
54    for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
55      cpu = _Per_CPU_Get_by_index( cpu_index );
56      state = cpu->state;
57      if (state == PER_CPU_STATE_INITIAL )
58         cpu->state = PER_CPU_STATE_READY_TO_START_MULTITASKING;
59    }
60  }
61}
62
63
64void _CPU_SMP_Processor_event_receive( void )
65{
66}
67
68uint32_t _CPU_SMP_Get_current_processor( void )
69{
70  return Schedsim_Current_cpu;
71}
Note: See TracBrowser for help on using the repository browser.