source: rtems/doc/user/init.t @ 20515fc

4.104.114.84.95
Last change on this file since 20515fc was 20515fc, checked in by Joel Sherrill <joel.sherrill@…>, on 03/27/98 at 18:53:17

Nodes, menus, etc are automatically generated now

  • Property mode set to 100644
File size: 13.2 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter Initialization Manager
10
11@section Introduction
12
13The initialization manager is responsible for
14initiating and shutting down RTEMS.  Initiating RTEMS involves
15creating and starting all configured initialization tasks, and
16for invoking the initialization routine for each user-supplied
17device driver.  In a multiprocessor configuration, this manager
18also initializes the interprocessor communications layer.  The
19directives provided by the initialization manager are:
20
21@itemize @bullet
22@item @code{@value{DIRPREFIX}initialize_executive} - Initialize RTEMS
23@item @code{@value{DIRPREFIX}initialize_executive_early} - Initialize RTEMS and do NOT Start Multitasking
24@item @code{@value{DIRPREFIX}initialize_executive_late} - Complete Initialization and Start Multitasking
25@item @code{@value{DIRPREFIX}shutdown_executive} - Shutdown RTEMS
26@end itemize
27
28@section Background
29
30@subsection Initialization Tasks
31
32Initialization task(s) are the mechanism by which
33RTEMS transfers initial control to the user's application.
34Initialization tasks differ from other application tasks in that
35they are defined in the User Initialization Tasks Table and
36automatically created and started by RTEMS as part of its
37initialization sequence.  Since the initialization tasks are
38scheduled using the same algorithm as all other RTEMS tasks,
39they must be configured at a priority and mode which will insure
40that they will complete execution before other application tasks
41execute.  Although there is no upper limit on the number of
42initialization tasks, an application is required to define at
43least one.
44
45A typical initialization task will create and start
46the static set of application tasks.  It may also create any
47other objects used by the application.  Initialization tasks
48which only perform initialization should delete themselves upon
49completion to free resources for other tasks.  Initialization
50tasks may transform themselves into a "normal" application task.
51This transformation typically involves changing priority and
52execution mode.  RTEMS does not automatically delete the
53initialization tasks.
54
55@subsection The System Initialization Task
56
57The System Initialization Task is responsible for
58initializing all device drivers.  As a result, this task has a
59higher priority than all other tasks to insure that no
60application tasks executes until all device drivers are
61initialized.  After device initialization in a single processor
62system, this task will delete itself.
63
64The System Initialization Task must have enough stack
65space to successfully execute the initialization routines for
66all device drivers and, in multiprocessor configurations, the
67Multiprocessor Communications Interface Layer initialization
68routine.  The CPU Configuration Table contains a field which
69allows the application or BSP to increase the default amount of
70stack space allocated for this task.
71
72In multiprocessor configurations, the System
73Initialization Task does not delete itself after initializing
74the device drivers.  Instead it transforms itself into the
75Multiprocessing Server which initializes the Multiprocessor
76Communications Interface Layer, verifies multiprocessor system
77consistency, and processes all requests from remote nodes.
78
79@subsection The Idle Task
80
81The Idle Task is the lowest priority task in a system
82and executes only when no other task is ready to execute.  This
83task consists of an infinite loop and will be preempted when any
84other task is made ready to execute.
85
86@subsection Initialization Manager Failure
87
88The fatal_error_occurred directive will be called
89from @code{@value{DIRPREFIX}initialize_executive}
90for any of the following reasons:
91
92@itemize @bullet
93@item If either the Configuration Table or the CPU Dependent
94Information Table is not provided.
95
96@item If the starting address of the RTEMS RAM Workspace,
97supplied by the application in the Configuration Table, is NULL
98or is not aligned on a four-byte boundary.
99
100@item If the size of the RTEMS RAM Workspace is not large
101enough to initialize and configure the system.
102
103@item If the interrupt stack size specified is too small.
104
105@item If multiprocessing is configured and the node entry in
106the Multiprocessor Configuration Table is not between one and
107the maximum_nodes entry.
108
109@item If a multiprocessor system is being configured and no
110Multiprocessor Communications Interface is specified.
111
112@item If no user initialization tasks are configured.  At
113least one initialization task must be configured to allow RTEMS
114to pass control to the application at the end of the executive
115initialization sequence.
116
117@item If any of the user initialization tasks cannot be
118created or started successfully.
119@end itemize
120
121@section Operations
122
123@subsection Initializing RTEMS
124
125The @code{@value{DIRPREFIX}initialize_executive}
126directive is called by the
127board support package at the completion of its initialization
128sequence.  RTEMS assumes that the board support package
129successfully completed its initialization activities.  The
130@code{@value{DIRPREFIX}initialize_executive}
131directive completes the initialization
132sequence by performing the following actions:
133
134@itemize @bullet
135@item Initializing internal RTEMS variables;
136@item Allocating system resources;
137@item Creating and starting the System Initialization Task;
138@item Creating and starting the Idle Task;
139@item Creating and starting the user initialization task(s); and
140@item Initiating multitasking.
141@end itemize
142
143This directive MUST be called before any other RTEMS
144directives.  The effect of calling any RTEMS directives before
145@code{@value{DIRPREFIX}initialize_executive}
146is unpredictable.  Many of RTEMS actions
147during initialization are based upon the contents of the
148Configuration Table and CPU Dependent Information Table.  For
149more information regarding the format and contents of these
150tables, please refer to the chapter Configuring a System.
151
152The final step in the initialization sequence is the
153initiation of multitasking.  When the scheduler and dispatcher
154are enabled, the highest priority, ready task will be dispatched
155to run.  Control will not be returned to the board support
156package after multitasking is enabled until
157@code{@value{DIRPREFIX}shutdown_executive}
158the directive is called.
159
160The @code{@value{DIRPREFIX}initialize_executive}
161directive provides a
162conceptually simple way to initialize RTEMS.  However, in
163certain cases, this mechanism cannot be used.  The
164@code{@value{DIRPREFIX}initialize_executive_early}
165and @code{@value{DIRPREFIX}initialize_executive_late}
166directives are provided as an alternative mechanism for
167initializing RTEMS.  The
168@code{@value{DIRPREFIX}initialize_executive_early} directive
169returns to the caller BEFORE initiating multitasking.  The
170@code{@value{DIRPREFIX}initialize_executive_late}
171directive is invoked to start
172multitasking.  It is critical that only one of the RTEMS
173initialization sequences be used in an application.
174
175@subsection Shutting Down RTEMS
176
177The @code{@value{DIRPREFIX}shutdown_executive} directive is invoked by the
178application to end multitasking and return control to the board
179support package.  The board support package resumes execution at
180the code immediately following the invocation of the
181@code{@value{DIRPREFIX}initialize_executive} directive.
182
183@section Directives
184
185This section details the initialization manager's
186directives.  A subsection is dedicated to each of this manager's
187directives and describes the calling sequence, related
188constants, usage, and status codes.
189
190@page
191@subsection INITIALIZE_EXECUTIVE - Initialize RTEMS
192
193@subheading CALLING SEQUENCE:
194
195@ifset is-C
196@example
197void rtems_initialize_executive(
198  rtems_configuration_table *configuration_table,
199  rtems_cpu_table           *cpu_table
200);
201@end example
202@end ifset
203
204@ifset is-Ada
205@example
206procedure Initialize_Executive (
207  Configuration_Table : in     RTEMS.Configuration_Table_Pointer;
208  CPU_Table           : in     RTEMS.CPU_Table_Pointer
209);
210@end example
211@end ifset
212
213@subheading DIRECTIVE STATUS CODES:
214
215NONE
216
217@subheading DESCRIPTION:
218
219This directive is called when the board support
220package has completed its initialization to allow RTEMS to
221initialize the application environment based upon the
222information in the Configuration Table, CPU Dependent
223Information Table, User Initialization Tasks Table, Device
224Driver Table, User Extension Table, Multiprocessor Configuration
225Table, and the Multiprocessor Communications Interface (MPCI)
226Table.  This directive starts multitasking and does not return
227to the caller until the @code{@value{DIRPREFIX}shutdown_executive}
228directive is invoked.
229
230@subheading NOTES:
231
232This directive MUST be the first RTEMS directive
233called and it DOES NOT RETURN to the caller until the
234@code{@value{DIRPREFIX}shutdown_executive}
235is invoked.
236
237This directive causes all nodes in the system to
238verify that certain configuration parameters are the same as
239those of the local node.  If an inconsistency is detected, then
240a fatal error is generated.
241
242The application must use only one of the two
243initialization sequences:
244@code{@value{DIRPREFIX}initialize_executive} or
245@code{@value{DIRPREFIX}initialize_executive_early} and
246@code{@value{DIRPREFIX}initialize_executive_late}.  The
247@code{@value{DIRPREFIX}initialize_executive}
248directive is logically equivalent to invoking
249@code{@value{DIRPREFIX}initialize_executive_early} and
250@code{@value{DIRPREFIX}initialize_executive_late}
251with no intervening actions.
252
253@page
254@subsection INITIALIZE_EXECUTIVE_EARLY - Initialize RTEMS and do NOT Start Multitasking
255
256@subheading CALLING SEQUENCE:
257
258@ifset is-C
259@example
260rtems_interrupt_level rtems_initialize_executive_early(
261  rtems_configuration_table *configuration_table,
262  rtems_cpu_table           *cpu_table
263);
264@end example
265@end ifset
266
267@ifset is-Ada
268@example
269procedure Initialize_Executive_Early(
270  Configuration_Table : in     RTEMS.Configuration_Table_Pointer;
271  CPU_Table           : in     RTEMS.Cpu_Table;
272  Level               :    out RTEMS.ISR_Level
273);
274@end example
275@end ifset
276
277@subheading DIRECTIVE STATUS CODES:
278
279NONE
280
281@subheading DESCRIPTION:
282
283This directive is called when the board support
284package has completed its initialization to allow RTEMS to
285initialize the application environment based upon the
286information in the Configuration Table, CPU Dependent
287Information Table, User Initialization Tasks Table, Device
288Driver Table, User Extension Table, Multiprocessor Configuration
289Table, and the Multiprocessor Communications Interface (MPCI)
290Table.  This directive returns to the caller after completing
291the basic RTEMS initialization but before multitasking is
292initiated.  The interrupt level in place when the directive is
293invoked is returned to the caller.  This interrupt level should
294be the same one passed to
295@code{@value{DIRPREFIX}initialize_executive_late}.
296
297@subheading NOTES:
298
299The application must use only one of the two
300initialization sequences:
301@code{@value{DIRPREFIX}initialize_executive} or
302@code{@value{DIRPREFIX}nitialize_executive_early} and
303@code{@value{DIRPREFIX}nitialize_executive_late}.
304
305@page
306@subsection INITIALIZE_EXECUTIVE_LATE - Complete Initialization and Start Multitasking
307
308@subheading CALLING SEQUENCE:
309
310@ifset is-C
311@example
312void rtems_initialize_executive_late(
313  rtems_interrupt_level  bsp_level
314);
315@end example
316@end ifset
317
318@ifset is-Ada
319@example
320procedure Initialize_Executive_Late(
321  BSP_Level : in    RTEMS.ISR_Level
322);
323@end example
324@end ifset
325
326@subheading DIRECTIVE STATUS CODES:
327
328NONE
329
330@subheading DESCRIPTION:
331
332This directive is called after the
333@code{@value{DIRPREFIX}initialize_executive_early}
334directive has been called to complete
335the RTEMS initialization sequence and initiate multitasking.
336The interrupt level returned by the
337@code{@value{DIRPREFIX}initialize_executive_early}
338directive should be in bsp_level and this value is restored as
339part of this directive returning to the caller after the
340@code{@value{DIRPREFIX}shutdown_executive}
341directive is invoked.
342
343@subheading NOTES:
344
345This directive MUST be the second RTEMS directive
346called and it DOES NOT RETURN to the caller until the
347@code{@value{DIRPREFIX}shutdown_executive} is invoked.
348
349This directive causes all nodes in the system to
350verify that certain configuration parameters are the same as
351those of the local node.  If an inconsistency is detected, then
352a fatal error is generated.
353
354The application must use only one of the two
355initialization sequences:
356@code{@value{DIRPREFIX}initialize_executive} or
357@code{@value{DIRPREFIX}nitialize_executive_early} and
358@code{@value{DIRPREFIX}initialize_executive_late}.
359
360
361
362@page
363@subsection SHUTDOWN_EXECUTIVE - Shutdown RTEMS
364
365@subheading CALLING SEQUENCE:
366
367@ifset is-C
368@example
369void rtems_shutdown_executive(
370  rtems_unsigned32 result
371);
372@end example
373@end ifset
374
375@ifset is-Ada
376@example
377procedure Shutdown_Executive(
378  result : in     RTEMS.Unsigned32
379);
380@end example
381@end ifset
382
383@subheading DIRECTIVE STATUS CODES:
384
385NONE
386
387@subheading DESCRIPTION:
388
389This directive is called when the application wishes
390to shutdown RTEMS and return control to the board support
391package.  The board support package resumes execution at the
392code immediately following the invocation of the
393@code{@value{DIRPREFIX}initialize_executive} directive.
394
395@subheading NOTES:
396
397This directive MUST be the last RTEMS directive
398invoked by an application and it DOES NOT RETURN to the caller.
399
400This directive should not be invoked until the
401executive has successfully completed initialization.
Note: See TracBrowser for help on using the repository browser.