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