source: rtems/doc/user/init.t @ f331481c

4.104.114.84.95
Last change on this file since f331481c was f331481c, checked in by Joel Sherrill <joel.sherrill@…>, on 03/27/98 at 13:24:52

Conditionally adding RTEMS_ and rtems_ prefixes.

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