source: rtems/cpukit/sapi/src/exinit.c @ 15aecdc

4.104.114.84.95
Last change on this file since 15aecdc was ff3f8c85, checked in by Joel Sherrill <joel.sherrill@…>, on 05/28/07 at 15:51:01

2007-05-28 Joel Sherrill <joel.sherrill@…>

  • libmisc/Makefile.am, libmisc/monitor/mon-object.c, libmisc/monitor/monitor.h, sapi/include/confdefs.h, sapi/include/rtems/config.h, sapi/include/rtems/io.h, sapi/src/exinit.c, sapi/src/io.c: Eliminate maximum_drivers configuration parameter since it was used to configure a no longer used feature. Device names are now part of the filesystem not in a table. This also eliminated the variables _IO_Number_of_devices and _IO_Driver_name_table from RTEMS as well as the memory allocation used to populate _IO_Driver_name_table.
  • libmisc/monitor/mon-dname.c: Removed.
  • Property mode set to 100644
File size: 6.8 KB
Line 
1/*
2 *  Initialization Manager
3 *
4 *  COPYRIGHT (c) 1989-1999.
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 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18/*
19 *  SCORE_INIT and SAPI_INIT are defined so all of the super core and
20 *  super API data will be included in this object file.
21 */
22
23#define SAPI_INIT
24#define SCORE_INIT
25
26#include <rtems/system.h>
27#include <rtems/config.h>
28#include <rtems/debug.h>
29#include <rtems/extension.h>
30#include <rtems/fatal.h>
31#include <rtems/init.h>
32#include <rtems/io.h>
33#include <rtems/score/sysstate.h>
34
35#include <rtems/score/apiext.h>
36#include <rtems/score/apimutex.h>
37#include <rtems/score/copyrt.h>
38#include <rtems/score/heap.h>
39#include <rtems/score/interr.h>
40#include <rtems/score/isr.h>
41#if defined(RTEMS_MULTIPROCESSING)
42#include <rtems/score/mpci.h>
43#endif
44#include <rtems/score/priority.h>
45#include <rtems/score/thread.h>
46#include <rtems/score/tod.h>
47#include <rtems/score/userext.h>
48#include <rtems/score/watchdog.h>
49#include <rtems/score/wkspace.h>
50
51#include <rtems/sptables.h>
52
53
54#include <rtems/rtems/rtemsapi.h>
55#ifdef RTEMS_POSIX_API
56#include <rtems/posix/posixapi.h>
57#endif
58#ifdef RTEMS_ITRON_API
59#include <rtems/itron/itronapi.h>
60#endif
61
62Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
63
64rtems_interrupt_level rtems_initialize_executive_early(
65  rtems_configuration_table *configuration_table,
66  rtems_cpu_table           *cpu_table
67)
68{
69  rtems_interrupt_level        bsp_level;
70  rtems_multiprocessing_table *multiprocessing_table;
71
72  /*
73   *  Dispatching and interrupts are disabled until the end of the
74   *  initialization sequence.  This prevents an inadvertent context
75   *  switch before the executive is initialized.
76   */
77
78  _ISR_Disable( bsp_level );
79
80  if ( configuration_table == NULL )
81    _Internal_error_Occurred(
82      INTERNAL_ERROR_CORE,
83      TRUE,
84      INTERNAL_ERROR_NO_CONFIGURATION_TABLE
85    );
86
87  /*
88   *  Initialize the system state based on whether this is an MP system.
89   */
90
91#if defined(RTEMS_MULTIPROCESSING)
92  multiprocessing_table = configuration_table->User_multiprocessing_table;
93
94  _System_state_Handler_initialization(
95    (multiprocessing_table) ? TRUE : FALSE
96  );
97#else
98  multiprocessing_table = NULL;
99
100  _System_state_Handler_initialization( FALSE );
101#endif
102
103  /*
104   *  Grab our own copy of the user's CPU table.
105   */
106
107  _CPU_Table = *cpu_table;
108
109  /*
110   *  Provided just for user convenience.
111   */
112
113  _Configuration_Table    = configuration_table;
114#if defined(RTEMS_MULTIPROCESSING)
115  _Configuration_MP_table = multiprocessing_table;
116#endif
117
118  /*
119   *  Internally we view single processor systems as a very restricted
120   *  multiprocessor system.
121   */
122
123  if ( multiprocessing_table == NULL )
124    multiprocessing_table =
125      (void *)&_Initialization_Default_multiprocessing_table;
126
127  if ( cpu_table == NULL )
128    _Internal_error_Occurred(
129      INTERNAL_ERROR_CORE,
130      TRUE,
131      INTERNAL_ERROR_NO_CPU_TABLE
132    );
133
134  _CPU_Initialize( cpu_table, _Thread_Dispatch );
135
136  /*
137   *  Do this as early as possible to insure no debugging output
138   *  is even attempted to be printed.
139   */
140
141  _Debug_Manager_initialization();
142
143  _API_extensions_Initialization();
144
145  _Thread_Dispatch_initialization();
146
147  _Workspace_Handler_initialization(
148     (void *)configuration_table->work_space_start,
149     configuration_table->work_space_size
150  );
151
152  _User_extensions_Handler_initialization(
153    configuration_table->number_of_initial_extensions,
154    configuration_table->User_extension_table
155  );
156
157  _ISR_Handler_initialization();
158
159  _Objects_Handler_initialization(
160    multiprocessing_table->node,
161    multiprocessing_table->maximum_nodes,
162    multiprocessing_table->maximum_global_objects
163  );
164
165  _Objects_Information_table[OBJECTS_INTERNAL_API] = _Internal_Objects;
166
167  /*
168   * Initialize the internal allocator Mutex
169   */
170  _API_Mutex_Initialization( 1 );
171  _API_Mutex_Allocate( _RTEMS_Allocator_Mutex );
172
173  _Priority_Handler_initialization();
174
175  _Watchdog_Handler_initialization();
176
177  _TOD_Handler_initialization( configuration_table->microseconds_per_tick );
178
179  _Thread_Handler_initialization(
180    configuration_table->ticks_per_timeslice,
181    configuration_table->maximum_extensions,
182    multiprocessing_table->maximum_proxies
183  );
184
185#if defined(RTEMS_MULTIPROCESSING)
186  _MPCI_Handler_initialization(
187    multiprocessing_table->User_mpci_table,
188    RTEMS_TIMEOUT
189  );
190#endif
191
192/* MANAGERS */
193
194  _RTEMS_API_Initialize( configuration_table );
195
196  _Extension_Manager_initialization( configuration_table->maximum_extensions );
197
198  _IO_Manager_initialization(
199    configuration_table->Device_driver_table,
200    configuration_table->number_of_device_drivers,
201    configuration_table->maximum_drivers
202  );
203
204#ifdef RTEMS_POSIX_API
205  _POSIX_API_Initialize( configuration_table );
206#endif
207
208#ifdef RTEMS_ITRON_API
209  _ITRON_API_Initialize( configuration_table );
210#endif
211
212  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
213
214  /*
215   *  No threads should be created before this point!!!
216   *  _Thread_Executing and _Thread_Heir are not set.
217   *
218   *  At this point all API extensions are in place.  After the call to
219   *  _Thread_Create_idle() _Thread_Executing and _Thread_Heir will be set.
220   */
221
222  _Thread_Create_idle();
223
224  /*
225   *  Scheduling can properly occur now as long as we avoid dispatching.
226   */
227
228  if ( cpu_table->pretasking_hook )
229    (*cpu_table->pretasking_hook)();
230
231#if defined(RTEMS_MULTIPROCESSING)
232  _MPCI_Create_server();
233#endif
234
235  /*
236   *  Run the API and BSPs predriver hook.
237   */
238
239  _API_extensions_Run_predriver();
240
241  if ( _CPU_Table.predriver_hook )
242    (*_CPU_Table.predriver_hook)();
243
244  /*
245   *  Initialize all the device drivers and initialize the MPCI layer.
246   *
247   *  NOTE:  The MPCI may be build upon a device driver.
248   */
249
250  _IO_Initialize_all_drivers();
251
252#if defined(RTEMS_MULTIPROCESSING)
253  if ( _System_state_Is_multiprocessing ) {
254    _MPCI_Initialization();
255    _MPCI_Internal_packets_Send_process_packet(
256      MPCI_PACKETS_SYSTEM_VERIFY
257    );
258  }
259#endif
260
261  /*
262   *  Run the APIs and BSPs postdriver hooks.
263   *
264   *  The API extensions are supposed to create user initialization tasks.
265   */
266
267  _API_extensions_Run_postdriver();
268
269  if ( _CPU_Table.postdriver_hook )
270    (*_CPU_Table.postdriver_hook)();
271
272  return bsp_level;
273}
274
275void rtems_initialize_executive_late(
276  rtems_interrupt_level bsp_level
277)
278{
279
280  _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
281
282  _Thread_Start_multitasking();
283
284  /*
285   *  Restore the interrupt level to what the BSP had.  Technically,
286   *  this is unnecessary since the BSP should have all interrupts
287   *  disabled when rtems_initialize_executive is invoked.  But this keeps
288   *  the ISR Disable/Enable calls paired.
289   */
290
291  _ISR_Enable( bsp_level );
292}
Note: See TracBrowser for help on using the repository browser.