source: rtems/doc/user/conf.t @ b4a662a

4.115
Last change on this file since b4a662a was b4a662a, checked in by Joel Sherrill <joel.sherrill@…>, on 07/26/11 at 14:13:20

2011-07-26 Joel Sherrill <joel.sherrilL@…>

PR 1851/doc

  • user/conf.t: Fix typo in CONFIGURE_MESSAGE_BUFFER_MEMORY example.
  • Property mode set to 100644
File size: 85.1 KB
Line 
1@c  COPYRIGHT (c) 1988-2011.
2@c  On-Line Applications Research Corporation (OAR).
3@c  All rights reserved.
4@c
5@c  $Id$
6@c
7
8@c The following macros from confdefs.h have not been discussed in this
9@c chapter:
10@c
11@c CONFIGURE_NEWLIB_EXTENSION - probably not needed
12@c
13@c In addition, there should be examples of defining your own
14@c Device Driver Table, Init task table, etc.
15@c
16@c Regardless, this is a big step up. :)
17@c
18
19@chapter Configuring a System
20
21@section Introduction
22
23RTEMS must be configured for an application.  This configuration
24information encompasses a variety of information including
25the length of each clock tick, the maximum number of each RTEMS
26object that can be created, the application initialization tasks,
27the task scheduling algorithm to be used,
28and the device drivers in the application.  This information
29is placed in data structures that are given to RTEMS at
30system initialization time.  This chapter details the
31format of these data structures as well as a simpler
32mechanism to automate the generation of these structures.
33
34@ifset is-Ada
35System configuration is ALWAYS done from C.  When developing
36an Ada application, the user is responsible for creating at
37least one C file which contains the Ada run-time initialization
38and the RTEMS System Configuration.  There is no Ada binding
39for RTEMS System Configuration information.  Thus all examples
40and data structures shown in this chapter are in C.
41@end ifset
42
43@section Automatic Generation of System Configuration
44
45@cindex confdefs.h
46@findex confdefs.h
47
48RTEMS provides the @code{rtems/confdefs.h} C language header file that
49based on the setting of a variety of macros can automatically
50produce nearly all of the configuration tables required
51by an RTEMS application.  Rather than building the individual
52tables by hand, the application simply specifies the values
53for the configuration parameters it wishes to set.  In the following
54example, the configuration information for a simple system with
55a message queue and a time slice of 50 milliseconds is configured:
56
57@example
58@group
59#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
60#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
61
62#define CONFIGURE_MICROSECONDS_PER_TICK   1000 /* 1 millisecond */
63#define CONFIGURE_TICKS_PER_TIMESLICE       50 /* 50 milliseconds */
64
65#define CONFIGURE_MAXIMUM_TASKS 4
66#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
67@end group
68@end example
69
70This system will begin execution with the single initialization task
71named @code{Init}.  It will be configured to have both a console
72device driver (for standard I/O) and a clock tick device driver.
73
74For each configuration parameter in the configuration tables, the
75macro corresponding to that field is discussed.  Most systems
76can be easily configured using the @code{rtems/confdefs.h} mechanism.
77
78The @code{CONFIGURE_INIT} constant must be defined in order to
79make @code{rtems/confdefs.h} instantiate the configuration data
80structures.  This can only be defined in one source file per
81application that includes @code{rtems/confdefs.h} or the symbol
82table will be instantiated multiple times and linking errors
83produced.
84
85The user should be aware that the defaults are intentionally
86set as low as possible.  By default, no application resources
87are configured.  The @code{rtems/confdefs.h} file ensures that
88at least one application tasks or thread is configured
89and that at least one of the initialization task/thread
90tables is configured.
91
92The @code{rtems/confdefs.h} file estimates the amount of
93memory required for the RTEMS Executive Workspace.  This
94estimate is only as accurate as the information given
95to @code{rtems/confdefs.h} and may be either too high or too
96low for a variety of reasons.  Some of the reasons that
97@code{rtems/confdefs.h} may reserve too much memory for RTEMS
98are:
99
100@itemize @bullet
101@item All tasks/threads are assumed to be floating point.
102@end itemize
103
104Conversely, there are many more reasons, the resource
105estimate could be too low:
106
107@itemize @bullet
108@item Task/thread stacks greater than minimum size must be
109accounted for explicitly by developer.
110
111@item Memory for messages is not included.
112
113@item Device driver requirements are not included.
114
115
116@item Network stack requirements are not included.
117
118@item Requirements for add-on libraries are not included.
119@end itemize
120
121In general, @code{rtems/confdefs.h} is very accurate when given
122enough information.  However, it is quite easy to use
123a library and not account for its resources.
124
125The following subsection list all of the constants which can be
126set by the user.
127
128@subsection Library Support Definitions
129
130This section defines the file system and IO library
131related configuration parameters supported by
132@code{rtems/confdefs.h}.
133
134@itemize @bullet
135@findex CONFIGURE_MALLOC_STATISTICS
136@item @code{CONFIGURE_MALLOC_STATISTICS} is defined when the application
137wishes to enable the gathering of more detailed statistics on the
138C Malloc Family of routines.
139
140@findex CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
141@item @code{CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK} is defined by a BSP
142to indicate that it does not allocate all available memory to the
143C Program Heap used by the Malloc Family of routines.  If defined,
144when @code{malloc()} is unable to allocate memory, it will call
145the BSP supplied @code{sbrk()} to obtain more memory.
146
147@findex CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
148@item @code{CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS} is set to the
149maximum number of files that can be concurrently open.  Libio requires
150a Classic RTEMS semaphore for each file descriptor as well as one
151global one.  The default value is 3 file descriptors which is
152enough to support standard input, output, and error output.
153
154@findex CONFIGURE_TERMIOS_DISABLED
155@item @code{CONFIGURE_TERMIOS_DISABLED} is defined if the
156software implementing POSIX termios functionality is
157not going to be used by this application.  By default, this
158is not defined and resources are reserved for the
159termios functionality.
160
161@findex CONFIGURE_NUMBER_OF_TERMIOS_PORTS
162@item @code{CONFIGURE_NUMBER_OF_TERMIOS_PORTS} is set to the
163number of ports using the termios functionality.  Each
164concurrently active termios port requires resources.
165By default, this is set to 1 so a console port can be
166used.
167
168@findex CONFIGURE_HAS_OWN_MOUNT_TABLE
169@item @code{CONFIGURE_HAS_OWN_MOUNT_TABLE} is defined when the
170application provides their own filesystem mount table.  The
171mount table is an array of @code{rtems_filesystem_mount_table_t}
172entries pointed to by the global variable
173@code{rtems_filesystem_mount_table}.  The number of
174entries in this table is in an integer variable named
175@code{rtems_filesystem_mount_table_t}.
176
177@findex CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
178@item @code{CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM} is defined
179if the application wishes to use the full functionality
180IMFS.  By default, the miniIMFS is used.  The miniIMFS
181is a minimal functionality subset of the In-Memory
182FileSystem (IMFS).  The miniIMFS is comparable
183in functionality to the pseudo-filesystem name space provided
184before RTEMS release 4.5.0.  The miniIMFS supports
185only directories and device nodes and is smaller in executable
186code size than the full IMFS.
187
188@findex CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
189@item @code{CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM} is defined
190if the application wishes to use the device-only filesytem. The
191device-only filesystem supports only device nodes and is smaller
192in executable code size than the full IMFS and miniIMFS.
193
194@findex CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
195@item @code{CONFIGURE_APPLICATION_DISABLE_FILESYSTEM} is defined
196if the application dose not intend to use any kind of filesystem
197supports(including printf family).
198
199
200@findex CONFIGURE_STACK_CHECKER_ENABLED
201@item @code{CONFIGURED_STACK_CHECKER_ENABLED} is defined when
202the application wishes to enable run-time stack bounds checking.
203This increases the time required to create tasks as well as adding
204overhead to each context switch.  By default, this is not defined and
205thus stack checking is disabled.  NOTE: In 4.9 and older, this was named
206@code{STACK_CHECKER_ON}
207
208@end itemize
209
210@subsection Basic System Information
211
212This section defines the general system configuration parameters supported by
213@code{rtems/confdefs.h}.
214
215@itemize @bullet
216@findex CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
217@item @code{CONFIGURE_HAS_OWN_CONFIGURATION_TABLE} should only be defined
218if the application is providing their own complete set of configuration
219tables.
220
221@findex CONFIGURE_EXECUTIVE_RAM_WORK_AREA
222@item @code{CONFIGURE_EXECUTIVE_RAM_WORK_AREA} is the base
223address of the RTEMS RAM Workspace.  By default, this value
224is NULL indicating that the BSP is to determine the location
225of the RTEMS RAM Workspace.
226
227@findex CONFIGURE_UNIFIED_WORK_AREAS
228@item @code{CONFIGURE_UNIFIED_WORK_AREAS} configures RTEMS to use a
229single memory pool for the RTEMS Workspace and C Program Heap.  If not
230defined, there will be separate memory pools for the RTEMS Workspace and
231C Program Heap.  Having separate pools does have some advantages in the
232event a task blows a stack or writes outside its memory area. However,
233in low memory systems the overhead of the two pools plus the potential
234for unused memory in either pool is very undesirable.
235
236In high memory environments, this is desirable when you want to use the
237RTEMS "unlimited" objects option.  You will be able to create objects
238until you run out of all available memory rather then just until you
239run out of RTEMS Workspace.
240
241@item @code{CONFIGURE_MICROSECONDS_PER_TICK} is the length
242of time between clock ticks.  By default, this is set to
24310000 microseconds.
244
245@findex CONFIGURE_TICKS_PER_TIMESLICE
246@item @code{CONFIGURE_TICKS_PER_TIMESLICE} is the length
247of the timeslice quantum in ticks for each task.  By
248default, this is 50.
249
250@findex CONFIGURE_MAXIMUM_PRIORITY
251@item @code{CONFIGURE_MAXIMUM_PRIORITY} is the maximum numeric priority
252of any task in the system and one less that the number of priority levels
253in the system.  The numerically greatest priority is the logically lowest
254priority in the system and will thus be used by the IDLE task.  Valid values
255for this configuration parameter must be one (1) less than than a power
256of two (2) between 4 and 256 inclusively.  In other words, valid values
257are 3, 7, 31, 63, 127, and 255.  Reducing the number of priorities in the
258system reduces the amount of memory allocated from the RTEMS Workspace.
259By default, RTEMS supports 256 priority levels ranging from 0 to 255 so
260the default value for this field is 255.
261
262@findex CONFIGURE_MICROSECONDS_PER_TICK
263@fnindex CONFIGURE_MINIMUM_STACK_SIZE
264@item @code{CONFIGURE_MINIMUM_STACK_SIZE} is set to the number of bytes
265the application wants the minimum stack size to be for every task or
266thread in the system.  By default, this is set to the recommended minimum
267stack size for this processor.
268
269@fnindex CONFIGURE_INTERRUPT_STACK_SIZE
270@item @code{CONFIGURE_INTERRUPT_STACK_SIZE} is set to the
271size of the interrupt stack.  The interrupt stack size is
272usually set by the BSP but since this memory may be allocated
273from the RTEMS Ram Workspace, it must be accounted for.  The
274default for this field is the configured minimum stack size.  [NOTE:
275In some BSPs, changing this constant does NOT change the
276size of the interrupt stack, only the amount of memory
277reserved for it.] If not specified, the interrupt stack
278will be of minimum size.  The default value is the configured
279minimum stack size.
280
281@findex CONFIGURE_TASK_STACK_ALLOCATOR
282@item @code{CONFIGURE_TASK_STACK_ALLOCATOR}
283may point to a user provided routine to allocate task stacks.
284The default value for this field is NULL which indicates that
285task stacks will be allocated from the RTEMS Workspace.
286
287@findex CONFIGURE_TASK_STACK_DEALLOCATOR
288@item @code{CONFIGURE_TASK_STACK_DEALLOCATOR}
289may point to a user provided routine to free task stacks.
290The default value for this field is NULL which indicates that
291task stacks will be allocated from the RTEMS Workspace.
292
293@findex CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
294@item @code{CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY}
295indicates whether RTEMS should zero the RTEMS Workspace and
296C Program Heap as part of its initialization.  If set to
297TRUE, the Workspace is zeroed.  Otherwise, it is not.
298Unless overridden by the BSP, the default value for this
299field is FALSE.
300
301@findex CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE
302@item @code{CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE} is a helper macro
303which is used to assist in computing the total amount of memory
304required for message buffers.  Each message queue will have its
305own configuration with maximum message size and maximum number of
306pending messages.  The interface for this macro is as follows:
307
308@example
309CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(max_messages, size_per)
310@end example
311
312Where @code{max_messages} is the maximum number of pending messages
313and @code{size_per} is the size in bytes of the user message.
314
315@findex CONFIGURE_MESSAGE_BUFFER_MEMORY
316@item @code{CONFIGURE_MESSAGE_BUFFER_MEMORY} is set to the number of
317bytes the application requires to be reserved for pending message queue
318buffers.  This value should include memory for all buffers across
319all APIs.  The default value is 0.
320
321The following illustrates how the help macro
322@code{CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE} can be used to assist in
323calculating the message buffer memory required.  In this example, there
324are two message queues used in this application.  The first message
325queue has maximum of 24 pending messages with the message structure
326defined by the type @code{one_message_type}.  The other message queue
327has maximum of 500 pending messages with the message structure defined
328by the type @code{other_message_type}.
329
330@example
331
332#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
333 (CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( \
334    24, sizeof(one_message_type) + \
335  CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( \
336    500, sizeof(other_message_type) \
337 )
338@end example
339
340@findex CONFIGURE_MEMORY_OVERHEAD
341@item @code{CONFIGURE_MEMORY_OVERHEAD} is set to the number of
342kilobytes the application wishes to add to the requirements calculated
343by @code{rtems/confdefs.h}.  The default value is 0.
344
345@findex CONFIGURE_EXTRA_TASK_STACKS
346@item @code{CONFIGURE_EXTRA_TASK_STACKS} is set to the number of
347bytes the applications wishes to add to the task stack requirements
348calculated by @code{rtems/confdefs.h}.  This parameter is very important.
349If the application creates tasks with stacks larger then the
350minimum, then that memory is NOT accounted for by @code{rtems/confdefs.h}.
351The default value is 0.
352
353@end itemize
354
355NOTE: The required size of the Executive RAM Work Area is calculated
356automatically when using the @code{rtems/confdefs.h} mechanism.
357
358@c
359@c
360@c
361@subsection Idle Task Configuration
362
363This section defines the IDLE task related configuration parameters
364supported by @code{rtems/confdefs.h}.
365
366@itemize @bullet
367
368@fnindex CONFIGURE_IDLE_TASK_BODY
369@item @code{CONFIGURE_IDLE_TASK_BODY} is set to the method name
370corresponding to the application specific IDLE thread body.  If
371not specified, the BSP or RTEMS default IDLE thread body will
372be used.  The default value is NULL.
373
374@fnindex CONFIGURE_IDLE_TASK_STACK_SIZE
375@item @code{CONFIGURE_IDLE_TASK_STACK_SIZE} is set to the
376desired stack size for the IDLE task.  If not specified,
377the IDLE task will have a stack of minimum size.  The default
378value is the configured minimum stack size.
379
380@fnindex CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
381@item @code{CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION} is set to
382indicate that the user has configured @b{NO} user initialization tasks
383or threads and that the user provided IDLE task will perform application
384initialization and then transform itself into an IDLE task.  If you
385use this option be careful, the user IDLE task @b{CANNOT} block at
386all during the initialization sequence.  Further, once application
387initialization is complete, it must make itself preemptible and
388enter an IDLE body loop.  By default, this is not the mode of operation
389and the user is assumed to provide one or more initialization tasks.
390
391@end itemize
392
393@c
394@c
395@c
396@subsection Scheduler Algorithm Configuration
397
398This section defines the configuration parameters related to selecting
399a scheduling algorithm for an application.  For the schedulers built into RTEMS, the configuration is straightforward.  All that is required is to define the configuration macro which specifies which scheduler you want for in your application.  The currently available schedulers are:
400
401@itemize @bullet
402
403@findex CONFIGURE_SCHEDULER_PRIORITY
404@item Deterministic Priority Scheduler - This is the default scheduler
405in RTEMS for single core applications and is designed for predictable
406performance under the highest loads.  It can block or unblock a thread
407in a constant amount of time.  This scheduler requires a variable
408amount of memory based upon the number of priorities configured in
409the system.  This scheduler may be explicitly selected by defining
410@code{CONFIGURE_SCHEDULER_PRIORITY}.
411
412@findex CONFIGURE_SCHEDULER_SIMPLE
413@item Simple Priority Scheduler - This is an alternative scheduler
414in RTEMS.  It is designed to provide the same task scheduling behaviour
415as the Deterministic Priority Scheduler while being simpler in implementation
416and uses less memory for data management.  It maintains a single sorted list
417of all ready threads.  Thus blocking or unblocking a thread is not a
418constant time operation with this scheduler.  This scheduler is appropriate
419for use in small systems where RAM is limited.  This scheduler may be explicitly
420selected by defining @code{CONFIGURE_SCHEDULER_SIMPLE}.
421
422@findex CONFIGURE_SCHEDULER_SIMPLE_SMP
423@item Simple SMP Priority Scheduler - This scheduler is derived from the
424Simple Priority Scheduler but is capable of scheduling threads across
425multiple cores.  It is designed to provide the same task scheduling
426behaviour as the Deterministic Priority Scheduler while distributing
427threads across multiple cores.  Being based upon the Simple Priority
428Scheduler, it also maintains a single sorted list of all ready threads.
429Thus blocking or unblocking a thread is not a constant time operation
430with this scheduler.  In addition, when allocating threads to cores,
431the algorithm is not constant time.  This algorithm was not designed
432with efficiency as a primary design goal.  Its primary design goal was to
433provide an SMP-aware scheduling algorithm that is simple to understand.
434This scheduler is currently the default in SMP configurations and is
435only selected when @code{CONFIGURE_SMP_APPLICATION} is defined.  In a
436configuration with SMP enabled at configure time, it may be explicitly
437selected by defining @code{CONFIGURE_SCHEDULER_SIMPLE_SMP}.
438
439@end itemize
440
441The pluggable scheduler interface was added after the 4.10 release series
442so there are not a lot of options at this point.  We anticipate a lower
443memory, non-deterministic priority scheduler suitable for use in small
444systems and an Earliest Deadline First Scheduler (EDF) to arrive in
445the future.
446
447The pluggable scheduler interface enables the user to provide their own scheduling algorithm.  If you choose to do this, you must define multiple configuration macros. 
448
449@findex CONFIGURE_SCHEDULER_USER
450First, you must define @code{CONFIGURE_SCHEDULER_USER} to indicate the application provides its own scheduling algorithm. If @code{CONFIGURE_SCHEDULER_USER} is defined then the following additional macros must be defined:
451
452@itemize @bullet
453@item @code{CONFIGURE_SCHEDULER_USER_ENTRY_POINTS} must be defined with the set of methods which implement this scheduler. 
454
455@item @code{CONFIGURE_MEMORY_FOR_SCHEDULER} must be defined with the
456amount of memory required as a base amount for the scheduler.
457
458@item @code{CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER(_tasks)} must be
459defined as a formula which computes the amount of memory required based upon the number of tasks configured.
460
461@end itemize
462
463At this time, the mechanics and requirements for writing a new
464scheduler are evolving and not fully documented.  It is recommended
465that you look at the existing Deterministic Priority Scheduler
466in @code{cpukit/score/src/schedulerpriority*.c} for guidance.
467For guidance on the configuration macros, please examine
468@code{cpukit/sapi/include/confdefs.h} for how these are defined for the
469Deterministic Priority Scheduler.
470
471@c
472@c
473@c
474@subsection SMP Specific Configuration Parameters
475
476When RTEMS is configured to support SMP target systems, there are other
477configuration parameters which apply.
478
479@itemize @bullet
480
481@findex CONFIGURE_SMP_APPLICATION
482@item @code{CONFIGURE_SMP_APPLICATION} must be defined if the application
483is to make use of multiple CPU cores in an SMP target system.
484
485@item @code{CONFIGURE_SMP_MAXIMUM_PROCESSORS} must be set to the number
486of CPU cores in the SMP configuration.  If there are more cores available
487than configured, the rest will be ignored.
488
489@end itemize
490
491@c
492@c
493@c
494@subsection Device Driver Table
495
496This section defines the configuration parameters related
497to the automatic generation of a Device Driver Table.  As
498@code{rtems/confdefs.h} only is aware of a small set of
499standard device drivers, the generated Device Driver
500Table is suitable for simple applications with no
501custom device drivers.
502
503@itemize @bullet
504@findex CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
505@item @code{CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE} is defined if
506the application wishes to provide their own Device Driver Table.
507The table generated is an array of @code{rtems_driver_address_table}
508entries named @code{Device_drivers}.  By default, this is not
509defined indicating the @code{rtems/confdefs.h} is providing the
510device driver table.
511
512@findex CONFIGURE_MAXIMUM_DRIVERS
513@item @code{CONFIGURE_MAXIMUM_DRIVERS} is defined
514as the number of device drivers per node.  By default, this is
515set to 10.
516
517@findex CONFIGURE_MAXIMUM_DEVICES
518@item @code{CONFIGURE_MAXIMUM_DEVICES} is defined
519to the number of individual devices that may be registered
520in the system.  By default, this is set to 4.
521
522@findex CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
523@item @code{CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER}
524is defined
525if the application wishes to include the Console Device Driver.
526This device driver is responsible for providing standard input
527and output using "/dev/console".  By default, this is not
528defined.
529
530@findex CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
531@item @code{CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER}
532is defined
533if the application wishes to include the Clock Device Driver.
534This device driver is responsible for providing a regular
535interrupt which invokes the @code{rtems_clock_tick} directive.
536By default, this is not defined.
537
538@findex CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
539@item @code{CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER}
540is defined if the application wishes to include the Timer Driver.
541This device driver is used to benchmark execution times
542by the RTEMS Timing Test Suites.  By default, this is not
543defined.
544
545@findex CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
546@item @code{CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER} is defined
547when the application does @b{NOT} want the Clock Device Driver
548and is @b{NOT} using the Timer Driver.  The inclusion or
549exclusion of the Clock Driver must be explicit in typical
550user applications.  This is intended to prevent the common
551user error of using the Hello World example as the baseline
552for an application and leaving out a clock tick source.
553
554@findex CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
555@item @code{CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER}
556is defined if the application wishes to include the Real-Time Clock Driver.
557By default, this is not defined.
558
559@findex CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
560@item @code{CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER}
561is defined if the application wishes to include the Watchdog Driver.
562By default, this is not defined.
563
564@findex CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
565@item @code{CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER}
566is defined
567if the application wishes to include the BSP's Frame Buffer Device Driver.
568Most BSPs do not provide a Frame Buffer Device Driver.  If this is
569defined and the BSP does not have this device driver, then the user
570will get a link time error for an undefined symbol.
571By default, this is not defined.
572
573@findex CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
574@item @code{CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER}
575is defined if the application wishes to include the Stub Device Driver.
576This device driver simply provides entry points that return
577successful and is primarily a test fixture.
578By default, this is not defined.
579
580@findex CONFIGURE_BSP_PREREQUISITE_DRIVERS
581@item @code{CONFIGURE_BSP_PREREQUISITE_DRIVERS} is defined if the
582BSP has device drivers it needs to include in the Device Driver
583Table.  This should be defined to the set of device driver entries that
584will be placed in the table at the @b{FRONT} of the Device Driver Table
585and initialized before any other drivers @b{INCLUDING} any application
586prerequisite drivers.  By default,this is not defined.
587
588@findex CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
589@item @code{CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS} is defined if the
590application has device drivers it needs to include in the Device Driver
591Table.  This should be defined to the set of device driver entries that
592will be placed in the table at the @b{FRONT} of the Device Driver Table
593and initialized before any other drivers @b{EXCEPT} any BSP prerequisite
594drivers.  By default,this is not defined.
595
596@findex CONFIGURE_APPLICATION_EXTRA_DRIVERS
597@item @code{CONFIGURE_APPLICATION_EXTRA_DRIVERS} is defined if the
598application has device drivers it needs to include in the Device Driver
599Table.  This should be defined to the set of device driver entries that
600will be placed in the table at the @b{END} of the Device Driver Table.
601By default,this is not defined.
602
603@end itemize
604
605@subsection Multiprocessing Configuration
606
607This section defines the multiprocessing related
608system configuration parameters supported by @code{rtems/confdefs.h}.
609This class of Configuration Constants are only applicable if
610@code{CONFIGURE_MP_APPLICATION} is defined.
611
612@itemize @bullet
613@findex CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE
614@item @code{CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE} is defined
615if the application wishes to provide their own Multiprocessing
616Configuration Table.  The generated table is named
617@code{Multiprocessing_configuration}.  By default, this
618is not defined.
619
620@findex CONFIGURE_MP_NODE_NUMBER
621@item @code{CONFIGURE_MP_NODE_NUMBER} is the node number of
622this node in a multiprocessor system.  The default node number
623is @code{NODE_NUMBER} which is set directly in RTEMS test Makefiles.
624
625@findex CONFIGURE_MP_MAXIMUM_NODES
626@item @code{CONFIGURE_MP_MAXIMUM_NODES} is the maximum number
627of nodes in a multiprocessor system.  The default is 2.
628
629@findex CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
630@item @code{CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS}
631is the maximum number
632of concurrently active global objects in a multiprocessor
633system.  The default is 32.
634
635@findex CONFIGURE_MP_MAXIMUM_PROXIES
636@item @code{CONFIGURE_MP_MAXIMUM_PROXIES} is the maximum number
637of concurrently active thread/task proxies in a multiprocessor
638system.  The default is 32.
639
640@findex CONFIGURE_MP_MPCI_TABLE_POINTER
641@item @code{CONFIGURE_MP_MPCI_TABLE_POINTER} is the pointer
642to the MPCI Configuration Table.  The default value of
643this field is @code{&MPCI_table}.
644@end itemize
645
646@subsection Classic API Configuration
647
648This section defines the Classic API related
649system configuration parameters supported by @code{rtems/confdefs.h}.
650
651@itemize @bullet
652@findex CONFIGURE_MAXIMUM_TASKS
653@item @code{CONFIGURE_MAXIMUM_TASKS} is the maximum number of
654Classic API tasks that can be concurrently active.
655The default for this field is 0.
656
657@findex CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
658@item @code{CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS} should be defined
659if the user does not want to have support for Classic API Notepads
660in their application.  By default, this is not defined and Classic API
661Notepads are supported.
662
663@findex CONFIGURE_MAXIMUM_TIMERS
664@item @code{CONFIGURE_MAXIMUM_TIMERS} is the maximum number of
665Classic API timers that can be concurrently active.
666The default for this field is 0.
667
668@findex CONFIGURE_MAXIMUM_SEMAPHORES
669@item @code{CONFIGURE_MAXIMUM_SEMAPHORES} is the maximum number of
670Classic API semaphores that can be concurrently active.
671The default for this field is 0.
672
673@findex CONFIGURE_MAXIMUM_MESSAGE_QUEUES
674@item @code{CONFIGURE_MAXIMUM_MESSAGE_QUEUES} is the maximum number of
675Classic API message queues that can be concurrently active.
676The default for this field is 0.
677
678@findex CONFIGURE_MAXIMUM_PARTITIONS
679@item @code{CONFIGURE_MAXIMUM_PARTITIONS} is the maximum number of
680Classic API partitions that can be concurrently active.
681The default for this field is 0.
682
683@findex CONFIGURE_MAXIMUM_REGIONS
684@item @code{CONFIGURE_MAXIMUM_REGIONS} is the maximum number of
685Classic API regions that can be concurrently active.
686The default for this field is 0.
687
688@findex CONFIGURE_MAXIMUM_PORTS
689@item @code{CONFIGURE_MAXIMUM_PORTS} is the maximum number of
690Classic API ports that can be concurrently active.
691The default for this field is 0.
692
693@findex CONFIGURE_MAXIMUM_PERIODS
694@item @code{CONFIGURE_MAXIMUM_PERIODS} is the maximum number of
695Classic API rate monotonic periods that can be concurrently active.
696The default for this field is 0.
697
698@findex CONFIGURE_MAXIMUM_USER_EXTENSIONS
699@item @code{CONFIGURE_MAXIMUM_USER_EXTENSIONS} is the maximum number of
700Classic API user extensions that can be concurrently active.
701The default for this field is 0.
702
703@end itemize
704
705@subsection Classic API Initialization Tasks Table Configuration
706
707The @code{rtems/confdefs.h} configuration system can automatically
708generate an Initialization Tasks Table named
709@code{Initialization_tasks} with a single entry.  The following
710parameters control the generation of that table.
711
712@itemize @bullet
713@findex CONFIGURE_RTEMS_INIT_TASKS_TABLE
714@item @code{CONFIGURE_RTEMS_INIT_TASKS_TABLE} is defined
715if the user wishes to use a Classic RTEMS API Initialization
716Task Table.  The application may choose to use the initialization
717tasks or threads table from another API.  By default, this
718field is not defined as the user MUST select their own
719API for initialization tasks.
720
721@findex CONFIGURE_HAS_OWN_INIT_TASK_TABLE
722@item @code{CONFIGURE_HAS_OWN_INIT_TASK_TABLE} is defined
723if the user wishes to define their own Classic API Initialization
724Tasks Table.  This table should be named @code{Initialization_tasks}.
725By default, this is not defined.
726
727@findex CONFIGURE_INIT_TASK_NAME
728@item @code{CONFIGURE_INIT_TASK_NAME} is the name
729of the single initialization task defined by the
730Classic API Initialization Tasks Table.  By default
731the value is @code{rtems_build_name( 'U', 'I', '1', ' ' )}.
732
733@findex CONFIGURE_INIT_TASK_STACK_SIZE
734@item @code{CONFIGURE_INIT_TASK_STACK_SIZE}
735is the stack size
736of the single initialization task defined by the
737Classic API Initialization Tasks Table.  By default
738value is the configured minimum stack size.
739
740@findex CONFIGURE_INIT_TASK_PRIORITY
741@item @code{CONFIGURE_INIT_TASK_PRIORITY}
742is the initial priority
743of the single initialization task defined by the
744Classic API Initialization Tasks Table.  By default
745the value is 1 which is the highest priority
746in the Classic API.
747
748@findex CONFIGURE_INIT_TASK_ATTRIBUTES
749@item @code{CONFIGURE_INIT_TASK_ATTRIBUTES}
750is the task attributes
751of the single initialization task defined by the
752Classic API Initialization Tasks Table.  By default
753the value is @code{RTEMS_DEFAULT_ATTRIBUTES}.
754
755@findex CONFIGURE_INIT_TASK_ENTRY_POINT
756@item @code{CONFIGURE_INIT_TASK_ENTRY_POINT}
757is the entry point (a.k.a. function name)
758of the single initialization task defined by the
759Classic API Initialization Tasks Table.  By default
760the value is @code{Init}.
761
762@findex CONFIGURE_INIT_TASK_INITIAL_MODES
763@item @code{CONFIGURE_INIT_TASK_INITIAL_MODES}
764is the initial execution mode
765of the single initialization task defined by the
766Classic API Initialization Tasks Table.  By default
767the value is @code{RTEMS_NO_PREEMPT}.
768
769@findex CONFIGURE_INIT_TASK_ARGUMENTS
770@item @code{CONFIGURE_INIT_TASK_ARGUMENTS}
771is the task argument
772of the single initialization task defined by the
773Classic API Initialization Tasks Table.  By default
774the value is 0.
775
776@end itemize
777
778
779@subsection POSIX API Configuration
780
781The parameters in this section are used to configure resources
782for the RTEMS POSIX API.  They are only relevant if the POSIX API
783is enabled at configure time using the @code{--enable-posix} option.
784
785@itemize @bullet
786@findex CONFIGURE_MAXIMUM_POSIX_THREADS
787@item @code{CONFIGURE_MAXIMUM_POSIX_THREADS} is the maximum number of
788POSIX API threads that can be concurrently active.
789The default is 0.
790
791@findex CONFIGURE_MAXIMUM_POSIX_MUTEXES
792@item @code{CONFIGURE_MAXIMUM_POSIX_MUTEXES} is the maximum number of
793POSIX API mutexes that can be concurrently active.
794The default is 0.
795
796@findex CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
797@item @code{CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES} is the maximum number of
798POSIX API condition variables that can be concurrently active.
799The default is 0.
800
801@findex CONFIGURE_MAXIMUM_POSIX_KEYS
802@item @code{CONFIGURE_MAXIMUM_POSIX_KEYS} is the maximum number of
803POSIX API keys that can be concurrently active.
804The default is 0.
805
806@findex CONFIGURE_MAXIMUM_POSIX_TIMERS
807@item @code{CONFIGURE_MAXIMUM_POSIX_TIMERS} is the maximum number of
808POSIX API timers that can be concurrently active.
809The default is 0.
810
811@findex CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
812@item @code{CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS} is the maximum number of
813POSIX API queued signals that can be concurrently active.
814The default is 0.
815
816@findex CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
817@item @code{CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES} is the maximum number of
818POSIX API message queues that can be concurrently active.
819The default is 0.
820
821@findex CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
822@item @code{CONFIGURE_MAXIMUM_POSIX_SEMAPHORES} is the maximum number of
823POSIX API semaphores that can be concurrently active.
824The default is 0.
825
826@end itemize
827
828@subsection POSIX Initialization Threads Table Configuration
829
830The @code{rtems/confdefs.h} configuration system can automatically
831generate a POSIX Initialization Threads Table named
832@code{POSIX_Initialization_threads} with a single entry.  The following
833parameters control the generation of that table.
834
835@itemize @bullet
836@findex CONFIGURE_POSIX_INIT_THREAD_TABLE
837@item @code{CONFIGURE_POSIX_INIT_THREAD_TABLE}
838is defined
839if the user wishes to use a POSIX API Initialization
840Threads Table.  The application may choose to use the initialization
841tasks or threads table from another API.  By default, this
842field is not defined as the user MUST select their own
843API for initialization tasks.
844
845@findex CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
846@item @code{CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE}
847is defined if the user wishes to define their own POSIX API Initialization
848Threads Table.  This table should be named @code{POSIX_Initialization_threads}.
849By default, this is not defined.
850
851@findex CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
852@item @code{CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT}
853is the entry point (a.k.a. function name)
854of the single initialization thread defined by the
855POSIX API Initialization Threads Table.  By default
856the value is @code{POSIX_Init}.
857
858@findex CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
859@item @code{CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE}
860is the stack size of the single initialization thread defined by the
861POSIX API Initialization Threads Table.  By default
862value is twice the configured minimum stack size.
863
864@end itemize
865
866@subsection Ada Tasks
867
868This section defines the system configuration parameters supported
869by @code{rtems/confdefs.h} related to configuring RTEMS to support
870a task using Ada tasking with GNAT.
871
872@itemize @bullet
873@findex CONFIGURE_GNAT_RTEMS
874@item @code{CONFIGURE_GNAT_RTEMS} is defined to inform
875RTEMS that the GNAT Ada run-time is to be used by the
876application.  This configuration parameter is critical
877as it makes @code{rtems/confdefs.h} configure the resources
878(mutexes and keys) used implicitly by the GNAT run-time.
879By default, this parameter is not defined.
880
881@findex CONFIGURE_MAXIMUM_ADA_TASKS
882@item @code{CONFIGURE_MAXIMUM_ADA_TASKS} is the
883number of Ada tasks that can be concurrently active
884in the system.  By default, when @code{CONFIGURE_GNAT_RTEMS}
885is defined, this is set to 20.
886
887@findex CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
888@item @code{CONFIGURE_MAXIMUM_FAKE_ADA_TASKS} is
889the number of "fake" Ada tasks that can be concurrently
890active in the system.  A "fake" Ada task is a non-Ada
891task that makes calls back into Ada code and thus
892implicitly uses the Ada run-time.
893
894@end itemize
895
896@section Configuration Data Structures
897
898It is recommended that applications be configured using
899@code{rtems/confdefs.h} as it is simpler and insulates applications from
900changes in the underlying data structures.  However, it is sometimes
901important to understand the data structures that are automatically filled
902in by the configuration parameters.  This section describes the primary
903configuration data structures.
904
905@subsection Configuration Table
906
907@cindex Configuration Table
908@cindex RTEMS Configuration Table
909
910The RTEMS Configuration Table is used to tailor an
911application for its specific needs.  For example, the user can
912configure the number of device drivers or which APIs may be used.
913THe address of the user-defined Configuration Table is passed as an
914argument to the @code{rtems_initialize_executive}
915directive, which MUST be the first RTEMS directive called. 
916The RTEMS Configuration Table is defined in the following C structure:
917
918@findex rtems_configuration_table
919@example
920@group
921typedef struct @{
922  void                           *work_space_start;
923  uintptr_t                       work_space_size;
924  uint32_t                        maximum_extensions;
925  uint32_t                        microseconds_per_tick;
926  uint32_t                        ticks_per_timeslice;
927  uint32_t                        scheduler_policy;
928  void                          (*idle_task)( void );
929  uint32_t                        idle_task_stack_size;
930  uint32_t                        interrupt_stack_size;
931  void *                        (*stack_allocate_hook)( size_t );
932  void                          (*stack_free_hook)( void * );
933  bool                            do_zero_of_workspace;
934  uint32_t                        maximum_drivers;
935  uint32_t                        number_of_device_drivers;
936  rtems_driver_address_table     *Device_driver_table;
937  uint32_t                        number_of_initial_extensions;
938  rtems_extensions_table         *User_extension_table;
939#if defined(RTEMS_MULTIPROCESSING)
940  rtems_multiprocessing_table    *User_multiprocessing_table;
941#endif
942  rtems_api_configuration_table  *RTEMS_api_configuration;
943  posix_api_configuration_table  *POSIX_api_configuration;
944@} rtems_configuration_table;
945@end group
946@end example
947
948@table @b
949@item work_space_start
950is the address of the RTEMS RAM Workspace. 
951This area contains items such as the
952various object control blocks (TCBs, QCBs, ...) and task stacks.
953If the address is not aligned on a four-word boundary, then
954RTEMS will invoke the fatal error handler during
955@code{rtems_initialize_executive}.
956When using the @code{rtems/confdefs.h} mechanism for configuring
957an RTEMS application, the value for this field corresponds
958to the setting of the macro @code{CONFIGURE_EXECUTIVE_RAM_WORK_AREA}
959which defaults to @code{NULL}.  Normally, this field should be
960configured as @code{NULL} as BSPs will assign memory for the
961RTEMS RAM Workspace as part of system initialization.
962
963@item work_space_size
964is the calculated size of the
965RTEMS RAM Workspace.  The section Sizing the RTEMS RAM Workspace
966details how to arrive at this number.
967When using the @code{rtems/confdefs.h} mechanism for configuring
968an RTEMS application, the value for this field corresponds
969to the setting of the macro @code{CONFIGURE_EXECUTIVE_RAM_SIZE}
970and is calculated based on the other system configuration settings.
971
972@item microseconds_per_tick
973is number of microseconds per clock tick.
974When using the @code{rtems/confdefs.h} mechanism for configuring
975an RTEMS application, the value for this field corresponds
976to the setting of the macro @code{CONFIGURE_MICROSECONDS_PER_TICK}.
977If not defined by the application, then the
978@code{CONFIGURE_MICROSECONDS_PER_TICK} macro defaults to 10000
979(10 milliseconds).
980
981@item ticks_per_timeslice
982is the number of clock ticks for a timeslice.
983When using the @code{rtems/confdefs.h} mechanism for configuring
984an RTEMS application, the value for this field corresponds
985to the setting of the macro @code{CONFIGURE_TICKS_PER_TIMESLICE}.
986
987@item scheduler_policy
988is the algorithm to use for task scheduling.
989When using the @code{rtems/confdefs.h} mechanism for configuring
990an RTEMS application, the value for this field corresponds
991to the setting of the macro @code{CONFIGURE_SCHEDULER_POLICY}.
992
993@item idle_task
994is the address of the optional user
995provided routine which is used as the system's IDLE task.  If
996this field is not NULL, then the RTEMS default IDLE task is not
997used.  This field may be NULL to indicate that the default IDLE
998is to be used.  When using the @code{rtems/confdefs.h} mechanism
999for configuring an RTEMS application, the value for this field
1000corresponds to the setting of the macro @code{CONFIGURE_IDLE_TASK_BODY}.
1001
1002@item idle_task_stack_size
1003is the size of the RTEMS idle task stack in bytes.  If this number is less
1004than the configured minimum stack size, then the idle task's stack will
1005be set to the minimum.  When using the @code{rtems/confdefs.h} mechanism
1006for configuring an RTEMS application, the value for this field corresponds
1007to the setting of the macro @code{CONFIGURE_IDLE_TASK_STACK_SIZE}.
1008
1009@item interrupt_stack_size
1010is the size of the RTEMS interrupt stack in bytes.  If this number is less
1011than configured minimum stack size, then the interrupt stack will be set
1012to the minimum.  When using the @code{rtems/confdefs.h} mechanism for
1013configuring an RTEMS application, the value for this field corresponds
1014to the setting of the macro @code{CONFIGURE_INTERRUPT_STACK_SIZE}.
1015
1016@item stack_allocate_hook
1017may point to a user provided routine to allocate task stacks.
1018The default is to allocate task stacks from the RTEMS Workspace.
1019When using the @code{rtems/confdefs.h} mechanism
1020for configuring an RTEMS application, the value for this field
1021corresponds to the setting of the macro
1022@code{CONFIGURE_TASK_STACK_ALLOCATOR}.
1023
1024@item stack_free_hook
1025may point to a user provided routine to free task stacks.
1026The default is to allocate task stacks from the RTEMS Workspace.
1027When using the @code{rtems/confdefs.h} mechanism
1028for configuring an RTEMS application, the value for this field
1029corresponds to the setting of the macro
1030@code{CONFIGURE_TASK_STACK_DEALLOCATOR}.
1031
1032@item do_zero_of_workspace
1033indicates whether RTEMS should zero the RTEMS Workspace and
1034C Program Heap as part of its initialization.  If set to
1035TRUE, the Workspace is zeroed.  Otherwise, it is not.
1036When using the @code{rtems/confdefs.h} mechanism
1037for configuring an RTEMS application, the value for this field
1038corresponds to the setting of the macro
1039@code{CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY}.
1040
1041@item maximum_drivers
1042is the maximum number of device drivers that can be registered.
1043When using the @code{rtems/confdefs.h} mechanism for configuring
1044an RTEMS application, the value for this field corresponds
1045to the setting of the macro @code{CONFIGURE_MAXIMUM_DRIVERS}.
1046
1047@item number_of_device_drivers
1048is the number of device drivers for the system.  There should be
1049the same number of entries in the Device Driver Table.  If this field
1050is zero, then the @code{User_driver_address_table} entry should be NULL.
1051When using the @code{rtems/confdefs.h} mechanism for configuring
1052an RTEMS application, the value for this field is calculated
1053automatically based on the number of entries in the
1054Device Driver Table.  This calculation is based on the assumption
1055that the Device Driver Table is named @code{Device_drivers}
1056and defined in C.  This table may be generated automatically
1057for simple applications using only the device drivers that correspond
1058to the following macros:
1059
1060@itemize @bullet
1061
1062@item @code{CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER}
1063@item @code{CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER}
1064@item @code{CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER}
1065@item @code{CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER}
1066@item @code{CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER}
1067
1068@end itemize
1069
1070Note that network device drivers are not configured in the
1071Device Driver Table.
1072
1073@item Device_driver_table
1074is the address of the Device Driver Table.  This table contains the entry
1075points for each device driver.  If the number_of_device_drivers field is zero,
1076then this entry should be NULL. The format of this table will be
1077discussed below.
1078When using the @code{rtems/confdefs.h} mechanism for configuring
1079an RTEMS application, the Device Driver Table is assumed to be
1080named @code{Device_drivers} and defined in C.  If the application is providing
1081its own Device Driver Table, then the macro
1082@code{CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE} must be defined to indicate
1083this and prevent @code{rtems/confdefs.h} from generating the table.
1084
1085@item number_of_initial_extensions
1086is the number of initial user extensions.  There should be
1087the same number of entries as in the User_extension_table.  If this field
1088is zero, then the User_driver_address_table entry should be NULL.
1089When using the @code{rtems/confdefs.h} mechanism for configuring
1090an RTEMS application, the value for this field corresponds
1091to the setting of the macro @code{CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS}
1092which is set automatically by @code{rtems/confdefs.h} based on the size
1093of the User Extensions Table.
1094
1095@item User_extension_table
1096is the address of the User
1097Extension Table.  This table contains the entry points for the
1098static set of optional user extensions.  If no user extensions
1099are configured, then this entry should be NULL.  The format of
1100this table will be discussed below.
1101When using the @code{rtems/confdefs.h} mechanism for configuring
1102an RTEMS application, the User Extensions Table is named
1103@code{Configuration_Initial_Extensions} and defined in
1104confdefs.h.  It is initialized based on the following
1105macros:
1106
1107@itemize @bullet
1108
1109@item @code{CONFIGURE_INITIAL_EXTENSIONS}
1110@item @code{STACK_CHECKER_EXTENSION}
1111
1112@end itemize
1113
1114The application may configure one or more initial user extension
1115sets by setting the @code{CONFIGURE_INITIAL_EXTENSIONS} macro.  By
1116defining the @code{STACK_CHECKER_EXTENSION} macro, the task stack bounds
1117checking user extension set is automatically included in the
1118application.
1119
1120@item User_multiprocessing_table
1121is the address of the Multiprocessor Configuration Table.  This
1122table contains information needed by RTEMS only when used in a multiprocessor
1123configuration.  This field must be NULL when RTEMS is used in a
1124single processor configuration.
1125When using the @code{rtems/confdefs.h} mechanism for configuring
1126an RTEMS application, the Multiprocessor Configuration Table
1127is automatically generated when the @code{CONFIGURE_MP_APPLICATION}
1128is defined.  If @code{CONFIGURE_MP_APPLICATION} is not defined, the this
1129entry is set to NULL.  The generated table has the name
1130@code{Multiprocessing_configuration}.
1131
1132@item RTEMS_api_configuration
1133is the address of the RTEMS API Configuration Table.  This table
1134contains information needed by the RTEMS API.  This field should be
1135NULL if the RTEMS API is not used.  [NOTE: Currently the RTEMS API
1136is required to support support components such as BSPs and libraries
1137which use this API.]  This table is built automatically and this
1138entry filled in, if using the @code{rtems/confdefs.h} application
1139configuration mechanism.  The generated table has the name
1140@code{Configuration_RTEMS_API}.
1141
1142@item POSIX_api_configuration
1143is the address of the POSIX API Configuration Table.  This table
1144contains information needed by the POSIX API.  This field should be
1145NULL if the POSIX API is not used.  This table is built automatically
1146and this entry filled in, if using the @code{rtems/confdefs.h} application
1147configuration mechanism.  The @code{rtems/confdefs.h} application
1148mechanism will fill this field in with the address of the
1149@code{Configuration_POSIX_API} table of POSIX API is configured
1150and NULL if the POSIX API is not configured.
1151
1152@end table
1153
1154@subsection RTEMS API Configuration Table
1155
1156@cindex RTEMS API Configuration Table
1157
1158The RTEMS API Configuration Table is used to configure the
1159managers which constitute the RTEMS API for a particular application. 
1160For example, the user can configure the maximum number of tasks for
1161this application. The RTEMS API Configuration Table is defined in
1162the following C structure:
1163
1164@findex rtems_api_configuration_table
1165@example
1166@group
1167typedef struct @{
1168  uint32_t  maximum_tasks;
1169  uint32_t  maximum_timers;
1170  uint32_t  maximum_semaphores;
1171  uint32_t  maximum_message_queues;
1172  uint32_t  maximum_partitions;
1173  uint32_t  maximum_regions;
1174  uint32_t  maximum_ports;
1175  uint32_t  maximum_periods;
1176  uint32_t  maximum_barriers;
1177  uint32_t  number_of_initialization_tasks;
1178  rtems_initialization_tasks_table *User_initialization_tasks_table;
1179@} rtems_api_configuration_table;
1180@end group
1181@end example
1182
1183@table @b
1184@item maximum_tasks
1185is the maximum number of tasks that
1186can be concurrently active (created) in the system including
1187initialization tasks.
1188When using the @code{rtems/confdefs.h} mechanism for configuring
1189an RTEMS application, the value for this field corresponds
1190to the setting of the macro @code{CONFIGURE_MAXIMUM_TASKS}.
1191If not defined by the application, then the @code{CONFIGURE_MAXIMUM_TASKS}
1192macro defaults to 0.
1193
1194@item maximum_timers
1195is the maximum number of timers
1196that can be concurrently active in the system.
1197When using the @code{rtems/confdefs.h} mechanism for configuring
1198an RTEMS application, the value for this field corresponds
1199to the setting of the macro @code{CONFIGURE_MAXIMUM_TIMERS}.
1200If not defined by the application, then the @code{CONFIGURE_MAXIMUM_TIMERS}
1201macro defaults to 0.
1202
1203@item maximum_semaphores
1204is the maximum number of
1205semaphores that can be concurrently active in the system.
1206When using the @code{rtems/confdefs.h} mechanism for configuring
1207an RTEMS application, the value for this field corresponds
1208to the setting of the macro @code{CONFIGURE_MAXIMUM_SEMAPHORES}.
1209If not defined by the application, then the @code{CONFIGURE_MAXIMUM_SEMAPHORES}
1210macro defaults to 0.
1211
1212@item maximum_message_queues
1213is the maximum number of
1214message queues that can be concurrently active in the system.
1215When using the @code{rtems/confdefs.h} mechanism for configuring
1216an RTEMS application, the value for this field corresponds
1217to the setting of the macro @code{CONFIGURE_MAXIMUM_MESSAGE_QUEUES}.
1218If not defined by the application, then the
1219@code{CONFIGURE_MAXIMUM_MESSAGE_QUEUES} macro defaults to 0.
1220
1221@item maximum_partitions
1222is the maximum number of
1223partitions that can be concurrently active in the system.
1224When using the @code{rtems/confdefs.h} mechanism for configuring
1225an RTEMS application, the value for this field corresponds
1226to the setting of the macro @code{CONFIGURE_MAXIMUM_PARTITIONS}.
1227If not defined by the application, then the @code{CONFIGURE_MAXIMUM_PARTITIONS}
1228macro defaults to 0.
1229
1230@item maximum_regions
1231is the maximum number of regions
1232that can be concurrently active in the system.
1233When using the @code{rtems/confdefs.h} mechanism for configuring
1234an RTEMS application, the value for this field corresponds
1235to the setting of the macro @code{CONFIGURE_MAXIMUM_REGIONS}.
1236If not defined by the application, then the @code{CONFIGURE_MAXIMUM_REGIONS}
1237macro defaults to 0.
1238
1239@item maximum_ports
1240is the maximum number of ports into
1241dual-port memory areas that can be concurrently active in the
1242system.
1243When using the @code{rtems/confdefs.h} mechanism for configuring
1244an RTEMS application, the value for this field corresponds
1245to the setting of the macro @code{CONFIGURE_MAXIMUM_PORTS}.
1246If not defined by the application, then the @code{CONFIGURE_MAXIMUM_PORTS}
1247macro defaults to 0.
1248
1249@item number_of_initialization_tasks
1250is the number of initialization tasks configured.  At least one
1251RTEMS initialization task or POSIX initializatin must be configured
1252in order for the user's application to begin executing.
1253When using the @code{rtems/confdefs.h} mechanism for configuring
1254an RTEMS application, the user must define the
1255@code{CONFIGURE_RTEMS_INIT_TASKS_TABLE} to indicate that there
1256is one or more RTEMS initialization task.  If the application
1257only has one RTEMS initialization task, then the automatically
1258generated Initialization Task Table will be sufficient.  The following
1259macros correspond to the single initialization task:
1260 
1261@itemize @bullet
1262
1263@item @code{CONFIGURE_INIT_TASK_NAME} - is the name of the task. 
1264If this macro is not defined by the application, then this defaults
1265to the task name of @code{"UI1 "} for User Initialization Task 1.
1266
1267@item @code{CONFIGURE_INIT_TASK_STACK_SIZE} - is the stack size
1268of the single initialization task.  If this macro is not defined
1269by the application, then this defaults to configured minimum
1270stack size.
1271
1272@item @code{CONFIGURE_INIT_TASK_PRIORITY} - is the initial priority
1273of the single initialization task.  If this macro is not defined
1274by the application, then this defaults to 1.
1275
1276@item @code{CONFIGURE_INIT_TASK_ATTRIBUTES} - is the attributes
1277of the single initialization task.  If this macro is not defined
1278by the application, then this defaults to @code{RTEMS_DEFAULT_ATTRIBUTES}.
1279
1280@item @code{CONFIGURE_INIT_TASK_ENTRY_POINT} - is the entry point
1281of the single initialization task.  If this macro is not defined
1282by the application, then this defaults to the C language routine
1283@code{Init}.
1284
1285@item @code{CONFIGURE_INIT_TASK_INITIAL_MODES} - is the initial execution
1286modes of the single initialization task.  If this macro is not defined
1287by the application, then this defaults to @code{RTEMS_NO_PREEMPT}.
1288
1289@item @code{CONFIGURE_INIT_TASK_ARGUMENTS} - is the argument passed to the
1290of the single initialization task.  If this macro is not defined
1291by the application, then this defaults to 0.
1292
1293
1294@end itemize
1295
1296
1297has the option to have
1298 value for this field corresponds
1299to the setting of the macro @code{}.
1300
1301@item User_initialization_tasks_table
1302is the address of the Initialization Task Table. This table contains the
1303information needed to create and start each of the
1304initialization tasks.  The format of this table will be discussed below.
1305When using the @code{rtems/confdefs.h} mechanism for configuring
1306an RTEMS application, the value for this field corresponds
1307to the setting of the macro @code{CONFIGURE_EXECUTIVE_RAM_WORK_AREA}.
1308
1309@end table
1310
1311@subsection POSIX API Configuration Table
1312
1313@cindex POSIX API Configuration Table
1314
1315The POSIX API Configuration Table is used to configure the
1316managers which constitute the POSIX API for a particular application.
1317For example, the user can configure the maximum number of threads for
1318this application. The POSIX API Configuration Table is defined in
1319the following C structure:
1320 
1321@findex posix_initialization_threads_table
1322@findex posix_api_configuration_table
1323@example
1324@group
1325typedef struct @{
1326  void       *(*thread_entry)(void *);
1327@} posix_initialization_threads_table;
1328 
1329typedef struct @{
1330  int                                 maximum_threads;
1331  int                                 maximum_mutexes;
1332  int                                 maximum_condition_variables;
1333  int                                 maximum_keys;
1334  int                                 maximum_timers;
1335  int                                 maximum_queued_signals;
1336  int                                 maximum_message_queues;
1337  int                                 maximum_message_queue_descriptors;
1338  int                                 maximum_semaphores;
1339  int                                 maximum_barriers;
1340  int                                 maximum_rwlocks;
1341  int                                 maximum_spinlocks;
1342  int                                 number_of_initialization_threads;
1343  posix_initialization_threads_table *User_initialization_tasks_table;
1344@} posix_api_configuration_table;
1345@end group
1346@end example
1347 
1348@table @b
1349@item maximum_threads
1350is the maximum number of threads that
1351can be concurrently active (created) in the system including
1352initialization threads.
1353When using the @code{rtems/confdefs.h} mechanism for configuring
1354an RTEMS application, the value for this field corresponds
1355to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_THREADS}.
1356If not defined by the application, then the
1357@code{CONFIGURE_MAXIMUM_POSIX_THREADS} macro defaults to 0.
1358
1359@item maximum_mutexes
1360is the maximum number of mutexes that can be concurrently
1361active in the system.
1362When using the @code{rtems/confdefs.h} mechanism for configuring
1363an RTEMS application, the value for this field corresponds
1364to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_MUTEXES}.
1365If not defined by the application, then the
1366@code{CONFIGURE_MAXIMUM_POSIX_MUTEXES} macro defaults to 0.
1367
1368@item maximum_condition_variables
1369is the maximum number of condition variables that can be
1370concurrently active in the system.
1371When using the @code{rtems/confdefs.h} mechanism for configuring
1372an RTEMS application, the value for this field corresponds
1373to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES}.
1374If not defined by the application, then the
1375@code{CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES} macro defaults to 0.
1376
1377@item maximum_keys
1378is the maximum number of keys that can be concurrently active in the system.
1379When using the @code{rtems/confdefs.h} mechanism for configuring
1380an RTEMS application, the value for this field corresponds
1381to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_KEYS}.
1382If not defined by the application, then the
1383@code{CONFIGURE_MAXIMUM_POSIX_KEYS} macro defaults to 0.
1384
1385@item maximum_timers
1386is the maximum number of POSIX timers that can be concurrently active
1387in the system.
1388When using the @code{rtems/confdefs.h} mechanism for configuring
1389an RTEMS application, the value for this field corresponds
1390to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_TIMERS}.
1391If not defined by the application, then the
1392@code{CONFIGURE_MAXIMUM_POSIX_TIMERS} macro defaults to 0.
1393
1394@item maximum_queued_signals
1395is the maximum number of queued signals that can be concurrently
1396pending in the system.
1397When using the @code{rtems/confdefs.h} mechanism for configuring
1398an RTEMS application, the value for this field corresponds
1399to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS}.
1400If not defined by the application, then the
1401@code{CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS} macro defaults to 0.
1402
1403@item maximum_message_queues
1404is the maximum number of POSIX message queues that can be concurrently
1405active in the system.  When using the @code{rtems/confdefs.h}
1406mechanism for configuring an RTEMS application, the
1407value for this field corresponds to the setting of the macro
1408@code{CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES}.  If not defined by the
1409application, then the @code{CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES}
1410macro defaults to 0.
1411
1412@item maximum_message_queue_descriptors
1413is the maximum number of POSIX message queue descriptors
1414that can be concurrently active in the system.  When using the
1415@code{rtems/confdefs.h} mechanism for configuring an RTEMS application,
1416the value for this field corresponds to the setting of the macro
1417@code{CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS}.
1418If not defined by the application, then the
1419@code{CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS} macro defaults
1420to the value of @code{CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES}
1421
1422@item maximum_semaphores
1423is the maximum number of POSIX semaphore that can be concurrently
1424active in the system.  When using the @code{rtems/confdefs.h}
1425mechanism for configuring an RTEMS application, the
1426value for this field corresponds to the setting of the macro
1427@code{CONFIGURE_MAXIMUM_POSIX_SEMAPHORES}.  If not defined by the
1428application, then the @code{CONFIGURE_MAXIMUM_POSIX_SEMAPHORES}
1429macro defaults to 0.
1430
1431@item maximum_barriers
1432is the maximum number of POSIX barriers that can be concurrently
1433active in the system.  When using the @code{rtems/confdefs.h}
1434mechanism for configuring an RTEMS application, the
1435value for this field corresponds to the setting of the macro
1436@code{CONFIGURE_MAXIMUM_POSIX_BARRIERS}.  If not defined by the
1437application, then the @code{CONFIGURE_MAXIMUM_POSIX_BARRIERS}
1438macro defaults to 0.
1439
1440@item maximum_rwlocks
1441is the maximum number of POSIX rwlocks that can be concurrently
1442active in the system.  When using the @code{rtems/confdefs.h}
1443mechanism for configuring an RTEMS application, the
1444value for this field corresponds to the setting of the macro
1445@code{CONFIGURE_MAXIMUM_POSIX_SPINLOCKS}.  If not defined by the
1446application, then the @code{CONFIGURE_MAXIMUM_POSIX_SPINLOCKS}
1447macro defaults to 0.
1448
1449@item maximum_spinlocks
1450is the maximum number of POSIX spinlocks that can be concurrently
1451active in the system.  When using the @code{rtems/confdefs.h}
1452mechanism for configuring an RTEMS application, the
1453value for this field corresponds to the setting of the macro
1454@code{CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES}.  If not defined by the
1455application, then the @code{CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES}
1456macro defaults to 0.
1457
1458@item number_of_initialization_threads
1459is the number of initialization threads configured.  At least one
1460initialization threads must be configured.
1461When using the @code{rtems/confdefs.h} mechanism for configuring
1462an RTEMS application, the user must define the
1463@code{CONFIGURE_POSIX_INIT_THREAD_TABLE} to indicate that there
1464is one or more POSIX initialization thread.  If the application
1465only has one POSIX initialization thread, then the automatically
1466generated POSIX Initialization Thread Table will be sufficient.  The following
1467macros correspond to the single initialization task:
1468
1469@itemize @bullet
1470
1471@item @code{CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT} - is the entry
1472point of the thread.  If this macro is not defined by the application,
1473then this defaults to the C routine @code{POSIX_Init}.
1474
1475@item @code{CONFIGURE_POSIX_INIT_TASK_STACK_SIZE} - is the stack size
1476of the single initialization thread.  If this macro is not defined
1477by the application, then this defaults to twice the configured
1478minimum stack size.
1479
1480@end itemize
1481 
1482@item User_initialization_threads_table
1483is the address of the Initialization Threads Table. This table contains the
1484information needed to create and start each of the initialization threads. 
1485The format of each entry in this table is defined in the
1486@code{posix_initialization_threads_table} structure.
1487When using the @code{rtems/confdefs.h} mechanism for configuring
1488an RTEMS application, the value for this field corresponds
1489to the address of the @code{POSIX_Initialization_threads} structure.
1490
1491@end table
1492
1493@subsection CPU Dependent Information Table
1494
1495@cindex CPU Dependent Information Table
1496
1497The CPU Dependent Information Table is used to
1498describe processor dependent information required by RTEMS.
1499This table is generally used to supply RTEMS with information
1500only known by the Board Support Package.  The contents of this
1501table are discussed in the CPU Dependent Information Table
1502chapter of the Applications Supplement document for a specific
1503target processor.
1504
1505The @code{rtems/confdefs.h} mechanism does not support generating this
1506table.  It is normally filled in by the Board Support Package.
1507
1508@subsection Initialization Task Table
1509
1510@cindex Initialization Tasks Table
1511
1512The Initialization Task Table is used to describe
1513each of the user initialization tasks to the Initialization
1514Manager.  The table contains one entry for each initialization
1515task the user wishes to create and start.  The fields of this
1516data structure directly correspond to arguments to the
1517@code{@value{DIRPREFIX}task_create} and
1518@code{@value{DIRPREFIX}task_start} directives.  The number of entries is
1519found in the @code{number_of_initialization_tasks} entry in the
1520Configuration Table. 
1521
1522The format of each entry in the
1523Initialization Task Table is defined in the following C structure:
1524
1525@findex rtems_initialization_tasks_table
1526@example
1527typedef struct @{
1528  rtems_name           name;
1529  size_t               stack_size;
1530  rtems_task_priority  initial_priority;
1531  rtems_attribute      attribute_set;
1532  rtems_task_entry     entry_point;
1533  rtems_mode           mode_set;
1534  rtems_task_argument  argument;
1535@} rtems_initialization_tasks_table;
1536@end example
1537
1538@table @b
1539@item name
1540is the name of this initialization task.
1541
1542@item stack_size
1543is the size of the stack for this initialization task.
1544
1545@item initial_priority
1546is the priority of this initialization task.
1547
1548@item attribute_set
1549is the attribute set used during creation of this initialization task.
1550
1551@item entry_point
1552is the address of the entry point of this initialization task.
1553
1554@item mode_set
1555is the initial execution mode of this initialization task.
1556
1557@item argument
1558is the initial argument for this initialization task.
1559
1560@end table
1561
1562A typical declaration for an Initialization Task Table might appear as follows:
1563
1564@example
1565rtems_initialization_tasks_table
1566Initialization_tasks[2] = @{
1567   @{ INIT_1_NAME,
1568     1024,
1569     1,
1570     DEFAULT_ATTRIBUTES,
1571     Init_1,
1572     DEFAULT_MODES,
1573     1
1574
1575   @},
1576   @{ INIT_2_NAME,
1577     1024,
1578     250,
1579     FLOATING_POINT,
1580     Init_2,
1581     NO_PREEMPT,
1582     2
1583
1584   @}
1585@};
1586@end example
1587
1588@subsection Driver Address Table
1589
1590@cindex Device Driver Table
1591
1592The Device Driver Table is used to inform the I/O Manager of the set of
1593entry points for each device driver configured in the system.  The table
1594contains one entry for each device driver required by the application.
1595The number of entries is defined in the number_of_device_drivers entry
1596in the Configuration Table.  This table is copied to the Device Drive
1597Table during the IO Manager's initialization giving the entries in this
1598table the lower major numbers.  The format of each entry in the Device
1599Driver Table is defined in the following C structure:
1600
1601@findex rtems_driver_address_table
1602@example
1603typedef struct @{
1604  rtems_device_driver_entry initialization_entry;
1605  rtems_device_driver_entry open_entry;
1606  rtems_device_driver_entry close_entry;
1607  rtems_device_driver_entry read_entry;
1608  rtems_device_driver_entry write_entry;
1609  rtems_device_driver_entry control_entry;
1610@} rtems_driver_address_table;
1611@end example
1612
1613@table @b
1614@item initialization_entry
1615is the address of the entry point called by
1616@code{rtems_io_initialize}
1617to initialize a device driver and its associated devices.
1618
1619@item open_entry
1620is the address of the entry point called by @code{rtems_io_open}.
1621
1622@item close_entry
1623is the address of the entry point called by @code{rtems_io_close}.
1624
1625@item read_entry
1626is the address of the entry point called by @code{rtems_io_read}.
1627
1628@item write_entry
1629is the address of the entry point called by @code{rtems_io_write}.
1630
1631@item control_entry
1632is the address of the entry point called by @code{rtems_io_control}.
1633
1634@end table
1635
1636Driver entry points configured as NULL will always
1637return a status code of @code{@value{RPREFIX}SUCCESSFUL}.  No user code will be
1638executed in this situation.
1639
1640A typical declaration for a Device Driver Table might appear as follows:
1641
1642@example
1643rtems_driver_address_table Driver_table[2] = @{
1644   @{ tty_initialize, tty_open,  tty_close,  /* major = 0 */
1645     tty_read,       tty_write, tty_control
1646   @},
1647   @{ lp_initialize, lp_open,    lp_close,   /* major = 1 */
1648     NULL,          lp_write,   lp_control
1649   @}
1650@};
1651@end example
1652
1653More information regarding the construction and
1654operation of device drivers is provided in the I/O Manager
1655chapter.
1656
1657@subsection User Extensions Table
1658
1659@cindex User Extensions Table
1660
1661The User Extensions Table is used to inform RTEMS of
1662the optional user-supplied static extension set.  This table
1663contains one entry for each possible extension.  The entries are
1664called at critical times in the life of the system and
1665individual tasks.  The application may create dynamic extensions
1666in addition to this single static set.  The format of each entry
1667in the User Extensions Table is defined in the following C structure:
1668
1669@example
1670typedef void           rtems_extension;
1671typedef void (*rtems_task_create_extension)(
1672   Thread_Control * /* executing */,
1673   Thread_Control * /* created */
1674);
1675typedef void (*rtems_task_delete_extension)(
1676   Thread_Control * /* executing */,
1677   Thread_Control * /* deleted */
1678);
1679typedef void (*rtems_task_start_extension)(
1680   Thread_Control * /* executing */,
1681   Thread_Control * /* started */
1682);
1683typedef void (*rtems_task_restart_extension)(
1684   Thread_Control * /* executing */,
1685   Thread_Control * /* restarted */
1686);
1687typedef void (*rtems_task_switch_extension)(
1688   Thread_Control * /* executing */,
1689   Thread_Control * /* heir */
1690);
1691typedef void (*rtems_task_begin_extension)(
1692   Thread_Control * /* beginning */
1693);
1694typedef void (*rtems_task_exitted_extension)(
1695   Thread_Control * /* exiting */
1696);
1697typedef void (*rtems_fatal_extension)(
1698   Internal_errors_Source /* the_source */,
1699   bool                   /* is_internal */,
1700   uint32_t               /* the_error */
1701);
1702
1703typedef struct @{
1704  rtems_task_create_extension      thread_create;
1705  rtems_task_start_extension       thread_start;
1706  rtems_task_restart_extension     thread_restart;
1707  rtems_task_delete_extension      thread_delete;
1708  rtems_task_switch_extension      thread_switch;
1709  rtems_task_begin_extension       thread_begin;
1710  rtems_task_exitted_extension     thread_exitted;
1711  rtems_fatal_extension            fatal;
1712@} rtems_extensions_table;
1713@end example
1714
1715@table @b
1716
1717@item thread_create
1718is the address of the
1719user-supplied subroutine for the TASK_CREATE extension.  If this
1720extension for task creation is defined, it is called from the
1721task_create directive.  A value of NULL indicates that no
1722extension is provided.
1723
1724@item thread_start
1725is the address of the user-supplied
1726subroutine for the TASK_START extension.  If this extension for
1727task initiation is defined, it is called from the task_start
1728directive.  A value of NULL indicates that no extension is
1729provided.
1730
1731@item thread_restart
1732is the address of the user-supplied
1733subroutine for the TASK_RESTART extension.  If this extension
1734for task re-initiation is defined, it is called from the
1735task_restart directive.  A value of NULL indicates that no
1736extension is provided.
1737
1738@item thread_delete
1739is the address of the user-supplied
1740subroutine for the TASK_DELETE extension.  If this RTEMS
1741extension for task deletion is defined, it is called from the
1742task_delete directive.  A value of NULL indicates that no
1743extension is provided.
1744
1745@item thread_switch
1746is the address of the user-supplied
1747subroutine for the task context switch extension.  This
1748subroutine is called from RTEMS dispatcher after the current
1749task has been swapped out but before the new task has been
1750swapped in.  A value of NULL indicates that no extension is
1751provided.  As this routine is invoked after saving the current
1752task's context and before restoring the heir task's context, it
1753is not necessary for this routine to save and restore any
1754registers.
1755
1756@item thread_begin
1757is the address of the user-supplied
1758subroutine which is invoked immediately before a task begins
1759execution.  It is invoked in the context of the beginning task.
1760A value of NULL indicates that no extension is provided.
1761
1762@item thread_exitted
1763is the address of the user-supplied
1764subroutine which is invoked when a task exits.  This procedure
1765is responsible for some action which will allow the system to
1766continue execution (i.e. delete or restart the task) or to
1767terminate with a fatal error.  If this field is set to NULL, the
1768default RTEMS TASK_EXITTED handler will be invoked.
1769
1770@item fatal
1771is the address of the user-supplied
1772subroutine for the FATAL extension.  This RTEMS extension of
1773fatal error handling is called from the
1774@code{@value{DIRPREFIX}fatal_error_occurred}
1775directive.  If the user's fatal error handler returns or if this
1776entry is NULL then the default RTEMS fatal error handler will be
1777executed.
1778
1779@end table
1780
1781A typical declaration for a User Extension Table
1782which defines the TASK_CREATE, TASK_DELETE, TASK_SWITCH, and
1783FATAL extension might appear as follows:
1784
1785@example
1786rtems_extensions_table User_extensions = @{
1787   task_create_extension,
1788   NULL,
1789   NULL,
1790   task_delete_extension,
1791   task_switch_extension,
1792   NULL,
1793   NULL,
1794   fatal_extension
1795@};
1796@end example
1797
1798More information regarding the user extensions is
1799provided in the User Extensions chapter.
1800
1801@subsection Multiprocessor Configuration Table
1802
1803@cindex Multiprocessor Configuration Table
1804
1805The Multiprocessor Configuration Table contains
1806information needed when using RTEMS in a multiprocessor
1807configuration.  Many of the details associated with configuring
1808a multiprocessor system are dependent on the multiprocessor
1809communications layer provided by the user.  The address of the
1810Multiprocessor Configuration Table should be placed in the
1811@code{User_multiprocessing_table} entry in the primary Configuration
1812Table.  Further details regarding many of the entries in the
1813Multiprocessor Configuration Table will be provided in the
1814Multiprocessing chapter. 
1815
1816
1817When using the @code{rtems/confdefs.h} mechanism for configuring
1818an RTEMS application, the macro @code{CONFIGURE_MP_APPLICATION} must
1819be defined to automatically generate the Multiprocessor Configuration Table.
1820If @code{CONFIGURE_MP_APPLICATION}, is not defined, then a NULL pointer
1821is configured as the address of this table.
1822
1823The format of the Multiprocessor Configuration Table is defined in
1824the following C structure:
1825
1826@example
1827typedef struct @{
1828  uint32_t          node;
1829  uint32_t          maximum_nodes;
1830  uint32_t          maximum_global_objects;
1831  uint32_t          maximum_proxies;
1832  uint32_t          extra_mpci_receive_server_stack;
1833  rtems_mpci_table *User_mpci_table;
1834@} rtems_multiprocessing_table;
1835@end example
1836
1837@table @b
1838@item node
1839is a unique processor identifier
1840and is used in routing messages between nodes in a
1841multiprocessor configuration.  Each processor must have a unique
1842node number.  RTEMS assumes that node numbers start at one and
1843increase sequentially.  This assumption can be used to advantage
1844by the user-supplied MPCI layer.  Typically, this requirement is
1845made when the node numbers are used to calculate the address of
1846inter-processor communication links.  Zero should be avoided as
1847a node number because some MPCI layers use node zero to
1848represent broadcasted packets.  Thus, it is recommended that
1849node numbers start at one and increase sequentially.
1850When using the @code{rtems/confdefs.h} mechanism for configuring
1851an RTEMS application, the value for this field corresponds
1852to the setting of the macro @code{CONFIGURE_MP_NODE_NUMBER}.
1853If not defined by the application, then the @code{CONFIGURE_MP_NODE_NUMBER}
1854macro defaults to the value of the @code{NODE_NUMBER} macro which is
1855set on the compiler command line by the RTEMS Multiprocessing Test Suites.
1856
1857
1858@item maximum_nodes
1859is the number of processor nodes in the system.
1860When using the @code{rtems/confdefs.h} mechanism for configuring
1861an RTEMS application, the value for this field corresponds
1862to the setting of the macro @code{CONFIGURE_MP_MAXIMUM_NODES}.
1863If not defined by the application, then the @code{CONFIGURE_MP_MAXIMUM_NODES}
1864macro defaults to the value 2.
1865
1866@item maximum_global_objects
1867is the maximum number of global objects which can exist at any
1868given moment in the entire system.  If this parameter is not the
1869same on all nodes in the system, then a fatal error is generated
1870to inform the user that the system is inconsistent.
1871When using the @code{rtems/confdefs.h} mechanism for configuring
1872an RTEMS application, the value for this field corresponds
1873to the setting of the macro @code{CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS}.
1874If not defined by the application, then the
1875@code{CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS} macro defaults to the value 32.
1876
1877
1878@item maximum_proxies
1879is the maximum number of proxies which can exist at any given moment
1880on this particular node.  A proxy is a substitute task control block
1881which represent a task residing on a remote node when that task blocks
1882on a remote object.  Proxies are used in situations in which delayed
1883interaction is required with a remote node.
1884When using the @code{rtems/confdefs.h} mechanism for configuring
1885an RTEMS application, the value for this field corresponds
1886to the setting of the macro @code{CONFIGURE_MP_MAXIMUM_PROXIES}.
1887If not defined by the application, then the @code{CONFIGURE_MP_MAXIMUM_PROXIES}
1888macro defaults to the value 32.
1889
1890@item extra_mpci_receive_server_stack
1891is the extra stack space allocated for the RTEMS MPCI receive server task
1892in bytes.  The MPCI receive server may invoke nearly all directives and
1893may require extra stack space on some targets.
1894
1895@item User_mpci_table
1896is the address of the Multiprocessor Communications Interface
1897Table.  This table contains the entry points of user-provided functions
1898which constitute the multiprocessor communications layer.  This table
1899must be provided in multiprocessor configurations with all
1900entries configured.  The format of this table and details
1901regarding its entries can be found in the next section.
1902When using the @code{rtems/confdefs.h} mechanism for configuring
1903an RTEMS application, the value for this field corresponds
1904to the setting of the macro @code{CONFIGURE_MP_MPCI_TABLE_POINTER}.
1905If not defined by the application, then the
1906@code{CONFIGURE_MP_MPCI_TABLE_POINTER} macro defaults to the
1907address of the table named @code{MPCI_table}.
1908
1909
1910@end table
1911
1912@subsection Multiprocessor Communications Interface Table
1913
1914@cindex  Multiprocessor Communications Interface Table
1915
1916This table defines the set of callouts that must be provided by
1917an Multiprocessor Communications Interface implementation. 
1918
1919When using the @code{rtems/confdefs.h} mechanism for configuring
1920an RTEMS application, the name of this table is assumed
1921to be @code{MPCI_table} unless the application sets
1922the @code{CONFIGURE_MP_MPCI_TABLE_POINTER} when configuring a
1923multiprocessing system.
1924
1925The format of this table is defined in
1926the following C structure:
1927
1928@example
1929typedef struct @{
1930  uint32_t                        default_timeout; /* in ticks */
1931  uint32_t                        maximum_packet_size;
1932  rtems_mpci_initialization_entry initialization;
1933  rtems_mpci_get_packet_entry     get_packet;
1934  rtems_mpci_return_packet_entry  return_packet;
1935  rtems_mpci_send_entry           send_packet;
1936  rtems_mpci_receive_entry        receive_packet;
1937@} rtems_mpci_table;
1938@end example
1939
1940@table @b
1941@item default_timeout
1942is the default maximum length of time a task should block waiting for
1943a response to a directive which results in communication with a remote node.
1944The maximum length of time is a function the user supplied
1945multiprocessor communications layer and the media used.  This
1946timeout only applies to directives which would not block if the
1947operation were performed locally.
1948
1949@item maximum_packet_size
1950is the size in bytes of the longest packet which the MPCI layer is capable
1951of sending.  This value should represent the total number of bytes available
1952for a RTEMS interprocessor messages.
1953
1954@item initialization
1955is the address of the entry point for the initialization procedure of the
1956user supplied multiprocessor communications layer.
1957
1958@item get_packet
1959is the address of the entry point for the procedure called by RTEMS to
1960obtain a packet from the user supplied multiprocessor communications layer.
1961
1962@item return_packet
1963is the address of the entry point for the procedure called by RTEMS to
1964return a packet to the user supplied multiprocessor communications layer.
1965
1966@item send
1967is the address of the entry point for the procedure called by RTEMS to
1968send an envelope to another node.  This procedure is part of the user
1969supplied multiprocessor communications layer.
1970
1971@item receive
1972is the address of the entry point for the
1973procedure called by RTEMS to retrieve an envelope containing a
1974message from another node.  This procedure is part of the user
1975supplied multiprocessor communications layer.
1976
1977@end table
1978
1979More information regarding the required functionality of these
1980entry points is provided in the Multiprocessor chapter.
1981
1982@subsection Determining Memory Requirements
1983
1984Since memory is a critical resource in many real-time
1985embedded systems, the RTEMS Classic API was specifically designed to allow
1986unused managers to be forcibly excluded from the run-time environment.
1987This allows the application designer the flexibility to tailor
1988RTEMS to most efficiently meet system requirements while still
1989satisfying even the most stringent memory constraints.  As
1990result, the size of the RTEMS executive is application
1991dependent.
1992
1993It is not necessary for RTEMS Application Developers to calculate
1994the amount of memory required for the RTEMS Workspace.  This
1995is done automatically by @code{<rtems/confdefs.h>}. 
1996See @ref{Configuring a System Sizing the RTEMS RAM Workspace} for
1997more details on how
1998this works.  In the event, you are interested in the memory required
1999for an instance of a particular RTEMS object, please run the test
2000@code{spsize} on your target board.
2001
2002RTEMS is built to be a library and any routines that you do not
2003directly or indirectly require in your application will @b{NOT}
2004be included in your executable image.  However, some managers
2005may be explicitly excluded and no attempt to create these instances
2006of these objects will succeed even if they are configured.
2007The following Classic API managers may be optionally excluded:
2008
2009@itemize @bullet
2010@item signal
2011@item region
2012@item dual ported memory
2013@item event
2014@item multiprocessing
2015@item partition
2016@item timer
2017@item semaphore
2018@item message
2019@item rate monotonic
2020@end itemize
2021
2022RTEMS is designed to be built and installed as a library
2023that is linked into the application.  As such, much of
2024RTEMS is implemented in such a way that there is a single
2025entry point per source file.  This avoids having the
2026linker being forced to pull large object files in their
2027entirety into an application when the application references
2028a single symbol.  In the event you discover an RTEMS method
2029that is included in your executable but never entered, please
2030let us know.  It might be an opportunity to break a dependency
2031and shrink many RTEMS applications.
2032
2033RTEMS based applications must somehow provide memory
2034for RTEMS' code and data space.  Although RTEMS' data space must
2035be in RAM, its code space can be located in either ROM or RAM.
2036In addition, the user must allocate RAM for the RTEMS RAM
2037Workspace.  The size of this area is application dependent and
2038can be calculated using the formula provided in the Memory
2039Requirements chapter of the Applications Supplement document
2040for a specific target processor.
2041
2042All private RTEMS data variables and routine names used by
2043RTEMS begin with the underscore ( _ ) character followed by an
2044upper-case letter.  If RTEMS is linked with an application, then
2045the application code should NOT contain any symbols which begin
2046with the underscore character and followed by an upper-case
2047letter to avoid any naming conflicts.  All RTEMS directive names
2048should be treated as reserved words.
2049
2050@subsection Sizing the RTEMS RAM Workspace
2051
2052The RTEMS RAM Workspace is a user-specified block of
2053memory reserved for use by RTEMS.  The application should NOT
2054modify this memory.  This area consists primarily of the RTEMS
2055data structures whose exact size depends upon the values
2056specified in the Configuration Table.  In addition, task stacks
2057and floating point context areas are dynamically allocated from
2058the RTEMS RAM Workspace.
2059
2060The @code{rtems/confdefs.h} mechanism calcalutes the size
2061of the RTEMS RAM Workspace automatically.  It assumes that
2062all tasks are floating point and that all will be allocated
2063the miminum stack space.  This calculation also automatically
2064includes the memory that will be allocated for internal use
2065by RTEMS.  The following macros may be set
2066by the application to make the calculation
2067of memory required more accurate:
2068
2069@itemize @bullet
2070
2071@item @code{CONFIGURE_MEMORY_OVERHEAD}
2072@item @code{CONFIGURE_EXTRA_TASK_STACKS}
2073
2074@end itemize
2075
2076The starting address of the RTEMS RAM Workspace must
2077be aligned on a four-byte boundary.  Failure to properly align
2078the workspace area will result in the
2079@code{@value{DIRPREFIX}fatal_error_occurred}
2080directive being invoked with the
2081@code{@value{RPREFIX}INVALID_ADDRESS} error code.
2082
2083The file @code{<rtems/confdefs.h>} will calculate the
2084value that is specified as the @code{work_space_size}
2085parameter of the Configuration Table. There are many
2086parameters the application developer can specify to
2087help @code{<rtems/confdefs.h>} in its calculations.  Correctly
2088specifying the application requirements via parameters
2089such as @code{CONFIGURE_EXTRA_TASK_STACKS} and
2090@code{CONFIGURE_MAXIMUM_TASKS} is critical.
2091
2092The allocation of objects can operate in two modes. The default mode
2093has an object number ceiling. No more than the specified number of
2094objects can be allocated from the RTEMS RAM Workspace. The number of objects
2095specified in the particular API Configuration table fields are
2096allocated at initialisation. The second mode allows the number of
2097objects to grow to use the available free memory in the RTEMS RAM Workspace.
2098
2099The auto-extending mode can be enabled individually for each object
2100type by using the macro @code{rtems_resource_unlimited}. This takes a value
2101as a parameter, and is used to set the object maximum number field in
2102an API Configuration table. The value is an allocation unit size. When
2103RTEMS is required to grow the object table it is grown by this
2104size. The kernel will return the object memory back to the RTEMS RAM Workspace
2105when an object is destroyed. The kernel will only return an allocated
2106block of objects to the RTEMS RAM Workspace if at least half the allocation
2107size of free objects remain allocated. RTEMS always keeps one
2108allocation block of objects allocated. Here is an example of using
2109@code{rtems_resource_unlimited}:
2110
2111@example
2112#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(5)
2113@end example
2114
2115The user is cautioned that future versions of RTEMS may not have the
2116same memory requirements per object. Although the value calculated is
2117suficient for a particular target processor and release of RTEMS,
2118memory usage is subject to change across versions and target
2119processors.  To avoid problems, the user should accurately
2120specify each configuration parameter and allow
2121@code{<rtems/confdefs.h>} to calculate the memory requirements.
2122The memory requirements are likely to change each
2123time one of the following events occurs:
2124
2125@itemize @bullet
2126@item a configuration parameter is modified,
2127@item task or interrupt stack requirements change,
2128@item task floating point attribute is altered,
2129@item RTEMS is upgraded, or
2130@item the target processor is changed.
2131@end itemize
2132
2133Failure to provide enough space in the RTEMS RAM
2134Workspace will result in the
2135@code{@value{DIRPREFIX}fatal_error_occurred} directive
2136being invoked with the appropriate error code.
Note: See TracBrowser for help on using the repository browser.