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

4.115
Last change on this file since ced0816 was ced0816, checked in by Sebastian Huber <sebastian.huber@…>, on 04/11/12 at 14:29:28

doc: Document new macros

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