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