source: rtems/testsuites/sptests/spsize/size.c @ 340835b0

4.104.114.84.95
Last change on this file since 340835b0 was d2b93bfd, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:53:48

2003-09-04 Joel Sherrill <joel@…>

  • sp01/init.c, sp01/sp01.doc, sp01/system.h, sp01/task1.c, sp02/init.c, sp02/preempt.c, sp02/sp02.doc, sp02/system.h, sp02/task1.c, sp02/task2.c, sp02/task3.c, sp03/init.c, sp03/sp03.doc, sp03/system.h, sp03/task1.c, sp03/task2.c, sp04/init.c, sp04/sp04.doc, sp04/system.h, sp04/task1.c, sp04/task2.c, sp04/task3.c, sp04/tswitch.c, sp05/init.c, sp05/sp05.doc, sp05/system.h, sp05/task1.c, sp05/task2.c, sp05/task3.c, sp06/init.c, sp06/sp06.doc, sp06/system.h, sp06/task1.c, sp06/task2.c, sp06/task3.c, sp07/init.c, sp07/sp07.doc, sp07/system.h, sp07/task1.c, sp07/task2.c, sp07/task3.c, sp07/task4.c, sp07/taskexit.c, sp07/tcreate.c, sp07/tdelete.c, sp07/trestart.c, sp07/tstart.c, sp08/init.c, sp08/sp08.doc, sp08/system.h, sp08/task1.c, sp09/delay.c, sp09/init.c, sp09/isr.c, sp09/screen01.c, sp09/screen02.c, sp09/screen03.c, sp09/screen04.c, sp09/screen05.c, sp09/screen06.c, sp09/screen07.c, sp09/screen08.c, sp09/screen09.c, sp09/screen10.c, sp09/screen11.c, sp09/screen12.c, sp09/screen13.c, sp09/screen14.c, sp09/sp09.doc, sp09/system.h, sp09/task1.c, sp09/task2.c, sp09/task3.c, sp09/task4.c, sp11/init.c, sp11/sp11.doc, sp11/system.h, sp11/task1.c, sp11/task2.c, sp11/timer.c, sp12/init.c, sp12/pridrv.c, sp12/pritask.c, sp12/sp12.doc, sp12/system.h, sp12/task1.c, sp12/task2.c, sp12/task3.c, sp12/task4.c, sp12/task5.c, sp13/fillbuff.c, sp13/init.c, sp13/putbuff.c, sp13/sp13.doc, sp13/system.h, sp13/task1.c, sp13/task2.c, sp13/task3.c, sp14/asr.c, sp14/init.c, sp14/sp14.doc, sp14/system.h, sp14/task1.c, sp14/task2.c, sp15/init.c, sp15/sp15.doc, sp15/system.h, sp15/task1.c, sp16/init.c, sp16/sp16.doc, sp16/system.h, sp16/task1.c, sp16/task2.c, sp16/task3.c, sp16/task4.c, sp16/task5.c, sp17/asr.c, sp17/init.c, sp17/sp17.doc, sp17/system.h, sp17/task1.c, sp17/task2.c, sp19/first.c, sp19/fptask.c, sp19/fptest.h, sp19/init.c, sp19/inttest.h, sp19/sp19.doc, sp19/system.h, sp19/task1.c, sp20/getall.c, sp20/init.c, sp20/sp20.doc, sp20/system.h, sp20/task1.c, sp21/init.c, sp21/sp21.doc, sp21/system.h, sp21/task1.c, sp22/delay.c, sp22/init.c, sp22/prtime.c, sp22/sp22.doc, sp22/system.h, sp22/task1.c, sp23/init.c, sp23/sp23.doc, sp23/system.h, sp23/task1.c, sp24/init.c, sp24/resume.c, sp24/sp24.doc, sp24/system.h, sp24/task1.c, sp25/init.c, sp25/sp25.doc, sp25/system.h, sp25/task1.c, sp26/init.c, sp26/sp26.doc, sp26/system.h, sp26/task1.c, sp30/init.c, sp30/resume.c, sp30/sp30.doc, sp30/system.h, sp30/task1.c, sp31/delay.c, sp31/init.c, sp31/prtime.c, sp31/sp31.doc, sp31/system.h, sp31/task1.c, sp32/init.c, spfatal/fatal.c, spfatal/init.c, spfatal/puterr.c, spfatal/spfatal.doc, spfatal/system.h, spfatal/task1.c, spsize/getint.c, spsize/init.c, spsize/size.c, spsize/system.h: URL for license changed.
  • Property mode set to 100644
