source: rtems/cpukit/sapi/src/exinit.c @ 3a4ae6c

4.104.114.84.9
Last change on this file since 3a4ae6c was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 11, 1995 at 7:35:39 PM

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • Property mode set to 100644
File size: 6.0 KB
Line 
1/*
2 *  Initialization Manager
3 *
4 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
5 *  On-Line Applications Research Corporation (OAR).
6 *  All rights assigned to U.S. Government, 1994.
7 *
8 *  This material may be reproduced by or for the U.S. Government pursuant
9 *  to the copyright license under the clause at DFARS 252.227-7013.  This
10 *  notice must appear in all copies of this file and its derivatives.
11 *
12 *  $Id$
13 */
14
15/*
16 *  INIT is defined so all of the data will be included in this
17 *  file.
18 */
19
20#define INIT
21
22#include <rtems/system.h>
23#include <rtems/config.h>
24#include <rtems/debug.h>
25#include <rtems/extension.h>
26#include <rtems/fatal.h>
27#include <rtems/init.h>
28#include <rtems/io.h>
29#include <rtems/sysstate.h>
30
31#include <rtems/core/copyrt.h>
32#include <rtems/core/heap.h>
33#include <rtems/core/interr.h>
34#include <rtems/core/intthrd.h>
35#include <rtems/core/isr.h>
36#include <rtems/core/mpci.h>
37#include <rtems/core/priority.h>
38#include <rtems/core/thread.h>
39#include <rtems/core/tod.h>
40#include <rtems/core/userext.h>
41#include <rtems/core/watchdog.h>
42#include <rtems/core/wkspace.h>
43
44#include <rtems/directives.h>
45#include <rtems/sptables.h>
46
47#include <rtems/rtems/rtemsapi.h>
48
49/*PAGE
50 *
51 *  rtems_initialize_executive
52 *
53 *  This directive initializes all the kernels data structures
54 *  to the states necessary for the kernel to begin execution.  All
55 *  include files that contain global variable definitions should be
56 *  included in this file.  The system threads and initialization threads
57 *  are created and started by this routine.  This routine then
58 *  initiates multithreading.
59 *
60 *  Input parameters:
61 *    configuration_table - pointer to the user's configuration table
62 *    cpu_table           - pointer to the user's CPU configuration table
63 *
64 *  Output parameters:  NONE
65 */
66
67struct months {
68  unsigned32 months[2][13];
69};
70
71void rtems_initialize_executive(
72  rtems_configuration_table *configuration_table,
73  rtems_cpu_table           *cpu_table
74)
75{
76  rtems_interrupt_level bsp_level;
77
78  bsp_level = rtems_initialize_executive_early(configuration_table, cpu_table);
79  rtems_initialize_executive_late( bsp_level );
80}
81
82rtems_interrupt_level rtems_initialize_executive_early(
83  rtems_configuration_table *configuration_table,
84  rtems_cpu_table           *cpu_table
85)
86{
87  rtems_interrupt_level        bsp_level;
88  rtems_multiprocessing_table *multiprocessing_table;
89
90  /*
91   *  Dispatching and interrupts are disabled until the end of the
92   *  initialization sequence.  This prevents an inadvertent context
93   *  switch before the executive is initialized.
94   */
95
96  _ISR_Disable( bsp_level );
97
98  if ( cpu_table == NULL )
99    _Internal_error_Occurred(
100      INTERNAL_ERROR_CORE,
101      TRUE,
102      INTERNAL_ERROR_NO_CONFIGURATION_TABLE
103    );
104
105  /*
106   *  Initialize the system state based on whether this is an MP system.
107   */
108
109  multiprocessing_table = configuration_table->User_multiprocessing_table;
110
111  _System_state_Handler_initialization(
112    (multiprocessing_table) ? TRUE : FALSE
113  );
114
115  /*
116   *  Provided just for user convenience.
117   */
118
119  _Configuration_Table    = configuration_table;
120  _Configuration_MP_table = multiprocessing_table;
121
122  /*
123   *  Internally we view single processor systems as a very restricted
124   *  multiprocessor system.
125   */
126
127  if ( multiprocessing_table == NULL )
128    multiprocessing_table = 
129      (void *)&_Initialization_Default_multiprocessing_table;
130
131  if ( cpu_table == NULL )
132    _Internal_error_Occurred(
133      INTERNAL_ERROR_CORE,
134      TRUE,
135      INTERNAL_ERROR_NO_CPU_TABLE
136    );
137
138  _CPU_Initialize( cpu_table, _Thread_Dispatch );
139
140  /*
141   *  Do this as early as possible to insure no debugging output
142   *  is even attempted to be printed.
143   */
144
145  _Debug_Manager_initialization();
146
147  _Thread_Dispatch_initialization();
148
149  _User_extensions_Handler_initialization(
150    configuration_table->User_extension_table
151  );
152
153  _Workspace_Handler_initialization(
154     (void *)configuration_table->work_space_start,
155     configuration_table->work_space_size
156  );
157
158  _ISR_Handler_initialization();
159
160  _Objects_Handler_initialization(
161    multiprocessing_table->node,
162    multiprocessing_table->maximum_nodes,
163    multiprocessing_table->maximum_global_objects
164  );
165
166  _Priority_Handler_initialization();
167
168  _Watchdog_Handler_initialization();
169
170  _TOD_Handler_initialization( configuration_table->microseconds_per_tick );
171
172  _Thread_Handler_initialization(
173    configuration_table->ticks_per_timeslice,
174    configuration_table->maximum_extensions,
175    multiprocessing_table->maximum_proxies
176  );
177
178  _MPCI_Handler_initialization(
179    multiprocessing_table->User_mpci_table
180  );
181
182  _Internal_threads_Initialization();
183
184/* MANAGERS */
185
186  _Extension_Manager_initialization( configuration_table->maximum_extensions );
187
188  _IO_Manager_initialization(
189    configuration_table->Device_driver_table,
190    configuration_table->number_of_device_drivers,
191    configuration_table->maximum_devices
192  );
193
194  _RTEMS_API_Initialize( configuration_table );
195
196  if ( cpu_table->pretasking_hook )
197    (*cpu_table->pretasking_hook)();
198
199  _Internal_threads_Start();
200
201  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
202
203  return bsp_level;
204}
205
206void rtems_initialize_executive_late(
207  rtems_interrupt_level bsp_level
208)
209{
210
211  _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
212
213  _Thread_Start_multitasking(
214    _Internal_threads_System_initialization_thread,
215    _Internal_threads_Idle_thread
216  );
217
218  /*
219   *  Restore the interrupt level to what the BSP had.  Technically,
220   *  this is unnecessary since the BSP should have all interrupts
221   *  disabled when rtems_initialize_executive is invoked.  But this keeps
222   *  the ISR Disable/Enable calls paired.
223   */
224
225  _ISR_Enable( bsp_level );
226}
227
228/*PAGE
229 *
230 *  rtems_shutdown_executive
231 *
232 *  This kernel routine shutdowns the executive.  It halts multitasking
233 *  and returns control to the application execution "thread" which
234 *  initialially invoked the rtems_initialize_executive directive.
235 *
236 *  Input parameters:   NONE
237 *
238 *  Output parameters:  NONE
239 */
240
241void rtems_shutdown_executive(
242   unsigned32 result
243)
244{
245  _Thread_Stop_multitasking();
246}
Note: See TracBrowser for help on using the repository browser.