source: rtems/doc/user/init.t @ 5cd3258

4.104.114.84.95
Last change on this file since 5cd3258 was 6449498, checked in by Joel Sherrill <joel.sherrill@…>, on 01/17/02 at 21:47:47

2001-01-17 Joel Sherrill <joel@…>

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