File size: 21.5 KB
Line 
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 */
54int 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#define rtems_unsigned32 unsigned32
132
133rtems_unsigned32 sys_req;
134
135void help_size();
136void print_formula();
137
138void size_rtems(
139  int mode
140)
141{
142int uninitialized = 0;
143int initialized = 0;
144
145/*
146 *  The following data is allocated for each Manager:
147 *
148 *    + Per Manager Object Information
149 *      - local pointer table
150 *      - local name table
151 *      - the object's control blocks
152 *      - global name chains
153 *
154 *  The following is the data allocate from the RTEMS Workspace Area.
155 *  The order indicates the order in which RTEMS allocates it.
156 *
157 *    + Object MP
158 *      - Global Object CB's
159 *    + Thread
160 *      - Ready Chain
161 *    + Thread MP
162 *      - Proxies Chain
163 *    + Interrupt Manager
164 *      - Interrupt Stack
165 *    + Timer Manager
166 *      - per Manager Object Data
167 *    + Extension Manager
168 *      - per Manager Object Data
169 *    + Message Queue Manager
170 *      - per Manager Object Data
171 *      - Message Buffers
172 *    + Semaphore Manager
173 *      - per Manager Object Data
174 *    + Partition Manager
175 *      - per Manager Object Data
176 *    + Region Manager
177 *      - per Manager Object Data
178 *    + Dual Ported Memory Manager
179 *      - per Manager Object Data
180 *    + Rate Monotonic Manager
181 *      - per Manager Object Data
182 *    + Internal Threads Handler
183 *      - MPCI Receive Server Thread TCB
184 *      - IDLE Thread TCB
185 *      - MPCI Receive Server Thread stack
186 *      - MPCI Receive Server Thread FP area (if CPU requires this)
187 *      - IDLE Thread stack
188 *      - IDLE Thread FP area (if CPU requires this)
189 *
190 *  This does not take into account any CPU dependent alignment requirements.
191 *
192 *  The following calculates the overhead needed by RTEMS from the
193 *  Workspace Area.
194 */
195sys_req = SYSTEM_TASKS     +     /* MPCI Receive Server and IDLE */
196          NAME_PTR_SIZE    +     /* Task Overhead */
197          READYCHAINS_SIZE +     /* Ready Chains */
198          NAME_PTR_SIZE    +     /* Timer Overhead */
199          NAME_PTR_SIZE    +     /* Semaphore Overhead */
200          NAME_PTR_SIZE    +     /* Message Queue Overhead */
201          NAME_PTR_SIZE    +     /* Region Overhead */
202          NAME_PTR_SIZE    +     /* Partition Overhead */
203          NAME_PTR_SIZE    +     /* Dual-Ported Memory Overhead */
204          NAME_PTR_SIZE    +     /* Rate Monotonic Overhead */
205          NAME_PTR_SIZE    +     /* Extension Overhead */
206          PER_NODE;              /* Extra Gobject Table */
207
208uninitialized =
209/*address.h*/   0                                         +
210
211/*apiext.h*/    (sizeof _API_extensions_List)             +
212
213/*asr.h*/       0                                         +
214
215/*attr.h*/      0                                         +
216
217/*bitfield.h*/  0                                         +
218
219/*chain.h*/     0                                         +
220
221/*clock.h*/     0                                         +
222
223/*config.h*/    (sizeof _Configuration_Table)             +
224                (sizeof _Configuration_MP_table)          +
225
226/*context.h*/   (sizeof _Context_Switch_necessary)        +
227
228/*copyrt.h*/    0                                         +
229
230/*debug.h*/     (sizeof _Debug_Level)                     +
231
232/*dpmem.h*/     (sizeof _Dual_ported_memory_Information)  +
233
234/*event.h*/     (sizeof _Event_Sync_state)                +
235
236#if defined(RTEMS_MULTIPROCESSING)
237/*eventmp.h*/   0                                         +
238#endif
239
240/*eventset.h*/  0                                         +
241
242/*extension.h*/ (sizeof _Extension_Information)           +
243
244/*fatal.h*/     0                                         +
245
246/*heap.h*/      0                                         +
247
248/*init.h*/      0                                         +
249
250/*interr.h*/    (sizeof Internal_errors_What_happened)    +
251
252/*intr.h*/      0                                         +
253
254/*io.h*/        (sizeof _IO_Number_of_drivers)            +
255                (sizeof _IO_Driver_address_table)         +
256                (sizeof _IO_Number_of_devices)            +
257                (sizeof _IO_Driver_name_table)            +
258
259/*isr.h*/       (sizeof _ISR_Nest_level)                  +
260                (sizeof _ISR_Vector_table)                +
261                (sizeof _ISR_Signals_to_thread_executing) +
262
263/*message.h*/   (sizeof _Message_queue_Information)       +
264
265/*modes.h*/     0                                         +
266
267#if defined(RTEMS_MULTIPROCESSING)
268/*mp.h*/        0                                         +
269#endif
270
271#if defined(RTEMS_MULTIPROCESSING)
272/*mpci.h*/      (sizeof _MPCI_Remote_blocked_threads)     +
273                (sizeof _MPCI_Semaphore)                  +
274                (sizeof _MPCI_table)                      +
275                (sizeof _MPCI_Receive_server_tcb)         +
276                (sizeof _MPCI_Packet_processors)          +
277#endif
278
279#if defined(RTEMS_MULTIPROCESSING)
280/*mppkt.h*/     0                                         +
281#endif
282
283#if defined(RTEMS_MULTIPROCESSING)
284/*mptables.h*/  0                                         +
285#endif
286
287#if defined(RTEMS_MULTIPROCESSING)
288/*msgmp.h*/     0                                         +
289#endif
290
291/*object.h*/    (sizeof _Objects_Local_node)              +
292                (sizeof _Objects_Maximum_nodes)           +
293                (sizeof _Objects_Information_table)       +
294
295#if defined(RTEMS_MULTIPROCESSING)
296/*objectmp.h*/  (sizeof _Objects_MP_Maximum_global_objects) +
297                (sizeof _Objects_MP_Inactive_global_objects) +
298#endif
299
300/*options.h*/   0                                         +
301
302/*part.h*/      (sizeof _Partition_Information)           +
303
304#if defined(RTEMS_MULTIPROCESSING)
305/*partmp.h*/    0                                         +
306#endif
307
308/*priority.h*/  (sizeof _Priority_Major_bit_map)          +
309                (sizeof _Priority_Bit_map)                +
310
311/*ratemon.h*/   (sizeof _Rate_monotonic_Information)      +
312
313/*region.h*/    (sizeof _Region_Information)              +
314
315#if defined(RTEMS_MULTIPROCESSING)
316/*regionmp.h*/  0                                         +
317#endif
318
319/*rtems.h*/     /* Not applicable */
320
321/*sem.h*/       (sizeof _Semaphore_Information)           +
322
323#if defined(RTEMS_MULTIPROCESSING)
324/*semmp.h*/     0                                         +
325#endif
326
327/*signal.h*/    0                                         +
328
329/*signalmp.h*/  0                                         +
330
331/*stack.h*/     0                                         +
332
333/*states.h*/    0                                         +
334
335/*status.h*/    0                                         +
336
337/*sysstate.h*/  (sizeof _System_state_Is_multiprocessing) +
338                (sizeof _System_state_Current)            +
339
340/*system.h*/    (sizeof _CPU_Table)                       +
341
342#if defined(RTEMS_MULTIPROCESSING)
343/*taskmp.h*/    0                                         +
344#endif
345
346/*tasks.h*/     (sizeof _RTEMS_tasks_Information)         +
347                (sizeof _RTEMS_tasks_User_initialization_tasks) +
348                (sizeof _RTEMS_tasks_Number_of_initialization_tasks) +
349
350/*thread.h*/    (sizeof _Thread_BSP_context)              +
351                (sizeof _Thread_Dispatch_disable_level)   +
352                (sizeof _Thread_Do_post_task_switch_extension) +
353                (sizeof _Thread_Maximum_extensions)       +
354                (sizeof _Thread_Ticks_per_timeslice)      +
355                (sizeof _Thread_Ready_chain)              +
356                (sizeof _Thread_Executing)                +
357                (sizeof _Thread_Heir)                     +
358#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
359                (sizeof _Thread_Allocated_fp)             +
360#endif
361                (sizeof _Thread_Internal_information)     +
362                (sizeof _Thread_Idle)                     +
363
364#if defined(RTEMS_MULTIPROCESSING)
365/*threadmp.h*/  (sizeof _Thread_MP_Receive)               +
366                (sizeof _Thread_MP_Active_proxies)        +
367                (sizeof _Thread_MP_Inactive_proxies)      +
368#endif
369
370/*threadq.h*/
371
372/*timer.h*/     (sizeof _Timer_Information)               +
373
374/*tod.h*/       (sizeof _TOD_Current)                     +
375                (sizeof _TOD_Seconds_since_epoch)         +
376                (sizeof _TOD_Microseconds_per_tick)       +
377                (sizeof _TOD_Ticks_per_second)            +
378                (sizeof _TOD_Seconds_watchdog)            +
379
380/*tqdata.h*/    0                                         +
381
382/*types.h*/     0                                         +
383
384/*userext.h*/   (sizeof _User_extensions_List)            +
385
386/*watchdog.h*/  (sizeof _Watchdog_Sync_level)             +
387                (sizeof _Watchdog_Sync_count)             +
388                (sizeof _Watchdog_Ticks_since_boot)       +
389                (sizeof _Watchdog_Ticks_chain)            +
390                (sizeof _Watchdog_Seconds_chain)          +
391
392/*wkspace.h*/   (sizeof _Workspace_Area);
393
394uninitialized = 0;
395
396#ifndef unix  /* make sure this is not a native compile */
397
398#ifdef __i386__
399
400/* cpu.h */
401uninitialized += (sizeof _CPU_Null_fp_context);
402
403#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)
404uninitialized += (sizeof _CPU_Interrupt_stack_low) +
405                 (sizeof _CPU_Interrupt_stack_high);
406#endif
407
408#endif
409
410#ifdef __i960__
411
412/* cpu.h */
413uninitialized += (sizeof _CPU_Interrupt_stack_low) +
414                 (sizeof _CPU_Interrupt_stack_high);
415
416#endif
417
418#ifdef __hppa__
419
420/* cpu.h */
421uninitialized += (sizeof _CPU_Null_fp_context) +
422#if !defined(RTEMS_UNIX)
423                 (sizeof _CPU_Default_gr27) +
424#endif
425                 (sizeof _CPU_Interrupt_stack_low) +
426                 (sizeof _CPU_Interrupt_stack_high);
427#endif
428
429#ifdef __mc68000__
430
431/* cpu.h */
432uninitialized += (sizeof _CPU_Interrupt_stack_low) +
433                 (sizeof _CPU_Interrupt_stack_high);
434
435#endif
436
437#ifdef __sparc__
438 
439/* cpu.h */
440uninitialized += (sizeof _CPU_Interrupt_stack_low) +
441                 (sizeof _CPU_Interrupt_stack_high) +
442                 (sizeof _CPU_Null_fp_context);
443
444#endif
445
446
447#ifdef no_cpu
448
449/* cpu.h */
450uninitialized += (sizeof _CPU_Null_fp_context) +
451                 (sizeof _CPU_Interrupt_stack_low) +
452                 (sizeof _CPU_Interrupt_stack_high) +
453                 (sizeof _CPU_Thread_dispatch_pointer);
454
455#endif
456
457#ifdef __PPC__
458
459/* cpu.h */
460uninitialized += (sizeof _CPU_Interrupt_stack_low) +
461                 (sizeof _CPU_Interrupt_stack_high) +
462                 (sizeof _CPU_IRQ_info);
463
464#endif
465#endif /* !unix */
466
467initialized +=
468/*copyrt.h*/    (strlen(_Copyright_Notice)+1)             +
469
470/*sptables.h*/  (sizeof _Initialization_Default_multiprocessing_table)  +
471                (strlen(_RTEMS_version)+1)      +
472
473
474/*tod.h*/       (sizeof _TOD_Days_per_month)    +
475                (sizeof _TOD_Days_to_date)      +
476                (sizeof _TOD_Days_since_last_leap_year);
477
478#ifndef unix /* make sure this is not native */
479#ifdef __sparc__
480
481initialized +=  (sizeof _CPU_Trap_slot_template);
482
483#endif
484#endif /* !unix */
485
486puts( "" );
487
488  if ( mode == 0 ) help_size();
489  else             print_formula();
490
491printf( "\n" );
492printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized );
493printf( "RTEMS intialized data consumes %d bytes\n", initialized );
494
495}
496
497void help_size()
498{
499int c = '\0';
500int break_loop;
501int total_size;
502int task_stacks;
503int interrupt_stack;
504int maximum_tasks, size_tasks;
505int maximum_sems, size_sems;
506int maximum_timers, size_timers;
507int maximum_msgqs, size_msgqs;
508int maximum_msgs, size_msgs_overhead;
509int maximum_regns, size_regns;
510int maximum_parts, size_parts;
511int maximum_ports, size_ports;
512int maximum_periods, size_periods;
513int maximum_extensions, size_extensions;
514int maximum_drvs, size_drvs;
515int maximum_fps, size_fps;
516int maximum_nodes, size_nodes;
517int maximum_gobjs, size_gobjs;
518int maximum_proxies, size_proxies;
519
520total_size = sys_req;    /* Fixed Overhead */
521printf( "What is maximum_tasks? " );
522maximum_tasks = getint();
523size_tasks = PER_TASK * maximum_tasks;
524total_size += size_tasks;
525
526printf( "What is maximum_semaphores? " );
527maximum_sems = getint();
528size_sems = PER_SEMAPHORE * maximum_sems;
529total_size += size_sems;
530
531printf( "What is maximum_timers? " );
532maximum_timers = getint();
533size_timers = PER_TIMER * maximum_timers;
534total_size += size_timers;
535
536printf( "What is maximum_message_queues? " );
537maximum_msgqs = getint();
538size_msgqs = PER_MSGQ * maximum_msgqs;
539total_size += size_msgqs;
540
541printf( "What is maximum_messages?  XXXX " );
542maximum_msgs = getint();
543size_msgs_overhead = 0;
544total_size += size_msgs_overhead;
545
546printf( "What is maximum_regions? " );
547maximum_regns = getint();
548size_regns = PER_REGN * maximum_regns;
549total_size += size_regns;
550
551printf( "What is maximum_partitions? " );
552maximum_parts = getint();
553size_parts = PER_PART * maximum_parts;
554total_size += size_parts;
555
556printf( "What is maximum_ports? " );
557maximum_ports = getint();
558size_ports = PER_PORT * maximum_ports;
559total_size += size_ports;
560
561printf( "What is maximum_periods? " );
562maximum_periods = getint();
563size_periods = PER_PORT * maximum_periods;
564total_size += size_periods;
565
566printf( "What is maximum_extensions? " );
567maximum_extensions = getint();
568size_extensions = PER_EXTENSION * maximum_extensions;
569total_size += size_extensions;
570
571printf( "What is number_of_device_drivers? " );
572maximum_drvs = getint();
573size_drvs = PER_DRV  * maximum_drvs;
574total_size += size_drvs;
575
576printf( "What will be total stack requirement for all tasks? " );
577task_stacks = getint();
578total_size += task_stacks;
579
580printf( "What is the size of the interrupt stack? " );
581interrupt_stack = getint();
582total_size += interrupt_stack;
583
584printf( "How many tasks will be created with the FP flag? " );
585maximum_fps = getint();
586size_fps = PER_FPTASK  * maximum_fps;
587total_size += size_fps;
588
589printf( "Is this a single processor system? " );
590for ( break_loop=0 ; !break_loop; c = getchar() ) {
591  switch ( c ) {
592    case 'Y':  case 'y':
593    case 'N':  case 'n':
594      break_loop = 1;
595      break;
596  }
597}
598printf( "%c\n", c );
599if ( c == 'n' || c == 'N' ) {
600  printf( "What is maximum_nodes? " );
601  maximum_nodes = getint();
602  size_nodes = PER_NODE * maximum_nodes;
603  total_size += size_nodes;
604  printf( "What is maximum_global_objects? " );
605  maximum_gobjs = getint();
606  size_gobjs = PER_GOBJECT * maximum_gobjs;
607  total_size += size_gobjs;
608  printf( "What is maximum_proxies? " );
609  maximum_proxies = getint();
610  size_proxies = PER_PROXY * maximum_proxies;
611  total_size += size_proxies;
612} else {
613  maximum_nodes = 0;
614  size_nodes = PER_NODE * 0;
615  maximum_gobjs = 0;
616  size_gobjs = PER_GOBJECT * 0;
617  maximum_proxies = 0;
618  size_proxies = PER_PROXY * 0;
619}
620
621printf( "\n\n" );
622printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" );
623printf( " Tasks                - %03d * %03ld            =  %ld\n",
624          maximum_tasks, PER_TASK, (long) size_tasks );
625printf( " Semaphores           - %03d * %03ld            =  %ld\n",
626          maximum_sems, PER_SEMAPHORE, (long) size_sems );
627printf( " Timers               - %03d * %03ld            =  %ld\n",
628          maximum_timers, PER_TIMER, (long) size_timers );
629printf( " Msg Queues           - %03d * %03ld            =  %ld\n",
630          maximum_msgqs, PER_MSGQ, (long) size_msgqs );
631printf( " Messages Overhead    - %03d * %03d            =  %ld\n",
632          maximum_msgs, 0 /* PER_MSG_OVERHEAD */, (long) size_msgs_overhead );
633printf( " Regions              - %03d * %03ld            =  %ld\n",
634          maximum_regns, PER_REGN, (long) size_regns);
635printf( " Partitions           - %03d * %03ld            =  %ld\n",
636          maximum_parts, PER_PART, (long) size_parts );
637printf( " Periods              - %03d * %03ld            =  %ld\n",
638          maximum_periods, PER_PERIOD, (long) size_periods );
639printf( " Extensions           - %03d * %03ld            =  %ld\n",
640          maximum_extensions, PER_EXTENSION, (long) size_extensions );
641printf( " Device Drivers       - %03d * %03ld            =  %ld\n",
642          maximum_drvs, PER_DRV, (long) size_drvs );
643
644printf( " System Requirements  - %04d                 =  %d\n",
645          sys_req, sys_req );
646
647printf( " Floating Point Tasks - %03d * %03ld            =  %ld\n",
648          maximum_fps, PER_FPTASK, (long) size_fps );
649printf( " Application Task Stacks -                     =  %d\n",
650          task_stacks );
651printf( " Interrupt Stacks -                            =  %d\n",
652          task_stacks );
653printf( " \n" );
654printf( " Global object tables - %03d * %03ld            =  %ld\n",
655          maximum_nodes, PER_NODE, (long) size_nodes );
656printf( " Global objects       - %03d * %03ld            =  %ld\n",
657          maximum_gobjs, PER_GOBJECT, (long) size_gobjs );
658printf( " Proxies              - %03d * %03ld            =  %ld\n",
659          maximum_proxies, PER_PROXY, (long) size_proxies );
660printf( "\n\n" );
661printf( " TOTAL                                       = %d bytes\n",
662      total_size );
663}
664
665void print_formula()
666{
667printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" );
668printf( " Tasks                - maximum_tasks * %ld\n",      PER_TASK );
669printf( " Timers               - maximum_timers * %ld\n",     PER_TIMER );
670printf( " Semaphores           - maximum_semaphores * %ld\n", PER_SEMAPHORE);
671printf( " Message Queues       - maximum_message_queues * %ld\n", PER_MSGQ );
672printf( " Messages             -\n");
673printf( " Regions              - maximum_regions * %ld\n",    PER_REGN );
674printf( " Partitions           - maximum_partitions * %ld\n", PER_PART );
675printf( " Ports                - maximum_ports * %ld\n",      PER_PORT );
676printf( " Periods              - maximum_periods * %ld\n",    PER_PORT );
677printf( " Extensions           - maximum_extensions * %ld\n", PER_EXTENSION );
678printf( " Device Drivers       - number_of_device_drivers * %ld\n", PER_DRV);
679printf( " System Requirements  - %d\n",                       sys_req );
680printf( " Floating Point Tasks - FPMASK Tasks * %ld\n",       PER_FPTASK );
681printf( " User's Tasks' Stacks -\n" );
682printf( " Interrupt Stack      -\n" );
683printf( " \n" );
684printf( " Global object tables - maximum_nodes * %ld\n",          PER_NODE );
685printf( " Global objects       - maximum_global_objects * %ld\n", PER_GOBJECT );
686printf( " Proxies              - maximum_proxies * %ld\n",        PER_PROXY );
687}
Note: See TracBrowser for help on using the repository browser.