source: rtems/cpukit/sapi/src/exinit.c

Last change on this file was 3fe2155, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 1, 2019 at 9:00:36 AM

Remove superfluous <rtems/system.h> includes

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/**
2 * @file
3 *
4 * @brief Initialization Manager
5 *
6 * @ingroup ClassicRTEMS
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2014.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/config.h>
23#include <rtems/extensionimpl.h>
24#include <rtems/init.h>
25#include <rtems/ioimpl.h>
26#include <rtems/sysinit.h>
27#include <rtems/score/sysstate.h>
28
29#include <rtems/score/copyrt.h>
30#include <rtems/score/heap.h>
31#include <rtems/score/interr.h>
32#include <rtems/score/isr.h>
33#include <rtems/score/priority.h>
34#include <rtems/score/schedulerimpl.h>
35#include <rtems/score/smpimpl.h>
36#include <rtems/score/timecounter.h>
37#include <rtems/score/threadimpl.h>
38#include <rtems/score/todimpl.h>
39#include <rtems/score/wkspace.h>
40
41const char _Copyright_Notice[] =
42"COPYRIGHT (c) 1989-2008.\n\
43On-Line Applications Research Corporation (OAR).\n";
44
45static Objects_Information *
46_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
47
48static Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ];
49
50static Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];
51
52Objects_Information ** const
53_Objects_Information_table[ OBJECTS_APIS_LAST + 1 ] = {
54  NULL,
55  &_Internal_Objects[ 0 ],
56  &_RTEMS_Objects[ 0 ],
57  &_POSIX_Objects[ 0 ]
58};
59
60static void rtems_initialize_data_structures(void)
61{
62  /*
63   *  Dispatching and interrupts are disabled until the end of the
64   *  initialization sequence.  This prevents an inadvertent context
65   *  switch before the executive is initialized.
66   *
67   *  WARNING: Interrupts should have been disabled by the BSP and
68   *           are disabled by boot_card().
69   */
70
71  /*
72   * Initialize any target architecture specific support as early as possible
73   */
74  _CPU_Initialize();
75
76  _Thread_Dispatch_initialization();
77
78  _ISR_Handler_initialization();
79
80  _Thread_Handler_initialization();
81
82  _Scheduler_Handler_initialization();
83
84  _SMP_Handler_initialize();
85}
86
87RTEMS_LINKER_ROSET( _Sysinit, rtems_sysinit_item );
88
89RTEMS_SYSINIT_ITEM(
90  rtems_initialize_data_structures,
91  RTEMS_SYSINIT_DATA_STRUCTURES,
92  RTEMS_SYSINIT_ORDER_MIDDLE
93);
94
95/*
96 *  No threads should be created before this point!!!
97 *  _Thread_Executing and _Thread_Heir are not set.
98 *
99 *  At this point all API extensions are in place.  After the call to
100 *  _Thread_Create_idle() _Thread_Executing and _Thread_Heir will be set.
101 *
102 *  Scheduling can properly occur afterwards as long as we avoid dispatching.
103 */
104RTEMS_SYSINIT_ITEM(
105  _Thread_Create_idle,
106  RTEMS_SYSINIT_IDLE_THREADS,
107  RTEMS_SYSINIT_ORDER_MIDDLE
108);
109
110/* Initialize I/O drivers.
111 *
112 * Driver Manager note:
113 * All drivers may not be registered yet. Drivers will dynamically
114 * be initialized when registered in level 2,3 and 4.
115 */
116RTEMS_SYSINIT_ITEM(
117  _IO_Initialize_all_drivers,
118  RTEMS_SYSINIT_DEVICE_DRIVERS,
119  RTEMS_SYSINIT_ORDER_MIDDLE
120);
121
122void rtems_initialize_executive(void)
123{
124  const rtems_sysinit_item *item;
125
126  /* Invoke the registered system initialization handlers */
127  RTEMS_LINKER_SET_FOREACH( _Sysinit, item ) {
128    ( *item->handler )();
129  }
130
131  _System_state_Set( SYSTEM_STATE_UP );
132
133  _SMP_Request_start_multitasking();
134
135  _Thread_Start_multitasking();
136
137  /*******************************************************************
138   *******************************************************************
139   *******************************************************************
140   ******                 APPLICATION RUNS HERE                 ******
141   ******              THE FUNCTION NEVER RETURNS               ******
142   *******************************************************************
143   *******************************************************************
144   *******************************************************************/
145}
Note: See TracBrowser for help on using the repository browser.