source: rtems-schedsim/schedsim/rtems/rtems_init.c @ 9a34e3a

Last change on this file since 9a34e3a was a2aad55, checked in by Joel Sherrill <joel.sherrill@…>, on 05/01/13 at 00:41:56

Remove CVS $

  • Property mode set to 100644
File size: 3.0 KB
RevLine 
[abb18dc]1/*
2 *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
3 *
[783fbfe]4 *  COPYRIGHT (c) 1989-2013.
[abb18dc]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#define SAPI_INIT
13#define SCORE_INIT
14#define RTEMS_API_INIT
15
16#include <rtems.h>
17#include <rtems/score/apiext.h>
18#include <rtems/score/bitfield.h>
19#include <rtems/score/apimutex.h>
[783fbfe]20#include <rtems/score/userextimpl.h>
[abb18dc]21#include <rtems/score/wkspace.h>
22
23Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
24
25Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ];
26
27extern void check_heir_and_executing(void);
28
29void rtems_initialize_data_structures(void)
30{
31  _System_state_Handler_initialization( FALSE );
32
33  /*
34   *  Do this as early as possible to ensure no debugging output
35   *  is even attempted to be printed.
36   */
37  _Debug_Manager_initialization();
38
39  _API_extensions_Initialization();
40
41  _Thread_Dispatch_initialization();
42
43  /*
44   *  Before this is called, we are not allowed to allocate memory
45   *  from the Workspace because it is not initialized.
46   */
[783fbfe]47  _Workspace_Handler_initialization(NULL, 0, NULL);
[abb18dc]48
[aebb1ca]49  #if defined(RTEMS_SMP)
50    _SMP_Handler_initialize();
51  #endif
52
[abb18dc]53  _User_extensions_Handler_initialization();
54
[aebb1ca]55  _ISR_Handler_initialization();
[abb18dc]56
57  /*
58   * Initialize the internal support API and allocator Mutex
59   */
60  _Objects_Information_table[OBJECTS_INTERNAL_API] = _Internal_Objects;
61
62  _API_Mutex_Initialization( 1 );
63  _API_Mutex_Allocate( &_RTEMS_Allocator_Mutex );
64
65  _Priority_bit_map_Handler_initialization();
66  _Watchdog_Handler_initialization();
67  _TOD_Handler_initialization();
68
69  _Thread_Handler_initialization();
70
71  _Scheduler_Handler_initialization();
72
73
74/* MANAGERS */
75  /*
76   * Install our API Object Management Table and initialize the
77   * various managers.
78   */
79  _Objects_Information_table[OBJECTS_CLASSIC_API] = _RTEMS_Objects;
80
81  _RTEMS_tasks_Manager_initialization();
82  _Semaphore_Manager_initialization();
83
[aebb1ca]84  /*
85   * Discover and initialize the secondary cores in an SMP system.
86   */
87  #if defined(RTEMS_SMP)
88    _SMP_Processor_count =
89      bsp_smp_initialize( rtems_configuration_smp_maximum_processors );
90  #endif
91
[abb18dc]92  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
93
94  /*
95   *  No threads should be created before this point!!!
96   *  _Thread_Executing and _Thread_Heir are not set.
97   *
98   *  At this point all API extensions are in place.  After the call to
99   *  _Thread_Create_idle() _Thread_Executing and _Thread_Heir will be set.
100   */
101  _Thread_Create_idle();
102
103  /*
104   *  Scheduling can properly occur now as long as we avoid dispatching.
105   */
106
107  _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
108
109  _Thread_Start_multitasking();
110
111  /*
112   *  Now we are back in a non-dispatching critical section
113   */
114  _Thread_Dispatch_set_disable_level(0);
115
116  /*
117   * Print an initial message
118   */
119  check_heir_and_executing();
120}
Note: See TracBrowser for help on using the repository browser.