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