1 | /* main |
---|
2 | * |
---|
3 | * This program is run to determine the data space and work space |
---|
4 | * requirements of the current version of RTEMS. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1998. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #include <rtems/system.h> |
---|
18 | #include <rtems/config.h> |
---|
19 | #include <rtems/directives.h> |
---|
20 | #include <rtems/score/apiext.h> |
---|
21 | #include <rtems/score/copyrt.h> |
---|
22 | #include <rtems/rtems/clock.h> |
---|
23 | #include <rtems/rtems/tasks.h> |
---|
24 | #include <rtems/rtems/dpmem.h> |
---|
25 | #include <rtems/rtems/event.h> |
---|
26 | #include <rtems/extension.h> |
---|
27 | #include <rtems/fatal.h> |
---|
28 | #include <rtems/init.h> |
---|
29 | #include <rtems/score/isr.h> |
---|
30 | #include <rtems/rtems/intr.h> |
---|
31 | #include <rtems/io.h> |
---|
32 | #include <rtems/rtems/message.h> |
---|
33 | #include <rtems/rtems/mp.h> |
---|
34 | #include <rtems/score/mpci.h> |
---|
35 | #include <rtems/rtems/part.h> |
---|
36 | #include <rtems/score/priority.h> |
---|
37 | #include <rtems/rtems/ratemon.h> |
---|
38 | #include <rtems/rtems/region.h> |
---|
39 | #include <rtems/rtems/sem.h> |
---|
40 | #include <rtems/rtems/signal.h> |
---|
41 | #include <rtems/score/sysstate.h> |
---|
42 | #include <rtems/score/thread.h> |
---|
43 | #include <rtems/rtems/timer.h> |
---|
44 | #include <rtems/score/tod.h> |
---|
45 | #include <rtems/score/userext.h> |
---|
46 | #include <rtems/score/wkspace.h> |
---|
47 | |
---|
48 | #include <stdlib.h> |
---|
49 | |
---|
50 | /* These are always defined by the executive. |
---|
51 | * |
---|
52 | * #include <rtems/copyrt.h> |
---|
53 | * #include <rtems/tables.h> |
---|
54 | * #include <rtems/sptables.h> |
---|
55 | */ |
---|
56 | #define HEAP_OVHD 16 /* wasted heap space per task stack */ |
---|
57 | #define NAME_PTR_SIZE 8 /* size of name and pointer table entries */ |
---|
58 | #define READYCHAINS_SIZE \ |
---|
59 | ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control )) |
---|
60 | |
---|
61 | #define PER_TASK \ |
---|
62 | (long) (sizeof (Thread_Control) + \ |
---|
63 | NAME_PTR_SIZE + HEAP_OVHD + sizeof( RTEMS_API_Control )) |
---|
64 | #define PER_SEMAPHORE \ |
---|
65 | (long) (sizeof (Semaphore_Control) + NAME_PTR_SIZE) |
---|
66 | #define PER_TIMER \ |
---|
67 | (long) (sizeof (Timer_Control) + NAME_PTR_SIZE) |
---|
68 | #define PER_MSGQ \ |
---|
69 | (long) (sizeof (Message_queue_Control) + NAME_PTR_SIZE) |
---|
70 | #define PER_REGN \ |
---|
71 | (long) (sizeof (Region_Control) + NAME_PTR_SIZE) |
---|
72 | #define PER_PART \ |
---|
73 | (long) (sizeof (Partition_Control) + NAME_PTR_SIZE) |
---|
74 | #define PER_PERIOD \ |
---|
75 | (long) (sizeof (Rate_monotonic_Control) + NAME_PTR_SIZE) |
---|
76 | #define PER_PORT \ |
---|
77 | (long) (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE) |
---|
78 | #define PER_EXTENSION \ |
---|
79 | (long) (sizeof (Extension_Control) + NAME_PTR_SIZE) |
---|
80 | |
---|
81 | #define PER_DRV (long) (0) |
---|
82 | #define PER_FPTASK (long) (CONTEXT_FP_SIZE) |
---|
83 | #define PER_GOBTBL (long) (sizeof (Chain_Control)*4) |
---|
84 | #define PER_NODE (long) PER_GOBTBL |
---|
85 | #define PER_GOBJECT (long) (sizeof (Objects_MP_Control)) |
---|
86 | #define PER_PROXY (long) (sizeof (Thread_Proxy_control)) |
---|
87 | |
---|
88 | #if (CPU_ALL_TASKS_ARE_FP == TRUE) |
---|
89 | #define MPCI_RECEIVE_SERVER_FP (long) (sizeof( Context_Control_fp )) |
---|
90 | #else |
---|
91 | #define MPCI_RECEIVE_SERVER_FP (long) 0 |
---|
92 | #endif |
---|
93 | |
---|
94 | #if (CPU_IDLE_TASK_IS_FP == TRUE) |
---|
95 | #define SYSTEM_IDLE_FP (long) (sizeof( Context_Control_fp )) |
---|
96 | #else |
---|
97 | #define SYSTEM_IDLE_FP (long) 0 |
---|
98 | #endif |
---|
99 | |
---|
100 | #define SYSTEM_TASKS \ |
---|
101 | (THREAD_IDLE_STACK_SIZE + \ |
---|
102 | MPCI_RECEIVE_SERVER_STACK_SIZE + \ |
---|
103 | (2*sizeof(Thread_Control))) + \ |
---|
104 | MPCI_RECEIVE_SERVER_FP + \ |
---|
105 | SYSTEM_IDLE_FP |
---|
106 | |
---|
107 | #define rtems_unsigned32 unsigned32 |
---|
108 | |
---|
109 | rtems_unsigned32 sys_req; |
---|
110 | |
---|
111 | /* to avoid warnings */ |
---|
112 | int puts(); |
---|
113 | int printf(); |
---|
114 | int getint(); |
---|
115 | #undef getchar |
---|
116 | int getchar(); |
---|
117 | void help_size(); |
---|
118 | void print_formula(); |
---|
119 | |
---|
120 | void size_rtems( |
---|
121 | int mode |
---|
122 | ) |
---|
123 | { |
---|
124 | int uninitialized = 0; |
---|
125 | int initialized = 0; |
---|
126 | |
---|
127 | /* |
---|
128 | * The following data is allocated for each Manager: |
---|
129 | * |
---|
130 | * + Per Manager Object Information |
---|
131 | * - local pointer table |
---|
132 | * - local name table |
---|
133 | * - the object's control blocks |
---|
134 | * - global name chains |
---|
135 | * |
---|
136 | * The following is the data allocate from the RTEMS Workspace Area. |
---|
137 | * The order indicates the order in which RTEMS allocates it. |
---|
138 | * |
---|
139 | * + Object MP |
---|
140 | * - Global Object CB's |
---|
141 | * + Thread |
---|
142 | * - Ready Chain |
---|
143 | * + Thread MP |
---|
144 | * - Proxies Chain |
---|
145 | * + Interrupt Manager |
---|
146 | * - Interrupt Stack |
---|
147 | * + Timer Manager |
---|
148 | * - per Manager Object Data |
---|
149 | * + Extension Manager |
---|
150 | * - per Manager Object Data |
---|
151 | * + Message Queue Manager |
---|
152 | * - per Manager Object Data |
---|
153 | * - Message Buffers |
---|
154 | * + Semaphore Manager |
---|
155 | * - per Manager Object Data |
---|
156 | * + Partition Manager |
---|
157 | * - per Manager Object Data |
---|
158 | * + Region Manager |
---|
159 | * - per Manager Object Data |
---|
160 | * + Dual Ported Memory Manager |
---|
161 | * - per Manager Object Data |
---|
162 | * + Rate Monotonic Manager |
---|
163 | * - per Manager Object Data |
---|
164 | * + Internal Threads Handler |
---|
165 | * - MPCI Receive Server Thread TCB |
---|
166 | * - IDLE Thread TCB |
---|
167 | * - MPCI Receive Server Thread stack |
---|
168 | * - MPCI Receive Server Thread FP area (if CPU requires this) |
---|
169 | * - IDLE Thread stack |
---|
170 | * - IDLE Thread FP area (if CPU requires this) |
---|
171 | * |
---|
172 | * This does not take into account any CPU dependent alignment requirements. |
---|
173 | * |
---|
174 | * The following calculates the overhead needed by RTEMS from the |
---|
175 | * Workspace Area. |
---|
176 | */ |
---|
177 | sys_req = SYSTEM_TASKS + /* MPCI Receive Server and IDLE */ |
---|
178 | NAME_PTR_SIZE + /* Task Overhead */ |
---|
179 | READYCHAINS_SIZE + /* Ready Chains */ |
---|
180 | NAME_PTR_SIZE + /* Timer Overhead */ |
---|
181 | NAME_PTR_SIZE + /* Semaphore Overhead */ |
---|
182 | NAME_PTR_SIZE + /* Message Queue Overhead */ |
---|
183 | NAME_PTR_SIZE + /* Region Overhead */ |
---|
184 | NAME_PTR_SIZE + /* Partition Overhead */ |
---|
185 | NAME_PTR_SIZE + /* Dual-Ported Memory Overhead */ |
---|
186 | NAME_PTR_SIZE + /* Rate Monotonic Overhead */ |
---|
187 | NAME_PTR_SIZE + /* Extension Overhead */ |
---|
188 | PER_NODE; /* Extra Gobject Table */ |
---|
189 | |
---|
190 | uninitialized = |
---|
191 | /*address.h*/ 0 + |
---|
192 | |
---|
193 | /*apiext.h*/ (sizeof _API_extensions_List) + |
---|
194 | |
---|
195 | /*asr.h*/ 0 + |
---|
196 | |
---|
197 | /*attr.h*/ 0 + |
---|
198 | |
---|
199 | /*bitfield.h*/ 0 + |
---|
200 | |
---|
201 | /*chain.h*/ 0 + |
---|
202 | |
---|
203 | /*clock.h*/ 0 + |
---|
204 | |
---|
205 | /*config.h*/ (sizeof _Configuration_Table) + |
---|
206 | (sizeof _Configuration_MP_table) + |
---|
207 | |
---|
208 | /*context.h*/ (sizeof _Context_Switch_necessary) + |
---|
209 | |
---|
210 | /*copyrt.h*/ 0 + |
---|
211 | |
---|
212 | /*debug.h*/ (sizeof _Debug_Level) + |
---|
213 | |
---|
214 | /*dpmem.h*/ (sizeof _Dual_ported_memory_Information) + |
---|
215 | |
---|
216 | /*event.h*/ (sizeof _Event_Sync_state) + |
---|
217 | |
---|
218 | /*eventmp.h*/ 0 + |
---|
219 | |
---|
220 | /*eventset.h*/ 0 + |
---|
221 | |
---|
222 | /*extension.h*/ (sizeof _Extension_Information) + |
---|
223 | |
---|
224 | /*fatal.h*/ 0 + |
---|
225 | |
---|
226 | /*heap.h*/ 0 + |
---|
227 | |
---|
228 | /*init.h*/ 0 + |
---|
229 | |
---|
230 | /*interr.h*/ (sizeof Internal_errors_What_happened) + |
---|
231 | |
---|
232 | /*intr.h*/ 0 + |
---|
233 | |
---|
234 | /*io.h*/ (sizeof _IO_Number_of_drivers) + |
---|
235 | (sizeof _IO_Driver_address_table) + |
---|
236 | (sizeof _IO_Number_of_devices) + |
---|
237 | (sizeof _IO_Driver_name_table) + |
---|
238 | |
---|
239 | /*isr.h*/ (sizeof _ISR_Nest_level) + |
---|
240 | (sizeof _ISR_Vector_table) + |
---|
241 | (sizeof _ISR_Signals_to_thread_executing) + |
---|
242 | |
---|
243 | /*message.h*/ (sizeof _Message_queue_Information) + |
---|
244 | |
---|
245 | /*modes.h*/ 0 + |
---|
246 | |
---|
247 | /*mp.h*/ 0 + |
---|
248 | |
---|
249 | /*mpci.h*/ (sizeof _MPCI_Remote_blocked_threads) + |
---|
250 | (sizeof _MPCI_Semaphore) + |
---|
251 | (sizeof _MPCI_table) + |
---|
252 | (sizeof _MPCI_Receive_server_tcb) + |
---|
253 | (sizeof _MPCI_Packet_processors) + |
---|
254 | |
---|
255 | /*mppkt.h*/ 0 + |
---|
256 | |
---|
257 | /*mptables.h*/ 0 + |
---|
258 | |
---|
259 | /*msgmp.h*/ 0 + |
---|
260 | |
---|
261 | /*object.h*/ (sizeof _Objects_Local_node) + |
---|
262 | (sizeof _Objects_Maximum_nodes) + |
---|
263 | (sizeof _Objects_Information_table) + |
---|
264 | |
---|
265 | /*objectmp.h*/ (sizeof _Objects_MP_Maximum_global_objects) + |
---|
266 | (sizeof _Objects_MP_Inactive_global_objects) + |
---|
267 | |
---|
268 | /*options.h*/ 0 + |
---|
269 | |
---|
270 | /*part.h*/ (sizeof _Partition_Information) + |
---|
271 | |
---|
272 | /*partmp.h*/ 0 + |
---|
273 | |
---|
274 | /*priority.h*/ (sizeof _Priority_Major_bit_map) + |
---|
275 | (sizeof _Priority_Bit_map) + |
---|
276 | |
---|
277 | /*ratemon.h*/ (sizeof _Rate_monotonic_Information) + |
---|
278 | |
---|
279 | /*region.h*/ (sizeof _Region_Information) + |
---|
280 | |
---|
281 | /*regionmp.h*/ 0 + |
---|
282 | |
---|
283 | /*rtems.h*/ /* Not applicable */ |
---|
284 | |
---|
285 | /*sem.h*/ (sizeof _Semaphore_Information) + |
---|
286 | |
---|
287 | /*semmp.h*/ 0 + |
---|
288 | |
---|
289 | /*signal.h*/ 0 + |
---|
290 | |
---|
291 | /*signalmp.h*/ 0 + |
---|
292 | |
---|
293 | /*stack.h*/ 0 + |
---|
294 | |
---|
295 | /*states.h*/ 0 + |
---|
296 | |
---|
297 | /*status.h*/ 0 + |
---|
298 | |
---|
299 | /*sysstate.h*/ (sizeof _System_state_Is_multiprocessing) + |
---|
300 | (sizeof _System_state_Current) + |
---|
301 | |
---|
302 | /*system.h*/ (sizeof _CPU_Table) + |
---|
303 | |
---|
304 | /*taskmp.h*/ 0 + |
---|
305 | |
---|
306 | /*tasks.h*/ (sizeof _RTEMS_tasks_Information) + |
---|
307 | (sizeof _RTEMS_tasks_User_initialization_tasks) + |
---|
308 | (sizeof _RTEMS_tasks_Number_of_initialization_tasks) + |
---|
309 | |
---|
310 | /*thread.h*/ (sizeof _Thread_BSP_context) + |
---|
311 | (sizeof _Thread_Dispatch_disable_level) + |
---|
312 | (sizeof _Thread_Do_post_task_switch_extension) + |
---|
313 | (sizeof _Thread_Maximum_extensions) + |
---|
314 | (sizeof _Thread_Ticks_per_timeslice) + |
---|
315 | (sizeof _Thread_Ready_chain) + |
---|
316 | (sizeof _Thread_Executing) + |
---|
317 | (sizeof _Thread_Heir) + |
---|
318 | (sizeof _Thread_Allocated_fp) + |
---|
319 | (sizeof _Thread_Internal_information) + |
---|
320 | (sizeof _Thread_Idle) + |
---|
321 | |
---|
322 | /*threadmp.h*/ (sizeof _Thread_MP_Receive) + |
---|
323 | (sizeof _Thread_MP_Active_proxies) + |
---|
324 | (sizeof _Thread_MP_Inactive_proxies) + |
---|
325 | |
---|
326 | /*threadq.h*/ (sizeof _Thread_queue_Extract_table) + |
---|
327 | |
---|
328 | /*timer.h*/ (sizeof _Timer_Information) + |
---|
329 | |
---|
330 | /*tod.h*/ (sizeof _TOD_Current) + |
---|
331 | (sizeof _TOD_Seconds_since_epoch) + |
---|
332 | (sizeof _TOD_Microseconds_per_tick) + |
---|
333 | (sizeof _TOD_Ticks_per_second) + |
---|
334 | (sizeof _TOD_Seconds_watchdog) + |
---|
335 | |
---|
336 | /*tqdata.h*/ 0 + |
---|
337 | |
---|
338 | /*types.h*/ 0 + |
---|
339 | |
---|
340 | /*userext.h*/ (sizeof _User_extensions_Initial) + |
---|
341 | (sizeof _User_extensions_List) + |
---|
342 | |
---|
343 | /*watchdog.h*/ (sizeof _Watchdog_Sync_level) + |
---|
344 | (sizeof _Watchdog_Sync_count) + |
---|
345 | (sizeof _Watchdog_Ticks_since_boot) + |
---|
346 | (sizeof _Watchdog_Ticks_chain) + |
---|
347 | (sizeof _Watchdog_Seconds_chain) + |
---|
348 | |
---|
349 | /*wkspace.h*/ (sizeof _Workspace_Area); |
---|
350 | |
---|
351 | uninitialized = 0; |
---|
352 | |
---|
353 | #ifndef unix /* make sure this is not a native compile */ |
---|
354 | |
---|
355 | #ifdef __i386__ |
---|
356 | |
---|
357 | /* cpu.h */ |
---|
358 | uninitialized += (sizeof _CPU_Null_fp_context) + |
---|
359 | (sizeof _CPU_Interrupt_stack_low) + |
---|
360 | (sizeof _CPU_Interrupt_stack_high); |
---|
361 | |
---|
362 | #endif |
---|
363 | |
---|
364 | #ifdef __i960__ |
---|
365 | |
---|
366 | /* cpu.h */ |
---|
367 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
368 | (sizeof _CPU_Interrupt_stack_high); |
---|
369 | |
---|
370 | #endif |
---|
371 | |
---|
372 | #ifdef __hppa__ |
---|
373 | |
---|
374 | /* cpu.h */ |
---|
375 | uninitialized += (sizeof _CPU_Null_fp_context) + |
---|
376 | #ifndef RTEMS_UNIX |
---|
377 | (sizeof _CPU_Default_gr27) + |
---|
378 | #endif |
---|
379 | (sizeof _CPU_Interrupt_stack_low) + |
---|
380 | (sizeof _CPU_Interrupt_stack_high); |
---|
381 | #endif |
---|
382 | |
---|
383 | #ifdef __mc68000__ |
---|
384 | |
---|
385 | /* cpu.h */ |
---|
386 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
387 | (sizeof _CPU_Interrupt_stack_high); |
---|
388 | |
---|
389 | #endif |
---|
390 | |
---|
391 | #ifdef __sparc__ |
---|
392 | |
---|
393 | /* cpu.h */ |
---|
394 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
395 | (sizeof _CPU_Interrupt_stack_high) + |
---|
396 | (sizeof _CPU_Null_fp_context); |
---|
397 | |
---|
398 | #ifndef NO_TABLE_MOVE |
---|
399 | uninitialized += (sizeof _CPU_Trap_Table_area); |
---|
400 | #endif |
---|
401 | |
---|
402 | #ifdef erc32 |
---|
403 | uninitialized += (sizeof _ERC32_MEC_Timer_Control_Mirror); |
---|
404 | #endif |
---|
405 | |
---|
406 | |
---|
407 | #endif |
---|
408 | |
---|
409 | |
---|
410 | #ifdef no_cpu |
---|
411 | |
---|
412 | /* cpu.h */ |
---|
413 | uninitialized += (sizeof _CPU_Null_fp_context) + |
---|
414 | (sizeof _CPU_Interrupt_stack_low) + |
---|
415 | (sizeof _CPU_Interrupt_stack_high) + |
---|
416 | (sizeof _CPU_Thread_dispatch_pointer); |
---|
417 | |
---|
418 | #endif |
---|
419 | |
---|
420 | #ifdef __PPC__ |
---|
421 | |
---|
422 | /* cpu.h */ |
---|
423 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
424 | (sizeof _CPU_Interrupt_stack_high) + |
---|
425 | (sizeof _CPU_IRQ_info); |
---|
426 | |
---|
427 | #endif |
---|
428 | #endif /* !unix */ |
---|
429 | |
---|
430 | initialized += |
---|
431 | /*copyrt.h*/ (strlen(_Copyright_Notice)+1) + |
---|
432 | |
---|
433 | /*sptables.h*/ (sizeof _Initialization_Default_multiprocessing_table) + |
---|
434 | (strlen(_RTEMS_version)+1) + |
---|
435 | (sizeof _Entry_points) + |
---|
436 | |
---|
437 | |
---|
438 | /*tod.h*/ (sizeof _TOD_Days_per_month) + |
---|
439 | (sizeof _TOD_Days_to_date) + |
---|
440 | (sizeof _TOD_Days_since_last_leap_year); |
---|
441 | |
---|
442 | #ifndef unix /* make sure this is not native */ |
---|
443 | #ifdef __sparc__ |
---|
444 | |
---|
445 | initialized += (sizeof _CPU_Trap_slot_template); |
---|
446 | |
---|
447 | #endif |
---|
448 | #endif /* !unix */ |
---|
449 | |
---|
450 | puts( "" ); |
---|
451 | |
---|
452 | if ( mode == 0 ) help_size(); |
---|
453 | else print_formula(); |
---|
454 | |
---|
455 | printf( "\n" ); |
---|
456 | printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized ); |
---|
457 | printf( "RTEMS intialized data consumes %d bytes\n", initialized ); |
---|
458 | |
---|
459 | } |
---|
460 | |
---|
461 | void help_size() |
---|
462 | { |
---|
463 | int c = '\0'; |
---|
464 | int break_loop; |
---|
465 | int total_size; |
---|
466 | int task_stacks; |
---|
467 | int interrupt_stack; |
---|
468 | int maximum_tasks, size_tasks; |
---|
469 | int maximum_sems, size_sems; |
---|
470 | int maximum_timers, size_timers; |
---|
471 | int maximum_msgqs, size_msgqs; |
---|
472 | int maximum_msgs, size_msgs_overhead; |
---|
473 | int maximum_regns, size_regns; |
---|
474 | int maximum_parts, size_parts; |
---|
475 | int maximum_ports, size_ports; |
---|
476 | int maximum_periods, size_periods; |
---|
477 | int maximum_extensions, size_extensions; |
---|
478 | int maximum_drvs, size_drvs; |
---|
479 | int maximum_fps, size_fps; |
---|
480 | int maximum_nodes, size_nodes; |
---|
481 | int maximum_gobjs, size_gobjs; |
---|
482 | int maximum_proxies, size_proxies; |
---|
483 | |
---|
484 | total_size = sys_req; /* Fixed Overhead */ |
---|
485 | printf( "What is maximum_tasks? " ); |
---|
486 | maximum_tasks = getint(); |
---|
487 | size_tasks = PER_TASK * maximum_tasks; |
---|
488 | total_size += size_tasks; |
---|
489 | |
---|
490 | printf( "What is maximum_semaphores? " ); |
---|
491 | maximum_sems = getint(); |
---|
492 | size_sems = PER_SEMAPHORE * maximum_sems; |
---|
493 | total_size += size_sems; |
---|
494 | |
---|
495 | printf( "What is maximum_timers? " ); |
---|
496 | maximum_timers = getint(); |
---|
497 | size_timers = PER_TIMER * maximum_timers; |
---|
498 | total_size += size_timers; |
---|
499 | |
---|
500 | printf( "What is maximum_message_queues? " ); |
---|
501 | maximum_msgqs = getint(); |
---|
502 | size_msgqs = PER_MSGQ * maximum_msgqs; |
---|
503 | total_size += size_msgqs; |
---|
504 | |
---|
505 | printf( "What is maximum_messages? XXXX " ); |
---|
506 | maximum_msgs = getint(); |
---|
507 | size_msgs_overhead = 0; |
---|
508 | total_size += size_msgs_overhead; |
---|
509 | |
---|
510 | printf( "What is maximum_regions? " ); |
---|
511 | maximum_regns = getint(); |
---|
512 | size_regns = PER_REGN * maximum_regns; |
---|
513 | total_size += size_regns; |
---|
514 | |
---|
515 | printf( "What is maximum_partitions? " ); |
---|
516 | maximum_parts = getint(); |
---|
517 | size_parts = PER_PART * maximum_parts; |
---|
518 | total_size += size_parts; |
---|
519 | |
---|
520 | printf( "What is maximum_ports? " ); |
---|
521 | maximum_ports = getint(); |
---|
522 | size_ports = PER_PORT * maximum_ports; |
---|
523 | total_size += size_ports; |
---|
524 | |
---|
525 | printf( "What is maximum_periods? " ); |
---|
526 | maximum_periods = getint(); |
---|
527 | size_periods = PER_PORT * maximum_periods; |
---|
528 | total_size += size_periods; |
---|
529 | |
---|
530 | printf( "What is maximum_extensions? " ); |
---|
531 | maximum_extensions = getint(); |
---|
532 | size_extensions = PER_EXTENSION * maximum_extensions; |
---|
533 | total_size += size_extensions; |
---|
534 | |
---|
535 | printf( "What is number_of_device_drivers? " ); |
---|
536 | maximum_drvs = getint(); |
---|
537 | size_drvs = PER_DRV * maximum_drvs; |
---|
538 | total_size += size_drvs; |
---|
539 | |
---|
540 | printf( "What will be total stack requirement for all tasks? " ); |
---|
541 | task_stacks = getint(); |
---|
542 | total_size += task_stacks; |
---|
543 | |
---|
544 | printf( "What is the size of the interrupt stack? " ); |
---|
545 | interrupt_stack = getint(); |
---|
546 | total_size += interrupt_stack; |
---|
547 | |
---|
548 | printf( "How many tasks will be created with the FP flag? " ); |
---|
549 | maximum_fps = getint(); |
---|
550 | size_fps = PER_FPTASK * maximum_fps; |
---|
551 | total_size += size_fps; |
---|
552 | |
---|
553 | printf( "Is this a single processor system? " ); |
---|
554 | for ( break_loop=0 ; !break_loop; c = getchar() ) { |
---|
555 | switch ( c ) { |
---|
556 | case 'Y': case 'y': |
---|
557 | case 'N': case 'n': |
---|
558 | break_loop = 1; |
---|
559 | break; |
---|
560 | } |
---|
561 | } |
---|
562 | printf( "%c\n", c ); |
---|
563 | if ( c == 'n' || c == 'N' ) { |
---|
564 | printf( "What is maximum_nodes? " ); |
---|
565 | maximum_nodes = getint(); |
---|
566 | size_nodes = PER_NODE * maximum_nodes; |
---|
567 | total_size += size_nodes; |
---|
568 | printf( "What is maximum_global_objects? " ); |
---|
569 | maximum_gobjs = getint(); |
---|
570 | size_gobjs = PER_GOBJECT * maximum_gobjs; |
---|
571 | total_size += size_gobjs; |
---|
572 | printf( "What is maximum_proxies? " ); |
---|
573 | maximum_proxies = getint(); |
---|
574 | size_proxies = PER_PROXY * maximum_proxies; |
---|
575 | total_size += size_proxies; |
---|
576 | } else { |
---|
577 | maximum_nodes = 0; |
---|
578 | size_nodes = PER_NODE * 0; |
---|
579 | maximum_gobjs = 0; |
---|
580 | size_gobjs = PER_GOBJECT * 0; |
---|
581 | maximum_proxies = 0; |
---|
582 | size_proxies = PER_PROXY * 0; |
---|
583 | } |
---|
584 | |
---|
585 | printf( "\n\n" ); |
---|
586 | printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" ); |
---|
587 | printf( " Tasks - %03d * %03ld = %ld\n", |
---|
588 | maximum_tasks, PER_TASK, (long) size_tasks ); |
---|
589 | printf( " Semaphores - %03d * %03ld = %ld\n", |
---|
590 | maximum_sems, PER_SEMAPHORE, (long) size_sems ); |
---|
591 | printf( " Timers - %03d * %03ld = %ld\n", |
---|
592 | maximum_timers, PER_TIMER, (long) size_timers ); |
---|
593 | printf( " Msg Queues - %03d * %03ld = %ld\n", |
---|
594 | maximum_msgqs, PER_MSGQ, (long) size_msgqs ); |
---|
595 | printf( " Messages Overhead - %03d * %03d = %ld\n", |
---|
596 | maximum_msgs, 0 /* PER_MSG_OVERHEAD */, (long) size_msgs_overhead ); |
---|
597 | printf( " Regions - %03d * %03ld = %ld\n", |
---|
598 | maximum_regns, PER_REGN, (long) size_regns); |
---|
599 | printf( " Partitions - %03d * %03ld = %ld\n", |
---|
600 | maximum_parts, PER_PART, (long) size_parts ); |
---|
601 | printf( " Periods - %03d * %03ld = %ld\n", |
---|
602 | maximum_periods, PER_PERIOD, (long) size_periods ); |
---|
603 | printf( " Extensions - %03d * %03ld = %ld\n", |
---|
604 | maximum_extensions, PER_EXTENSION, (long) size_extensions ); |
---|
605 | printf( " Device Drivers - %03d * %03ld = %ld\n", |
---|
606 | maximum_drvs, PER_DRV, (long) size_drvs ); |
---|
607 | |
---|
608 | printf( " System Requirements - %04d = %d\n", |
---|
609 | sys_req, sys_req ); |
---|
610 | |
---|
611 | printf( " Floating Point Tasks - %03d * %03ld = %ld\n", |
---|
612 | maximum_fps, PER_FPTASK, (long) size_fps ); |
---|
613 | printf( " Application Task Stacks - = %d\n", |
---|
614 | task_stacks ); |
---|
615 | printf( " Interrupt Stacks - = %d\n", |
---|
616 | task_stacks ); |
---|
617 | printf( " \n" ); |
---|
618 | printf( " Global object tables - %03d * %03ld = %ld\n", |
---|
619 | maximum_nodes, PER_NODE, (long) size_nodes ); |
---|
620 | printf( " Global objects - %03d * %03ld = %ld\n", |
---|
621 | maximum_gobjs, PER_GOBJECT, (long) size_gobjs ); |
---|
622 | printf( " Proxies - %03d * %03ld = %ld\n", |
---|
623 | maximum_proxies, PER_PROXY, (long) size_proxies ); |
---|
624 | printf( "\n\n" ); |
---|
625 | printf( " TOTAL = %d bytes\n", |
---|
626 | total_size ); |
---|
627 | } |
---|
628 | |
---|
629 | void print_formula() |
---|
630 | { |
---|
631 | printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" ); |
---|
632 | printf( " Tasks - maximum_tasks * %ld\n", PER_TASK ); |
---|
633 | printf( " Timers - maximum_timers * %ld\n", PER_TIMER ); |
---|
634 | printf( " Semaphores - maximum_semaphores * %ld\n", PER_SEMAPHORE); |
---|
635 | printf( " Message Queues - maximum_message_queues * %ld\n", PER_MSGQ ); |
---|
636 | printf( " Messages -\n"); |
---|
637 | printf( " Regions - maximum_regions * %ld\n", PER_REGN ); |
---|
638 | printf( " Partitions - maximum_partitions * %ld\n", PER_PART ); |
---|
639 | printf( " Ports - maximum_ports * %ld\n", PER_PORT ); |
---|
640 | printf( " Periods - maximum_periods * %ld\n", PER_PORT ); |
---|
641 | printf( " Extensions - maximum_extensions * %ld\n", PER_EXTENSION ); |
---|
642 | printf( " Device Drivers - number_of_device_drivers * %ld\n", PER_DRV); |
---|
643 | printf( " System Requirements - %d\n", sys_req ); |
---|
644 | printf( " Floating Point Tasks - FPMASK Tasks * %ld\n", PER_FPTASK ); |
---|
645 | printf( " User's Tasks' Stacks -\n" ); |
---|
646 | printf( " Interrupt Stack -\n" ); |
---|
647 | printf( " \n" ); |
---|
648 | printf( " Global object tables - maximum_nodes * %ld\n", PER_NODE ); |
---|
649 | printf( " Global objects - maximum_global_objects * %ld\n", PER_GOBJECT ); |
---|
650 | printf( " Proxies - maximum_proxies * %ld\n", PER_PROXY ); |
---|
651 | } |
---|