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