source: rtems/cpukit/sapi/include/confdefs.h @ f2a776ac

4.104.114.9
Last change on this file since f2a776ac was f2a776ac, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 17, 2008 at 6:52:30 PM

2008-06-17 Joel Sherrill <joel.sherrill@…>

  • sapi/include/confdefs.h: The math in the _Configure_Object_RAM macro was always adding heap overhead even when the number of objects configured was zero and we would not do an allocation. This resulted in an over estimation of the amount of Workspace required (~2K on minimum.exe on PowerPC).
  • Property mode set to 100644
File size: 60.7 KB
Line 
1/**
2 * @file rtems/confdefs.h
3 *
4 *  This include file contains the configuration table template that will
5 *  be instantiated by an application based on the setting of a number
6 *  of macros.  The macros are documented in the Configuring a System
7 *  chapter of the Classic API User's Guide
8 *
9 *  The model is to estimate the memory required for each configured item
10 *  and sum those estimates.  The estimate can be too high or too low for
11 *  a variety of reasons:
12 *
13 *  Reasons estimate is too high:
14 *    + FP contexts (not all tasks are FP)
15 *
16 *  Reasons estimate is too low:
17 *    + stacks greater than minimum size
18 *    + messages
19 *    + application must account for device driver resources
20 *    + application must account for add-on library resource requirements
21 *
22 *  NOTE:  Eventually this may be able to take into account some of
23 *         the above.  This procedure has evolved from just enough to
24 *         support the RTEMS Test Suites into something that can be
25 *         used remarkably reliably by most applications.
26 */
27 
28/*
29 *  COPYRIGHT (c) 1989-2008.
30 *  On-Line Applications Research Corporation (OAR).
31 *
32 *  The license and distribution terms for this file may be
33 *  found in the file LICENSE in this distribution or at
34 *  http://www.rtems.com/license/LICENSE.
35 *
36 *  $Id$
37 */
38
39#ifndef __CONFIGURATION_TEMPLATE_h
40#define __CONFIGURATION_TEMPLATE_h
41
42/*
43 * Include the executive's configuration
44 */
45#include <rtems/score/cpuopts.h>
46#include <rtems/score/apimutex.h>
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52extern rtems_initialization_tasks_table Initialization_tasks[];
53extern rtems_driver_address_table       Device_drivers[];
54extern rtems_configuration_table        Configuration;
55#if defined(RTEMS_MULTIPROCESSING)
56  extern rtems_multiprocessing_table      Multiprocessing_configuration;
57#endif
58#ifdef RTEMS_POSIX_API
59  extern posix_api_configuration_table    Configuration_POSIX_API;
60#endif
61#ifdef RTEMS_ITRON_API
62  extern itron_api_configuration_table    Configuration_ITRON_API;
63#endif
64
65/**
66 *  This macro determines whether the RTEMS reentrancy support for
67 *  the Newlib C Library is enabled.
68 */
69#if (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
70  #define CONFIGURE_NEWLIB_EXTENSION 1
71#else
72  #define CONFIGURE_NEWLIB_EXTENSION 0
73#endif
74
75/**
76 *  This macro defines the number of POSIX file descriptors allocated
77 *  and managed by libio.  These are the "integer" file descriptors that
78 *  are used by calls like open(2) and read(2).
79 */
80#ifndef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
81  #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 3
82#endif
83
84/**
85 *  From the number of file descriptors, we can determine how many
86 *  semaphores the implementation will require.
87 */
88#define CONFIGURE_LIBIO_SEMAPHORES \
89  (CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS + 1)
90
91#ifdef CONFIGURE_INIT
92  /**
93   *  When instantiating the configuration tables, this variable is
94   *  initialized to specify the maximum number of file descriptors.
95   */
96  uint32_t rtems_libio_number_iops = CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS;
97#endif
98
99/**
100 *  This macro determines if termios is disabled by this application.
101 *  This only means that resources will not be reserved.  If you end
102 *  up using termios, it will fail.
103 */
104#ifdef CONFIGURE_TERMIOS_DISABLED
105  #define CONFIGURE_TERMIOS_SEMAPHORES 0
106#else
107  /**
108   *  This macro specifies the number of serial or PTY ports that will
109   *  use termios.
110   */
111  #ifndef CONFIGURE_NUMBER_OF_TERMIOS_PORTS
112  #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1
113  #endif
114
115  /**
116   *  This macro reserves the number of semaphores required by termios
117   *  based upon the number of communication ports that will use it.
118   */
119  #define CONFIGURE_TERMIOS_SEMAPHORES \
120    ((CONFIGURE_NUMBER_OF_TERMIOS_PORTS * 4) + 1)
121#endif
122
123/**
124 *  This macro specifies the number of PTYs that can be concurrently
125 *  active.
126 */
127#ifndef CONFIGURE_MAXIMUM_PTYS
128  #define CONFIGURE_MAXIMUM_PTYS 0
129#endif
130
131/**
132 *  This variable contains the maximum number of PTYs that can be
133 *  concurrently active.
134 */
135#ifdef CONFIGURE_INIT
136  int rtems_telnetd_maximum_ptys = CONFIGURE_MAXIMUM_PTYS;
137#else
138  extern int rtems_telnetd_maximum_ptys;
139#endif
140
141/*
142 *  Mount Table Configuration
143 */
144#include <rtems/imfs.h>
145
146/**
147 *  This specifies the number of bytes per block for files within
148 *  the IMFS.  There are a maximum number of blocks per file so
149 *  this dictates the maximum size of a file.  This has to be balanced
150 *  with the unused portion of each block that might be wasted.
151 */
152#ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK
153  #define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK \
154                    IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK
155#endif
156#ifdef CONFIGURE_INIT
157  int imfs_rq_memfile_bytes_per_block = CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
158#endif /* CONFIGURE_INIT */
159
160#ifdef CONFIGURE_INIT
161  #ifndef CONFIGURE_HAS_OWN_MOUNT_TABLE
162    const rtems_filesystem_mount_table_t configuration_mount_table = {
163      #ifdef CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
164        &IMFS_ops,
165      #else  /* using miniIMFS as base filesystem */
166        &miniIMFS_ops,
167      #endif
168      RTEMS_FILESYSTEM_READ_WRITE,
169      NULL,
170      NULL
171    };
172
173    const rtems_filesystem_mount_table_t
174        *rtems_filesystem_mount_table = &configuration_mount_table;
175    const int rtems_filesystem_mount_table_size = 1;
176  #endif
177#endif
178
179/**
180 *  This configures the stack checker user extension.
181 */
182#ifdef STACK_CHECKER_ON
183  #define CONFIGURE_STACK_CHECKER_EXTENSION 1
184#else
185  #define CONFIGURE_STACK_CHECKER_EXTENSION 0
186#endif
187
188/**
189 *  @brief Maximum Priority configuration
190 *
191 *  This configures the maximum priority value that
192 *  a task may have.
193 *
194 *  By reducing the number of priorities in a system,
195 *  the amount of RAM required by RTEMS can be significantly
196 *  reduced.  RTEMS allocates a Chain_Control structure per
197 *  priority and this structure contains 3 pointers.  So
198 *  the default is (256 * 12) = 3K on 32-bit architectures.
199 *
200 *  This must be one less than a power of 2 between
201 *  4 and 256.  Valid values along with the application
202 *  priority levels and memory saved when pointers are
203 *  32-bits in size are:
204 *
205 *    + 3,  2 application priorities, 3024 bytes saved
206 *    + 7, 5 application priorities, 2976 bytes saved
207 *    + 15, 13 application priorities, 2880 bytes saved
208 *    + 31, 29 application priorities, 2688 bytes saved
209 *    + 63, 61 application priorities, 2304 bytes saved
210 *    + 127, 125 application priorities, 1536 bytes saved
211 *    + 255, 253 application priorities, 0 bytes saved
212 *
213 *  It is specified in terms of Classic API
214 *  priority values.
215 */
216#ifndef CONFIGURE_MAXIMUM_PRIORITY
217  #define CONFIGURE_MAXIMUM_PRIORITY 255
218#endif
219
220/*
221 *  If you said the IDLE task was going to do application initialization
222 *  and didn't override the IDLE body, then something is amiss.
223 */
224#if (defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
225     !defined(CONFIGURE_IDLE_TASK_BODY))
226  #error "CONFIGURE_ERROR: You did not override the IDLE task body."
227#endif
228
229/**
230 *  @brief Idle task body configuration
231 *
232 *  There is a default IDLE thread body provided by RTEMS which
233 *  has the possibility of being CPU specific.  There may be a
234 *  BSP specific override of the RTEMS default body and in turn,
235 *  the application may override and provide its own.
236 */
237#ifndef CONFIGURE_IDLE_TASK_BODY
238  #ifdef BSP_IDLE_TASK_BODY
239    #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
240  #else
241    #define CONFIGURE_IDLE_TASK_BODY NULL
242  #endif
243#endif
244
245/**
246 *  By default, use the minimum stack size requested by this port.
247 */
248#ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE
249  #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
250#endif
251
252/**
253 *  @brief Idle task stack size configuration
254 *
255 *  By default, the IDLE task will have a stack of minimum size.
256 *  The BSP or application may override this value.
257 */
258#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
259  #ifdef BSP_IDLE_TASK_STACK_SIZE
260    #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
261  #else
262    #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
263  #endif
264#endif
265
266/**
267 *  @brief Interrupt stack size configuration
268 *
269 *  By default, the interrupt stack will be of minimum size.
270 *  The BSP or application may override this value.
271 */
272#ifndef CONFIGURE_INTERRUPT_STACK_SIZE
273  #ifdef BSP_INTERRUPT_STACK_SIZE
274    #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
275  #else
276    #define CONFIGURE_INTERRUPT_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
277  #endif
278#endif
279
280/**
281 *  This reserves memory for the interrupt stack if it is to be allocated
282 *  by RTEMS rather than the BSP.
283 *
284 *  @todo Try to get to the point where all BSPs support allocating the
285 *        memory from the Workspace.
286 */
287#if (CPU_ALLOCATE_INTERRUPT_STACK == 0)
288  #define CONFIGURE_INTERRUPT_STACK_MEMORY 0
289#else
290  #define CONFIGURE_INTERRUPT_STACK_MEMORY CONFIGURE_INTERRUPT_STACK_SIZE
291#endif
292
293/**
294 *  Configure the very much optional task stack allocator
295 */
296#ifndef CONFIGURE_TASK_STACK_ALLOCATOR
297  #define CONFIGURE_TASK_STACK_ALLOCATOR NULL
298#endif
299
300/**
301 *  Configure the very much optional task stack deallocator
302 */
303#ifndef CONFIGURE_TASK_STACK_DEALLOCATOR
304  #define CONFIGURE_TASK_STACK_DEALLOCATOR NULL
305#endif
306
307/**
308 *  Should the RTEMS Workspace and C Program Heap be cleared automatically
309 *  at system start up?
310 */
311#ifndef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
312  #ifdef BSP_ZERO_WORKSPACE_AUTOMATICALLY
313    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY \
314            BSP_ZERO_WORKSPACE_AUTOMATICALLY
315  #else
316    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY FALSE
317  #endif
318#endif
319
320/*
321 *  RTEMS Malloc configuration
322 */
323
324#include <rtems/malloc.h>
325
326#ifdef CONFIGURE_INIT
327  /**
328   *  This configures the malloc family statistics to be available.
329   *  By default only function call counts are kept.
330   */
331  rtems_malloc_statistics_functions_t *rtems_malloc_statistics_helpers =
332    #ifndef CONFIGURE_MALLOC_STATISTICS
333      NULL;
334    #else
335      &rtems_malloc_statistics_helpers_table;
336    #endif
337#endif
338
339#ifdef CONFIGURE_INIT
340  /**
341   *  This configures the sbrk() support for the malloc family.
342   *  By default it is assumed that the BSP provides all available
343   *  RAM to the malloc family implementation so sbrk()'ing to get
344   *  more memory would always fail anyway.
345   */
346  rtems_malloc_sbrk_functions_t *rtems_malloc_sbrk_helpers =
347    #ifndef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
348      NULL;
349    #else
350      &rtems_malloc_sbrk_helpers_table;
351    #endif
352#endif
353
354#ifdef CONFIGURE_INIT
355  /**
356   *  This configures the malloc family plugin which dirties memory
357   *  allocated.  This is helpful for finding unitialized data structure
358   *  problems.
359   */
360  rtems_malloc_dirtier_t *rtems_malloc_dirty_helper =
361    #if defined(CONFIGURE_MALLOC_DIRTY)
362      rtems_malloc_dirty_memory;
363    #else
364      NULL;
365    #endif
366#endif
367
368/**
369 *  This is a helper macro used in calculations in this file.  It is used
370 *  to noted when an element is allocated from the RTEMS Workspace and adds
371 *  a factor to account for heap overhead plus an alignment factor that
372 *  may be applied.
373 */
374#define _Configure_From_workspace(_size) \
375  ((_size) + (2 * sizeof(uint32_t)) + CPU_ALIGNMENT)
376
377/**
378 *  This macro accounts for how memory for a set of configured objects is
379 *  allocated from the Executive Workspace. 
380 *
381 *  NOTE: It does NOT attempt to address the more complex case of unlimited
382 *        objects.
383 */
384#define _Configure_Object_RAM(_number, _size) \
385  ( _Configure_From_workspace((_number) * (_size)) + \
386    _Configure_From_workspace( \
387      (((_number) + 1) * sizeof(Objects_Control *)) + \
388      (sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *)) \
389    ) \
390  )
391
392/*
393 *  Default User Initialization Task Table.  This table guarantees that
394 *  one user initialization table is defined.
395 */
396
397#ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
398
399#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
400
401/*
402 *  The user is defining their own table information and setting the
403 *  appropriate variables.
404 */
405
406#else
407
408#ifndef CONFIGURE_INIT_TASK_NAME
409  #define CONFIGURE_INIT_TASK_NAME          rtems_build_name('U', 'I', '1', ' ')
410#endif
411
412#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
413  #define CONFIGURE_INIT_TASK_STACK_SIZE    CONFIGURE_MINIMUM_TASK_STACK_SIZE
414#endif
415
416#ifndef CONFIGURE_INIT_TASK_PRIORITY
417  #define CONFIGURE_INIT_TASK_PRIORITY      1
418#endif
419
420#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
421  #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_DEFAULT_ATTRIBUTES
422#endif
423
424#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
425  #define CONFIGURE_INIT_TASK_ENTRY_POINT   Init
426#endif
427
428#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
429  #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
430#endif
431
432#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
433  #define CONFIGURE_INIT_TASK_ARGUMENTS     0
434#endif
435
436#ifdef CONFIGURE_INIT
437  rtems_initialization_tasks_table Initialization_tasks[] = {
438    { CONFIGURE_INIT_TASK_NAME,
439      CONFIGURE_INIT_TASK_STACK_SIZE,
440      CONFIGURE_INIT_TASK_PRIORITY,
441      CONFIGURE_INIT_TASK_ATTRIBUTES,
442      CONFIGURE_INIT_TASK_ENTRY_POINT,
443      CONFIGURE_INIT_TASK_INITIAL_MODES,
444      CONFIGURE_INIT_TASK_ARGUMENTS
445    }
446  };
447#endif
448
449#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
450
451#define CONFIGURE_INIT_TASK_TABLE_SIZE \
452  sizeof(CONFIGURE_INIT_TASK_TABLE) / sizeof(rtems_initialization_tasks_table)
453
454#endif    /* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
455
456#else     /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
457
458#define CONFIGURE_INIT_TASK_TABLE      NULL
459#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
460#define CONFIGURE_INIT_TASK_STACK_SIZE 0
461
462#endif
463
464/*
465 *  Default Device Driver Table.  Each driver needed by the test is explicitly
466 *  choosen by that test.  There is always a null driver entry.
467 */
468
469#define NULL_DRIVER_TABLE_ENTRY \
470 { NULL, NULL, NULL, NULL, NULL, NULL }
471
472#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
473  #include <rtems/console.h>
474#endif
475
476#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
477  #include <rtems/clockdrv.h>
478#endif
479
480#ifdef CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
481  #include <rtems/timerdrv.h>
482#endif
483
484#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
485  #include <rtems/rtc.h>
486#endif
487
488#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
489  #include <rtems/watchdogdrv.h>
490#endif
491
492#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
493  #include <rtems/devnull.h>
494#endif
495
496#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
497  /* the ide driver needs the ATA driver */
498  #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
499    #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
500  #endif
501  #include <libchip/ide_ctrl.h>
502#endif
503
504#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
505  #include <libchip/ata.h>
506#endif
507
508#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
509
510#ifdef CONFIGURE_INIT
511  rtems_driver_address_table Device_drivers[] = {
512    #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
513      CONSOLE_DRIVER_TABLE_ENTRY,
514    #endif
515    #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
516      CLOCK_DRIVER_TABLE_ENTRY,
517    #endif
518    #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
519      RTC_DRIVER_TABLE_ENTRY,
520    #endif
521    #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
522      WATCHDOG_DRIVER_TABLE_ENTRY,
523    #endif
524    #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
525      DEVNULL_DRIVER_TABLE_ENTRY,
526    #endif
527    #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
528      IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
529    #endif
530    #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
531      ATA_DRIVER_TABLE_ENTRY,
532    #endif
533    #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
534      CONFIGURE_APPLICATION_EXTRA_DRIVERS,
535    #endif
536    #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
537      NULL_DRIVER_TABLE_ENTRY
538    #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
539        !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
540        !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \
541        !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \
542        !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \
543        !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \
544        !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
545      NULL_DRIVER_TABLE_ENTRY
546    #endif
547  };
548#endif
549
550#endif  /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
551
552/*
553 *  Default the number of drivers per node.  This value may be
554 *  overridden by the user.
555 */
556
557#define CONFIGURE_NUMBER_OF_DRIVERS \
558  ((sizeof(Device_drivers) / sizeof(rtems_driver_address_table)))
559
560/**
561 *  This specifies the maximum number of device drivers that
562 *  can be installed in the system at one time.  It must account
563 *  for both the statically and dynamically installed drivers.
564 */
565#ifndef CONFIGURE_MAXIMUM_DRIVERS
566  #define CONFIGURE_MAXIMUM_DRIVERS CONFIGURE_NUMBER_OF_DRIVERS
567#endif
568
569/**
570 *  Default the number of devices per device driver.  This value may be
571 *  overridden by the user.
572 *
573 *  @note This configuration parameter is obsolete. Thus we will warn the
574 *        user that it is obsolete.
575 */
576#ifdef CONFIGURE_MAXIMUM_DEVICES
577  #warning "CONFIGURE_MAXIMUM_DEVICES is obsolete.  Do not use any longer."
578#endif
579
580#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
581  /*
582   * configure the priority of the ATA driver task
583   */
584  #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
585    #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
586  #endif
587  #ifdef CONFIGURE_INIT
588    rtems_task_priority ata_driver_task_priority
589      = CONFIGURE_ATA_DRIVER_TASK_PRIORITY;
590  #endif /* CONFIGURE_INIT */
591#endif
592
593/*
594 * add bdbuf configuration and values for swapout task priority
595 */
596#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
597  #include <rtems/bdbuf.h>
598  /*
599   * configure the priority of the bdbuf swapout task
600   */
601  #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
602    #define CONFIGURE_SWAPOUT_TASK_PRIORITY SWAPOUT_TASK_DEFAULT_PRIORITY
603  #endif
604  #ifdef CONFIGURE_INIT
605    rtems_task_priority swapout_task_priority = CONFIGURE_SWAPOUT_TASK_PRIORITY;
606  #endif
607  #ifndef CONFIGURE_HAS_OWN_BDBUF_TABLE
608    #ifndef CONFIGURE_BDBUF_BUFFER_COUNT
609      #define CONFIGURE_BDBUF_BUFFER_COUNT 64
610    #endif
611
612    #ifndef CONFIGURE_BDBUF_BUFFER_SIZE
613      #define CONFIGURE_BDBUF_BUFFER_SIZE 512
614    #endif
615    #ifdef CONFIGURE_INIT
616      rtems_bdbuf_config rtems_bdbuf_configuration[] = {
617        {CONFIGURE_BDBUF_BUFFER_SIZE, CONFIGURE_BDBUF_BUFFER_COUNT, NULL}
618      };
619      int rtems_bdbuf_configuration_size =( sizeof(rtems_bdbuf_configuration)
620                                 /sizeof(rtems_bdbuf_configuration[0]));
621    #endif /* CONFIGURE_INIT */
622  #endif /* CONFIGURE_HAS_OWN_BDBUF_TABLE        */
623#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
624
625#if defined(RTEMS_MULTIPROCESSING)
626  /*
627   *  Default Multiprocessing Configuration Table.  The defaults are
628   *  appropriate for most of the RTEMS Multiprocessor Test Suite.  Each
629   *  value may be overridden within each test to customize the environment.
630   */
631
632  #ifdef CONFIGURE_MP_APPLICATION
633    #ifndef CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE
634
635      #ifndef CONFIGURE_MP_NODE_NUMBER
636        #define CONFIGURE_MP_NODE_NUMBER                NODE_NUMBER
637      #endif
638
639      #ifndef CONFIGURE_MP_MAXIMUM_NODES
640        #define CONFIGURE_MP_MAXIMUM_NODES              2
641      #endif
642
643      #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
644        #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS     32
645      #endif
646      #define CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
647        _Configure_Object_RAM((_global_objects), sizeof(Objects_MP_Control))
648
649      #ifndef CONFIGURE_MP_MAXIMUM_PROXIES
650        #define CONFIGURE_MP_MAXIMUM_PROXIES            32
651      #endif
652      #define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
653        _Configure_Object_RAM((_proxies) + 1, sizeof(Thread_Proxy_control) )
654
655      #ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
656        #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
657      #endif
658
659      #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
660        #include <mpci.h>
661        #define CONFIGURE_MP_MPCI_TABLE_POINTER         &MPCI_table
662      #endif
663
664      #ifdef CONFIGURE_INIT
665        rtems_multiprocessing_table Multiprocessing_configuration = {
666          CONFIGURE_MP_NODE_NUMBER,               /* local node number */
667          CONFIGURE_MP_MAXIMUM_NODES,             /* maximum # nodes */
668          CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS,    /* maximum # global objects */
669          CONFIGURE_MP_MAXIMUM_PROXIES,           /* maximum # proxies */
670          CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, /* MPCI stack > minimum */
671          CONFIGURE_MP_MPCI_TABLE_POINTER         /* ptr to MPCI config table */
672        };
673      #endif
674
675      #define CONFIGURE_MULTIPROCESSING_TABLE    &Multiprocessing_configuration
676
677    #endif /* CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE */
678
679  #else
680
681    #define CONFIGURE_MULTIPROCESSING_TABLE    NULL
682
683  #endif /* CONFIGURE_MP_APPLICATION */
684#endif /* RTEMS_MULTIPROCESSING */
685
686/*
687 *  Default Configuration Table.
688 */
689
690#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
691
692  #ifndef CONFIGURE_EXECUTIVE_RAM_WORK_AREA
693    #define CONFIGURE_EXECUTIVE_RAM_WORK_AREA     NULL
694  #endif
695
696  #ifndef CONFIGURE_MAXIMUM_TASKS
697    #define CONFIGURE_MAXIMUM_TASKS               0
698  #endif
699
700  #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
701    #define CONFIGURE_NOTEPADS_ENABLED           TRUE
702  #else
703    #define CONFIGURE_NOTEPADS_ENABLED           FALSE
704  #endif
705
706  #ifndef CONFIGURE_DISABLE_CLASSIC_NOTEPADS
707    #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
708      sizeof(RTEMS_API_Control)
709  #else
710    #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
711      (sizeof(RTEMS_API_Control) - (RTEMS_NUMBER_NOTEPADS * sizeof(uint32_t)))
712  #endif
713
714  /**
715   *  This macro calculates the memory required for task variables.
716   *
717   *  @note Each task variable is individually allocated from the Workspace.
718   *        Hence, we do the multiplication on the configured size.
719   */
720  #ifndef CONFIGURE_MAXIMUM_TASK_VARIABLES
721    #define CONFIGURE_MAXIMUM_TASK_VARIABLES                     0
722    #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) 0
723  #else
724    #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) \
725      (_task_variables) * \
726         _Configure_From_workspace(sizeof(rtems_task_variable_t))
727  #endif
728
729  #ifndef CONFIGURE_MAXIMUM_TIMERS
730    #define CONFIGURE_MAXIMUM_TIMERS             0
731    #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0
732  #else
733    #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
734      _Configure_Object_RAM(_timers, sizeof(Timer_Control) )
735  #endif
736
737  #ifndef CONFIGURE_MAXIMUM_SEMAPHORES
738    #define CONFIGURE_MAXIMUM_SEMAPHORES                 0
739  #else
740  #endif
741
742  /*
743   * If there are no user or support semaphores defined, then we can assume
744   * that no memory need be allocated at all for semaphores.
745   */
746  #if  ((CONFIGURE_MAXIMUM_SEMAPHORES == 0) && \
747        (CONFIGURE_LIBIO_SEMAPHORES == 0) && \
748        (CONFIGURE_TERMIOS_SEMAPHORES == 0))
749    #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0
750  #else
751    #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
752      _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) )
753  #endif
754
755  #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
756    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES             0
757    #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0
758  #else
759    #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
760      _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) )
761  #endif
762
763  #ifndef CONFIGURE_MAXIMUM_PARTITIONS
764    #define CONFIGURE_MAXIMUM_PARTITIONS                 0
765    #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0
766  #else
767    #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
768      _Configure_Object_RAM(_partitions, sizeof(Partition_Control) )
769  #endif
770
771  #ifndef CONFIGURE_MAXIMUM_REGIONS
772    #define CONFIGURE_MAXIMUM_REGIONS              0
773    #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0
774  #else
775    #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
776      _Configure_Object_RAM(_regions, sizeof(Region_Control) )
777  #endif
778
779  #ifndef CONFIGURE_MAXIMUM_PORTS
780    #define CONFIGURE_MAXIMUM_PORTS            0
781    #define CONFIGURE_MEMORY_FOR_PORTS(_ports) 0
782  #else
783    #define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
784      _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) )
785  #endif
786
787  #ifndef CONFIGURE_MAXIMUM_PERIODS
788    #define CONFIGURE_MAXIMUM_PERIODS              0
789    #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0
790  #else
791    #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
792      _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) )
793  #endif
794
795  #ifndef CONFIGURE_MAXIMUM_BARRIERS
796    #define CONFIGURE_MAXIMUM_BARRIERS               0
797    #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0
798  #else
799    #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \
800      _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) )
801  #endif
802
803  #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
804    #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
805    #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0
806  #else
807    #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
808      _Configure_Object_RAM(_extensions, sizeof(Extension_Control) )
809  #endif
810
811  #ifndef CONFIGURE_MICROSECONDS_PER_TICK
812    #define CONFIGURE_MICROSECONDS_PER_TICK \
813            RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
814  #endif
815
816  #ifndef CONFIGURE_TICKS_PER_TIMESLICE
817    #define CONFIGURE_TICKS_PER_TIMESLICE        50
818  #endif
819
820  #ifndef CONFIGURE_DISABLE_CLASSIC_NOTEPADS
821    #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
822      sizeof(RTEMS_API_Control)
823  #else
824    #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
825      (sizeof(RTEMS_API_Control) - (RTEMS_NUMBER_NOTEPADS * sizeof(uint32_t)))
826  #endif
827
828/*
829 *  Initial Extension Set
830 */
831
832#ifdef CONFIGURE_INIT
833#ifdef STACK_CHECKER_ON
834#include <rtems/stackchk.h>
835#endif
836#include <rtems/libcsupport.h>
837
838#if defined(CONFIGURE_INITIAL_EXTENSIONS) || \
839    defined(STACK_CHECKER_ON) || \
840    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
841  rtems_extensions_table Configuration_Initial_Extensions[] = {
842    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
843      RTEMS_NEWLIB_EXTENSION,
844    #endif
845    #if defined(STACK_CHECKER_ON)
846      RTEMS_STACK_CHECKER_EXTENSION,
847    #endif
848    #if defined(CONFIGURE_INITIAL_EXTENSIONS)
849      CONFIGURE_INITIAL_EXTENSIONS,
850    #endif
851  };
852
853  #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
854  #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
855    ((sizeof(Configuration_Initial_Extensions) / \
856      sizeof(rtems_extensions_table)))
857#else
858  #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
859  #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
860#endif
861
862
863#endif
864
865/*
866 *  POSIX API Configuration Parameters
867 */
868
869#ifdef RTEMS_POSIX_API
870
871  #include <sys/types.h>
872  #include <signal.h>
873  #include <limits.h>
874  #include <mqueue.h>
875  #include <rtems/posix/barrier.h>
876  #include <rtems/posix/cond.h>
877  #include <rtems/posix/mqueue.h>
878  #include <rtems/posix/mutex.h>
879  #include <rtems/posix/key.h>
880  #include <rtems/posix/psignal.h>
881  #include <rtems/posix/rwlock.h>
882  #include <rtems/posix/semaphore.h>
883  #include <rtems/posix/spinlock.h>
884  #include <rtems/posix/threadsup.h>
885  #include <rtems/posix/timer.h>
886
887  /**
888   *  Account for the object control structures plus the name
889   *  of the object to be duplicated.
890   */
891  #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
892    _Configure_Object_RAM( (_number), _size ) + \
893    ((_number) + _Configure_From_workspace(NAME_MAX) )
894
895  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
896    #define CONFIGURE_MAXIMUM_POSIX_THREADS      0
897  #endif
898
899  #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \
900    ( \
901      sizeof (POSIX_API_Control) + \
902     (sizeof (void *) * (CONFIGURE_MAXIMUM_POSIX_KEYS)) \
903    )
904
905  #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
906    #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              0
907    #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) 0
908  #else
909    #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
910      _Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
911  #endif
912
913  #ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
914    #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES               0
915    #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) 0
916  #else
917    #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) \
918        _Configure_Object_RAM(_condvars, \
919                            sizeof(POSIX_Condition_variables_Control) )
920  #endif
921
922  #ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
923    #define CONFIGURE_MAXIMUM_POSIX_KEYS           0
924    #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys) 0
925  #else
926    #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys) \
927      _Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) )
928  #endif
929
930  #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
931    #define CONFIGURE_MAXIMUM_POSIX_TIMERS             0
932    #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) 0
933  #else
934    #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
935      _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
936  #endif
937
938  #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
939    #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS                     0
940    #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) 0
941  #else
942    #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
943      _Configure_From_workspace( \
944        (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
945  #endif
946
947  #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
948    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
949    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) 0
950  #else
951    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
952      _Configure_POSIX_Named_Object_RAM( \
953         _message_queues, sizeof(POSIX_Message_queue_Control) )
954  #endif
955
956  #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
957    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES                 0
958    #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) 0
959  #else
960    #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
961      _Configure_POSIX_Named_Object_RAM( \
962         _semaphores, sizeof(POSIX_Semaphore_Control) )
963  #endif
964
965  #ifndef CONFIGURE_MAXIMUM_POSIX_BARRIERS
966    #define CONFIGURE_MAXIMUM_POSIX_BARRIERS               0
967    #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) 0
968  #else
969    #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \
970      _Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) )
971  #endif
972
973  #ifndef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
974    #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS                0
975    #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) 0
976  #else
977    #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \
978      _Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) )
979  #endif
980
981  #ifndef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
982    #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS              0
983    #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) 0
984  #else
985    #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) \
986      _Configure_Object_RAM(_rwlocks, sizeof(POSIX_RWLock_Control) )
987  #endif
988
989  #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
990
991    #ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
992
993      /*
994       *  The user is defining their own table information and setting the
995       *  appropriate variables for the POSIX Initialization Thread Table.
996       */
997
998    #else
999
1000      #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
1001        #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
1002      #endif
1003
1004      #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
1005        #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
1006                (CONFIGURE_MINIMUM_TASK_STACK_SIZE * 2)
1007      #endif
1008
1009      #ifdef CONFIGURE_INIT
1010        posix_initialization_threads_table POSIX_Initialization_threads[] = {
1011          { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT, \
1012              CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
1013        };
1014      #endif
1015
1016      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
1017              POSIX_Initialization_threads
1018
1019      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
1020        sizeof(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME) / \
1021            sizeof(posix_initialization_threads_table)
1022
1023    #endif    /* CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
1024
1025  #else     /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
1026
1027    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
1028    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
1029
1030  #endif
1031
1032  #define CONFIGURE_MEMORY_FOR_POSIX \
1033    ( \
1034      CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES ) + \
1035      CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES( \
1036          CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES ) + \
1037      CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS ) + \
1038      CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
1039          CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ) + \
1040      CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
1041          CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ) + \
1042      CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
1043          CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ) + \
1044      CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(CONFIGURE_MAXIMUM_POSIX_BARRIERS) + \
1045      CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( \
1046          CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ) + \
1047      CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( \
1048          CONFIGURE_MAXIMUM_POSIX_RWLOCKS ) + \
1049      CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ) + \
1050      (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE) \
1051     )
1052#else
1053
1054  #define CONFIGURE_MAXIMUM_POSIX_THREADS         0
1055  #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API 0
1056  #define CONFIGURE_MEMORY_FOR_POSIX              0
1057
1058#endif    /* RTEMS_POSIX_API */
1059
1060#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
1061  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE    0
1062#endif
1063
1064/*
1065 *  This block of defines are for applications which use GNAT/RTEMS.
1066 *  GNAT implements each Ada task as a POSIX thread.
1067 */
1068#ifdef CONFIGURE_GNAT_RTEMS
1069
1070  /**
1071   *  The GNAT run-time needs something less than (10) POSIX mutexes.
1072   *  We may be able to get by with less but why bother.
1073   */
1074  #define CONFIGURE_GNAT_MUTEXES 10
1075
1076  /**
1077   *  This is the maximum number of Ada tasks which can be concurrently
1078   *  in existence.  Twenty (20) are required to run all tests in the
1079   *  ACATS (formerly ACVC).
1080   */
1081  #ifndef CONFIGURE_MAXIMUM_ADA_TASKS
1082    #define CONFIGURE_MAXIMUM_ADA_TASKS  20
1083  #endif
1084
1085  /**
1086   * This is the number of non-Ada tasks which invoked Ada code.
1087   */
1088  #ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
1089    #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
1090  #endif
1091
1092  /**
1093   * Ada tasks are allocated twice the minimum stack space.
1094   */
1095  #define CONFIGURE_ADA_TASKS_STACK \
1096    (CONFIGURE_MAXIMUM_ADA_TASKS * \
1097      (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (6 * 1024)))
1098
1099#else
1100  #define CONFIGURE_GNAT_MUTEXES           0
1101  #define CONFIGURE_MAXIMUM_ADA_TASKS      0
1102  #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
1103  #define CONFIGURE_ADA_TASKS_STACK        0
1104#endif
1105
1106/*
1107 *  ITRON API Configuration Parameters
1108 */
1109
1110#ifdef RTEMS_ITRON_API
1111
1112  #include <rtems/itron.h>
1113  #include <rtems/itron/config.h>
1114  #include <rtems/itron/eventflags.h>
1115  #include <rtems/itron/fmempool.h>
1116  #include <rtems/itron/mbox.h>
1117  #include <rtems/itron/msgbuffer.h>
1118  #include <rtems/itron/port.h>
1119  #include <rtems/itron/semaphore.h>
1120  #include <rtems/itron/task.h>
1121  #include <rtems/itron/vmempool.h>
1122
1123  #ifndef CONFIGURE_MAXIMUM_ITRON_TASKS
1124    #define CONFIGURE_MAXIMUM_ITRON_TASKS      0
1125  #endif
1126  #define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API 0
1127
1128  #ifndef CONFIGURE_MAXIMUM_ITRON_SEMAPHORES
1129    #define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES                 0
1130    #define CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES(_semaphores) 0
1131  #else
1132    #define CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES(_semaphores) \
1133      _Configure_Object_RAM(_semaphores, sizeof(ITRON_Semaphore_Control))
1134  #endif
1135
1136  #ifndef CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS
1137    #define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS                 0
1138    #define CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS(_eventflags) 0
1139  #else
1140    #define CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS(_eventflags) \
1141      _Configure_Object_RAM(_eventflags, sizeof(ITRON_Eventflags_Control))
1142  #endif
1143
1144  #ifndef CONFIGURE_MAXIMUM_ITRON_MAILBOXES
1145    #define CONFIGURE_MAXIMUM_ITRON_MAILBOXES                0
1146    #define CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES(_mailboxes) 0
1147  #else
1148    #define CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES(_mailboxes) \
1149      _Configure_Object_RAM(_mailboxes, sizeof(ITRON_Mailbox_Control))
1150  #endif
1151
1152  #ifndef CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS
1153    #define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS                      0
1154    #define CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS(_message_buffers) 0
1155  #else
1156    #define CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS(_message_buffers) \
1157      _Configure_Object_RAM(_message_buffers, \
1158        sizeof(ITRON_Message_buffer_Control))
1159  #endif
1160
1161  #ifndef CONFIGURE_MAXIMUM_ITRON_PORTS
1162    #define CONFIGURE_MAXIMUM_ITRON_PORTS            0
1163    #define CONFIGURE_MEMORY_FOR_ITRON_PORTS(_ports) 0
1164  #else
1165    #define CONFIGURE_MEMORY_FOR_ITRON_PORTS(_ports) \
1166      _Configure_Object_RAM(_ports, sizeof(ITRON_Port_Control))
1167  #endif
1168
1169  #ifndef CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS
1170    #define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS            0
1171    #define CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS(_pools) 0
1172  #else
1173    #define CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS(_pools) \
1174      _Configure_Object_RAM( _pools, sizeof(ITRON_Variable_memory_pool_Control))
1175  #endif
1176
1177  #ifndef CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS
1178    #define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS            0
1179    #define CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS(_pools) 0
1180  #else
1181    #define CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS(_pools) \
1182      _Configure_Object_RAM(_pools, sizeof(ITRON_Fixed_memory_pool_Control))
1183  #endif
1184
1185  #ifdef CONFIGURE_ITRON_INIT_TASK_TABLE
1186
1187    #ifdef CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE
1188
1189      /*
1190       *  The user is defining their own table information and setting the
1191       *  appropriate variables for the ITRON Initialization Task Table.
1192       */
1193
1194    #else
1195
1196      #ifndef CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT
1197        #define CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT   ITRON_Init
1198      #endif
1199
1200      #ifndef CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES
1201        #define CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES    TA_HLNG
1202      #endif
1203
1204      #ifndef CONFIGURE_ITRON_INIT_TASK_PRIORITY
1205        #define CONFIGURE_ITRON_INIT_TASK_PRIORITY      1
1206      #endif
1207
1208      #ifndef CONFIGURE_ITRON_INIT_TASK_STACK_SIZE
1209        #define CONFIGURE_ITRON_INIT_TASK_STACK_SIZE \
1210                CONFIGURE_MINIMUM_TASK_STACK_SIZE
1211      #endif
1212
1213      #ifdef CONFIGURE_INIT
1214        itron_initialization_tasks_table ITRON_Initialization_tasks[] = {
1215          { 1,                                    /* ID */
1216            { (VP) 0,                                /* exinfo */
1217              CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES,  /* task attributes */
1218              CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT, /* task start address */
1219              CONFIGURE_ITRON_INIT_TASK_PRIORITY,    /* initial task priority */
1220              CONFIGURE_ITRON_INIT_TASK_STACK_SIZE   /* stack size */
1221            }
1222          }
1223        };
1224      #endif
1225
1226      #define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME ITRON_Initialization_tasks
1227
1228      #define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE \
1229        sizeof(CONFIGURE_ITRON_INIT_TASK_TABLE_NAME) / \
1230            sizeof(itron_initialization_tasks_table)
1231
1232    #endif    /* CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE */
1233
1234  #else     /* CONFIGURE_ITRON_INIT_TASK_TABLE */
1235
1236    #define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME NULL
1237    #define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE 0
1238    #define CONFIGURE_ITRON_INIT_TASK_STACK_SIZE 0
1239
1240  #endif
1241
1242  #define CONFIGURE_MEMORY_FOR_ITRON \
1243    ( \
1244      CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES( \
1245          CONFIGURE_MAXIMUM_ITRON_SEMAPHORES ) + \
1246      CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS( \
1247          CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS ) + \
1248      CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES( \
1249          CONFIGURE_MAXIMUM_ITRON_MAILBOXES ) + \
1250      CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS( \
1251          CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS ) + \
1252      CONFIGURE_MEMORY_FOR_ITRON_PORTS( \
1253          CONFIGURE_MAXIMUM_ITRON_PORTS ) + \
1254      CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS( \
1255          CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS ) + \
1256      CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS( \
1257          CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS ) + \
1258      CONFIGURE_ITRON_INIT_TASK_STACK_SIZE \
1259     )
1260
1261#else
1262
1263  #define CONFIGURE_MAXIMUM_ITRON_TASKS               0
1264  #define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES          0
1265  #define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS          0
1266  #define CONFIGURE_MAXIMUM_ITRON_MAILBOXES           0
1267  #define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS     0
1268  #define CONFIGURE_MAXIMUM_ITRON_PORTS               0
1269  #define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS        0
1270  #define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS  0
1271  #define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API     0
1272  #define CONFIGURE_MEMORY_FOR_ITRON                  0
1273
1274#endif    /* RTEMS_ITRON_API */
1275
1276#if defined(RTEMS_NEWLIB)
1277  #include <reent.h>
1278
1279  #define CONFIGURE_MEMORY_PER_TASK_FOR_LIBC_REENTRANCY sizeof(struct _reent)
1280#else
1281  #define CONFIGURE_MEMORY_PER_TASK_FOR_LIBC_REENTRANCY 0
1282#endif
1283
1284/*
1285 *  Calculate the RAM size based on the maximum number of objects configured.
1286 */
1287
1288#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
1289
1290/**
1291 *  Account for allocating the following per object
1292 *    + array of object control structures
1293 *    + local pointer table -- pointer per object plus a zero'th
1294 *      entry in the local pointer table.
1295 */
1296
1297#define CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \
1298 ( \
1299  _Configure_Object_RAM(_tasks, sizeof(Thread_Control)) + \
1300  ((_tasks) * \
1301   (_Configure_From_workspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \
1302    _Configure_From_workspace(CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API) + \
1303    _Configure_From_workspace(CONFIGURE_MEMORY_PER_TASK_FOR_LIBC_REENTRANCY) + \
1304    _Configure_From_workspace(CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API) + \
1305    _Configure_From_workspace(CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API)))  + \
1306  _Configure_From_workspace((_number_FP_tasks) * CONTEXT_FP_SIZE) \
1307 )
1308
1309/**
1310 *  This defines the amount of memory configured for the multiprocessing
1311 *  support required by this application.
1312 */
1313#ifdef CONFIGURE_MP_APPLICATION
1314  #define CONFIGURE_MEMORY_FOR_MP \
1315    (CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
1316     CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS( \
1317             CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) + \
1318     CONFIGURE_MEMORY_FOR_TASKS(1, 1) + \
1319     CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK \
1320  )
1321#else
1322  #define CONFIGURE_MEMORY_FOR_MP  0
1323#endif
1324
1325/**
1326 *  This is so we can account for tasks with stacks greater than minimum
1327 *  size.  This is in bytes.
1328 */
1329#ifndef CONFIGURE_EXTRA_TASK_STACKS
1330  #define CONFIGURE_EXTRA_TASK_STACKS 0
1331#endif
1332
1333/**
1334 *  The following macro is used to calculate the memory allocated by RTEMS
1335 *  for the message buffers associated with a particular message queue.
1336 *  There is a fixed amount of overhead per message.
1337 */
1338#define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
1339    _Configure_From_workspace( \
1340      (_messages) * ((_size) + sizeof(CORE_message_queue_Buffer_control)))
1341
1342/**
1343 *  This macros is set to the amount of memory required for pending message
1344 *  buffers in bytes.  It should be constructed by adding together a
1345 *  set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
1346 */
1347#ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
1348  #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
1349#endif
1350
1351/**
1352 *  This macro is available just in case the confdefs.h file underallocates
1353 *  memory for a particular application.  This lets the user add some extra
1354 *  memory in case something broken and underestimates.
1355 *
1356 *  It is also possible for cases where confdefs.h overallocates memory,
1357 *  you could substract memory from the allocated.  The estimate is just
1358 *  that, an estimate, and assumes worst case alignment and padding on
1359 *  each allocated element.  So in some cases it could be too conservative.
1360 *
1361 *  @note Historically this was used for message buffers.
1362 */
1363#ifndef CONFIGURE_MEMORY_OVERHEAD
1364  #define CONFIGURE_MEMORY_OVERHEAD 0
1365#endif
1366
1367/**
1368 *  On architectures that use Simple Vectored Interrupts, it is RTEMS
1369 *  responsibility to allocate the vector table.  This avoids reserving
1370 *  the memory on architectures that use the Programmable Interrupt
1371 *  Controller Vectored Interrupts.
1372 */
1373#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
1374  /*
1375   *  This is a (hopefully) temporary hack.  On the mips, the number of
1376   *  vectors is NOT statically defined.  But it has to be statically
1377   *  defined for this to work.  This is an issue looking for a nice
1378   *  solution.
1379   */
1380  #if defined(__mips__)
1381    #define CONFIGURE_INTERRUPT_VECTOR_TABLE (sizeof(ISR_Handler_entry) * 256)
1382  #else
1383    #define CONFIGURE_INTERRUPT_VECTOR_TABLE \
1384      (sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS)
1385  #endif
1386#else
1387  #define CONFIGURE_INTERRUPT_VECTOR_TABLE 0
1388#endif
1389
1390/**
1391 *  RTEMS uses one instance of an internal mutex class.  This accounts
1392 *  for that mutex
1393 */
1394#define CONFIGURE_API_MUTEX_MEMORY \
1395  _Configure_Object_RAM(1, sizeof(API_Mutex_Control))
1396
1397/**
1398 *  This macro accounts for general RTEMS system overhead.
1399 */
1400#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
1401  ( \
1402    CONFIGURE_MEMORY_FOR_TASKS(1, 0) +              /* IDLE and stack */ \
1403    (CONFIGURE_IDLE_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \
1404    _Configure_From_workspace(                        /* Ready chains */ \
1405        ((CONFIGURE_MAXIMUM_PRIORITY+1) * sizeof(Chain_Control)) ) + \
1406    CONFIGURE_INTERRUPT_VECTOR_TABLE +           /* interrupt vectors */ \
1407    CONFIGURE_INTERRUPT_STACK_MEMORY +             /* interrupt stack */ \
1408    CONFIGURE_API_MUTEX_MEMORY                    /* allocation mutex */ \
1409  )
1410
1411/*
1412 *  Now account for any extra memory that initialization tasks or threads
1413 *  may have requested.
1414 */
1415
1416/**
1417 *  This accounts for any extra memory required by the Classic API
1418 *  Initialization Task.
1419 */
1420#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1421  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
1422      (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1423#else
1424  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
1425#endif
1426
1427/**
1428 *  This accounts for any extra memory required by the POSIX API
1429 *  Initialization Thread.
1430 */
1431#if defined(RTEMS_POSIX_API) && \
1432    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1433  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
1434    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1435#else
1436  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
1437#endif
1438
1439/**
1440 *  This accounts for any extra memory required by the ITRON API
1441 *  Initialization Task.
1442 */
1443#if defined(RTEMS_ITRON_API) && \
1444    (CONFIGURE_ITRON_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1445  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_ITRON_PART \
1446      (CONFIGURE_ITRON_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1447#else
1448  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_ITRON_PART 0
1449#endif
1450
1451/**
1452 *  This macro provides a summation of the various initialization task
1453 *  and thread stack requirements.
1454 */
1455#define CONFIGURE_INITIALIZATION_THREADS_STACKS \
1456    (CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
1457    CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART + \
1458    CONFIGURE_INITIALIZATION_THREADS_STACKS_ITRON_PART)
1459
1460/**
1461 *  This macro provides a summation of the various task and thread
1462 *  requirements.
1463 */
1464#define CONFIGURE_TOTAL_TASKS_AND_THREADS \
1465   (CONFIGURE_MAXIMUM_TASKS + \
1466    CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS + \
1467    CONFIGURE_MAXIMUM_ITRON_TASKS \
1468   )
1469
1470/**
1471 *  This macro reserves the memory required by the statically configured
1472 *  user extensions.
1473 */
1474#define CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \
1475   _Configure_From_workspace( \
1476     (CONFIGURE_NEWLIB_EXTENSION + CONFIGURE_STACK_CHECKER_EXTENSION) * \
1477      sizeof(User_extensions_Control) \
1478   )
1479
1480/**
1481 *  This macro provides a summation of the memory required by the
1482 *  Classic API as configured.
1483 */
1484#define CONFIGURE_MEMORY_FOR_CLASSIC \
1485  (CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES) + \
1486   CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS) + \
1487   CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES + \
1488     CONFIGURE_LIBIO_SEMAPHORES + CONFIGURE_TERMIOS_SEMAPHORES) + \
1489   CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
1490   CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
1491   CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \
1492   CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
1493   CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
1494   CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_MAXIMUM_BARRIERS) + \
1495   CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \
1496  )
1497
1498#if 1 && defined(CONFIGURE_INIT)
1499  /**
1500   *  This is a debug mechanism, so if you need to, the executable will
1501   *  have a structure with various partial values.  Add to this as you
1502   *  need to.  Viewing this structure in gdb combined with dumping
1503   *  the Configuration structures generated should help a lot in tracing
1504   *  down errors and analyzing where over and under allocations are.
1505   */
1506  typedef struct {
1507    uint32_t Classic;
1508    uint32_t ITRON;
1509    uint32_t POSIX;
1510    uint32_t TASKS;
1511    uint32_t INIT_TASK_STACKS;
1512    uint32_t CLASSIC_SEMAPHORES;
1513  } Configuration_Debug_t;
1514
1515  Configuration_Debug_t Configuration_Memory_Debug = {
1516    CONFIGURE_MEMORY_FOR_CLASSIC, /* MEMORY_CLASSIC */
1517    CONFIGURE_MEMORY_FOR_ITRON,   /* MEMORY_ITRON */
1518    CONFIGURE_MEMORY_FOR_POSIX,   /* MEMORY_POSIX */
1519    CONFIGURE_MEMORY_FOR_TASKS(   /* MEMORY_TASKS */
1520        CONFIGURE_TOTAL_TASKS_AND_THREADS, CONFIGURE_TOTAL_TASKS_AND_THREADS),
1521    CONFIGURE_INITIALIZATION_THREADS_STACKS, /* INIT_TASK_STACKS */
1522    CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES + \
1523      CONFIGURE_LIBIO_SEMAPHORES + CONFIGURE_TERMIOS_SEMAPHORES)
1524  };
1525#endif
1526
1527/**
1528 *  This calculates the memory required for the executive workspace.
1529 */
1530#define CONFIGURE_EXECUTIVE_RAM_SIZE \
1531(( \
1532   CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD + \
1533   CONFIGURE_MEMORY_FOR_TASKS( \
1534     CONFIGURE_TOTAL_TASKS_AND_THREADS, CONFIGURE_TOTAL_TASKS_AND_THREADS) + \
1535   CONFIGURE_MEMORY_FOR_CLASSIC + \
1536   CONFIGURE_MEMORY_FOR_POSIX + \
1537   (CONFIGURE_MAXIMUM_POSIX_THREADS * CONFIGURE_MINIMUM_TASK_STACK_SIZE ) + \
1538   CONFIGURE_MEMORY_FOR_ITRON + \
1539   CONFIGURE_INITIALIZATION_THREADS_STACKS + \
1540   CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
1541   CONFIGURE_MEMORY_FOR_MP + \
1542   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
1543   (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
1544   (CONFIGURE_EXTRA_TASK_STACKS) + (CONFIGURE_ADA_TASKS_STACK) \
1545) & ~0x7)
1546#endif
1547
1548#ifdef CONFIGURE_INIT
1549  /**
1550   *  This is the Classic API Configuration Table.
1551   */
1552  rtems_api_configuration_table Configuration_RTEMS_API = {
1553    CONFIGURE_MAXIMUM_TASKS,
1554    CONFIGURE_NOTEPADS_ENABLED,
1555    CONFIGURE_MAXIMUM_TIMERS,
1556    CONFIGURE_MAXIMUM_SEMAPHORES + CONFIGURE_LIBIO_SEMAPHORES +
1557      CONFIGURE_TERMIOS_SEMAPHORES,
1558    CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
1559    CONFIGURE_MAXIMUM_PARTITIONS,
1560    CONFIGURE_MAXIMUM_REGIONS,
1561    CONFIGURE_MAXIMUM_PORTS,
1562    CONFIGURE_MAXIMUM_PERIODS,
1563    CONFIGURE_MAXIMUM_BARRIERS,
1564    CONFIGURE_INIT_TASK_TABLE_SIZE,
1565    CONFIGURE_INIT_TASK_TABLE
1566  };
1567
1568  #ifdef RTEMS_POSIX_API
1569    /**
1570     *  This is the POSIX API Configuration Table.
1571     */
1572    posix_api_configuration_table Configuration_POSIX_API = {
1573      CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS,
1574      CONFIGURE_MAXIMUM_POSIX_MUTEXES + CONFIGURE_GNAT_MUTEXES +
1575        CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS,
1576      CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
1577        CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS,
1578      CONFIGURE_MAXIMUM_POSIX_KEYS,
1579      CONFIGURE_MAXIMUM_POSIX_TIMERS,
1580      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
1581      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
1582      CONFIGURE_MAXIMUM_POSIX_SEMAPHORES,
1583      CONFIGURE_MAXIMUM_POSIX_BARRIERS,
1584      CONFIGURE_MAXIMUM_POSIX_RWLOCKS,
1585      CONFIGURE_MAXIMUM_POSIX_SPINLOCKS,
1586      CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
1587      CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
1588    };
1589  #endif
1590
1591  #ifdef RTEMS_ITRON_API
1592    /**
1593     *  This is the ITRON API Configuration Table.
1594     */
1595    itron_api_configuration_table Configuration_ITRON_API = {
1596      CONFIGURE_MAXIMUM_ITRON_TASKS,
1597      CONFIGURE_MAXIMUM_ITRON_SEMAPHORES,
1598      CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS,
1599      CONFIGURE_MAXIMUM_ITRON_MAILBOXES,
1600      CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS,
1601      CONFIGURE_MAXIMUM_ITRON_PORTS,
1602      CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS,
1603      CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS,
1604      CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE,
1605      CONFIGURE_ITRON_INIT_TASK_TABLE_NAME
1606    };
1607  #endif
1608
1609  /** This variable specifies the minimum stack size for tasks in an RTEMS
1610   *  application.
1611   *
1612   *  @note This is left as a simple uint32_t so it can be externed as
1613   *        needed without requring being high enough logical to
1614   *        include the full configuration table.
1615   */
1616  uint32_t rtems_minimum_stack_size = 
1617    CONFIGURE_MINIMUM_TASK_STACK_SIZE;
1618
1619  /** This variable specifies the maximum priority value that
1620   *  a task may have.  This must be a power of 2 between 4
1621   *  and 256 and is specified in terms of Classic API
1622   *  priority values.
1623   *
1624   *  @note This is left as a simple uint8_t so it can be externed as
1625   *        needed without requring being high enough logical to
1626   *        include the full configuration table.
1627   */
1628  uint8_t rtems_maximum_priority = CONFIGURE_MAXIMUM_PRIORITY;
1629
1630  /**
1631   *  This is the primary Configuration Table for this application.
1632   */
1633  rtems_configuration_table Configuration = {
1634    CONFIGURE_EXECUTIVE_RAM_WORK_AREA,
1635    CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
1636    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
1637    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
1638    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
1639    CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
1640    CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
1641    CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
1642    CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
1643    CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
1644    CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */
1645    CONFIGURE_MAXIMUM_DRIVERS,                /* maximum device drivers */
1646    CONFIGURE_NUMBER_OF_DRIVERS,              /* static device drivers */
1647    Device_drivers,                           /* pointer to driver table */
1648    CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
1649    CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
1650    #if defined(RTEMS_MULTIPROCESSING)
1651      CONFIGURE_MULTIPROCESSING_TABLE,        /* pointer to MP config table */
1652    #endif
1653    &Configuration_RTEMS_API,                 /* pointer to RTEMS API config */
1654    #ifdef RTEMS_POSIX_API
1655      &Configuration_POSIX_API,               /* pointer to POSIX API config */
1656    #else
1657      NULL,                                   /* pointer to POSIX API config */
1658    #endif
1659    #ifdef RTEMS_ITRON_API
1660      &Configuration_ITRON_API                /* pointer to ITRON API config */
1661    #else
1662      NULL                                    /* pointer to ITRON API config */
1663    #endif
1664  };
1665#endif
1666
1667#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
1668
1669/*
1670 *  If the user has configured a set of Classic API Initialization Tasks,
1671 *  then we need to install the code that runs that loop.
1672 */
1673#ifdef CONFIGURE_INIT
1674  #ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
1675    void (_RTEMS_tasks_Initialize_user_tasks_body)(void);
1676    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) =
1677              _RTEMS_tasks_Initialize_user_tasks_body;
1678  #else
1679    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) = NULL;
1680  #endif
1681#endif
1682
1683/*
1684 *  If the user has configured a set of POSIX Initialization Threads,
1685 *  then we need to install the code that runs that loop.
1686 */
1687#ifdef RTEMS_POSIX_API
1688  #ifdef CONFIGURE_INIT
1689    #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
1690      void _POSIX_Threads_Initialize_user_threads_body(void);
1691      void (*_POSIX_Threads_Initialize_user_threads_p)(void) = 
1692                _POSIX_Threads_Initialize_user_threads_body;
1693    #else
1694      void (*_POSIX_Threads_Initialize_user_threads_p)(void) = NULL;
1695    #endif
1696  #endif
1697#endif
1698
1699/*
1700 *  If the user has configured a set of ITRON Initialization Tasks,
1701 *  then we need to install the code that runs that loop.
1702 */
1703#ifdef RTEMS_ITRON_API
1704  #ifdef CONFIGURE_INIT
1705    #ifdef CONFIGURE_ITRON_INIT_TASK_TABLE
1706      void _ITRON_Task_Initialize_user_tasks_body(void);
1707      void (*_ITRON_Initialize_user_tasks_p)(void) = 
1708                _ITRON_Task_Initialize_user_tasks_body;
1709    #else
1710      void (*_ITRON_Initialize_user_tasks_p)(void) = NULL;
1711    #endif
1712  #endif
1713#endif
1714
1715#ifdef __cplusplus
1716}
1717#endif
1718
1719/******************************************************************
1720 ******************************************************************
1721 ******************************************************************
1722 *         CONFIGURATION WARNINGS AND ERROR CHECKING              *
1723 ******************************************************************
1724 ******************************************************************
1725 ******************************************************************
1726 */
1727
1728/*
1729 *  Make sure a task/thread of some sort is configured.
1730 *
1731 *  When analyzing RTEMS to find the smallest possible of memory
1732 *  that must be allocated, you probably do want to configure 0
1733 *  tasks/threads so there is a smaller set of calls to _Workspace_Allocate
1734 *  to analyze.
1735 */
1736#if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
1737  #if (CONFIGURE_MAXIMUM_TASKS == 0) && \
1738      (CONFIGURE_MAXIMUM_POSIX_THREADS == 0) && \
1739      (CONFIGURE_MAXIMUM_ADA_TASKS == 0) &&  \
1740      (CONFIGURE_MAXIMUM_ITRON_TASKS == 0)
1741    #error "CONFIGURATION ERROR: No tasks or threads configured!!"
1742  #endif
1743#endif
1744
1745/*
1746 *  Make sure at least one of the initialization task/thread
1747 *  tables was defined.
1748 */
1749#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
1750    !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \
1751    !defined(CONFIGURE_ITRON_INIT_TASK_TABLE) && \
1752    !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
1753#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
1754#endif
1755
1756/*
1757 *  If the user is trying to configure a multiprocessing application and
1758 *  RTEMS was not configured and built multiprocessing, then error out.
1759 */
1760#if defined(CONFIGURE_MP_APPLICATION) && \
1761    !defined(RTEMS_MULTIPROCESSING)
1762#error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!"
1763#endif
1764
1765/*
1766 *  If an attempt was made to configure POSIX objects and
1767 *  the POSIX API was not configured into RTEMS, error out.
1768 */
1769#if !defined(RTEMS_POSIX_API)
1770  #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
1771       (CONFIGURE_MAXIMUM_POSIX_MUTEXES != 0) || \
1772       (CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES != 0) || \
1773       (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) || \
1774       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
1775       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
1776       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
1777       (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \
1778       (CONFIGURE_MAXIMUM_POSIX_BARRIERS != 0) || \
1779       (CONFIGURE_MAXIMUM_POSIX_SPINLOCKS != 0) || \
1780       (CONFIGURE_MAXIMUM_POSIX_RWLOCKS != 0) || \
1781      defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
1782  #error "CONFIGURATION ERROR: POSIX API support not configured!!"
1783  #endif
1784#endif
1785
1786/*
1787 *  If an attempt was made to configure ITRON objects and
1788 *  the ITRON API was not configured into RTEMS, error out.
1789 */
1790#if !defined(RTEMS_ITRON_API)
1791  #if ((CONFIGURE_MAXIMUM_ITRON_TASKS != 0) || \
1792       (CONFIGURE_MAXIMUM_ITRON_SEMAPHORES != 0) || \
1793       (CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS != 0) || \
1794       (CONFIGURE_MAXIMUM_ITRON_MAILBOXES != 0) || \
1795       (CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS != 0) || \
1796       (CONFIGURE_MAXIMUM_ITRON_PORTS != 0) || \
1797       (CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS != 0) || \
1798       (CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS != 0) || \
1799      defined(CONFIGURE_ITRON_INIT_TASK_TABLE))
1800  #error "CONFIGURATION ERROR: ITRON API support not configured!!"
1801  #endif
1802#endif
1803
1804/*
1805 *  You must either explicity include or exclude the clock driver.
1806 *  It is such a common newbie error to leave it out.  Maybe this
1807 *  will put an end to it.
1808 * 
1809 *  NOTE: If you are using the timer driver, it is considered
1810 *        mutually exclusive with the clock driver because the
1811 *        drivers are assumed to use the same "timer" hardware
1812 *        on many boards.
1813 */
1814#if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE)
1815  #if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
1816      !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \
1817      !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER)
1818    #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?"
1819   #endif
1820#endif
1821
1822/*
1823 *  These names have been obsoleted so make the user application stop compiling
1824 */
1825#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
1826    defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
1827    defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
1828    defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
1829    defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
1830#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
1831#endif
1832
1833/*
1834 *  Validate the configured maximum priority
1835 */
1836#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \
1837     (CONFIGURE_MAXIMUM_PRIORITY != 7) && \
1838     (CONFIGURE_MAXIMUM_PRIORITY != 15) && \
1839     (CONFIGURE_MAXIMUM_PRIORITY != 31) && \
1840     (CONFIGURE_MAXIMUM_PRIORITY != 63) && \
1841     (CONFIGURE_MAXIMUM_PRIORITY != 127) && \
1842     (CONFIGURE_MAXIMUM_PRIORITY != 255))
1843  #error "Maximum priority is not 1 less than a power of 2 between 4 and 256"
1844#endif
1845   
1846#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM)
1847  #error "Maximum priority configured higher than supported by target."
1848#endif
1849
1850#endif
1851/* end of include file */
Note: See TracBrowser for help on using the repository browser.