1 | @c |
---|
2 | @c COPYRIGHT (c) 1996. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | |
---|
7 | @ifinfo |
---|
8 | @node Configuring a System, Configuring a System Configuration Table, EXTENSION_DELETE - Delete a extension set, Top |
---|
9 | @end ifinfo |
---|
10 | @chapter Configuring a System |
---|
11 | @ifinfo |
---|
12 | @menu |
---|
13 | * Configuring a System Configuration Table:: |
---|
14 | * Configuring a System RTEMS API Configuration Table:: |
---|
15 | * Configuring a System POSIX API Configuration Table:: |
---|
16 | * Configuring a System CPU Dependent Information Table:: |
---|
17 | * Configuring a System Initialization Task Table:: |
---|
18 | * Configuring a System Driver Address Table:: |
---|
19 | * Configuring a System User Extensions Table:: |
---|
20 | * Configuring a System Multiprocessor Configuration Table:: |
---|
21 | * Configuring a System Multiprocessor Communications Interface Table:: |
---|
22 | * Configuring a System Determining Memory Requirements:: |
---|
23 | * Configuring a System Sizing the RTEMS RAM Workspace:: |
---|
24 | @end menu |
---|
25 | @end ifinfo |
---|
26 | |
---|
27 | @ifinfo |
---|
28 | @node Configuring a System Configuration Table, Configuring a System RTEMS API Configuration Table, Configuring a System, Configuring a System |
---|
29 | @end ifinfo |
---|
30 | @section Configuration Table |
---|
31 | |
---|
32 | The RTEMS Configuration Table is used to tailor an |
---|
33 | application for its specific needs. For example, the user can |
---|
34 | configure the number of device drivers or which APIs may be used. |
---|
35 | THe address of the user-defined Configuration Table is passed as an |
---|
36 | argument to the initialize_executive directive, which MUST be |
---|
37 | the first RTEMS directive called. The RTEMS Configuration Table |
---|
38 | is defined in the following @value{RTEMS-LANGUAGE} @value{RTEMS-STRUCTURE}: |
---|
39 | |
---|
40 | @ifset is-C |
---|
41 | @example |
---|
42 | @group |
---|
43 | typedef struct @{ |
---|
44 | void *work_space_start; |
---|
45 | rtems_unsigned32 work_space_size; |
---|
46 | rtems_unsigned32 maximum_extensions; |
---|
47 | rtems_unsigned32 microseconds_per_tick; |
---|
48 | rtems_unsigned32 ticks_per_timeslice; |
---|
49 | rtems_unsigned32 maximum_devices; |
---|
50 | rtems_unsigned32 number_of_device_drivers; |
---|
51 | rtems_driver_address_table *Device_driver_table; |
---|
52 | rtems_extensions_table *User_extension_table; |
---|
53 | rtems_multiprocessing_table *User_multiprocessing_table; |
---|
54 | rtems_api_configuration_table *RTEMS_api_configuration; |
---|
55 | posix_api_configuration_table *POSIX_api_configuration; |
---|
56 | @} rtems_configuration_table; |
---|
57 | @end group |
---|
58 | @end example |
---|
59 | @end ifset |
---|
60 | |
---|
61 | @ifset is-Ada |
---|
62 | @example |
---|
63 | type Configuration_Table is |
---|
64 | record |
---|
65 | Work_Space_Start : RTEMS.Address; |
---|
66 | Work_Space_Size : RTEMS.Unsigned32; |
---|
67 | Maximum_Extensions : RTEMS.Unsigned32; |
---|
68 | Microseconds_Per_Tick : RTEMS.Unsigned32; |
---|
69 | Ticks_Per_Timeslice : RTEMS.Unsigned32; |
---|
70 | Maximum_Devices : RTEMS.Unsigned32; |
---|
71 | Number_Of_Device_Drivers : RTEMS.Unsigned32; |
---|
72 | Device_Driver_Table : RTEMS.Driver_Address_Table_Pointer; |
---|
73 | User_Extension_Table : RTEMS.Extensions_Table_Pointer; |
---|
74 | User_Multiprocessing_Table : RTEMS.Multiprocessing_Table_Pointer; |
---|
75 | RTEMS_API_Configuration : RTEMS.API_Configuration_Table_Pointer; |
---|
76 | POSIX_API_Configuration : |
---|
77 | RTEMS.POSIX_API_Configuration_Table_Pointer; |
---|
78 | end record; |
---|
79 | |
---|
80 | type Configuration_Table_Pointer is access all Configuration_Table; |
---|
81 | @end example |
---|
82 | @end ifset |
---|
83 | |
---|
84 | @table @b |
---|
85 | @item work_space_start |
---|
86 | is the address of the RTEMS RAM Workspace. |
---|
87 | This area contains items such as the |
---|
88 | various object control blocks (TCBs, QCBs, ...) and task stacks. |
---|
89 | If the address is not aligned on a four-word boundary, then |
---|
90 | RTEMS will invoke the fatal error handler during |
---|
91 | initialize_executive. |
---|
92 | |
---|
93 | @item work_space_size |
---|
94 | is the calculated size of the |
---|
95 | RTEMS RAM Workspace. The section Sizing the RTEMS RAM Workspace |
---|
96 | details how to arrive at this number. |
---|
97 | |
---|
98 | @item microseconds_per_tick |
---|
99 | is number of microseconds per clock tick. |
---|
100 | |
---|
101 | @item ticks_per_timeslice |
---|
102 | is the number of clock ticks for a timeslice. |
---|
103 | |
---|
104 | @item maximum_devices |
---|
105 | is the maximum number of devices that can be registered. |
---|
106 | |
---|
107 | @item number_of_device_drivers |
---|
108 | is the number of device drivers for the system. There should be |
---|
109 | the same number of entries in the Device Driver Table. If this field |
---|
110 | is zero, then the User_driver_address_table entry should be NULL. |
---|
111 | |
---|
112 | @item Device_driver_table |
---|
113 | is the address of the Device Driver Table. This table contains the entry |
---|
114 | points for each device driver. If the number_of_device_drivers field is zero, |
---|
115 | then this entry should be NULL. The format of this table will be |
---|
116 | discussed below. |
---|
117 | |
---|
118 | @item User_extension_table |
---|
119 | is the address of the User |
---|
120 | Extension Table. This table contains the entry points for the |
---|
121 | static set of optional user extensions. If no user extensions |
---|
122 | are configured, then this entry should be NULL. The format of |
---|
123 | this table will be discussed below. |
---|
124 | |
---|
125 | @item User_multiprocessing_table |
---|
126 | is the address of the Multiprocessor Configuration Table. This |
---|
127 | table contains information needed by RTEMS only when used in a multiprocessor |
---|
128 | configuration. This field must be NULL when RTEMS is used in a |
---|
129 | single processor configuration. |
---|
130 | |
---|
131 | @item RTEMS_api_configuration |
---|
132 | is the address of the RTEMS API Configuration Table. This table |
---|
133 | contains information needed by the RTEMS API. This field should be |
---|
134 | NULL if the RTEMS API is not used. [NOTE: Currently the RTEMS API |
---|
135 | is required to support support components such as BSPs and libraries |
---|
136 | which use this API.] |
---|
137 | |
---|
138 | @item POSIX_api_configuration |
---|
139 | is the address of the POSIX API Configuration Table. This table |
---|
140 | contains information needed by the POSIX API. This field should be |
---|
141 | NULL if the POSIX API is not used. |
---|
142 | |
---|
143 | @end table |
---|
144 | |
---|
145 | @ifinfo |
---|
146 | @node Configuring a System RTEMS API Configuration Table, Configuring a System POSIX API Configuration Table, Configuring a System Configuration Table, Configuring a System |
---|
147 | @end ifinfo |
---|
148 | @section RTEMS API Configuration Table |
---|
149 | |
---|
150 | The RTEMS API Configuration Table is used to configure the |
---|
151 | managers which constitute the RTEMS API for a particular application. |
---|
152 | For example, the user can configure the maximum number of tasks for |
---|
153 | this application. The RTEMS API Configuration Table is defined in |
---|
154 | the following @value{RTEMS-LANGUAGE} @value{RTEMS-STRUCTURE}: |
---|
155 | |
---|
156 | @ifset is-C |
---|
157 | @example |
---|
158 | @group |
---|
159 | typedef struct @{ |
---|
160 | rtems_unsigned32 maximum_tasks; |
---|
161 | rtems_unsigned32 maximum_timers; |
---|
162 | rtems_unsigned32 maximum_semaphores; |
---|
163 | rtems_unsigned32 maximum_message_queues; |
---|
164 | rtems_unsigned32 maximum_partitions; |
---|
165 | rtems_unsigned32 maximum_regions; |
---|
166 | rtems_unsigned32 maximum_ports; |
---|
167 | rtems_unsigned32 maximum_periods; |
---|
168 | rtems_unsigned32 number_of_initialization_tasks; |
---|
169 | rtems_initialization_tasks_table *User_initialization_tasks_table; |
---|
170 | @} rtems_api_configuration_table; |
---|
171 | @end group |
---|
172 | @end example |
---|
173 | @end ifset |
---|
174 | |
---|
175 | @ifset is-Ada |
---|
176 | @example |
---|
177 | type API_Configuration_Table is |
---|
178 | record |
---|
179 | Maximum_Tasks : RTEMS.Unsigned32; |
---|
180 | Maximum_Timers : RTEMS.Unsigned32; |
---|
181 | Maximum_Semaphores : RTEMS.Unsigned32; |
---|
182 | Maximum_Message_queues : RTEMS.Unsigned32; |
---|
183 | Maximum_Partitions : RTEMS.Unsigned32; |
---|
184 | Maximum_Regions : RTEMS.Unsigned32; |
---|
185 | Maximum_Ports : RTEMS.Unsigned32; |
---|
186 | Maximum_Periods : RTEMS.Unsigned32; |
---|
187 | Number_Of_Initialization_Tasks : RTEMS.Unsigned32; |
---|
188 | User_Initialization_Tasks_Table : |
---|
189 | RTEMS.Initialization_Tasks_Table_Pointer; |
---|
190 | end record; |
---|
191 | |
---|
192 | type API_Configuration_Table_Pointer is access all API_Configuration_Table; |
---|
193 | @end example |
---|
194 | @end ifset |
---|
195 | |
---|
196 | @table @b |
---|
197 | @item maximum_tasks |
---|
198 | is the maximum number of tasks that |
---|
199 | can be concurrently active (created) in the system including |
---|
200 | initialization tasks. |
---|
201 | |
---|
202 | @item maximum_timers |
---|
203 | is the maximum number of timers |
---|
204 | that can be concurrently active in the system. |
---|
205 | |
---|
206 | @item maximum_semaphores |
---|
207 | is the maximum number of |
---|
208 | semaphores that can be concurrently active in the system. |
---|
209 | |
---|
210 | @item maximum_message_queues |
---|
211 | is the maximum number of |
---|
212 | message queues that can be concurrently active in the system. |
---|
213 | |
---|
214 | @item maximum_partitions |
---|
215 | is the maximum number of |
---|
216 | partitions that can be concurrently active in the system. |
---|
217 | |
---|
218 | @item maximum_regions |
---|
219 | is the maximum number of regions |
---|
220 | that can be concurrently active in the system. |
---|
221 | |
---|
222 | @item maximum_ports |
---|
223 | is the maximum number of ports into |
---|
224 | dual-port memory areas that can be concurrently active in the |
---|
225 | system. |
---|
226 | |
---|
227 | @item number_of_initialization_tasks |
---|
228 | is the number of initialization tasks configured. At least one |
---|
229 | initialization task must be configured. |
---|
230 | |
---|
231 | @item User_initialization_tasks_table |
---|
232 | is the address of the Initialization Task Table. This table contains the |
---|
233 | information needed to create and start each of the |
---|
234 | initialization tasks. The format of this table will be discussed below. |
---|
235 | |
---|
236 | @end table |
---|
237 | |
---|
238 | @ifinfo |
---|
239 | @node Configuring a System POSIX API Configuration Table, Configuring a System CPU Dependent Information Table, Configuring a System RTEMS API Configuration Table, Configuring a System |
---|
240 | @end ifinfo |
---|
241 | @section POSIX API Configuration Table |
---|
242 | |
---|
243 | The POSIX API Configuration Table is used to configure the |
---|
244 | managers which constitute the POSIX API for a particular application. |
---|
245 | For example, the user can configure the maximum number of threads for |
---|
246 | this application. The POSIX API Configuration Table is defined in |
---|
247 | the following @value{RTEMS-LANGUAGE} @value{RTEMS-STRUCTURE}: |
---|
248 | |
---|
249 | @ifset is-C |
---|
250 | @example |
---|
251 | @group |
---|
252 | typedef struct @{ |
---|
253 | void *(*thread_entry)(void *); |
---|
254 | @} posix_initialization_threads_table; |
---|
255 | |
---|
256 | typedef struct @{ |
---|
257 | int maximum_threads; |
---|
258 | int maximum_mutexes; |
---|
259 | int maximum_condition_variables; |
---|
260 | int maximum_keys; |
---|
261 | int maximum_queued_signals; |
---|
262 | int number_of_initialization_tasks; |
---|
263 | posix_initialization_threads_table *User_initialization_tasks_table; |
---|
264 | @} posix_api_configuration_table; |
---|
265 | @end group |
---|
266 | @end example |
---|
267 | @end ifset |
---|
268 | |
---|
269 | @ifset is-Ada |
---|
270 | @example |
---|
271 | type POSIX_Thread_Entry is access procedure ( |
---|
272 | Argument : in RTEMS.Address |
---|
273 | ); |
---|
274 | |
---|
275 | type POSIX_Initialization_Threads_Table_Entry is |
---|
276 | record |
---|
277 | Thread_Entry : RTEMS.POSIX_Thread_Entry; |
---|
278 | end record; |
---|
279 | |
---|
280 | type POSIX_Initialization_Threads_Table is array |
---|
281 | ( RTEMS.Unsigned32 range <> ) of |
---|
282 | RTEMS.POSIX_Initialization_Threads_Table_Entry; |
---|
283 | |
---|
284 | type POSIX_Initialization_Threads_Table_Pointer is access all |
---|
285 | POSIX_Initialization_Threads_Table; |
---|
286 | |
---|
287 | type POSIX_API_Configuration_Table_Entry is |
---|
288 | record |
---|
289 | Maximum_Threads : Interfaces.C.Int; |
---|
290 | Maximum_Mutexes : Interfaces.C.Int; |
---|
291 | Maximum_Condition_Variables : Interfaces.C.Int; |
---|
292 | Maximum_Keys : Interfaces.C.Int; |
---|
293 | Maximum_Queued_Signals : Interfaces.C.Int; |
---|
294 | Number_Of_Initialization_Tasks : Interfaces.C.Int; |
---|
295 | User_Initialization_Tasks_Table : |
---|
296 | RTEMS.POSIX_Initialization_Threads_Table_Pointer; |
---|
297 | end record; |
---|
298 | |
---|
299 | type POSIX_API_Configuration_Table is array ( RTEMS.Unsigned32 range <> ) of |
---|
300 | RTEMS.POSIX_API_Configuration_Table_Entry; |
---|
301 | |
---|
302 | type POSIX_API_Configuration_Table_Pointer is access all |
---|
303 | RTEMS.POSIX_API_Configuration_Table; |
---|
304 | @end example |
---|
305 | @end ifset |
---|
306 | |
---|
307 | @table @b |
---|
308 | @item maximum_threads |
---|
309 | is the maximum number of threads that |
---|
310 | can be concurrently active (created) in the system including |
---|
311 | initialization threads. |
---|
312 | |
---|
313 | @item maximum_mutexes |
---|
314 | is the maximum number of mutexes that can be concurrently |
---|
315 | active in the system. |
---|
316 | |
---|
317 | @item maximum_condition_variables |
---|
318 | is the maximum number of condition variables that can be |
---|
319 | concurrently active in the system. |
---|
320 | |
---|
321 | @item maximum_keys |
---|
322 | is the maximum number of keys that can be concurrently active in the system. |
---|
323 | |
---|
324 | @item maximum_queued_signals |
---|
325 | is the maximum number of queued signals that can be concurrently |
---|
326 | pending in the system. |
---|
327 | |
---|
328 | @item number_of_initialization_threads |
---|
329 | is the number of initialization threads configured. At least one |
---|
330 | initialization threads must be configured. |
---|
331 | |
---|
332 | @item User_initialization_threads_table |
---|
333 | is the address of the Initialization Threads Table. This table contains the |
---|
334 | information needed to create and start each of the initialization threads. |
---|
335 | The format of each entry in this table is defined in the |
---|
336 | posix_initialization_threads_table structure. |
---|
337 | |
---|
338 | @end table |
---|
339 | |
---|
340 | @ifinfo |
---|
341 | @node Configuring a System CPU Dependent Information Table, Configuring a System Initialization Task Table, Configuring a System POSIX API Configuration Table, Configuring a System |
---|
342 | @end ifinfo |
---|
343 | @section CPU Dependent Information Table |
---|
344 | |
---|
345 | The CPU Dependent Information Table is used to |
---|
346 | describe processor dependent information required by RTEMS. |
---|
347 | This table is generally used to supply RTEMS with information |
---|
348 | only known by the Board Support Package. The contents of this |
---|
349 | table are discussed in the CPU Dependent Information Table |
---|
350 | chapter of the Applications Supplement document for a specific |
---|
351 | target processor. |
---|
352 | |
---|
353 | @ifinfo |
---|
354 | @node Configuring a System Initialization Task Table, Configuring a System Driver Address Table, Configuring a System CPU Dependent Information Table, Configuring a System |
---|
355 | @end ifinfo |
---|
356 | @section Initialization Task Table |
---|
357 | |
---|
358 | The Initialization Task Table is used to describe |
---|
359 | each of the user initialization tasks to the Initialization |
---|
360 | Manager. The table contains one entry for each initialization |
---|
361 | task the user wishes to create and start. The fields of this |
---|
362 | data structure directly correspond to arguments to the |
---|
363 | task_create and task_start directives. The number of entries is |
---|
364 | found in the number_of_initialization_tasks entry in the |
---|
365 | Configuration Table. The format of each entry in the |
---|
366 | Initialization Task Table is defined in the following C |
---|
367 | structure: |
---|
368 | |
---|
369 | @ifset is-C |
---|
370 | @example |
---|
371 | typedef struct @{ |
---|
372 | rtems_name name; |
---|
373 | rtems_unsigned32 stack_size; |
---|
374 | rtems_task_priority initial_priority; |
---|
375 | rtems_attribute attribute_set; |
---|
376 | rtems_task_entry entry_point; |
---|
377 | rtems_mode mode_set; |
---|
378 | rtems_task_argument argument; |
---|
379 | @} rtems_initialization_tasks_table; |
---|
380 | @end example |
---|
381 | @end ifset |
---|
382 | |
---|
383 | @ifset is-Ada |
---|
384 | @example |
---|
385 | type Initialization_Tasks_Table_Entry is |
---|
386 | record |
---|
387 | Name : RTEMS.Name; -- task name |
---|
388 | Stack_Size : RTEMS.Unsigned32; -- task stack size |
---|
389 | Initial_Priority : RTEMS.Task_priority; -- task priority |
---|
390 | Attribute_Set : RTEMS.Attribute; -- task attributes |
---|
391 | Entry_Point : RTEMS.Task_Entry; -- task entry point |
---|
392 | Mode_Set : RTEMS.Mode; -- task initial mode |
---|
393 | Argument : RTEMS.Unsigned32; -- task argument |
---|
394 | end record; |
---|
395 | |
---|
396 | type Initialization_Tasks_Table is array ( RTEMS.Unsigned32 range <> ) of |
---|
397 | RTEMS.Initialization_Tasks_Table_Entry; |
---|
398 | |
---|
399 | type Initialization_Tasks_Table_Pointer is access all |
---|
400 | Initialization_Tasks_Table; |
---|
401 | @end example |
---|
402 | @end ifset |
---|
403 | |
---|
404 | @table @b |
---|
405 | @item name |
---|
406 | is the name of this initialization task. |
---|
407 | |
---|
408 | @item stack_size |
---|
409 | is the size of the stack for this initialization task. |
---|
410 | |
---|
411 | @item initial_priority |
---|
412 | is the priority of this initialization task. |
---|
413 | |
---|
414 | @item attribute_set |
---|
415 | is the attribute set used during creation of this initialization task. |
---|
416 | |
---|
417 | @item entry_point |
---|
418 | is the address of the entry point of this initialization task. |
---|
419 | |
---|
420 | @item mode_set |
---|
421 | is the initial execution mode of this initialization task. |
---|
422 | |
---|
423 | @item argument |
---|
424 | is the initial argument for this initialization task. |
---|
425 | |
---|
426 | @end table |
---|
427 | |
---|
428 | A typical declaration for an Initialization Task Table might appear as follows: |
---|
429 | |
---|
430 | @ifset is-C |
---|
431 | @example |
---|
432 | rtems_initialization_tasks_table |
---|
433 | Initialization_tasks[2] = @{ |
---|
434 | @{ INIT_1_NAME, |
---|
435 | 1024, |
---|
436 | 1, |
---|
437 | DEFAULT_ATTRIBUTES, |
---|
438 | Init_1, |
---|
439 | DEFAULT_MODES, |
---|
440 | 1 |
---|
441 | |
---|
442 | @}, |
---|
443 | @{ INIT_2_NAME, |
---|
444 | 1024, |
---|
445 | 250, |
---|
446 | FLOATING_POINT, |
---|
447 | Init_2, |
---|
448 | NO_PREEMPT, |
---|
449 | 2 |
---|
450 | |
---|
451 | @} |
---|
452 | @}; |
---|
453 | @end example |
---|
454 | @end ifset |
---|
455 | |
---|
456 | @ifset is-Ada |
---|
457 | @example |
---|
458 | Initialization_Tasks : aliased RTEMS.Initialization_Tasks_Table( 1 .. 2 ) := ( |
---|
459 | (INIT_1_NAME, |
---|
460 | 1024, |
---|
461 | 1, |
---|
462 | RTEMS.Default_Attributes, |
---|
463 | Init_1'Access, |
---|
464 | RTEMS.Default_Modes, |
---|
465 | 1), |
---|
466 | (INIT_2_NAME, |
---|
467 | 1024, |
---|
468 | 250, |
---|
469 | RTEMS.Floating_Point, |
---|
470 | Init_2'Access, |
---|
471 | RTEMS.No_Preempt, |
---|
472 | 2) |
---|
473 | ); |
---|
474 | @end example |
---|
475 | @end ifset |
---|
476 | |
---|
477 | @ifinfo |
---|
478 | @node Configuring a System Driver Address Table, Configuring a System User Extensions Table, Configuring a System Initialization Task Table, Configuring a System |
---|
479 | @end ifinfo |
---|
480 | @section Driver Address Table |
---|
481 | |
---|
482 | The Device Driver Table is used to inform the I/O |
---|
483 | Manager of the set of entry points for each device driver |
---|
484 | configured in the system. The table contains one entry for each |
---|
485 | device driver required by the application. The number of |
---|
486 | entries is defined in the number_of_device_drivers entry in the |
---|
487 | Configuration Table. The format of each entry in the Device |
---|
488 | Driver Table is defined in |
---|
489 | the following @value{RTEMS-LANGUAGE} @value{RTEMS-STRUCTURE}: |
---|
490 | |
---|
491 | @ifset is-C |
---|
492 | @example |
---|
493 | typedef struct @{ |
---|
494 | rtems_device_driver_entry initialization; |
---|
495 | rtems_device_driver_entry open; |
---|
496 | rtems_device_driver_entry close; |
---|
497 | rtems_device_driver_entry read; |
---|
498 | rtems_device_driver_entry write; |
---|
499 | rtems_device_driver_entry control; |
---|
500 | @} rtems_driver_address_table; |
---|
501 | @end example |
---|
502 | @end ifset |
---|
503 | |
---|
504 | @ifset is-Ada |
---|
505 | @example |
---|
506 | type Driver_Address_Table_Entry is |
---|
507 | record |
---|
508 | Initialization : RTEMS.Device_Driver_Entry; |
---|
509 | Open : RTEMS.Device_Driver_Entry; |
---|
510 | Close : RTEMS.Device_Driver_Entry; |
---|
511 | Read : RTEMS.Device_Driver_Entry; |
---|
512 | Write : RTEMS.Device_Driver_Entry; |
---|
513 | Control : RTEMS.Device_Driver_Entry; |
---|
514 | end record; |
---|
515 | |
---|
516 | type Driver_Address_Table is array ( RTEMS.Unsigned32 range <> ) of |
---|
517 | RTEMS.Driver_Address_Table_Entry; |
---|
518 | |
---|
519 | type Driver_Address_Table_Pointer is access all Driver_Address_Table; |
---|
520 | @end example |
---|
521 | @end ifset |
---|
522 | |
---|
523 | @table @b |
---|
524 | @item initialization |
---|
525 | is the address of the entry point called by io_initialize |
---|
526 | to initialize a device driver and its associated devices. |
---|
527 | |
---|
528 | @item open |
---|
529 | is the address of the entry point called by io_open. |
---|
530 | |
---|
531 | @item close |
---|
532 | is the address of the entry point called by io_close. |
---|
533 | |
---|
534 | @item read |
---|
535 | is the address of the entry point called by io_read. |
---|
536 | |
---|
537 | @item write |
---|
538 | is the address of the entry point called by io_write. |
---|
539 | |
---|
540 | @item control |
---|
541 | is the address of the entry point called by io_control. |
---|
542 | |
---|
543 | @end table |
---|
544 | |
---|
545 | Driver entry points configured as NULL will always |
---|
546 | return a status code of SUCCESSFUL. No user code will be |
---|
547 | executed in this situation. |
---|
548 | |
---|
549 | A typical declaration for a Device Driver Table might appear as follows: |
---|
550 | |
---|
551 | @ifset is-C |
---|
552 | @example |
---|
553 | rtems_driver_address_table Driver_table[2] = @{ |
---|
554 | @{ tty_initialize, tty_open, tty_close, /* major = 0 */ |
---|
555 | tty_read, tty_write, tty_control |
---|
556 | @}, |
---|
557 | @{ lp_initialize, lp_open, lp_close, /* major = 1 */ |
---|
558 | NULL, lp_write, lp_control |
---|
559 | @} |
---|
560 | @}; |
---|
561 | @end example |
---|
562 | @end ifset |
---|
563 | |
---|
564 | @ifset is-Ada |
---|
565 | @example |
---|
566 | @end example |
---|
567 | @end ifset |
---|
568 | |
---|
569 | More information regarding the construction and |
---|
570 | operation of device drivers is provided in the I/O Manager |
---|
571 | chapter. |
---|
572 | |
---|
573 | @ifinfo |
---|
574 | @node Configuring a System User Extensions Table, Configuring a System Multiprocessor Configuration Table, Configuring a System Driver Address Table, Configuring a System |
---|
575 | @end ifinfo |
---|
576 | @section User Extensions Table |
---|
577 | |
---|
578 | The User Extensions Table is used to inform RTEMS of |
---|
579 | the optional user-supplied static extension set. This table |
---|
580 | contains one entry for each possible extension. The entries are |
---|
581 | called at critical times in the life of the system and |
---|
582 | individual tasks. The application may create dynamic extensions |
---|
583 | in addition to this single static set. The format of each entry |
---|
584 | in the User Extensions Table is defined in the following C |
---|
585 | structure: |
---|
586 | |
---|
587 | typedef User_extensions_routine rtems_extension; |
---|
588 | typedef User_extensions_thread_create_extension rtems_task_create_extension; |
---|
589 | typedef User_extensions_thread_delete_extension rtems_task_delete_extension; |
---|
590 | typedef User_extensions_thread_start_extension rtems_task_start_extension; |
---|
591 | typedef User_extensions_thread_restart_extension rtems_task_restart_extension; |
---|
592 | typedef User_extensions_thread_switch_extension rtems_task_switch_extension; |
---|
593 | typedef User_extensions_thread_begin_extension rtems_task_begin_extension; |
---|
594 | typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension; |
---|
595 | typedef User_extensions_fatal_extension rtems_fatal_extension; |
---|
596 | |
---|
597 | typedef User_extensions_Table rtems_extensions_table; |
---|
598 | |
---|
599 | @ifset is-C |
---|
600 | @example |
---|
601 | typedef struct @{ |
---|
602 | rtems_task_create_extension thread_create; |
---|
603 | rtems_task_start_extension thread_start; |
---|
604 | rtems_task_restart_extension thread_restart; |
---|
605 | rtems_task_delete_extension thread_delete; |
---|
606 | rtems_task_switch_extension thread_switch; |
---|
607 | rtems_task_post_switch_extension thread_post_switch; |
---|
608 | rtems_task_begin_extension thread_begin; |
---|
609 | rtems_task_exitted_extension thread_exitted; |
---|
610 | rtems_fatal_extension fatal; |
---|
611 | @} User_extensions_Table; |
---|
612 | @end example |
---|
613 | @end ifset |
---|
614 | |
---|
615 | @ifset is-Ada |
---|
616 | @example |
---|
617 | type Extensions_Table_Entry is |
---|
618 | record |
---|
619 | Thread_Create : RTEMS.Thread_Create_Extension; |
---|
620 | Thread_Start : RTEMS.Thread_Start_Extension; |
---|
621 | Thread_Restart : RTEMS.Thread_Restart_Extension; |
---|
622 | Thread_Delete : RTEMS.Thread_Delete_Extension; |
---|
623 | Thread_Switch : RTEMS.Thread_Switch_Extension; |
---|
624 | Thread_Post_Switch : RTEMS.Thread_Post_Switch_Extension; |
---|
625 | Thread_Begin : RTEMS.Thread_Begin_Extension; |
---|
626 | Thread_Exitted : RTEMS.Thread_Exitted_Extension; |
---|
627 | Fatal : RTEMS.Fatal_Error_Extension; |
---|
628 | end record; |
---|
629 | @end example |
---|
630 | @end ifset |
---|
631 | |
---|
632 | @table @b |
---|
633 | |
---|
634 | @item thread_create |
---|
635 | is the address of the |
---|
636 | user-supplied subroutine for the TASK_CREATE extension. If this |
---|
637 | extension for task creation is defined, it is called from the |
---|
638 | task_create directive. A value of NULL indicates that no |
---|
639 | extension is provided. |
---|
640 | |
---|
641 | @item thread_start |
---|
642 | is the address of the user-supplied |
---|
643 | subroutine for the TASK_START extension. If this extension for |
---|
644 | task initiation is defined, it is called from the task_start |
---|
645 | directive. A value of NULL indicates that no extension is |
---|
646 | provided. |
---|
647 | |
---|
648 | @item thread_restart |
---|
649 | is the address of the user-supplied |
---|
650 | subroutine for the TASK_RESTART extension. If this extension |
---|
651 | for task re-initiation is defined, it is called from the |
---|
652 | task_restart directive. A value of NULL indicates that no |
---|
653 | extension is provided. |
---|
654 | |
---|
655 | @item thread_delete |
---|
656 | is the address of the user-supplied |
---|
657 | subroutine for the TASK_DELETE extension. If this RTEMS |
---|
658 | extension for task deletion is defined, it is called from the |
---|
659 | task_delete directive. A value of NULL indicates that no |
---|
660 | extension is provided. |
---|
661 | |
---|
662 | @item thread_switch |
---|
663 | is the address of the user-supplied |
---|
664 | subroutine for the task context switch extension. This |
---|
665 | subroutine is called from RTEMS dispatcher after the current |
---|
666 | task has been swapped out but before the new task has been |
---|
667 | swapped in. A value of NULL indicates that no extension is |
---|
668 | provided. As this routine is invoked after saving the current |
---|
669 | task's context and before restoring the heir task's context, it |
---|
670 | is not necessary for this routine to save and restore any |
---|
671 | registers. |
---|
672 | |
---|
673 | @item thread_post_switch |
---|
674 | is the address of the |
---|
675 | user-supplied subroutine for the post task context switch |
---|
676 | extension. This subroutine is called from RTEMS dispatcher in |
---|
677 | the context of the task which has just been swapped in. |
---|
678 | |
---|
679 | @item thread_begin |
---|
680 | is the address of the user-supplied |
---|
681 | subroutine which is invoked immediately before a task begins |
---|
682 | execution. It is invoked in the context of the beginning task. |
---|
683 | A value of NULL indicates that no extension is provided. |
---|
684 | |
---|
685 | @item thread_exitted |
---|
686 | is the address of the user-supplied |
---|
687 | subroutine which is invoked when a task exits. This procedure |
---|
688 | is responsible for some action which will allow the system to |
---|
689 | continue execution (i.e. delete or restart the task) or to |
---|
690 | terminate with a fatal error. If this field is set to NULL, the |
---|
691 | default RTEMS task_exitted handler will be invoked. |
---|
692 | |
---|
693 | @item fatal |
---|
694 | is the address of the user-supplied |
---|
695 | subroutine for the FATAL extension. This RTEMS extension of |
---|
696 | fatal error handling is called from the fatal_error_occurred |
---|
697 | directive. If the user's fatal error handler returns or if this |
---|
698 | entry is NULL then the default RTEMS fatal error handler will be |
---|
699 | executed. |
---|
700 | |
---|
701 | @end table |
---|
702 | |
---|
703 | A typical declaration for a User Extension Table |
---|
704 | which defines the TASK_CREATE, TASK_DELETE, TASK_SWITCH, and |
---|
705 | FATAL extension might appear as follows: |
---|
706 | |
---|
707 | @ifset is-C |
---|
708 | @example |
---|
709 | rtems_extensions_table User_extensions = @{ |
---|
710 | task_create_extension, |
---|
711 | NULL, |
---|
712 | NULL, |
---|
713 | task_delete_extension, |
---|
714 | task_switch_extension, |
---|
715 | NULL, |
---|
716 | NULL, |
---|
717 | fatal_extension |
---|
718 | @}; |
---|
719 | @end example |
---|
720 | @end ifset |
---|
721 | |
---|
722 | @ifset is-Ada |
---|
723 | User_Extensions : RTEMS.Extensions_Table := ( |
---|
724 | Task_Create_Extension'Access, |
---|
725 | null, |
---|
726 | null, |
---|
727 | Task_Delete_Extension'Access, |
---|
728 | Task_Switch_Extension'Access, |
---|
729 | null, |
---|
730 | null, |
---|
731 | Fatal_Extension'Access |
---|
732 | ); |
---|
733 | @example |
---|
734 | |
---|
735 | @end example |
---|
736 | @end ifset |
---|
737 | |
---|
738 | More information regarding the user extensions is |
---|
739 | provided in the User Extensions chapter. |
---|
740 | |
---|
741 | @ifinfo |
---|
742 | @node Configuring a System Multiprocessor Configuration Table, Configuring a System Multiprocessor Communications Interface Table, Configuring a System User Extensions Table, Configuring a System |
---|
743 | @end ifinfo |
---|
744 | @section Multiprocessor Configuration Table |
---|
745 | |
---|
746 | The Multiprocessor Configuration Table contains |
---|
747 | information needed when using RTEMS in a multiprocessor |
---|
748 | configuration. Many of the details associated with configuring |
---|
749 | a multiprocessor system are dependent on the multiprocessor |
---|
750 | communications layer provided by the user. The address of the |
---|
751 | Multiprocessor Configuration Table should be placed in the |
---|
752 | User_multiprocessing_table entry in the primary Configuration |
---|
753 | Table. Further details regarding many of the entries in the |
---|
754 | Multiprocessor Configuration Table will be provided in the |
---|
755 | Multiprocessing chapter. The format of the Multiprocessor |
---|
756 | Configuration Table is defined in |
---|
757 | the following @value{RTEMS-LANGUAGE} @value{RTEMS-STRUCTURE}: |
---|
758 | |
---|
759 | @ifset is-C |
---|
760 | @example |
---|
761 | typedef struct @{ |
---|
762 | rtems_unsigned32 node; |
---|
763 | rtems_unsigned32 maximum_nodes; |
---|
764 | rtems_unsigned32 maximum_global_objects; |
---|
765 | rtems_unsigned32 maximum_proxies; |
---|
766 | rtems_mpci_table *User_mpci_table; |
---|
767 | @} rtems_multiprocessing_table; |
---|
768 | @end example |
---|
769 | @end ifset |
---|
770 | |
---|
771 | @ifset is-Ada |
---|
772 | @example |
---|
773 | type Multiprocessing_Table is |
---|
774 | record |
---|
775 | Node : RTEMS.Unsigned32; |
---|
776 | Maximum_Nodes : RTEMS.Unsigned32; |
---|
777 | Maximum_Global_Objects : RTEMS.Unsigned32; |
---|
778 | Maximum_Proxies : RTEMS.Unsigned32; |
---|
779 | User_MPCI_Table : RTEMS.MPCI_Table_Pointer; |
---|
780 | end record; |
---|
781 | |
---|
782 | type Multiprocessing_Table_Pointer is access all Multiprocessing_Table; |
---|
783 | @end example |
---|
784 | @end ifset |
---|
785 | |
---|
786 | @table @b |
---|
787 | @item node |
---|
788 | is a unique processor identifier |
---|
789 | and is used in routing messages between nodes in a |
---|
790 | multiprocessor configuration. Each processor must have a unique |
---|
791 | node number. RTEMS assumes that node numbers start at one and |
---|
792 | increase sequentially. This assumption can be used to advantage |
---|
793 | by the user-supplied MPCI layer. Typically, this requirement is |
---|
794 | made when the node numbers are used to calculate the address of |
---|
795 | inter-processor communication links. Zero should be avoided as |
---|
796 | a node number because some MPCI layers use node zero to |
---|
797 | represent broadcasted packets. Thus, it is recommended that |
---|
798 | node numbers start at one and increase sequentially. |
---|
799 | |
---|
800 | @item maximum_nodes |
---|
801 | is the number of processor nodes in the system. |
---|
802 | |
---|
803 | @item maximum_global_objects |
---|
804 | is the maximum number of global objects which can exist at any |
---|
805 | given moment in the entire system. If this parameter is not the |
---|
806 | same on all nodes in the system, then a fatal error is generated |
---|
807 | to inform the user that the system is inconsistent. |
---|
808 | |
---|
809 | @item maximum_proxies |
---|
810 | is the maximum number of proxies which can exist at any given moment |
---|
811 | on this particular node. A proxy is a substitute task control block |
---|
812 | which represent a task residing on a remote node when that task blocks |
---|
813 | on a remote object. Proxies are used in situations in which delayed |
---|
814 | interaction is required with a remote node. |
---|
815 | |
---|
816 | @item User_mpci_table |
---|
817 | is the address of the Multiprocessor Communications Interface |
---|
818 | Table. This table contains the entry points of user-provided functions |
---|
819 | which constitute the multiprocessor communications layer. This table |
---|
820 | must be provided in multiprocessor configurations with all |
---|
821 | entries configured. The format of this table and details |
---|
822 | regarding its entries can be found in the next section. |
---|
823 | |
---|
824 | @end table |
---|
825 | |
---|
826 | @ifinfo |
---|
827 | @node Configuring a System Multiprocessor Communications Interface Table, Configuring a System Determining Memory Requirements, Configuring a System Multiprocessor Configuration Table, Configuring a System |
---|
828 | @end ifinfo |
---|
829 | @section Multiprocessor Communications Interface Table |
---|
830 | |
---|
831 | The format of this table is defined in |
---|
832 | the following @value{RTEMS-LANGUAGE} @value{RTEMS-STRUCTURE}: |
---|
833 | |
---|
834 | @ifset is-C |
---|
835 | @example |
---|
836 | typedef struct @{ |
---|
837 | rtems_unsigned32 default_timeout; /* in ticks */ |
---|
838 | rtems_unsigned32 maximum_packet_size; |
---|
839 | rtems_mpci_initialization_entry initialization; |
---|
840 | rtems_mpci_get_packet_entry get_packet; |
---|
841 | rtems_mpci_return_packet_entry return_packet; |
---|
842 | rtems_mpci_send_entry send; |
---|
843 | rtems_mpci_receive_entry receive; |
---|
844 | @} rtems_mpci_table; |
---|
845 | @end example |
---|
846 | @end ifset |
---|
847 | |
---|
848 | @ifset is-Ada |
---|
849 | @example |
---|
850 | type MPCI_Table is |
---|
851 | record |
---|
852 | Default_Timeout : RTEMS.Unsigned32; -- in ticks |
---|
853 | Maximum_Packet_Size : RTEMS.Unsigned32; |
---|
854 | Initialization : RTEMS.MPCI_Initialization_Entry; |
---|
855 | Get_Packet : RTEMS.MPCI_Get_Packet_Entry; |
---|
856 | Return_Packet : RTEMS.MPCI_Return_Packet_Entry; |
---|
857 | Send : RTEMS.MPCI_Send_Entry; |
---|
858 | Receive : RTEMS.MPCI_Receive_Entry; |
---|
859 | end record; |
---|
860 | |
---|
861 | type MPCI_Table_Pointer is access all MPCI_Table; |
---|
862 | @end example |
---|
863 | @end ifset |
---|
864 | |
---|
865 | @table @b |
---|
866 | @item default_timeout |
---|
867 | is the default maximum length of time a task should block waiting for |
---|
868 | a response to a directive which results in communication with a remote node. |
---|
869 | The maximum length of time is a function the user supplied |
---|
870 | multiprocessor communications layer and the media used. This |
---|
871 | timeout only applies to directives which would not block if the |
---|
872 | operation were performed locally. |
---|
873 | |
---|
874 | @item maximum_packet_size |
---|
875 | is the size in bytes of the longest packet which the MPCI layer is capable |
---|
876 | of sending. This value should represent the total number of bytes available |
---|
877 | for a RTEMS interprocessor messages. |
---|
878 | |
---|
879 | @item initialization |
---|
880 | is the address of the entry point for the initialization procedure of the |
---|
881 | user supplied multiprocessor communications layer. |
---|
882 | |
---|
883 | @item get_packet |
---|
884 | is the address of the entry point for the procedure called by RTEMS to |
---|
885 | obtain a packet from the user supplied multiprocessor communications layer. |
---|
886 | |
---|
887 | @item return_packet |
---|
888 | is the address of the entry point for the procedure called by RTEMS to |
---|
889 | return a packet to the user supplied multiprocessor communications layer. |
---|
890 | |
---|
891 | @item send |
---|
892 | is the address of the entry point for the procedure called by RTEMS to |
---|
893 | send an envelope to another node. This procedure is part of the user |
---|
894 | supplied multiprocessor communications layer. |
---|
895 | |
---|
896 | @item receive |
---|
897 | is the address of the entry point for the |
---|
898 | procedure called by RTEMS to retrieve an envelope containing a |
---|
899 | message from another node. This procedure is part of the user |
---|
900 | supplied multiprocessor communications layer. |
---|
901 | |
---|
902 | @end table |
---|
903 | |
---|
904 | More information regarding the required functionality of these |
---|
905 | entry points is provided in the Multiprocessor chapter. |
---|
906 | |
---|
907 | @ifinfo |
---|
908 | @node Configuring a System Determining Memory Requirements, Configuring a System Sizing the RTEMS RAM Workspace, Configuring a System Multiprocessor Communications Interface Table, Configuring a System |
---|
909 | @end ifinfo |
---|
910 | @section Determining Memory Requirements |
---|
911 | |
---|
912 | Since memory is a critical resource in many real-time |
---|
913 | embedded systems, RTEMS was specifically designed to allow |
---|
914 | unused managers to be excluded from the run-time environment. |
---|
915 | This allows the application designer the flexibility to tailor |
---|
916 | RTEMS to most efficiently meet system requirements while still |
---|
917 | satisfying even the most stringent memory constraints. As |
---|
918 | result, the size of the RTEMS executive is application |
---|
919 | dependent. A Memory Requirements worksheet is provided in the |
---|
920 | Applications Supplement document for a specific target |
---|
921 | processor. This worksheet can be used to calculate the memory |
---|
922 | requirements of a custom RTEMS run-time environment. To insure |
---|
923 | that enough memory is allocated for future versions of RTEMS, |
---|
924 | the application designer should round these memory requirements |
---|
925 | up. The following managers may be optionally excluded: |
---|
926 | |
---|
927 | @itemize @bullet |
---|
928 | @item signal |
---|
929 | @item region |
---|
930 | @item dual ported memory |
---|
931 | @item event |
---|
932 | @item multiprocessing |
---|
933 | @item partition |
---|
934 | @item timer |
---|
935 | @item semaphore |
---|
936 | @item message |
---|
937 | @item rate monotonic |
---|
938 | @end itemize |
---|
939 | |
---|
940 | RTEMS based applications must somehow provide memory |
---|
941 | for RTEMS' code and data space. Although RTEMS' data space must |
---|
942 | be in RAM, its code space can be located in either ROM or RAM. |
---|
943 | In addition, the user must allocate RAM for the RTEMS RAM |
---|
944 | Workspace. The size of this area is application dependent and |
---|
945 | can be calculated using the formula provided in the Memory |
---|
946 | Requirements chapter of the Applications Supplement document |
---|
947 | for a specific target processor. |
---|
948 | |
---|
949 | All RTEMS data variables and routine names used by |
---|
950 | RTEMS begin with the underscore ( _ ) character followed by an |
---|
951 | upper-case letter. If RTEMS is linked with an application, then |
---|
952 | the application code should NOT contain any symbols which begin |
---|
953 | with the underscore character and followed by an upper-case |
---|
954 | letter to avoid any naming conflicts. All RTEMS directive names |
---|
955 | should be treated as reserved words. |
---|
956 | |
---|
957 | @ifinfo |
---|
958 | @node Configuring a System Sizing the RTEMS RAM Workspace, Multiprocessing Manager, Configuring a System Determining Memory Requirements, Configuring a System |
---|
959 | @end ifinfo |
---|
960 | @section Sizing the RTEMS RAM Workspace |
---|
961 | |
---|
962 | The RTEMS RAM Workspace is a user-specified block of |
---|
963 | memory reserved for use by RTEMS. The application should NOT |
---|
964 | modify this memory. This area consists primarily of the RTEMS |
---|
965 | data structures whose exact size depends upon the values |
---|
966 | specified in the Configuration Table. In addition, task stacks |
---|
967 | and floating point context areas are dynamically allocated from |
---|
968 | the RTEMS RAM Workspace. |
---|
969 | |
---|
970 | The starting address of the RTEMS RAM Workspace must |
---|
971 | be aligned on a four-byte boundary. Failure to properly align |
---|
972 | the workspace area will result in the fatal_error_occurred |
---|
973 | directive being invoked with the INVALID_ADDRESS error code. |
---|
974 | |
---|
975 | A worksheet is provided in the Memory Requirements |
---|
976 | chapter of the Applications Supplement document for a specific |
---|
977 | target processor to assist the user in calculating the minimum |
---|
978 | size of the RTEMS RAM Workspace for each application. The value |
---|
979 | calculated with this worksheet is the minimum value that should |
---|
980 | be specified as the work_space_size parameter of the |
---|
981 | Configuration Table. The user is cautioned that future versions |
---|
982 | of RTEMS may not have the same memory requirements per object. |
---|
983 | Although the value calculated is sufficient for a particular |
---|
984 | target processor and release of RTEMS, memory usage is subject |
---|
985 | to change across versions and target processors. The user is |
---|
986 | advised to allocate somewhat more memory than the worksheet |
---|
987 | recommends to insure compatibility with future releases for a |
---|
988 | specific target processor and other target processors. To avoid |
---|
989 | problems, the user should recalculate the memory requirements |
---|
990 | each time one of the following events occurs: |
---|
991 | |
---|
992 | @itemize @bullet |
---|
993 | @item a configuration parameter is modified, |
---|
994 | @item task or interrupt stack requirements change, |
---|
995 | @item task floating point attribute is altered, |
---|
996 | @item RTEMS is upgraded, or |
---|
997 | @item the target processor is changed. |
---|
998 | @end itemize |
---|
999 | |
---|
1000 | Failure to provide enough space in the RTEMS RAM |
---|
1001 | Workspace will result in the fatal_error_occurred directive |
---|
1002 | being invoked with the appropriate error code. |
---|