source: rtems/doc/user/init.t @ 87ed029

4.104.114.84.95
Last change on this file since 87ed029 was 87ed029, checked in by Joel Sherrill <joel.sherrill@…>, on 04/02/98 at 16:18:26

Added "findex" for all directive pages but it turns out that this
blows up both makeinfo and texi2dvi. So I have commented them out.

  • Property mode set to 100644
File size: 13.4 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@c @findex rtems_initialize_executive
197@example
198void rtems_initialize_executive(
199  rtems_configuration_table *configuration_table,
200  rtems_cpu_table           *cpu_table
201);
202@end example
203@end ifset
204
205@ifset is-Ada
206@example
207procedure Initialize_Executive (
208  Configuration_Table : in     RTEMS.Configuration_Table_Pointer;
209  CPU_Table           : in     RTEMS.CPU_Table_Pointer
210);
211@end example
212@end ifset
213
214@subheading DIRECTIVE STATUS CODES:
215
216NONE
217
218@subheading DESCRIPTION:
219
220This directive is called when the board support
221package has completed its initialization to allow RTEMS to
222initialize the application environment based upon the
223information in the Configuration Table, CPU Dependent
224Information Table, User Initialization Tasks Table, Device
225Driver Table, User Extension Table, Multiprocessor Configuration
226Table, and the Multiprocessor Communications Interface (MPCI)
227Table.  This directive starts multitasking and does not return
228to the caller until the @code{@value{DIRPREFIX}shutdown_executive}
229directive is invoked.
230
231@subheading NOTES:
232
233This directive MUST be the first RTEMS directive
234called and it DOES NOT RETURN to the caller until the
235@code{@value{DIRPREFIX}shutdown_executive}
236is invoked.
237
238This directive causes all nodes in the system to
239verify that certain configuration parameters are the same as
240those of the local node.  If an inconsistency is detected, then
241a fatal error is generated.
242
243The application must use only one of the two
244initialization sequences:
245@code{@value{DIRPREFIX}initialize_executive} or
246@code{@value{DIRPREFIX}initialize_executive_early} and
247@code{@value{DIRPREFIX}initialize_executive_late}.  The
248@code{@value{DIRPREFIX}initialize_executive}
249directive is logically equivalent to invoking
250@code{@value{DIRPREFIX}initialize_executive_early} and
251@code{@value{DIRPREFIX}initialize_executive_late}
252with no intervening actions.
253
254@page
255@subsection INITIALIZE_EXECUTIVE_EARLY - Initialize RTEMS and do NOT Start Multitasking
256
257@subheading CALLING SEQUENCE:
258
259@ifset is-C
260@c @findex rtems_initialize_executive_early
261@example
262rtems_interrupt_level rtems_initialize_executive_early(
263  rtems_configuration_table *configuration_table,
264  rtems_cpu_table           *cpu_table
265);
266@end example
267@end ifset
268
269@ifset is-Ada
270@example
271procedure Initialize_Executive_Early(
272  Configuration_Table : in     RTEMS.Configuration_Table_Pointer;
273  CPU_Table           : in     RTEMS.Cpu_Table;
274  Level               :    out RTEMS.ISR_Level
275);
276@end example
277@end ifset
278
279@subheading DIRECTIVE STATUS CODES:
280
281NONE
282
283@subheading DESCRIPTION:
284
285This directive is called when the board support
286package has completed its initialization to allow RTEMS to
287initialize the application environment based upon the
288information in the Configuration Table, CPU Dependent
289Information Table, User Initialization Tasks Table, Device
290Driver Table, User Extension Table, Multiprocessor Configuration
291Table, and the Multiprocessor Communications Interface (MPCI)
292Table.  This directive returns to the caller after completing
293the basic RTEMS initialization but before multitasking is
294initiated.  The interrupt level in place when the directive is
295invoked is returned to the caller.  This interrupt level should
296be the same one passed to
297@code{@value{DIRPREFIX}initialize_executive_late}.
298
299@subheading NOTES:
300
301The application must use only one of the two
302initialization sequences:
303@code{@value{DIRPREFIX}initialize_executive} or
304@code{@value{DIRPREFIX}nitialize_executive_early} and
305@code{@value{DIRPREFIX}nitialize_executive_late}.
306
307@page
308@subsection INITIALIZE_EXECUTIVE_LATE - Complete Initialization and Start Multitasking
309
310@subheading CALLING SEQUENCE:
311
312@ifset is-C
313@c @findex rtems_initialize_executive_late
314@example
315void rtems_initialize_executive_late(
316  rtems_interrupt_level  bsp_level
317);
318@end example
319@end ifset
320
321@ifset is-Ada
322@example
323procedure Initialize_Executive_Late(
324  BSP_Level : in    RTEMS.ISR_Level
325);
326@end example
327@end ifset
328
329@subheading DIRECTIVE STATUS CODES:
330
331NONE
332
333@subheading DESCRIPTION:
334
335This directive is called after the
336@code{@value{DIRPREFIX}initialize_executive_early}
337directive has been called to complete
338the RTEMS initialization sequence and initiate multitasking.
339The interrupt level returned by the
340@code{@value{DIRPREFIX}initialize_executive_early}
341directive should be in bsp_level and this value is restored as
342part of this directive returning to the caller after the
343@code{@value{DIRPREFIX}shutdown_executive}
344directive is invoked.
345
346@subheading NOTES:
347
348This directive MUST be the second RTEMS directive
349called and it DOES NOT RETURN to the caller until the
350@code{@value{DIRPREFIX}shutdown_executive} is invoked.
351
352This directive causes all nodes in the system to
353verify that certain configuration parameters are the same as
354those of the local node.  If an inconsistency is detected, then
355a fatal error is generated.
356
357The application must use only one of the two
358initialization sequences:
359@code{@value{DIRPREFIX}initialize_executive} or
360@code{@value{DIRPREFIX}nitialize_executive_early} and
361@code{@value{DIRPREFIX}initialize_executive_late}.
362
363
364
365@page
366@subsection SHUTDOWN_EXECUTIVE - Shutdown RTEMS
367
368@subheading CALLING SEQUENCE:
369
370@ifset is-C
371@c @findex rtems_shutdown_executive
372@example
373void rtems_shutdown_executive(
374  rtems_unsigned32 result
375);
376@end example
377@end ifset
378
379@ifset is-Ada
380@example
381procedure Shutdown_Executive(
382  result : in     RTEMS.Unsigned32
383);
384@end example
385@end ifset
386
387@subheading DIRECTIVE STATUS CODES:
388
389NONE
390
391@subheading DESCRIPTION:
392
393This directive is called when the application wishes
394to shutdown RTEMS and return control to the board support
395package.  The board support package resumes execution at the
396code immediately following the invocation of the
397@code{@value{DIRPREFIX}initialize_executive} directive.
398
399@subheading NOTES:
400
401This directive MUST be the last RTEMS directive
402invoked by an application and it DOES NOT RETURN to the caller.
403
404This directive should not be invoked until the
405executive has successfully completed initialization.
Note: See TracBrowser for help on using the repository browser.