1 | @c COPYRIGHT (c) 1988-1998. |
---|
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 |
---|
12 | @c CONFIGURE_MALLOC_REGION |
---|
13 | @c CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS |
---|
14 | @c CONFIGURE_LIBIO_SEMAPHORES |
---|
15 | @c CONFIGURE_INIT |
---|
16 | @c CONFIGURE_INTERRUPT_STACK_MEMORY |
---|
17 | @c CONFIGURE_GNAT_RTEMS |
---|
18 | @c CONFIGURE_GNAT_MUTEXES |
---|
19 | @c CONFIGURE_GNAT_KEYS |
---|
20 | @c CONFIGURE_MAXIMUM_ADA_TASKS |
---|
21 | @c CONFIGURE_MAXIMUM_FAKE_ADA_TASKS |
---|
22 | @c CONFIGURE_ADA_TASKS_STACK |
---|
23 | @c |
---|
24 | @c In addition, there should be examples of defining your own |
---|
25 | @c Device Driver Table, Init task table, etc. |
---|
26 | @c |
---|
27 | @c Regardless, this is a big step up. :) |
---|
28 | @c |
---|
29 | |
---|
30 | @chapter Configuring a System |
---|
31 | |
---|
32 | @section Automatic Generation of System Configuration |
---|
33 | |
---|
34 | @cindex confdefs.h |
---|
35 | @fnindex confdefs.h |
---|
36 | |
---|
37 | RTEMS provides the @code{confdefs.h} C language header file that |
---|
38 | based on the setting of a variety of macros can automatically |
---|
39 | produce nearly all of the configuration tables required |
---|
40 | by an RTEMS application. Rather than building the individual |
---|
41 | tables by hand. the application simply specifies the values |
---|
42 | for the configuration parameters it wishes to set. In the following |
---|
43 | example, the configuration information for a simple system with |
---|
44 | a message queue and a time slice of 50 milliseconds is configured: |
---|
45 | |
---|
46 | @example |
---|
47 | @group |
---|
48 | #define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER |
---|
49 | #define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER |
---|
50 | |
---|
51 | #define CONFIGURE_MICROSECONDS_PER_TICK 1000 /* 1 millisecond */ |
---|
52 | #define CONFIGURE_TICKS_PER_TIMESLICE 50 /* 50 milliseconds */ |
---|
53 | |
---|
54 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
55 | @end group |
---|
56 | @end example |
---|
57 | |
---|
58 | This system will begin execution with the single initialization task |
---|
59 | named @code{Init}. It will be configured to have both a console |
---|
60 | device driver (for standard I/O) and a clock tick device driver. |
---|
61 | |
---|
62 | For each configuration parameter in the configuration tables, the |
---|
63 | macro corresponding to that field is discussed. Most systems |
---|
64 | can be easily configured using the @code{confdefs.h} mechanism. |
---|
65 | |
---|
66 | The following subsection list all of the constants which can be |
---|
67 | set by the user. |
---|
68 | |
---|
69 | @subsection Library Support Definitions |
---|
70 | |
---|
71 | @itemize @bullet |
---|
72 | @item CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS |
---|
73 | @item CONFIGURE_HAS_OWN_MOUNT_TABLE |
---|
74 | @item CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM |
---|
75 | @item STACK_CHECKER_ON |
---|
76 | @item CONFIGURE_MEMORY_OVERHEAD |
---|
77 | @item CONFIGURE_EXTRA_TASK_STACKS |
---|
78 | @end itemize |
---|
79 | |
---|
80 | @subsection Basic System Information |
---|
81 | |
---|
82 | @itemize @bullet |
---|
83 | @item CONFIGURE_HAS_OWN_CONFIGURATION_TABLE |
---|
84 | @item CONFIGURE_INTERRUPT_STACK_MEMORY |
---|
85 | @item CONFIGURE_EXECUTIVE_RAM_WORK_AREA |
---|
86 | @item CONFIGURE_MICROSECONDS_PER_TICK |
---|
87 | @item CONFIGURE_TICKS_PER_TIMESLICE |
---|
88 | @end itemize |
---|
89 | |
---|
90 | NOTE: The required size of the Executive RAM Work Area is calculated |
---|
91 | automatically when using the @code{confdefs.h} mechanism. |
---|
92 | |
---|
93 | @subsection Device Driver Table |
---|
94 | |
---|
95 | @itemize @bullet |
---|
96 | @item CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE |
---|
97 | @item CONFIGURE_HAS_OWN_NUMBER_OF_DEVICES |
---|
98 | @item CONFIGURE_MAXIMUM_DEVICES |
---|
99 | @item CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER |
---|
100 | @item CONFIGURE_TEST_NEEDS_CLOCK_DRIVER |
---|
101 | @item CONFIGURE_TEST_NEEDS_STUB_DRIVER |
---|
102 | @end itemize |
---|
103 | |
---|
104 | @subsection Multiprocessing Configuration |
---|
105 | |
---|
106 | @itemize @bullet |
---|
107 | @item CONFIGURE_HAS_OWN_MULTIPROCESING_TABLE |
---|
108 | @item CONFIGURE_MP_NODE_NUMBER |
---|
109 | @item CONFIGURE_MP_MAXIMUM_NODES |
---|
110 | @item CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS |
---|
111 | @item CONFIGURE_MP_MAXIMUM_PROXIES |
---|
112 | @item CONFIGURE_MP_MPCI_TABLE_POINTER |
---|
113 | @end itemize |
---|
114 | |
---|
115 | @subsection Classic API Configuration |
---|
116 | |
---|
117 | @itemize @bullet |
---|
118 | @item CONFIGURE_MAXIMUM_TASKS |
---|
119 | @item CONFIGURE_MAXIMUM_TIMERS |
---|
120 | @item CONFIGURE_MAXIMUM_SEMAPHORES |
---|
121 | @item CONFIGURE_MAXIMUM_MESSAGE_QUEUES |
---|
122 | @item CONFIGURE_MAXIMUM_PARTITIONS |
---|
123 | @item CONFIGURE_MAXIMUM_REGIONS |
---|
124 | @item CONFIGURE_MAXIMUM_PORTS |
---|
125 | @item CONFIGURE_MAXIMUM_PERIODS |
---|
126 | @item CONFIGURE_MAXIMUM_USER_EXTENSIONS |
---|
127 | @end itemize |
---|
128 | |
---|
129 | @subsection Initialization Tasks Table Configuration |
---|
130 | |
---|
131 | @itemize @bullet |
---|
132 | @item CONFIGURE_INIT_TASK_NAME |
---|
133 | @item CONFIGURE_INIT_TASK_STACK_SIZE |
---|
134 | @item CONFIGURE_INIT_TASK_PRIORITY |
---|
135 | @item CONFIGURE_INIT_TASK_ATTRIBUTES |
---|
136 | @item CONFIGURE_INIT_TASK_ENTRY_POINT |
---|
137 | @item CONFIGURE_INIT_TASK_INITIAL_MODES |
---|
138 | @item CONFIGURE_INIT_TASK_ARGUMENTS |
---|
139 | @end itemize |
---|
140 | |
---|
141 | |
---|
142 | @subsection POSIX API Configuration |
---|
143 | |
---|
144 | @itemize @bullet |
---|
145 | @item CONFIGURE_MAXIMUM_POSIX_THREADS |
---|
146 | @item CONFIGURE_MAXIMUM_POSIX_MUTEXES |
---|
147 | @item CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES |
---|
148 | @item CONFIGURE_MAXIMUM_POSIX_KEYS |
---|
149 | @item CONFIGURE_MAXIMUM_POSIX_TIMERS |
---|
150 | @item CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS |
---|
151 | @item CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES |
---|
152 | @item CONFIGURE_MAXIMUM_POSIX_SEMAPHORES |
---|
153 | @end itemize |
---|
154 | |
---|
155 | @subsection POSIX Initialization Thread Table Configuration |
---|
156 | |
---|
157 | @itemize @bullet |
---|
158 | @item CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT |
---|
159 | @item CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE |
---|
160 | @end itemize |
---|
161 | |
---|
162 | @subsection ITRON API Configuration |
---|
163 | |
---|
164 | @itemize @bullet |
---|
165 | @item CONFIGURE_MAXIMUM_ITRON_TASKS |
---|
166 | @item CONFIGURE_MAXIMUM_ITRON_SEMAPHORES |
---|
167 | @item CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS |
---|
168 | @item CONFIGURE_MAXIMUM_ITRON_MAILBOXES |
---|
169 | @item CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS |
---|
170 | @item CONFIGURE_MAXIMUM_ITRON_PORTS |
---|
171 | @item CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS |
---|
172 | @item CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS |
---|
173 | @end itemize |
---|
174 | |
---|
175 | @subsection ITRON Initialization Task Table Configuration |
---|
176 | |
---|
177 | @itemize @bullet |
---|
178 | @item CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT |
---|
179 | @item CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES |
---|
180 | @item CONFIGURE_ITRON_INIT_TASK_PRIORITY |
---|
181 | @item CONFIGURE_ITRON_INIT_TASK_STACK_SIZE |
---|
182 | @item CONFIGURE_ITRON_INIT_TASK_STACK_SIZES |
---|
183 | @end itemize |
---|
184 | |
---|
185 | @subsection Ada Tasks |
---|
186 | |
---|
187 | @itemize @bullet |
---|
188 | @item CONFIGURE_MAXIMUM_ADA_TASKS |
---|
189 | @item CONFIGURE_MAXIMUM_FAKE_ADA_TASKS |
---|
190 | @end itemize |
---|
191 | |
---|
192 | @section Configuration Table |
---|
193 | |
---|
194 | @cindex Configuration Table |
---|
195 | @cindex RTEMS Configuration Table |
---|
196 | |
---|
197 | The RTEMS Configuration Table is used to tailor an |
---|
198 | application for its specific needs. For example, the user can |
---|
199 | configure the number of device drivers or which APIs may be used. |
---|
200 | THe address of the user-defined Configuration Table is passed as an |
---|
201 | argument to the @code{@value{DIRPREFIX}initialize_executive} |
---|
202 | directive, which MUST be the first RTEMS directive called. |
---|
203 | The RTEMS Configuration Table |
---|
204 | is defined in the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
205 | |
---|
206 | @ifset is-C |
---|
207 | @example |
---|
208 | @group |
---|
209 | typedef struct @{ |
---|
210 | void *work_space_start; |
---|
211 | rtems_unsigned32 work_space_size; |
---|
212 | rtems_unsigned32 maximum_extensions; |
---|
213 | rtems_unsigned32 microseconds_per_tick; |
---|
214 | rtems_unsigned32 ticks_per_timeslice; |
---|
215 | rtems_unsigned32 maximum_devices; |
---|
216 | rtems_unsigned32 number_of_device_drivers; |
---|
217 | rtems_driver_address_table *Device_driver_table; |
---|
218 | rtems_unsigned32 number_of_initial_extensions; |
---|
219 | rtems_extensions_table *User_extension_table; |
---|
220 | rtems_multiprocessing_table *User_multiprocessing_table; |
---|
221 | rtems_api_configuration_table *RTEMS_api_configuration; |
---|
222 | posix_api_configuration_table *POSIX_api_configuration; |
---|
223 | @} rtems_configuration_table; |
---|
224 | @end group |
---|
225 | @end example |
---|
226 | @end ifset |
---|
227 | |
---|
228 | @ifset is-Ada |
---|
229 | @example |
---|
230 | type Configuration_Table is |
---|
231 | record |
---|
232 | Work_Space_Start : RTEMS.Address; |
---|
233 | Work_Space_Size : RTEMS.Unsigned32; |
---|
234 | Maximum_Extensions : RTEMS.Unsigned32; |
---|
235 | Microseconds_Per_Tick : RTEMS.Unsigned32; |
---|
236 | Ticks_Per_Timeslice : RTEMS.Unsigned32; |
---|
237 | Maximum_Devices : RTEMS.Unsigned32; |
---|
238 | Number_Of_Device_Drivers : RTEMS.Unsigned32; |
---|
239 | Device_Driver_Table : |
---|
240 | RTEMS.Driver_Address_Table_Pointer; |
---|
241 | Number_Of_Initial_Extensions : RTEMS.Unsigned32; |
---|
242 | User_Extension_Table : RTEMS.Extensions_Table_Pointer; |
---|
243 | User_Multiprocessing_Table : |
---|
244 | RTEMS.Multiprocessing_Table_Pointer; |
---|
245 | RTEMS_API_Configuration : |
---|
246 | RTEMS.API_Configuration_Table_Pointer; |
---|
247 | POSIX_API_Configuration : |
---|
248 | RTEMS.POSIX_API_Configuration_Table_Pointer; |
---|
249 | end record; |
---|
250 | |
---|
251 | type Configuration_Table_Pointer is access all Configuration_Table; |
---|
252 | @end example |
---|
253 | @end ifset |
---|
254 | |
---|
255 | @table @b |
---|
256 | @item work_space_start |
---|
257 | is the address of the RTEMS RAM Workspace. |
---|
258 | This area contains items such as the |
---|
259 | various object control blocks (TCBs, QCBs, ...) and task stacks. |
---|
260 | If the address is not aligned on a four-word boundary, then |
---|
261 | RTEMS will invoke the fatal error handler during |
---|
262 | @code{@value{DIRPREFIX}initialize_executive}. |
---|
263 | When using the @code{confdefs.h} mechanism for configuring |
---|
264 | an RTEMS application, the value for this field corresponds |
---|
265 | to the setting of the macro @code{CONFIGURE_EXECUTIVE_RAM_WORK_AREA}. |
---|
266 | |
---|
267 | @item work_space_size |
---|
268 | is the calculated size of the |
---|
269 | RTEMS RAM Workspace. The section Sizing the RTEMS RAM Workspace |
---|
270 | details how to arrive at this number. |
---|
271 | When using the @code{confdefs.h} mechanism for configuring |
---|
272 | an RTEMS application, the value for this field corresponds |
---|
273 | to the setting of the macro @code{CONFIGURE_EXECUTIVE_RAM_SIZE} |
---|
274 | and is calculated based on the other system configuration settings. |
---|
275 | |
---|
276 | @item microseconds_per_tick |
---|
277 | is number of microseconds per clock tick. |
---|
278 | When using the @code{confdefs.h} mechanism for configuring |
---|
279 | an RTEMS application, the value for this field corresponds |
---|
280 | to the setting of the macro @code{CONFIGURE_MICROSECONDS_PER_TICK}. |
---|
281 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_TASKS} |
---|
282 | macro defaults to 10. |
---|
283 | XXX |
---|
284 | |
---|
285 | @item ticks_per_timeslice |
---|
286 | is the number of clock ticks for a timeslice. |
---|
287 | When using the @code{confdefs.h} mechanism for configuring |
---|
288 | an RTEMS application, the value for this field corresponds |
---|
289 | to the setting of the macro @code{CONFIGURE_TICKS_PER_TIMESLICE}. |
---|
290 | |
---|
291 | @item maximum_devices |
---|
292 | is the maximum number of devices that can be registered. |
---|
293 | When using the @code{confdefs.h} mechanism for configuring |
---|
294 | an RTEMS application, the value for this field corresponds |
---|
295 | to the setting of the macro @code{CONFIGURE_MAXIMUM_DEVICES}. |
---|
296 | |
---|
297 | @item number_of_device_drivers |
---|
298 | is the number of device drivers for the system. There should be |
---|
299 | the same number of entries in the Device Driver Table. If this field |
---|
300 | is zero, then the @code{User_driver_address_table} entry should be NULL. |
---|
301 | When using the @code{confdefs.h} mechanism for configuring |
---|
302 | an RTEMS application, the value for this field is calculated |
---|
303 | automatically based on the number of entries in the |
---|
304 | Device Driver Table. This calculation is based on the assumption |
---|
305 | that the Device Driver Table is named @code{Device_drivers} |
---|
306 | and defined in C. This table may be generated automatically |
---|
307 | for simple applications using only the device drivers that correspond |
---|
308 | to the following macros: |
---|
309 | |
---|
310 | @itemize @bullet |
---|
311 | |
---|
312 | @item @code{CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER} |
---|
313 | @item @code{CONFIGURE_TEST_NEEDS_CLOCK_DRIVER} |
---|
314 | @item @code{CONFIGURE_TEST_NEEDS_TIMER_DRIVER} |
---|
315 | @item @code{CONFIGURE_TEST_NEEDS_RTC_DRIVER} |
---|
316 | @item @code{CONFIGURE_TEST_NEEDS_STUB_DRIVER} |
---|
317 | |
---|
318 | @end itemize |
---|
319 | |
---|
320 | Note that network device drivers are not configured in the |
---|
321 | Device Driver Table. |
---|
322 | |
---|
323 | @item Device_driver_table |
---|
324 | is the address of the Device Driver Table. This table contains the entry |
---|
325 | points for each device driver. If the number_of_device_drivers field is zero, |
---|
326 | then this entry should be NULL. The format of this table will be |
---|
327 | discussed below. |
---|
328 | When using the @code{confdefs.h} mechanism for configuring |
---|
329 | an RTEMS application, the Device Driver Table is assumed to be |
---|
330 | named @code{Device_drivers} and defined in C. If the application is providing |
---|
331 | its own Device Driver Table, then the macro |
---|
332 | @code{CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE} must be defined to indicate |
---|
333 | this and prevent @code{confdefs.h} from generating the table. |
---|
334 | |
---|
335 | @item number_of_initial_extensions |
---|
336 | is the number of initial user extensions. There should be |
---|
337 | the same number of entries as in the User_extension_table. If this field |
---|
338 | is zero, then the User_driver_address_table entry should be NULL. |
---|
339 | When using the @code{confdefs.h} mechanism for configuring |
---|
340 | an RTEMS application, the value for this field corresponds |
---|
341 | to the setting of the macro @code{CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS} |
---|
342 | which is set automatically by @code{confdefs.h} based on the size |
---|
343 | of the User Extensions Table. |
---|
344 | |
---|
345 | @item User_extension_table |
---|
346 | is the address of the User |
---|
347 | Extension Table. This table contains the entry points for the |
---|
348 | static set of optional user extensions. If no user extensions |
---|
349 | are configured, then this entry should be NULL. The format of |
---|
350 | this table will be discussed below. |
---|
351 | When using the @code{confdefs.h} mechanism for configuring |
---|
352 | an RTEMS application, the User Extensions Table is named |
---|
353 | @code{Configuration_Initial_Extensions} and defined in |
---|
354 | confdefs.h. It is initialized based on the following |
---|
355 | macros: |
---|
356 | |
---|
357 | @itemize @bullet |
---|
358 | |
---|
359 | @item @code{CONFIGURE_INITIAL_EXTENSIONS} |
---|
360 | @item @code{STACK_CHECKER_EXTENSION} |
---|
361 | |
---|
362 | @end itemize |
---|
363 | |
---|
364 | The application may configure one or more initial user extension |
---|
365 | sets by setting the @code{CONFIGURE_INITIAL_EXTENSIONS} macro. By |
---|
366 | defining the @code{STACK_CHECKER_EXTENSION} macro, the task stack bounds |
---|
367 | checking user extension set is automatically included in the |
---|
368 | application. |
---|
369 | |
---|
370 | @item User_multiprocessing_table |
---|
371 | is the address of the Multiprocessor Configuration Table. This |
---|
372 | table contains information needed by RTEMS only when used in a multiprocessor |
---|
373 | configuration. This field must be NULL when RTEMS is used in a |
---|
374 | single processor configuration. |
---|
375 | When using the @code{confdefs.h} mechanism for configuring |
---|
376 | an RTEMS application, the Multiprocessor Configuration Table |
---|
377 | is automatically generated when the @code{CONFIGURE_MPTEST} |
---|
378 | is defined. If @code{CONFIGURE_MPTEST} is not defined, the this |
---|
379 | entry is set to NULL. The generated table has the name |
---|
380 | @code{Multiprocessing_configuration}. |
---|
381 | |
---|
382 | @item RTEMS_api_configuration |
---|
383 | is the address of the RTEMS API Configuration Table. This table |
---|
384 | contains information needed by the RTEMS API. This field should be |
---|
385 | NULL if the RTEMS API is not used. [NOTE: Currently the RTEMS API |
---|
386 | is required to support support components such as BSPs and libraries |
---|
387 | which use this API.] This table is built automatically and this |
---|
388 | entry filled in, if using the @code{confdefs.h} application |
---|
389 | configuration mechanism. The generated table has the name |
---|
390 | @code{Configuration_RTEMS_API}. |
---|
391 | |
---|
392 | @item POSIX_api_configuration |
---|
393 | is the address of the POSIX API Configuration Table. This table |
---|
394 | contains information needed by the POSIX API. This field should be |
---|
395 | NULL if the POSIX API is not used. This table is built automatically |
---|
396 | and this entry filled in, if using the @code{confdefs.h} application |
---|
397 | configuration mechanism. The @code{confdefs.h} application |
---|
398 | mechanism will fill this field in with the address of the |
---|
399 | @code{Configuration_POSIX_API} table of POSIX API is configured |
---|
400 | and NULL if the POSIX API is not configured. |
---|
401 | |
---|
402 | @end table |
---|
403 | |
---|
404 | @section RTEMS API Configuration Table |
---|
405 | |
---|
406 | @cindex RTEMS API Configuration Table |
---|
407 | |
---|
408 | The RTEMS API Configuration Table is used to configure the |
---|
409 | managers which constitute the RTEMS API for a particular application. |
---|
410 | For example, the user can configure the maximum number of tasks for |
---|
411 | this application. The RTEMS API Configuration Table is defined in |
---|
412 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
413 | |
---|
414 | @ifset is-C |
---|
415 | @example |
---|
416 | @group |
---|
417 | typedef struct @{ |
---|
418 | rtems_unsigned32 maximum_tasks; |
---|
419 | rtems_unsigned32 maximum_timers; |
---|
420 | rtems_unsigned32 maximum_semaphores; |
---|
421 | rtems_unsigned32 maximum_message_queues; |
---|
422 | rtems_unsigned32 maximum_partitions; |
---|
423 | rtems_unsigned32 maximum_regions; |
---|
424 | rtems_unsigned32 maximum_ports; |
---|
425 | rtems_unsigned32 maximum_periods; |
---|
426 | rtems_unsigned32 number_of_initialization_tasks; |
---|
427 | rtems_initialization_tasks_table *User_initialization_tasks_table; |
---|
428 | @} rtems_api_configuration_table; |
---|
429 | @end group |
---|
430 | @end example |
---|
431 | @end ifset |
---|
432 | |
---|
433 | @ifset is-Ada |
---|
434 | @example |
---|
435 | type API_Configuration_Table is |
---|
436 | record |
---|
437 | Maximum_Tasks : RTEMS.Unsigned32; |
---|
438 | Maximum_Timers : RTEMS.Unsigned32; |
---|
439 | Maximum_Semaphores : RTEMS.Unsigned32; |
---|
440 | Maximum_Message_queues : RTEMS.Unsigned32; |
---|
441 | Maximum_Partitions : RTEMS.Unsigned32; |
---|
442 | Maximum_Regions : RTEMS.Unsigned32; |
---|
443 | Maximum_Ports : RTEMS.Unsigned32; |
---|
444 | Maximum_Periods : RTEMS.Unsigned32; |
---|
445 | Number_Of_Initialization_Tasks : RTEMS.Unsigned32; |
---|
446 | User_Initialization_Tasks_Table : |
---|
447 | RTEMS.Initialization_Tasks_Table_Pointer; |
---|
448 | end record; |
---|
449 | |
---|
450 | type API_Configuration_Table_Pointer is |
---|
451 | access all API_Configuration_Table; |
---|
452 | @end example |
---|
453 | @end ifset |
---|
454 | |
---|
455 | @table @b |
---|
456 | @item maximum_tasks |
---|
457 | is the maximum number of tasks that |
---|
458 | can be concurrently active (created) in the system including |
---|
459 | initialization tasks. |
---|
460 | When using the @code{confdefs.h} mechanism for configuring |
---|
461 | an RTEMS application, the value for this field corresponds |
---|
462 | to the setting of the macro @code{CONFIGURE_MAXIMUM_TASKS}. |
---|
463 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_TASKS} |
---|
464 | macro defaults to 10. |
---|
465 | |
---|
466 | @item maximum_timers |
---|
467 | is the maximum number of timers |
---|
468 | that can be concurrently active in the system. |
---|
469 | When using the @code{confdefs.h} mechanism for configuring |
---|
470 | an RTEMS application, the value for this field corresponds |
---|
471 | to the setting of the macro @code{CONFIGURE_MAXIMUM_TIMERS}. |
---|
472 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_TIMERS} |
---|
473 | macro defaults to 0. |
---|
474 | |
---|
475 | @item maximum_semaphores |
---|
476 | is the maximum number of |
---|
477 | semaphores that can be concurrently active in the system. |
---|
478 | When using the @code{confdefs.h} mechanism for configuring |
---|
479 | an RTEMS application, the value for this field corresponds |
---|
480 | to the setting of the macro @code{CONFIGURE_MAXIMUM_SEMAPHORES}. |
---|
481 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_SEMAPHORES} |
---|
482 | macro defaults to 0. |
---|
483 | |
---|
484 | @item maximum_message_queues |
---|
485 | is the maximum number of |
---|
486 | message queues that can be concurrently active in the system. |
---|
487 | When using the @code{confdefs.h} mechanism for configuring |
---|
488 | an RTEMS application, the value for this field corresponds |
---|
489 | to the setting of the macro @code{CONFIGURE_MAXIMUM_MESSAGE_QUEUES}. |
---|
490 | If not defined by the application, then the |
---|
491 | @code{CONFIGURE_MAXIMUM_MESSAGE_QUEUES} macro defaults to 0. |
---|
492 | |
---|
493 | @item maximum_partitions |
---|
494 | is the maximum number of |
---|
495 | partitions that can be concurrently active in the system. |
---|
496 | When using the @code{confdefs.h} mechanism for configuring |
---|
497 | an RTEMS application, the value for this field corresponds |
---|
498 | to the setting of the macro @code{CONFIGURE_MAXIMUM_PARTITIONS}. |
---|
499 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_PARTITIONS} |
---|
500 | macro defaults to 0. |
---|
501 | |
---|
502 | @item maximum_regions |
---|
503 | is the maximum number of regions |
---|
504 | that can be concurrently active in the system. |
---|
505 | When using the @code{confdefs.h} mechanism for configuring |
---|
506 | an RTEMS application, the value for this field corresponds |
---|
507 | to the setting of the macro @code{CONFIGURE_MAXIMUM_REGIONS}. |
---|
508 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_REGIONS} |
---|
509 | macro defaults to 0. |
---|
510 | |
---|
511 | @item maximum_ports |
---|
512 | is the maximum number of ports into |
---|
513 | dual-port memory areas that can be concurrently active in the |
---|
514 | system. |
---|
515 | When using the @code{confdefs.h} mechanism for configuring |
---|
516 | an RTEMS application, the value for this field corresponds |
---|
517 | to the setting of the macro @code{CONFIGURE_MAXIMUM_PORTS}. |
---|
518 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_PORTS} |
---|
519 | macro defaults to 0. |
---|
520 | |
---|
521 | @item number_of_initialization_tasks |
---|
522 | is the number of initialization tasks configured. At least one |
---|
523 | RTEMS initialization task or POSIX initializatin must be configured |
---|
524 | in order for the user's application to begin executing. |
---|
525 | When using the @code{confdefs.h} mechanism for configuring |
---|
526 | an RTEMS application, the user must define the |
---|
527 | @code{CONFIGURE_RTEMS_INIT_TASKS_TABLE} to indicate that there |
---|
528 | is one or more RTEMS initialization task. If the application |
---|
529 | only has one RTEMS initialization task, then the automatically |
---|
530 | generated Initialization Task Table will be sufficient. The following |
---|
531 | macros correspond to the single initialization task: |
---|
532 | |
---|
533 | @itemize @bullet |
---|
534 | |
---|
535 | @item @code{CONFIGURE_INIT_TASK_NAME} - is the name of the task. |
---|
536 | If this macro is not defined by the application, then this defaults |
---|
537 | to the task name of @code{"UI1 "} for User Initialization Task 1. |
---|
538 | |
---|
539 | @item @code{CONFIGURE_INIT_TASK_STACK_SIZE} - is the stack size |
---|
540 | of the single initialization task. If this macro is not defined |
---|
541 | by the application, then this defaults to @code{RTEMS_MINIMUM_STACK_SIZE}. |
---|
542 | |
---|
543 | @item @code{CONFIGURE_INIT_TASK_PRIORITY} - is the initial priority |
---|
544 | of the single initialization task. If this macro is not defined |
---|
545 | by the application, then this defaults to 1. |
---|
546 | |
---|
547 | @item @code{CONFIGURE_INIT_TASK_ATTRIBUTES} - is the attributes |
---|
548 | of the single initialization task. If this macro is not defined |
---|
549 | by the application, then this defaults to @code{RTEMS_DEFAULT_ATTRIBUTES}. |
---|
550 | |
---|
551 | @item @code{CONFIGURE_INIT_TASK_ENTRY_POINT} - is the entry point |
---|
552 | of the single initialization task. If this macro is not defined |
---|
553 | by the application, then this defaults to the C language routine |
---|
554 | @code{Init}. |
---|
555 | |
---|
556 | @item @code{CONFIGURE_INIT_TASK_INITIAL_MODES} - is the initial execution |
---|
557 | modes of the single initialization task. If this macro is not defined |
---|
558 | by the application, then this defaults to @code{RTEMS_NO_PREEMPT}. |
---|
559 | |
---|
560 | @item @code{CONFIGURE_INIT_TASK_ARGUMENTS} - is the argument passed to the |
---|
561 | of the single initialization task. If this macro is not defined |
---|
562 | by the application, then this defaults to 0. |
---|
563 | |
---|
564 | |
---|
565 | @end itemize |
---|
566 | |
---|
567 | |
---|
568 | has the option to have |
---|
569 | value for this field corresponds |
---|
570 | to the setting of the macro @code{}. |
---|
571 | |
---|
572 | @item User_initialization_tasks_table |
---|
573 | is the address of the Initialization Task Table. This table contains the |
---|
574 | information needed to create and start each of the |
---|
575 | initialization tasks. The format of this table will be discussed below. |
---|
576 | When using the @code{confdefs.h} mechanism for configuring |
---|
577 | an RTEMS application, the value for this field corresponds |
---|
578 | to the setting of the macro @code{CONFIGURE_EXECUTIVE_RAM_WORK_AREA}. |
---|
579 | |
---|
580 | @end table |
---|
581 | |
---|
582 | @section POSIX API Configuration Table |
---|
583 | |
---|
584 | @cindex POSIX API Configuration Table |
---|
585 | |
---|
586 | The POSIX API Configuration Table is used to configure the |
---|
587 | managers which constitute the POSIX API for a particular application. |
---|
588 | For example, the user can configure the maximum number of threads for |
---|
589 | this application. The POSIX API Configuration Table is defined in |
---|
590 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
591 | |
---|
592 | @ifset is-C |
---|
593 | @example |
---|
594 | @group |
---|
595 | typedef struct @{ |
---|
596 | void *(*thread_entry)(void *); |
---|
597 | @} posix_initialization_threads_table; |
---|
598 | |
---|
599 | typedef struct @{ |
---|
600 | int maximum_threads; |
---|
601 | int maximum_mutexes; |
---|
602 | int maximum_condition_variables; |
---|
603 | int maximum_keys; |
---|
604 | int maximum_timers; |
---|
605 | int maximum_queued_signals; |
---|
606 | int number_of_initialization_tasks; |
---|
607 | posix_initialization_threads_table *User_initialization_tasks_table; |
---|
608 | @} posix_api_configuration_table; |
---|
609 | @end group |
---|
610 | @end example |
---|
611 | @end ifset |
---|
612 | |
---|
613 | @ifset is-Ada |
---|
614 | @example |
---|
615 | type POSIX_Thread_Entry is access procedure ( |
---|
616 | Argument : in RTEMS.Address |
---|
617 | ); |
---|
618 | |
---|
619 | type POSIX_Initialization_Threads_Table_Entry is |
---|
620 | record |
---|
621 | Thread_Entry : RTEMS.POSIX_Thread_Entry; |
---|
622 | end record; |
---|
623 | |
---|
624 | type POSIX_Initialization_Threads_Table is array |
---|
625 | ( RTEMS.Unsigned32 range <> ) of |
---|
626 | RTEMS.POSIX_Initialization_Threads_Table_Entry; |
---|
627 | |
---|
628 | type POSIX_Initialization_Threads_Table_Pointer is access all |
---|
629 | POSIX_Initialization_Threads_Table; |
---|
630 | |
---|
631 | type POSIX_API_Configuration_Table_Entry is |
---|
632 | record |
---|
633 | Maximum_Threads : Interfaces.C.Int; |
---|
634 | Maximum_Mutexes : Interfaces.C.Int; |
---|
635 | Maximum_Condition_Variables : Interfaces.C.Int; |
---|
636 | Maximum_Keys : Interfaces.C.Int; |
---|
637 | Maximum_Timers : Interfaces.C.Int; |
---|
638 | Maximum_Queued_Signals : Interfaces.C.Int; |
---|
639 | Number_Of_Initialization_Tasks : Interfaces.C.Int; |
---|
640 | User_Initialization_Tasks_Table : |
---|
641 | RTEMS.POSIX_Initialization_Threads_Table_Pointer; |
---|
642 | end record; |
---|
643 | |
---|
644 | type POSIX_API_Configuration_Table is array |
---|
645 | ( RTEMS.Unsigned32 range <> ) of |
---|
646 | RTEMS.POSIX_API_Configuration_Table_Entry; |
---|
647 | |
---|
648 | type POSIX_API_Configuration_Table_Pointer is access all |
---|
649 | RTEMS.POSIX_API_Configuration_Table; |
---|
650 | @end example |
---|
651 | @end ifset |
---|
652 | |
---|
653 | @table @b |
---|
654 | @item maximum_threads |
---|
655 | is the maximum number of threads that |
---|
656 | can be concurrently active (created) in the system including |
---|
657 | initialization threads. |
---|
658 | When using the @code{confdefs.h} mechanism for configuring |
---|
659 | an RTEMS application, the value for this field corresponds |
---|
660 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_THREADS}. |
---|
661 | If not defined by the application, then the |
---|
662 | @code{CONFIGURE_MAXIMUM_POSIX_THREADS} macro defaults to 10. |
---|
663 | |
---|
664 | @item maximum_mutexes |
---|
665 | is the maximum number of mutexes that can be concurrently |
---|
666 | active in the system. |
---|
667 | When using the @code{confdefs.h} mechanism for configuring |
---|
668 | an RTEMS application, the value for this field corresponds |
---|
669 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_MUTEXES}. |
---|
670 | If not defined by the application, then the |
---|
671 | @code{CONFIGURE_MAXIMUM_POSIX_MUTEXES} macro defaults to 0. |
---|
672 | |
---|
673 | @item maximum_condition_variables |
---|
674 | is the maximum number of condition variables that can be |
---|
675 | concurrently active in the system. |
---|
676 | When using the @code{confdefs.h} mechanism for configuring |
---|
677 | an RTEMS application, the value for this field corresponds |
---|
678 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES}. |
---|
679 | If not defined by the application, then the |
---|
680 | @code{CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES} macro defaults to 0. |
---|
681 | |
---|
682 | @item maximum_keys |
---|
683 | is the maximum number of keys that can be concurrently active in the system. |
---|
684 | When using the @code{confdefs.h} mechanism for configuring |
---|
685 | an RTEMS application, the value for this field corresponds |
---|
686 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_KEYS}. |
---|
687 | If not defined by the application, then the |
---|
688 | @code{CONFIGURE_MAXIMUM_POSIX_KEYS} macro defaults to 0. |
---|
689 | |
---|
690 | @item maximum_timers |
---|
691 | is the maximum number of POSIX timers that can be concurrently active |
---|
692 | in the system. |
---|
693 | When using the @code{confdefs.h} mechanism for configuring |
---|
694 | an RTEMS application, the value for this field corresponds |
---|
695 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_TIMERS}. |
---|
696 | If not defined by the application, then the |
---|
697 | @code{CONFIGURE_MAXIMUM_POSIX_TIMERS} macro defaults to 0. |
---|
698 | |
---|
699 | @item maximum_queued_signals |
---|
700 | is the maximum number of queued signals that can be concurrently |
---|
701 | pending in the system. |
---|
702 | When using the @code{confdefs.h} mechanism for configuring |
---|
703 | an RTEMS application, the value for this field corresponds |
---|
704 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS}. |
---|
705 | If not defined by the application, then the |
---|
706 | @code{CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS} macro defaults to 0. |
---|
707 | |
---|
708 | @item number_of_initialization_threads |
---|
709 | is the number of initialization threads configured. At least one |
---|
710 | initialization threads must be configured. |
---|
711 | When using the @code{confdefs.h} mechanism for configuring |
---|
712 | an RTEMS application, the user must define the |
---|
713 | @code{CONFIGURE_POSIX_INIT_THREAD_TABLE} to indicate that there |
---|
714 | is one or more POSIX initialization thread. If the application |
---|
715 | only has one POSIX initialization thread, then the automatically |
---|
716 | generated POSIX Initialization Thread Table will be sufficient. The following |
---|
717 | macros correspond to the single initialization task: |
---|
718 | |
---|
719 | @itemize @bullet |
---|
720 | |
---|
721 | @item @code{CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT} - is the entry |
---|
722 | point of the thread. If this macro is not defined by the application, |
---|
723 | then this defaults to the C routine @code{POSIX_Init}. |
---|
724 | |
---|
725 | @item @code{CONFIGURE_POSIX_INIT_TASK_STACK_SIZE} - is the stack size |
---|
726 | of the single initialization thread. If this macro is not defined |
---|
727 | by the application, then this defaults to |
---|
728 | @code{(RTEMS_MINIMUM_STACK_SIZE * 2)}. |
---|
729 | |
---|
730 | @end itemize |
---|
731 | |
---|
732 | @item User_initialization_threads_table |
---|
733 | is the address of the Initialization Threads Table. This table contains the |
---|
734 | information needed to create and start each of the initialization threads. |
---|
735 | The format of each entry in this table is defined in the |
---|
736 | @code{posix_initialization_threads_table} @value{STRUCTURE}. |
---|
737 | When using the @code{confdefs.h} mechanism for configuring |
---|
738 | an RTEMS application, the value for this field corresponds |
---|
739 | to the address of the @code{POSIX_Initialization_threads} structure. |
---|
740 | |
---|
741 | @end table |
---|
742 | |
---|
743 | @section CPU Dependent Information Table |
---|
744 | |
---|
745 | @cindex CPU Dependent Information Table |
---|
746 | |
---|
747 | The CPU Dependent Information Table is used to |
---|
748 | describe processor dependent information required by RTEMS. |
---|
749 | This table is generally used to supply RTEMS with information |
---|
750 | only known by the Board Support Package. The contents of this |
---|
751 | table are discussed in the CPU Dependent Information Table |
---|
752 | chapter of the Applications Supplement document for a specific |
---|
753 | target processor. |
---|
754 | |
---|
755 | The @code{confdefs.h} mechanism does not support generating this |
---|
756 | table. It is normally filled in by the Board Support Package. |
---|
757 | |
---|
758 | @section Initialization Task Table |
---|
759 | |
---|
760 | @cindex Initialization Tasks Table |
---|
761 | |
---|
762 | The Initialization Task Table is used to describe |
---|
763 | each of the user initialization tasks to the Initialization |
---|
764 | Manager. The table contains one entry for each initialization |
---|
765 | task the user wishes to create and start. The fields of this |
---|
766 | data structure directly correspond to arguments to the |
---|
767 | @code{@value{DIRPREFIX}task_create} and |
---|
768 | @code{@value{DIRPREFIX}task_start} directives. The number of entries is |
---|
769 | found in the @code{number_of_initialization_tasks} entry in the |
---|
770 | Configuration Table. |
---|
771 | |
---|
772 | The format of each entry in the |
---|
773 | Initialization Task Table is defined in the following @value{LANGUAGE} |
---|
774 | @value{STRUCTURE}: |
---|
775 | |
---|
776 | @ifset is-C |
---|
777 | @example |
---|
778 | typedef struct @{ |
---|
779 | rtems_name name; |
---|
780 | rtems_unsigned32 stack_size; |
---|
781 | rtems_task_priority initial_priority; |
---|
782 | rtems_attribute attribute_set; |
---|
783 | rtems_task_entry entry_point; |
---|
784 | rtems_mode mode_set; |
---|
785 | rtems_task_argument argument; |
---|
786 | @} rtems_initialization_tasks_table; |
---|
787 | @end example |
---|
788 | @end ifset |
---|
789 | |
---|
790 | @ifset is-Ada |
---|
791 | @example |
---|
792 | type Initialization_Tasks_Table_Entry is |
---|
793 | record |
---|
794 | Name : RTEMS.Name; -- task name |
---|
795 | Stack_Size : RTEMS.Unsigned32; -- task stack size |
---|
796 | Initial_Priority : RTEMS.Task_priority; -- task priority |
---|
797 | Attribute_Set : RTEMS.Attribute; -- task attributes |
---|
798 | Entry_Point : RTEMS.Task_Entry; -- task entry point |
---|
799 | Mode_Set : RTEMS.Mode; -- task initial mode |
---|
800 | Argument : RTEMS.Unsigned32; -- task argument |
---|
801 | end record; |
---|
802 | |
---|
803 | type Initialization_Tasks_Table is array |
---|
804 | ( RTEMS.Unsigned32 range <> ) of |
---|
805 | RTEMS.Initialization_Tasks_Table_Entry; |
---|
806 | |
---|
807 | type Initialization_Tasks_Table_Pointer is access all |
---|
808 | Initialization_Tasks_Table; |
---|
809 | @end example |
---|
810 | @end ifset |
---|
811 | |
---|
812 | @table @b |
---|
813 | @item name |
---|
814 | is the name of this initialization task. |
---|
815 | |
---|
816 | @item stack_size |
---|
817 | is the size of the stack for this initialization task. |
---|
818 | |
---|
819 | @item initial_priority |
---|
820 | is the priority of this initialization task. |
---|
821 | |
---|
822 | @item attribute_set |
---|
823 | is the attribute set used during creation of this initialization task. |
---|
824 | |
---|
825 | @item entry_point |
---|
826 | is the address of the entry point of this initialization task. |
---|
827 | |
---|
828 | @item mode_set |
---|
829 | is the initial execution mode of this initialization task. |
---|
830 | |
---|
831 | @item argument |
---|
832 | is the initial argument for this initialization task. |
---|
833 | |
---|
834 | @end table |
---|
835 | |
---|
836 | A typical declaration for an Initialization Task Table might appear as follows: |
---|
837 | |
---|
838 | @ifset is-C |
---|
839 | @example |
---|
840 | rtems_initialization_tasks_table |
---|
841 | Initialization_tasks[2] = @{ |
---|
842 | @{ INIT_1_NAME, |
---|
843 | 1024, |
---|
844 | 1, |
---|
845 | DEFAULT_ATTRIBUTES, |
---|
846 | Init_1, |
---|
847 | DEFAULT_MODES, |
---|
848 | 1 |
---|
849 | |
---|
850 | @}, |
---|
851 | @{ INIT_2_NAME, |
---|
852 | 1024, |
---|
853 | 250, |
---|
854 | FLOATING_POINT, |
---|
855 | Init_2, |
---|
856 | NO_PREEMPT, |
---|
857 | 2 |
---|
858 | |
---|
859 | @} |
---|
860 | @}; |
---|
861 | @end example |
---|
862 | @end ifset |
---|
863 | |
---|
864 | @ifset is-Ada |
---|
865 | @example |
---|
866 | Initialization_Tasks : aliased |
---|
867 | RTEMS.Initialization_Tasks_Table( 1 .. 2 ) := ( |
---|
868 | (INIT_1_NAME, |
---|
869 | 1024, |
---|
870 | 1, |
---|
871 | RTEMS.Default_Attributes, |
---|
872 | Init_1'Access, |
---|
873 | RTEMS.Default_Modes, |
---|
874 | 1), |
---|
875 | (INIT_2_NAME, |
---|
876 | 1024, |
---|
877 | 250, |
---|
878 | RTEMS.Floating_Point, |
---|
879 | Init_2'Access, |
---|
880 | RTEMS.No_Preempt, |
---|
881 | 2) |
---|
882 | ); |
---|
883 | @end example |
---|
884 | @end ifset |
---|
885 | |
---|
886 | @section Driver Address Table |
---|
887 | |
---|
888 | @cindex Device Driver Table |
---|
889 | |
---|
890 | The Device Driver Table is used to inform the I/O |
---|
891 | Manager of the set of entry points for each device driver |
---|
892 | configured in the system. The table contains one entry for each |
---|
893 | device driver required by the application. The number of |
---|
894 | entries is defined in the number_of_device_drivers entry in the |
---|
895 | Configuration Table. The format of each entry in the Device |
---|
896 | Driver Table is defined in |
---|
897 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
898 | |
---|
899 | @ifset is-C |
---|
900 | @example |
---|
901 | typedef struct @{ |
---|
902 | rtems_device_driver_entry initialization; |
---|
903 | rtems_device_driver_entry open; |
---|
904 | rtems_device_driver_entry close; |
---|
905 | rtems_device_driver_entry read; |
---|
906 | rtems_device_driver_entry write; |
---|
907 | rtems_device_driver_entry control; |
---|
908 | @} rtems_driver_address_table; |
---|
909 | @end example |
---|
910 | @end ifset |
---|
911 | |
---|
912 | @ifset is-Ada |
---|
913 | @example |
---|
914 | type Driver_Address_Table_Entry is |
---|
915 | record |
---|
916 | Initialization : RTEMS.Device_Driver_Entry; |
---|
917 | Open : RTEMS.Device_Driver_Entry; |
---|
918 | Close : RTEMS.Device_Driver_Entry; |
---|
919 | Read : RTEMS.Device_Driver_Entry; |
---|
920 | Write : RTEMS.Device_Driver_Entry; |
---|
921 | Control : RTEMS.Device_Driver_Entry; |
---|
922 | end record; |
---|
923 | |
---|
924 | type Driver_Address_Table is array ( RTEMS.Unsigned32 range <> ) of |
---|
925 | RTEMS.Driver_Address_Table_Entry; |
---|
926 | |
---|
927 | type Driver_Address_Table_Pointer is access all Driver_Address_Table; |
---|
928 | @end example |
---|
929 | @end ifset |
---|
930 | |
---|
931 | @table @b |
---|
932 | @item initialization |
---|
933 | is the address of the entry point called by |
---|
934 | @code{@value{DIRPREFIX}io_initialize} |
---|
935 | to initialize a device driver and its associated devices. |
---|
936 | |
---|
937 | @item open |
---|
938 | is the address of the entry point called by @code{@value{DIRPREFIX}io_open}. |
---|
939 | |
---|
940 | @item close |
---|
941 | is the address of the entry point called by @code{@value{DIRPREFIX}io_close}. |
---|
942 | |
---|
943 | @item read |
---|
944 | is the address of the entry point called by @code{@value{DIRPREFIX}io_read}. |
---|
945 | |
---|
946 | @item write |
---|
947 | is the address of the entry point called by @code{@value{DIRPREFIX}io_write}. |
---|
948 | |
---|
949 | @item control |
---|
950 | is the address of the entry point called by @code{@value{DIRPREFIX}io_control}. |
---|
951 | |
---|
952 | @end table |
---|
953 | |
---|
954 | Driver entry points configured as NULL will always |
---|
955 | return a status code of @code{@value{RPREFIX}SUCCESSFUL}. No user code will be |
---|
956 | executed in this situation. |
---|
957 | |
---|
958 | A typical declaration for a Device Driver Table might appear as follows: |
---|
959 | |
---|
960 | @ifset is-C |
---|
961 | @example |
---|
962 | rtems_driver_address_table Driver_table[2] = @{ |
---|
963 | @{ tty_initialize, tty_open, tty_close, /* major = 0 */ |
---|
964 | tty_read, tty_write, tty_control |
---|
965 | @}, |
---|
966 | @{ lp_initialize, lp_open, lp_close, /* major = 1 */ |
---|
967 | NULL, lp_write, lp_control |
---|
968 | @} |
---|
969 | @}; |
---|
970 | @end example |
---|
971 | @end ifset |
---|
972 | |
---|
973 | @ifset is-Ada |
---|
974 | @example |
---|
975 | @end example |
---|
976 | @end ifset |
---|
977 | |
---|
978 | More information regarding the construction and |
---|
979 | operation of device drivers is provided in the I/O Manager |
---|
980 | chapter. |
---|
981 | |
---|
982 | @section User Extensions Table |
---|
983 | |
---|
984 | @cindex User Extensions Table |
---|
985 | |
---|
986 | The User Extensions Table is used to inform RTEMS of |
---|
987 | the optional user-supplied static extension set. This table |
---|
988 | contains one entry for each possible extension. The entries are |
---|
989 | called at critical times in the life of the system and |
---|
990 | individual tasks. The application may create dynamic extensions |
---|
991 | in addition to this single static set. The format of each entry |
---|
992 | in the User Extensions Table is defined in the following @value{LANGUAGE} |
---|
993 | @value{STRUCTURE}: |
---|
994 | |
---|
995 | @ifset is-C |
---|
996 | @example |
---|
997 | typedef User_extensions_routine rtems_extension; |
---|
998 | typedef User_extensions_thread_create_extension |
---|
999 | rtems_task_create_extension; |
---|
1000 | typedef User_extensions_thread_delete_extension |
---|
1001 | rtems_task_delete_extension; |
---|
1002 | typedef User_extensions_thread_start_extension |
---|
1003 | rtems_task_start_extension; |
---|
1004 | typedef User_extensions_thread_restart_extension |
---|
1005 | rtems_task_restart_extension; |
---|
1006 | typedef User_extensions_thread_switch_extension |
---|
1007 | rtems_task_switch_extension; |
---|
1008 | typedef User_extensions_thread_begin_extension |
---|
1009 | rtems_task_begin_extension; |
---|
1010 | typedef User_extensions_thread_exitted_extension |
---|
1011 | rtems_task_exitted_extension; |
---|
1012 | typedef User_extensions_fatal_extension rtems_fatal_extension; |
---|
1013 | |
---|
1014 | typedef User_extensions_Table rtems_extensions_table; |
---|
1015 | |
---|
1016 | typedef struct @{ |
---|
1017 | rtems_task_create_extension thread_create; |
---|
1018 | rtems_task_start_extension thread_start; |
---|
1019 | rtems_task_restart_extension thread_restart; |
---|
1020 | rtems_task_delete_extension thread_delete; |
---|
1021 | rtems_task_switch_extension thread_switch; |
---|
1022 | rtems_task_begin_extension thread_begin; |
---|
1023 | rtems_task_exitted_extension thread_exitted; |
---|
1024 | rtems_fatal_extension fatal; |
---|
1025 | @} User_extensions_Table; |
---|
1026 | @end example |
---|
1027 | @end ifset |
---|
1028 | |
---|
1029 | @ifset is-Ada |
---|
1030 | @example |
---|
1031 | type Extensions_Table_Entry is |
---|
1032 | record |
---|
1033 | Thread_Create : RTEMS.Thread_Create_Extension; |
---|
1034 | Thread_Start : RTEMS.Thread_Start_Extension; |
---|
1035 | Thread_Restart : RTEMS.Thread_Restart_Extension; |
---|
1036 | Thread_Delete : RTEMS.Thread_Delete_Extension; |
---|
1037 | Thread_Switch : RTEMS.Thread_Switch_Extension; |
---|
1038 | Thread_Post_Switch : RTEMS.Thread_Post_Switch_Extension; |
---|
1039 | Thread_Begin : RTEMS.Thread_Begin_Extension; |
---|
1040 | Thread_Exitted : RTEMS.Thread_Exitted_Extension; |
---|
1041 | Fatal : RTEMS.Fatal_Error_Extension; |
---|
1042 | end record; |
---|
1043 | @end example |
---|
1044 | @end ifset |
---|
1045 | |
---|
1046 | @table @b |
---|
1047 | |
---|
1048 | @item thread_create |
---|
1049 | is the address of the |
---|
1050 | user-supplied subroutine for the TASK_CREATE extension. If this |
---|
1051 | extension for task creation is defined, it is called from the |
---|
1052 | task_create directive. A value of NULL indicates that no |
---|
1053 | extension is provided. |
---|
1054 | |
---|
1055 | @item thread_start |
---|
1056 | is the address of the user-supplied |
---|
1057 | subroutine for the TASK_START extension. If this extension for |
---|
1058 | task initiation is defined, it is called from the task_start |
---|
1059 | directive. A value of NULL indicates that no extension is |
---|
1060 | provided. |
---|
1061 | |
---|
1062 | @item thread_restart |
---|
1063 | is the address of the user-supplied |
---|
1064 | subroutine for the TASK_RESTART extension. If this extension |
---|
1065 | for task re-initiation is defined, it is called from the |
---|
1066 | task_restart directive. A value of NULL indicates that no |
---|
1067 | extension is provided. |
---|
1068 | |
---|
1069 | @item thread_delete |
---|
1070 | is the address of the user-supplied |
---|
1071 | subroutine for the TASK_DELETE extension. If this RTEMS |
---|
1072 | extension for task deletion is defined, it is called from the |
---|
1073 | task_delete directive. A value of NULL indicates that no |
---|
1074 | extension is provided. |
---|
1075 | |
---|
1076 | @item thread_switch |
---|
1077 | is the address of the user-supplied |
---|
1078 | subroutine for the task context switch extension. This |
---|
1079 | subroutine is called from RTEMS dispatcher after the current |
---|
1080 | task has been swapped out but before the new task has been |
---|
1081 | swapped in. A value of NULL indicates that no extension is |
---|
1082 | provided. As this routine is invoked after saving the current |
---|
1083 | task's context and before restoring the heir task's context, it |
---|
1084 | is not necessary for this routine to save and restore any |
---|
1085 | registers. |
---|
1086 | |
---|
1087 | @item thread_begin |
---|
1088 | is the address of the user-supplied |
---|
1089 | subroutine which is invoked immediately before a task begins |
---|
1090 | execution. It is invoked in the context of the beginning task. |
---|
1091 | A value of NULL indicates that no extension is provided. |
---|
1092 | |
---|
1093 | @item thread_exitted |
---|
1094 | is the address of the user-supplied |
---|
1095 | subroutine which is invoked when a task exits. This procedure |
---|
1096 | is responsible for some action which will allow the system to |
---|
1097 | continue execution (i.e. delete or restart the task) or to |
---|
1098 | terminate with a fatal error. If this field is set to NULL, the |
---|
1099 | default RTEMS TASK_EXITTED handler will be invoked. |
---|
1100 | |
---|
1101 | @item fatal |
---|
1102 | is the address of the user-supplied |
---|
1103 | subroutine for the FATAL extension. This RTEMS extension of |
---|
1104 | fatal error handling is called from the |
---|
1105 | @code{@value{DIRPREFIX}fatal_error_occurred} |
---|
1106 | directive. If the user's fatal error handler returns or if this |
---|
1107 | entry is NULL then the default RTEMS fatal error handler will be |
---|
1108 | executed. |
---|
1109 | |
---|
1110 | @end table |
---|
1111 | |
---|
1112 | A typical declaration for a User Extension Table |
---|
1113 | which defines the TASK_CREATE, TASK_DELETE, TASK_SWITCH, and |
---|
1114 | FATAL extension might appear as follows: |
---|
1115 | |
---|
1116 | @ifset is-C |
---|
1117 | @example |
---|
1118 | rtems_extensions_table User_extensions = @{ |
---|
1119 | task_create_extension, |
---|
1120 | NULL, |
---|
1121 | NULL, |
---|
1122 | task_delete_extension, |
---|
1123 | task_switch_extension, |
---|
1124 | NULL, |
---|
1125 | NULL, |
---|
1126 | fatal_extension |
---|
1127 | @}; |
---|
1128 | @end example |
---|
1129 | @end ifset |
---|
1130 | |
---|
1131 | @ifset is-Ada |
---|
1132 | User_Extensions : RTEMS.Extensions_Table := ( |
---|
1133 | Task_Create_Extension'Access, |
---|
1134 | null, |
---|
1135 | null, |
---|
1136 | Task_Delete_Extension'Access, |
---|
1137 | Task_Switch_Extension'Access, |
---|
1138 | null, |
---|
1139 | null, |
---|
1140 | Fatal_Extension'Access |
---|
1141 | ); |
---|
1142 | @example |
---|
1143 | |
---|
1144 | @end example |
---|
1145 | @end ifset |
---|
1146 | |
---|
1147 | More information regarding the user extensions is |
---|
1148 | provided in the User Extensions chapter. |
---|
1149 | |
---|
1150 | @section Multiprocessor Configuration Table |
---|
1151 | |
---|
1152 | @cindex Multiprocessor Configuration Table |
---|
1153 | |
---|
1154 | The Multiprocessor Configuration Table contains |
---|
1155 | information needed when using RTEMS in a multiprocessor |
---|
1156 | configuration. Many of the details associated with configuring |
---|
1157 | a multiprocessor system are dependent on the multiprocessor |
---|
1158 | communications layer provided by the user. The address of the |
---|
1159 | Multiprocessor Configuration Table should be placed in the |
---|
1160 | @code{User_multiprocessing_table} entry in the primary Configuration |
---|
1161 | Table. Further details regarding many of the entries in the |
---|
1162 | Multiprocessor Configuration Table will be provided in the |
---|
1163 | Multiprocessing chapter. |
---|
1164 | |
---|
1165 | |
---|
1166 | When using the @code{confdefs.h} mechanism for configuring |
---|
1167 | an RTEMS application, the macro @code{CONFIGURE_MPTEST} must |
---|
1168 | be defined to automatically generate the Multiprocessor Configuration Table. |
---|
1169 | If @code{CONFIGURE_MPTEST}, is not defined, then a NULL pointer |
---|
1170 | is configured as the address of this table. |
---|
1171 | |
---|
1172 | The format of the Multiprocessor Configuration Table is defined in |
---|
1173 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
1174 | |
---|
1175 | @ifset is-C |
---|
1176 | @example |
---|
1177 | typedef struct @{ |
---|
1178 | rtems_unsigned32 node; |
---|
1179 | rtems_unsigned32 maximum_nodes; |
---|
1180 | rtems_unsigned32 maximum_global_objects; |
---|
1181 | rtems_unsigned32 maximum_proxies; |
---|
1182 | rtems_mpci_table *User_mpci_table; |
---|
1183 | @} rtems_multiprocessing_table; |
---|
1184 | @end example |
---|
1185 | @end ifset |
---|
1186 | |
---|
1187 | @ifset is-Ada |
---|
1188 | @example |
---|
1189 | type Multiprocessing_Table is |
---|
1190 | record |
---|
1191 | Node : RTEMS.Unsigned32; |
---|
1192 | Maximum_Nodes : RTEMS.Unsigned32; |
---|
1193 | Maximum_Global_Objects : RTEMS.Unsigned32; |
---|
1194 | Maximum_Proxies : RTEMS.Unsigned32; |
---|
1195 | User_MPCI_Table : RTEMS.MPCI_Table_Pointer; |
---|
1196 | end record; |
---|
1197 | |
---|
1198 | type Multiprocessing_Table_Pointer is access all Multiprocessing_Table; |
---|
1199 | @end example |
---|
1200 | @end ifset |
---|
1201 | |
---|
1202 | @table @b |
---|
1203 | @item node |
---|
1204 | is a unique processor identifier |
---|
1205 | and is used in routing messages between nodes in a |
---|
1206 | multiprocessor configuration. Each processor must have a unique |
---|
1207 | node number. RTEMS assumes that node numbers start at one and |
---|
1208 | increase sequentially. This assumption can be used to advantage |
---|
1209 | by the user-supplied MPCI layer. Typically, this requirement is |
---|
1210 | made when the node numbers are used to calculate the address of |
---|
1211 | inter-processor communication links. Zero should be avoided as |
---|
1212 | a node number because some MPCI layers use node zero to |
---|
1213 | represent broadcasted packets. Thus, it is recommended that |
---|
1214 | node numbers start at one and increase sequentially. |
---|
1215 | When using the @code{confdefs.h} mechanism for configuring |
---|
1216 | an RTEMS application, the value for this field corresponds |
---|
1217 | to the setting of the macro @code{CONFIGURE_MP_NODE_NUMBER}. |
---|
1218 | If not defined by the application, then the @code{CONFIGURE_MP_NODE_NUMBER} |
---|
1219 | macro defaults to the value of the @code{NODE_NUMBER} macro which is |
---|
1220 | set on the compiler command line by the RTEMS Multiprocessing Test Suites. |
---|
1221 | |
---|
1222 | |
---|
1223 | @item maximum_nodes |
---|
1224 | is the number of processor nodes in the system. |
---|
1225 | When using the @code{confdefs.h} mechanism for configuring |
---|
1226 | an RTEMS application, the value for this field corresponds |
---|
1227 | to the setting of the macro @code{CONFIGURE_MP_MAXIMUM_NODES}. |
---|
1228 | If not defined by the application, then the @code{CONFIGURE_MP_MAXIMUM_NODES} |
---|
1229 | macro defaults to the value 2. |
---|
1230 | |
---|
1231 | @item maximum_global_objects |
---|
1232 | is the maximum number of global objects which can exist at any |
---|
1233 | given moment in the entire system. If this parameter is not the |
---|
1234 | same on all nodes in the system, then a fatal error is generated |
---|
1235 | to inform the user that the system is inconsistent. |
---|
1236 | When using the @code{confdefs.h} mechanism for configuring |
---|
1237 | an RTEMS application, the value for this field corresponds |
---|
1238 | to the setting of the macro @code{CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS}. |
---|
1239 | If not defined by the application, then the |
---|
1240 | @code{CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS} macro defaults to the value 32. |
---|
1241 | |
---|
1242 | |
---|
1243 | @item maximum_proxies |
---|
1244 | is the maximum number of proxies which can exist at any given moment |
---|
1245 | on this particular node. A proxy is a substitute task control block |
---|
1246 | which represent a task residing on a remote node when that task blocks |
---|
1247 | on a remote object. Proxies are used in situations in which delayed |
---|
1248 | interaction is required with a remote node. |
---|
1249 | When using the @code{confdefs.h} mechanism for configuring |
---|
1250 | an RTEMS application, the value for this field corresponds |
---|
1251 | to the setting of the macro @code{CONFIGURE_MP_MAXIMUM_PROXIES}. |
---|
1252 | If not defined by the application, then the @code{CONFIGURE_MP_MAXIMUM_PROXIES} |
---|
1253 | macro defaults to the value 32. |
---|
1254 | |
---|
1255 | |
---|
1256 | @item User_mpci_table |
---|
1257 | is the address of the Multiprocessor Communications Interface |
---|
1258 | Table. This table contains the entry points of user-provided functions |
---|
1259 | which constitute the multiprocessor communications layer. This table |
---|
1260 | must be provided in multiprocessor configurations with all |
---|
1261 | entries configured. The format of this table and details |
---|
1262 | regarding its entries can be found in the next section. |
---|
1263 | When using the @code{confdefs.h} mechanism for configuring |
---|
1264 | an RTEMS application, the value for this field corresponds |
---|
1265 | to the setting of the macro @code{CONFIGURE_MP_MPCI_TABLE_POINTER}. |
---|
1266 | If not defined by the application, then the |
---|
1267 | @code{CONFIGURE_MP_MPCI_TABLE_POINTER} macro defaults to the |
---|
1268 | address of the table named @code{MPCI_table}. |
---|
1269 | |
---|
1270 | |
---|
1271 | @end table |
---|
1272 | |
---|
1273 | @section Multiprocessor Communications Interface Table |
---|
1274 | |
---|
1275 | @cindex Multiprocessor Communications Interface Table |
---|
1276 | |
---|
1277 | This table defines the set of callouts that must be provided by |
---|
1278 | an Multiprocessor Communications Interface implementation. |
---|
1279 | |
---|
1280 | When using the @code{confdefs.h} mechanism for configuring |
---|
1281 | an RTEMS application, the name of this table is assumed |
---|
1282 | to be @code{MPCI_table} unless the application sets |
---|
1283 | the @code{CONFIGURE_MP_MPCI_TABLE_POINTER} when configuring a |
---|
1284 | multiprocessing system. |
---|
1285 | |
---|
1286 | The format of this table is defined in |
---|
1287 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
1288 | |
---|
1289 | @ifset is-C |
---|
1290 | @example |
---|
1291 | typedef struct @{ |
---|
1292 | rtems_unsigned32 default_timeout; /* in ticks */ |
---|
1293 | rtems_unsigned32 maximum_packet_size; |
---|
1294 | rtems_mpci_initialization_entry initialization; |
---|
1295 | rtems_mpci_get_packet_entry get_packet; |
---|
1296 | rtems_mpci_return_packet_entry return_packet; |
---|
1297 | rtems_mpci_send_entry send; |
---|
1298 | rtems_mpci_receive_entry receive; |
---|
1299 | @} rtems_mpci_table; |
---|
1300 | @end example |
---|
1301 | @end ifset |
---|
1302 | |
---|
1303 | @ifset is-Ada |
---|
1304 | @example |
---|
1305 | type MPCI_Table is |
---|
1306 | record |
---|
1307 | Default_Timeout : RTEMS.Unsigned32; -- in ticks |
---|
1308 | Maximum_Packet_Size : RTEMS.Unsigned32; |
---|
1309 | Initialization : RTEMS.MPCI_Initialization_Entry; |
---|
1310 | Get_Packet : RTEMS.MPCI_Get_Packet_Entry; |
---|
1311 | Return_Packet : RTEMS.MPCI_Return_Packet_Entry; |
---|
1312 | Send : RTEMS.MPCI_Send_Entry; |
---|
1313 | Receive : RTEMS.MPCI_Receive_Entry; |
---|
1314 | end record; |
---|
1315 | |
---|
1316 | type MPCI_Table_Pointer is access all MPCI_Table; |
---|
1317 | @end example |
---|
1318 | @end ifset |
---|
1319 | |
---|
1320 | @table @b |
---|
1321 | @item default_timeout |
---|
1322 | is the default maximum length of time a task should block waiting for |
---|
1323 | a response to a directive which results in communication with a remote node. |
---|
1324 | The maximum length of time is a function the user supplied |
---|
1325 | multiprocessor communications layer and the media used. This |
---|
1326 | timeout only applies to directives which would not block if the |
---|
1327 | operation were performed locally. |
---|
1328 | |
---|
1329 | @item maximum_packet_size |
---|
1330 | is the size in bytes of the longest packet which the MPCI layer is capable |
---|
1331 | of sending. This value should represent the total number of bytes available |
---|
1332 | for a RTEMS interprocessor messages. |
---|
1333 | |
---|
1334 | @item initialization |
---|
1335 | is the address of the entry point for the initialization procedure of the |
---|
1336 | user supplied multiprocessor communications layer. |
---|
1337 | |
---|
1338 | @item get_packet |
---|
1339 | is the address of the entry point for the procedure called by RTEMS to |
---|
1340 | obtain a packet from the user supplied multiprocessor communications layer. |
---|
1341 | |
---|
1342 | @item return_packet |
---|
1343 | is the address of the entry point for the procedure called by RTEMS to |
---|
1344 | return a packet to the user supplied multiprocessor communications layer. |
---|
1345 | |
---|
1346 | @item send |
---|
1347 | is the address of the entry point for the procedure called by RTEMS to |
---|
1348 | send an envelope to another node. This procedure is part of the user |
---|
1349 | supplied multiprocessor communications layer. |
---|
1350 | |
---|
1351 | @item receive |
---|
1352 | is the address of the entry point for the |
---|
1353 | procedure called by RTEMS to retrieve an envelope containing a |
---|
1354 | message from another node. This procedure is part of the user |
---|
1355 | supplied multiprocessor communications layer. |
---|
1356 | |
---|
1357 | @end table |
---|
1358 | |
---|
1359 | More information regarding the required functionality of these |
---|
1360 | entry points is provided in the Multiprocessor chapter. |
---|
1361 | |
---|
1362 | @section Determining Memory Requirements |
---|
1363 | |
---|
1364 | Since memory is a critical resource in many real-time |
---|
1365 | embedded systems, the RTEMS Classic API was specifically designed to allow |
---|
1366 | unused managers to be forcibly excluded from the run-time environment. |
---|
1367 | This allows the application designer the flexibility to tailor |
---|
1368 | RTEMS to most efficiently meet system requirements while still |
---|
1369 | satisfying even the most stringent memory constraints. As |
---|
1370 | result, the size of the RTEMS executive is application |
---|
1371 | dependent. A Memory Requirements worksheet is provided in the |
---|
1372 | Applications Supplement document for a specific target |
---|
1373 | processor. This worksheet can be used to calculate the memory |
---|
1374 | requirements of a custom RTEMS run-time environment. To insure |
---|
1375 | that enough memory is allocated for future versions of RTEMS, |
---|
1376 | the application designer should round these memory requirements |
---|
1377 | up. The following Classic API managers may be optionally excluded: |
---|
1378 | |
---|
1379 | @itemize @bullet |
---|
1380 | @item signal |
---|
1381 | @item region |
---|
1382 | @item dual ported memory |
---|
1383 | @item event |
---|
1384 | @item multiprocessing |
---|
1385 | @item partition |
---|
1386 | @item timer |
---|
1387 | @item semaphore |
---|
1388 | @item message |
---|
1389 | @item rate monotonic |
---|
1390 | @end itemize |
---|
1391 | |
---|
1392 | RTEMS is designed to be built and installed as a library |
---|
1393 | that is linked into the application. As such, much of |
---|
1394 | RTEMS is implemented in such a way that there is a single |
---|
1395 | entry point per source file. This avoids having the |
---|
1396 | linker being forced to pull large object files in their |
---|
1397 | entirety into an application when the application references |
---|
1398 | a single symbol. |
---|
1399 | |
---|
1400 | RTEMS based applications must somehow provide memory |
---|
1401 | for RTEMS' code and data space. Although RTEMS' data space must |
---|
1402 | be in RAM, its code space can be located in either ROM or RAM. |
---|
1403 | In addition, the user must allocate RAM for the RTEMS RAM |
---|
1404 | Workspace. The size of this area is application dependent and |
---|
1405 | can be calculated using the formula provided in the Memory |
---|
1406 | Requirements chapter of the Applications Supplement document |
---|
1407 | for a specific target processor. |
---|
1408 | |
---|
1409 | All private RTEMS data variables and routine names used by |
---|
1410 | RTEMS begin with the underscore ( _ ) character followed by an |
---|
1411 | upper-case letter. If RTEMS is linked with an application, then |
---|
1412 | the application code should NOT contain any symbols which begin |
---|
1413 | with the underscore character and followed by an upper-case |
---|
1414 | letter to avoid any naming conflicts. All RTEMS directive names |
---|
1415 | should be treated as reserved words. |
---|
1416 | |
---|
1417 | @section Sizing the RTEMS RAM Workspace |
---|
1418 | |
---|
1419 | The RTEMS RAM Workspace is a user-specified block of |
---|
1420 | memory reserved for use by RTEMS. The application should NOT |
---|
1421 | modify this memory. This area consists primarily of the RTEMS |
---|
1422 | data structures whose exact size depends upon the values |
---|
1423 | specified in the Configuration Table. In addition, task stacks |
---|
1424 | and floating point context areas are dynamically allocated from |
---|
1425 | the RTEMS RAM Workspace. |
---|
1426 | |
---|
1427 | The @code{confdefs.h} mechanism calcalutes the size |
---|
1428 | of the RTEMS RAM Workspace automatically. It assumes that |
---|
1429 | all tasks are floating point and that all will be allocated |
---|
1430 | the miminum stack space. This calculation also automatically |
---|
1431 | includes the memory that will be allocated for internal use |
---|
1432 | by RTEMS. The following macros may be set |
---|
1433 | by the application to make the calculation |
---|
1434 | of memory required more accurate: |
---|
1435 | |
---|
1436 | @itemize @bullet |
---|
1437 | |
---|
1438 | CONFIGURE_MEMORY_OVERHEAD |
---|
1439 | CONFIGURE_EXTRA_TASK_STACKS |
---|
1440 | |
---|
1441 | @end itemize |
---|
1442 | |
---|
1443 | The starting address of the RTEMS RAM Workspace must |
---|
1444 | be aligned on a four-byte boundary. Failure to properly align |
---|
1445 | the workspace area will result in the |
---|
1446 | @code{@value{DIRPREFIX}fatal_error_occurred} |
---|
1447 | directive being invoked with the |
---|
1448 | @code{@value{RPREFIX}INVALID_ADDRESS} error code. |
---|
1449 | |
---|
1450 | A worksheet is provided in the @b{Memory Requirements} |
---|
1451 | chapter of the Applications Supplement document for a specific |
---|
1452 | target processor to assist the user in calculating the minimum |
---|
1453 | size of the RTEMS RAM Workspace for each application. The value |
---|
1454 | calculated with this worksheet is the minimum value that should |
---|
1455 | be specified as the @code{work_space_size} parameter of the |
---|
1456 | Configuration Table. |
---|
1457 | |
---|
1458 | The allocation of objects can operate in two modes. The default mode |
---|
1459 | has an object number ceiling. No more than the specified number of |
---|
1460 | objects can be allocated from the RTEMS RAM Workspace. The number of objects |
---|
1461 | specified in the particular API Configuration table fields are |
---|
1462 | allocated at initialisation. The second mode allows the number of |
---|
1463 | objects to grow to use the available free memory in the RTEMS RAM Workspace. |
---|
1464 | |
---|
1465 | The auto-extending mode can be enabled individually for each object |
---|
1466 | type by using the macro @code{rtems_resource_unlimited}. This takes a value |
---|
1467 | as a parameter, and is used to set the object maximum number field in |
---|
1468 | an API Configuration table. The value is an allocation unit size. When |
---|
1469 | RTEMS is required to grow the object table it is grown by this |
---|
1470 | size. The kernel will return the object memory back to the RTEMS RAM Workspace |
---|
1471 | when an object is destroyed. The kernel will only return an allocated |
---|
1472 | block of objects to the RTEMS RAM Workspace if at least half the allocation |
---|
1473 | size of free objects remain allocated. RTEMS always keeps one |
---|
1474 | allocation block of objects allocated. Here is an example of using |
---|
1475 | @code{rtems_resource_unlimited}: |
---|
1476 | |
---|
1477 | @example |
---|
1478 | #define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(5) |
---|
1479 | @end example |
---|
1480 | |
---|
1481 | The user is cautioned that future versions of RTEMS may not have the |
---|
1482 | same memory requirements per object. Although the value calculated is |
---|
1483 | suficient for a particular target processor and release of RTEMS, |
---|
1484 | memory usage is subject to change across versions and target |
---|
1485 | processors. The user is advised to allocate somewhat more memory than |
---|
1486 | the worksheet recommends to insure compatibility with future releases |
---|
1487 | for a specific target processor and other target processors. To avoid |
---|
1488 | problems, the user should recalculate the memory requirements each |
---|
1489 | time one of the following events occurs: |
---|
1490 | |
---|
1491 | @itemize @bullet |
---|
1492 | @item a configuration parameter is modified, |
---|
1493 | @item task or interrupt stack requirements change, |
---|
1494 | @item task floating point attribute is altered, |
---|
1495 | @item RTEMS is upgraded, or |
---|
1496 | @item the target processor is changed. |
---|
1497 | @end itemize |
---|
1498 | |
---|
1499 | Failure to provide enough space in the RTEMS RAM |
---|
1500 | Workspace will result in the |
---|
1501 | @code{@value{DIRPREFIX}fatal_error_occurred} directive |
---|
1502 | being invoked with the appropriate error code. |
---|