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

4.115
Last change on this file since eae1447 was eae1447, checked in by Joel Sherrill <joel.sherrill@…>, on 02/17/11 at 22:37:06

2011-02-17 Joel Sherrill <joel.sherrill@…>

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