LCOV - code coverage report
Current view: top level - opt/rtems-4.10/sparc-rtems/leon3/lib/include/rtems - confdefs.h (source / functions) Hit Total Coverage
Test: trace.info Lines: 1 1 100.0 %
Date: 2023-02-20 11:47:17 Functions: 1 1 100.0 %

          Line data    Source code
       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-2010.
      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.h>
      46             : #include <rtems/score/apimutex.h>
      47             : 
      48             : #ifdef __cplusplus
      49             : extern "C" {
      50             : #endif
      51             : 
      52             : extern rtems_initialization_tasks_table Initialization_tasks[];
      53             : extern rtems_driver_address_table       Device_drivers[];
      54             : extern 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             : #include <rtems/libio.h>
      76             : 
      77             : #ifdef CONFIGURE_INIT
      78             : rtems_libio_init_functions_t rtems_libio_init_helper =
      79             :     #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
      80             :     NULL;
      81             :     #else
      82             :     rtems_libio_init;
      83             :     #endif
      84             : 
      85             : rtems_libio_supp_functions_t rtems_libio_supp_helper =
      86             :     #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
      87             :     NULL;
      88             :     #else
      89             :     open_dev_console;
      90             :     #endif
      91             : 
      92             : rtems_fs_init_functions_t    rtems_fs_init_helper =
      93             :     #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
      94             :     NULL;
      95             :     #else
      96             :     rtems_filesystem_initialize;
      97             :     #endif
      98             : #endif
      99             : 
     100             : 
     101             : /*
     102             :  *  If the application disables the filesystem, they will not need
     103             :  *  a mount table, so do not produce one.
     104             :  */
     105             : #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
     106             :   #define CONFIGURE_HAS_OWN_MOUNT_TABLE
     107             : #endif
     108             : 
     109             : /**
     110             :  *  This macro defines the number of POSIX file descriptors allocated
     111             :  *  and managed by libio.  These are the "integer" file descriptors that
     112             :  *  are used by calls like open(2) and read(2).
     113             :  */
     114             : #ifndef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
     115             :   #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 3
     116             : #endif
     117             : 
     118             : /**
     119             :  *  From the number of file descriptors, we can determine how many
     120             :  *  semaphores the implementation will require.
     121             :  */
     122             : #define CONFIGURE_LIBIO_SEMAPHORES \
     123             :   (CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS + 1)
     124             : 
     125             : #ifdef CONFIGURE_INIT
     126             :   /**
     127             :    *  When instantiating the configuration tables, this variable is
     128             :    *  initialized to specify the maximum number of file descriptors.
     129             :    */
     130             :   uint32_t rtems_libio_number_iops = CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS;
     131             : #endif
     132             : 
     133             : /**
     134             :  *  This macro determines if termios is disabled by this application.
     135             :  *  This only means that resources will not be reserved.  If you end
     136             :  *  up using termios, it will fail.
     137             :  */
     138             : #ifdef CONFIGURE_TERMIOS_DISABLED
     139             :   #define CONFIGURE_TERMIOS_SEMAPHORES 0
     140             : #else
     141             :   /**
     142             :    *  This macro specifies the number of serial or PTY ports that will
     143             :    *  use termios.
     144             :    */
     145             :   #ifndef CONFIGURE_NUMBER_OF_TERMIOS_PORTS
     146             :   #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1
     147             :   #endif
     148             : 
     149             :   /**
     150             :    *  This macro reserves the number of semaphores required by termios
     151             :    *  based upon the number of communication ports that will use it.
     152             :    */
     153             :   #define CONFIGURE_TERMIOS_SEMAPHORES \
     154             :     ((CONFIGURE_NUMBER_OF_TERMIOS_PORTS * 4) + 1)
     155             : #endif
     156             : 
     157             : /**
     158             :  *  This macro specifies the number of PTYs that can be concurrently
     159             :  *  active.
     160             :  */
     161             : #ifndef CONFIGURE_MAXIMUM_PTYS
     162             :   #define CONFIGURE_MAXIMUM_PTYS 0
     163             : #endif
     164             : 
     165             : /**
     166             :  *  This variable contains the maximum number of PTYs that can be
     167             :  *  concurrently active.
     168             :  */
     169             : #ifdef CONFIGURE_INIT
     170             :   int rtems_telnetd_maximum_ptys = CONFIGURE_MAXIMUM_PTYS;
     171             : #else
     172             :   extern int rtems_telnetd_maximum_ptys;
     173             : #endif
     174             : 
     175             : /*
     176             :  *  Filesystems and Mount Table Configuration.
     177             :  *
     178             :  *  Defines to control the file system:
     179             :  *
     180             :  *   CONFIGURE_APPLICATION_DISABLE_FILESYSTEM:
     181             :  *     Disable the RTEMS filesystems. You get an empty DEVFS.
     182             :  *
     183             :  *   CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM:
     184             :  *     Use the DEVFS as the root file system. Limited functions are
     185             :  *     provided when this is used.
     186             :  *
     187             :  *   CONFIGURE_FILESYSTEM_ALL:
     188             :  *     Add file filesystems to the default filesystem table.
     189             :  *
     190             :  *   List of available file systems. You can define as many as you like:
     191             :  *     CONFIGURE_FILESYSTEM_MINIIMFS - MiniIMFS, use DEVFS now
     192             :  *     CONFIGURE_FILESYSTEM_IMFS     - In Memory File System (IMFS)
     193             :  *     CONFIGURE_FILESYSTEM_DEVFS    - Device File System (DSVFS)
     194             :  *     CONFIGURE_FILESYSTEM_TFTPFS   - TFTP File System, networking enabled
     195             :  *     CONFIGURE_FILESYSTEM_FTPFS    - FTP File System, networking enabled
     196             :  *     CONFIGURE_FILESYSTEM_NFS      - Network File System, networking enabled
     197             :  *     CONFIGURE_FILESYSTEM_DOSFS    - DOS File System, uses libblock
     198             :  *     CONFIGURE_FILESYSTEM_RFS      - RTEMS File System (RFS), uses libblock
     199             :  *
     200             :  *   Combinations:
     201             :  *
     202             :  *    - If nothing is defined the base file system is the IMFS.
     203             :  *
     204             :  *    - If CONFIGURE_APPLICATION_DISABLE_FILESYSTEM is defined all filesystem
     205             :  *      are disabled by force and an empty DEVFS is created.
     206             :  *
     207             :  *    - If CONFIGURE_USE_DEV_AS_BASE_FILESYSTEM is defined all filesystem
     208             :  *      are disabled by force and DEVFS is defined.
     209             :  */
     210             : 
     211             : #ifdef CONFIGURE_INIT
     212             : 
     213             :   /*
     214             :    * Include all file systems. Do this before checking if the filesystem has
     215             :    * been disabled.
     216             :    */
     217             :   #ifdef CONFIGURE_FILESYSTEM_ALL
     218             :     #define CONFIGURE_FILESYSTEM_MINIIMFS
     219             :     #define CONFIGURE_FILESYSTEM_IMFS
     220             :     #define CONFIGURE_FILESYSTEM_DEVFS
     221             :     #define CONFIGURE_FILESYSTEM_TFTPFS
     222             :     #define CONFIGURE_FILESYSTEM_FTPFS
     223             :     #define CONFIGURE_FILESYSTEM_NFS
     224             :     #define CONFIGURE_FILESYSTEM_DOSFS
     225             :     #define CONFIGURE_FILESYSTEM_RFS
     226             :   #endif
     227             : 
     228             :   /*
     229             :    * If disabling the file system undef everything. If DEVFS as the base
     230             :    * filesystem undefine all other filesystems because you cannot mount other
     231             :    * filesystems. Same for miniIMFS.
     232             :    */
     233             :   #if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) || \
     234             :       defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) || \
     235             :       defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
     236             :     #if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
     237             :       #undef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
     238             :       #undef CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
     239             :     #elif defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
     240             :       #undef CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
     241             :     #endif
     242             :     #undef CONFIGURE_FILESYSTEM_MINIIMFS
     243             :     #undef CONFIGURE_FILESYSTEM_IMFS
     244             :     #undef CONFIGURE_FILESYSTEM_DEVFS
     245             :     #undef CONFIGURE_FILESYSTEM_TFTPFS
     246             :     #undef CONFIGURE_FILESYSTEM_FTPFS
     247             :     #undef CONFIGURE_FILESYSTEM_NFS
     248             :     #undef CONFIGURE_FILESYSTEM_DOSFS
     249             :     #undef CONFIGURE_FILESYSTEM_RFS
     250             :   #endif
     251             : 
     252             :   /*
     253             :    * If the base filesystem is DEVFS define it else define IMFS.
     254             :    * We will have either DEVFS or IMFS defined after this.
     255             :    */
     256             :   #if !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
     257             :     #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
     258             :       #define CONFIGURE_FILESYSTEM_DEVFS
     259             :     #elif defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
     260             :       #define CONFIGURE_FILESYSTEM_MINIIMFS
     261             :     #elif !defined(CONFIGURE_FILESYSTEM_IMFS)
     262             :       #define CONFIGURE_FILESYSTEM_IMFS
     263             :     #endif
     264             :   #endif
     265             : 
     266             : #endif
     267             : 
     268             : /**
     269             :  * IMFS
     270             :  */
     271             : #include <rtems/imfs.h>
     272             : 
     273             : /**
     274             :  *  This specifies the number of bytes per block for files within the IMFS.
     275             :  *  There are a maximum number of blocks per file so this dictates the maximum
     276             :  *  size of a file.  This has to be balanced with the unused portion of each
     277             :  *  block that might be wasted.
     278             :  */
     279             : #ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK
     280             :   #define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK \
     281             :                     IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK
     282             : #endif
     283             : 
     284             : /**
     285             :  *  This defines the miniIMFS file system table entry.
     286             :  */ 
     287             : #if !defined(CONFIGURE_FILESYSTEM_ENTRY_miniIMFS) && \
     288             :     defined(CONFIGURE_FILESYSTEM_MINIIMFS)
     289             :   #define CONFIGURE_FILESYSTEM_ENTRY_miniIMFS \
     290             :     { RTEMS_FILESYSTEM_TYPE_MINIIMFS, miniIMFS_initialize }
     291             : #endif
     292             : 
     293             : /**
     294             :  *  This defines the IMFS file system table entry.
     295             :  */ 
     296             : #if !defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS) && \
     297             :     defined(CONFIGURE_FILESYSTEM_IMFS)
     298             : #define CONFIGURE_FILESYSTEM_ENTRY_IMFS { "imfs", IMFS_initialize }
     299             : #endif
     300             : 
     301             : /**
     302             :  * DEVFS
     303             :  */ 
     304             : #if !defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS) && \
     305             :     defined(CONFIGURE_FILESYSTEM_DEVFS)
     306             : #include <rtems/devfs.h>
     307             :   #define CONFIGURE_FILESYSTEM_ENTRY_DEVFS \
     308             :     { RTEMS_FILESYSTEM_TYPE_DEVFS, devFS_initialize }
     309             : #endif
     310             : 
     311             : #ifdef RTEMS_NETWORKING
     312             :   /**
     313             :    * FTPFS
     314             :    */ 
     315             :   #if !defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS) && \
     316             :       defined(CONFIGURE_FILESYSTEM_FTPFS) 
     317             :     #include <rtems/ftpfs.h>
     318             :     #define CONFIGURE_FILESYSTEM_ENTRY_FTPFS \
     319             :       { RTEMS_FILESYSTEM_TYPE_FTPFS, rtems_ftpfs_initialize }
     320             :   #endif
     321             : 
     322             :   /**
     323             :    * TFTPFS
     324             :    */ 
     325             :   #if !defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS) && \
     326             :       defined(CONFIGURE_FILESYSTEM_TFTPFS)
     327             :     #include <rtems/tftp.h>
     328             :     #define CONFIGURE_FILESYSTEM_ENTRY_TFTPFS \
     329             :       { RTEMS_FILESYSTEM_TYPE_TFTPFS, rtems_tftpfs_initialize }
     330             :   #endif
     331             : 
     332             :   /**
     333             :    * NFS
     334             :    */ 
     335             :   #if !defined(CONFIGURE_FILESYSTEM_ENTRY_NFS) && \
     336             :       defined(CONFIGURE_FILESYSTEM_NFS)
     337             :     #include <librtemsNfs.h>
     338             :     #define CONFIGURE_FILESYSTEM_ENTRY_NFS \
     339             :       { RTEMS_FILESYSTEM_TYPE_NFS, rtems_nfs_initialize }
     340             :   #endif
     341             : #endif
     342             : 
     343             : /**
     344             :  * DOSFS
     345             :  */ 
     346             : #if !defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS) && \
     347             :     defined(CONFIGURE_FILESYSTEM_DOSFS)
     348             :   #include <rtems/dosfs.h>
     349             :   #define CONFIGURE_FILESYSTEM_ENTRY_DOSFS \
     350             :     { RTEMS_FILESYSTEM_TYPE_DOSFS, rtems_dosfs_initialize }
     351             : #endif
     352             : 
     353             : /**
     354             :  * RFS
     355             :  */ 
     356             : #if !defined(CONFIGURE_FILESYSTEM_ENTRY_RFS) && \
     357             :     defined(CONFIGURE_FILESYSTEM_RFS)
     358             :   #include <rtems/rtems-rfs.h>
     359             :   #define CONFIGURE_FILESYSTEM_ENTRY_RFS \
     360             :     { RTEMS_FILESYSTEM_TYPE_RFS, rtems_rfs_rtems_initialise }
     361             : #endif
     362             : 
     363             : #ifdef CONFIGURE_INIT
     364             : 
     365             :   /*
     366             :    *  DEVFS variables.
     367             :    */
     368             :   #if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
     369             :     #define CONFIGURE_MEMORY_FOR_DEVFS  0
     370             :   #elif defined(CONFIGURE_FILESYSTEM_DEVFS)
     371             :     #ifndef CONFIGURE_MAXIMUM_DEVICES
     372             :       #define CONFIGURE_MAXIMUM_DEVICES 4
     373             :     #endif
     374             :     #include <rtems/devfs.h>
     375             :     uint32_t rtems_device_table_size = CONFIGURE_MAXIMUM_DEVICES;
     376             :     #define CONFIGURE_MEMORY_FOR_DEVFS \
     377             :       _Configure_Object_RAM(CONFIGURE_MAXIMUM_DEVICES, \
     378             :          sizeof (rtems_device_name_t))
     379             :   #else
     380             :     #define CONFIGURE_MEMORY_FOR_DEVFS  0
     381             :   #endif
     382             : 
     383             :   #if defined(CONFIGURE_FILESYSTEM_IMFS) || \
     384             :       defined(CONFIGURE_FILESYSTEM_MINIIMFS)
     385             :     int imfs_rq_memfile_bytes_per_block = CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
     386             :   #endif
     387             : 
     388             :   /**
     389             :    * Table termination record.
     390             :    */
     391             :   #define CONFIGURE_FILESYSTEM_NULL { NULL, NULL }
     392             : 
     393             :   /**
     394             :    * The default file system table. Must be terminated with the NULL entry if
     395             :    * you provide your own.
     396             :    */
     397             :   #ifndef CONFIGURE_HAS_OWN_FILESYSTEM_TABLE
     398             :     const rtems_filesystem_table_t rtems_filesystem_table[] = {
     399             :       #if defined(CONFIGURE_FILESYSTEM_MINIIMFS) && \
     400             :           defined(CONFIGURE_FILESYSTEM_ENTRY_miniIMFS)
     401             :         CONFIGURE_FILESYSTEM_ENTRY_miniIMFS,
     402             :       #endif
     403             :       #if defined(CONFIGURE_FILESYSTEM_IMFS) && \
     404             :           defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS)
     405             :         CONFIGURE_FILESYSTEM_ENTRY_IMFS,
     406             :       #endif
     407             :       #if defined(CONFIGURE_FILESYSTEM_DEVFS) && \
     408             :           defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS)
     409             :         CONFIGURE_FILESYSTEM_ENTRY_DEVFS,
     410             :       #endif
     411             :       #if defined(CONFIGURE_FILESYSTEM_TFTPFS) && \
     412             :           defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS)
     413             :         CONFIGURE_FILESYSTEM_ENTRY_TFTPFS,
     414             :       #endif
     415             :       #if defined(CONFIGURE_FILESYSTEM_FTPFS) && \
     416             :           defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS)
     417             :         CONFIGURE_FILESYSTEM_ENTRY_FTPFS,
     418             :       #endif
     419             :       #if defined(CONFIGURE_FILESYSTEM_NFS) && \
     420             :           defined(CONFIGURE_FILESYSTEM_ENTRY_NFS)
     421             :         CONFIGURE_FILESYSTEM_ENTRY_NFS,
     422             :       #endif
     423             :       #if defined(CONFIGURE_FILESYSTEM_DOSFS) && \
     424             :           defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS)
     425             :         CONFIGURE_FILESYSTEM_ENTRY_DOSFS,
     426             :       #endif
     427             :       #if defined(CONFIGURE_FILESYSTEM_RFS) && \
     428             :           defined(CONFIGURE_FILESYSTEM_ENTRY_RFS)
     429             :         CONFIGURE_FILESYSTEM_ENTRY_RFS,
     430             :       #endif
     431             :       CONFIGURE_FILESYSTEM_NULL
     432             :     };
     433             :   #endif
     434             : 
     435             :   /**
     436             :    *  This disables the inclusion of pipe support in the full IMFS.
     437             :    *
     438             :    *  NOTE: When building for coverage, we need this variable all the time.
     439             :    */
     440             :   #if !defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) || \
     441             :       defined(RTEMS_COVERAGE)
     442             :     #if defined(CONFIGURE_PIPES_ENABLED)
     443             :       bool rtems_pipe_configured = true;
     444             :     #else
     445             :       bool rtems_pipe_configured = false;
     446             :     #endif
     447             :   #endif
     448             : 
     449             :   #ifndef CONFIGURE_HAS_OWN_MOUNT_TABLE
     450             :     const rtems_filesystem_mount_table_t configuration_mount_table = {
     451             :       #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
     452             :         RTEMS_FILESYSTEM_TYPE_DEVFS,
     453             :       #elif defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
     454             :         RTEMS_FILESYSTEM_TYPE_MINIIMFS,
     455             :       #else  /* using IMFS as base filesystem */
     456             :         RTEMS_FILESYSTEM_TYPE_IMFS,
     457             :       #endif
     458             :       RTEMS_FILESYSTEM_READ_WRITE,
     459             :       NULL,
     460             :       NULL
     461             :     };
     462             : 
     463             :     const rtems_filesystem_mount_table_t
     464             :         *rtems_filesystem_mount_table = &configuration_mount_table;
     465             :     const int rtems_filesystem_mount_table_size = 1;
     466             :   #endif
     467             : 
     468             : #endif
     469             : 
     470             : /*
     471             :  *  STACK_CHECER_ON was still available in 4.9 so give a warning for now.
     472             :  */
     473             : #if defined(STACK_CHECKER_ON)
     474             :   #define CONFIGURE_STACK_CHECKER_ENABLED
     475             :   #warning "STACK_CHECKER_ON deprecated -- use CONFIGURE_STACK_CHECKER_ENABLED"
     476             : #endif
     477             : 
     478             : /**
     479             :  *  This configures the stack checker user extension.
     480             :  */
     481             : #ifdef CONFIGURE_STACK_CHECKER_ENABLED
     482             :   #define CONFIGURE_STACK_CHECKER_EXTENSION 1
     483             : #else
     484             :   #define CONFIGURE_STACK_CHECKER_EXTENSION 0
     485             : #endif
     486             : 
     487             : /**
     488             :  *  @brief Maximum Priority configuration
     489             :  *
     490             :  *  This configures the maximum priority value that
     491             :  *  a task may have.
     492             :  *
     493             :  *  By reducing the number of priorities in a system,
     494             :  *  the amount of RAM required by RTEMS can be significantly
     495             :  *  reduced.  RTEMS allocates a Chain_Control structure per
     496             :  *  priority and this structure contains 3 pointers.  So
     497             :  *  the default is (256 * 12) = 3K on 32-bit architectures.
     498             :  *
     499             :  *  This must be one less than a power of 2 between
     500             :  *  4 and 256.  Valid values along with the application
     501             :  *  priority levels and memory saved when pointers are
     502             :  *  32-bits in size are:
     503             :  *
     504             :  *    + 3,  2 application priorities, 3024 bytes saved
     505             :  *    + 7, 5 application priorities, 2976 bytes saved
     506             :  *    + 15, 13 application priorities, 2880 bytes saved
     507             :  *    + 31, 29 application priorities, 2688 bytes saved
     508             :  *    + 63, 61 application priorities, 2304 bytes saved
     509             :  *    + 127, 125 application priorities, 1536 bytes saved
     510             :  *    + 255, 253 application priorities, 0 bytes saved
     511             :  *
     512             :  *  It is specified in terms of Classic API
     513             :  *  priority values.
     514             :  */
     515             : #ifndef CONFIGURE_MAXIMUM_PRIORITY
     516             :   #define CONFIGURE_MAXIMUM_PRIORITY PRIORITY_DEFAULT_MAXIMUM
     517             : #endif
     518             : 
     519             : /*
     520             :  *  If you said the IDLE task was going to do application initialization
     521             :  *  and didn't override the IDLE body, then something is amiss.
     522             :  */
     523             : #if (defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
     524             :      !defined(CONFIGURE_IDLE_TASK_BODY))
     525             :   #error "CONFIGURE_ERROR: You did not override the IDLE task body."
     526             : #endif
     527             : 
     528             : /**
     529             :  *  @brief Idle task body configuration
     530             :  *
     531             :  *  There is a default IDLE thread body provided by RTEMS which
     532             :  *  has the possibility of being CPU specific.  There may be a
     533             :  *  BSP specific override of the RTEMS default body and in turn,
     534             :  *  the application may override and provide its own.
     535             :  */
     536             : #ifndef CONFIGURE_IDLE_TASK_BODY
     537             :   #if defined(BSP_IDLE_TASK_BODY)
     538             :     #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
     539             :   #elif (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
     540             :     #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
     541             :   #else
     542             :     /* only instantiate and compile if used */
     543             :     #ifdef CONFIGURE_INIT
     544             :       void *_Thread_Idle_body(uintptr_t ignored)
     545             :       {
     546             :         for( ; ; ) ;
     547             :         return 0;   /* to avoid warning */
     548             :       }
     549             :     #endif
     550             :     #define CONFIGURE_IDLE_TASK_BODY _Thread_Idle_body
     551             :   #endif
     552             : #endif
     553             : 
     554             : /**
     555             :  *  By default, use the minimum stack size requested by this port.
     556             :  */
     557             : #ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE
     558             :   #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
     559             : #endif
     560             : 
     561             : /**
     562             :  *  @brief Idle task stack size configuration
     563             :  *
     564             :  *  By default, the IDLE task will have a stack of minimum size.
     565             :  *  The BSP or application may override this value.
     566             :  */
     567             : #ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
     568             :   #ifdef BSP_IDLE_TASK_STACK_SIZE
     569             :     #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
     570             :   #else
     571             :     #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
     572             :   #endif
     573             : #endif
     574             : 
     575             : /**
     576             :  *  @brief Interrupt stack size configuration
     577             :  *
     578             :  *  By default, the interrupt stack will be of minimum size.
     579             :  *  The BSP or application may override this value.
     580             :  */
     581             : #ifndef CONFIGURE_INTERRUPT_STACK_SIZE
     582             :   #ifdef BSP_INTERRUPT_STACK_SIZE
     583             :     #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
     584             :   #else
     585             :     #define CONFIGURE_INTERRUPT_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
     586             :   #endif
     587             : #endif
     588             : 
     589             : /**
     590             :  *  This reserves memory for the interrupt stack if it is to be allocated
     591             :  *  by RTEMS rather than the BSP.
     592             :  *
     593             :  *  @todo Try to get to the point where all BSPs support allocating the
     594             :  *        memory from the Workspace.
     595             :  */
     596             : #if (CPU_ALLOCATE_INTERRUPT_STACK == 0)
     597             :   #define CONFIGURE_INTERRUPT_STACK_MEMORY 0
     598             : #else
     599             :   #define CONFIGURE_INTERRUPT_STACK_MEMORY \
     600             :      _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE )
     601             : #endif
     602             : 
     603             : /**
     604             :  *  Configure the very much optional task stack allocator
     605             :  */
     606             : #ifndef CONFIGURE_TASK_STACK_ALLOCATOR
     607             :   #define CONFIGURE_TASK_STACK_ALLOCATOR NULL
     608             : #endif
     609             : 
     610             : /**
     611             :  *  Configure the very much optional task stack deallocator
     612             :  */
     613             : #ifndef CONFIGURE_TASK_STACK_DEALLOCATOR
     614             :   #define CONFIGURE_TASK_STACK_DEALLOCATOR NULL
     615             : #endif
     616             : 
     617             : /**
     618             :  *  Should the RTEMS Workspace and C Program Heap be cleared automatically
     619             :  *  at system start up?
     620             :  */
     621             : #ifndef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
     622             :   #ifdef BSP_ZERO_WORKSPACE_AUTOMATICALLY
     623             :     #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY \
     624             :             BSP_ZERO_WORKSPACE_AUTOMATICALLY
     625             :   #else
     626             :     #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY FALSE
     627             :   #endif
     628             : #endif
     629             : 
     630             : /*
     631             :  *  RTEMS Malloc configuration
     632             :  */
     633             : 
     634             : #include <rtems/malloc.h>
     635             : 
     636             : #ifdef CONFIGURE_INIT
     637             :   /**
     638             :    *  By default, RTEMS uses separate heaps for the RTEMS Workspace and
     639             :    *  the C Program Heap.  On many BSPs, these can be optionally
     640             :    *  combined provided one larger memory pool. This is particularly
     641             :    *  useful in combination with the unlimited objects configuration.
     642             :    */
     643             :   #ifdef CONFIGURE_UNIFIED_WORK_AREAS
     644             :     #include <rtems/score/wkspace.h>
     645             :     Heap_Control  *RTEMS_Malloc_Heap = &_Workspace_Area;
     646             :     bool           rtems_unified_work_area = true;
     647             :   #else
     648             :     Heap_Control   RTEMS_Malloc_Area;
     649             :     Heap_Control  *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area;
     650             :     bool           rtems_unified_work_area = false;
     651             :   #endif
     652             : #endif
     653             : 
     654             : #ifdef CONFIGURE_INIT
     655             :   /**
     656             :    *  This configures the malloc family statistics to be available.
     657             :    *  By default only function call counts are kept.
     658             :    */
     659             :   rtems_malloc_statistics_functions_t *rtems_malloc_statistics_helpers =
     660             :     #ifndef CONFIGURE_MALLOC_STATISTICS
     661             :       NULL;
     662             :     #else
     663             :       &rtems_malloc_statistics_helpers_table;
     664             :     #endif
     665             : #endif
     666             : 
     667             : #ifdef CONFIGURE_INIT
     668             :   /**
     669             :    *  This configures the sbrk() support for the malloc family.
     670             :    *  By default it is assumed that the BSP provides all available
     671             :    *  RAM to the malloc family implementation so sbrk()'ing to get
     672             :    *  more memory would always fail anyway.
     673             :    */
     674             :   rtems_malloc_sbrk_functions_t *rtems_malloc_sbrk_helpers =
     675             :     #ifndef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
     676             :       NULL;
     677             :     #else
     678             :       &rtems_malloc_sbrk_helpers_table;
     679             :     #endif
     680             : #endif
     681             : 
     682             : #ifdef CONFIGURE_INIT
     683             :   /**
     684             :    *  This configures the malloc family plugin which dirties memory
     685             :    *  allocated.  This is helpful for finding unitialized data structure
     686             :    *  problems.
     687             :    */
     688             :   rtems_malloc_dirtier_t rtems_malloc_dirty_helper =
     689             :     #if defined(CONFIGURE_MALLOC_DIRTY)
     690             :       rtems_malloc_dirty_memory;
     691             :     #else
     692             :       NULL;
     693             :     #endif
     694             : #endif
     695             : 
     696             : /**
     697             :  *  This is a helper macro used in calculations in this file.  It is used
     698             :  *  to noted when an element is allocated from the RTEMS Workspace and adds
     699             :  *  a factor to account for heap overhead plus an alignment factor that
     700             :  *  may be applied.
     701             :  */
     702             : #define _Configure_From_workspace(_size) \
     703             :   (ssize_t)((_size) + (2 * sizeof(uint32_t)) + CPU_ALIGNMENT)
     704             : 
     705             : /**
     706             :  *  Do not use the unlimited bit as part of the multiplication
     707             :  *  for memory usage.
     708             :  */
     709             : #define _Configure_Max_Objects(_max) \
     710             :   ((_max) & ~RTEMS_UNLIMITED_OBJECTS)
     711             : 
     712             : /**
     713             :  *  This macro accounts for how memory for a set of configured objects is
     714             :  *  allocated from the Executive Workspace.
     715             :  *
     716             :  *  NOTE: It does NOT attempt to address the more complex case of unlimited
     717             :  *        objects.
     718             :  */
     719             : #define _Configure_Object_RAM(_number, _size) \
     720             :   ( _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
     721             :     _Configure_From_workspace( \
     722             :       ((_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *)) + \
     723             :       (sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *)) \
     724             :     ) \
     725             :   )
     726             : 
     727             : /*
     728             :  *  Default User Initialization Task Table.  This table guarantees that
     729             :  *  one user initialization table is defined.
     730             :  */
     731             : 
     732             : #ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
     733             : 
     734             : #ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
     735             : 
     736             : /*
     737             :  *  The user is defining their own table information and setting the
     738             :  *  appropriate variables.
     739             :  */
     740             : 
     741             : #else
     742             : 
     743             : #ifndef CONFIGURE_INIT_TASK_NAME
     744             :   #define CONFIGURE_INIT_TASK_NAME          rtems_build_name('U', 'I', '1', ' ')
     745             : #endif
     746             : 
     747             : #ifndef CONFIGURE_INIT_TASK_STACK_SIZE
     748             :   #define CONFIGURE_INIT_TASK_STACK_SIZE    CONFIGURE_MINIMUM_TASK_STACK_SIZE
     749             : #endif
     750             : 
     751             : #ifndef CONFIGURE_INIT_TASK_PRIORITY
     752             :   #define CONFIGURE_INIT_TASK_PRIORITY      1
     753             : #endif
     754             : 
     755             : #ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
     756             :   #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_DEFAULT_ATTRIBUTES
     757             : #endif
     758             : 
     759             : #ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
     760             :   #ifdef __cplusplus
     761             :   extern "C" {
     762             :   #endif
     763           1 :     rtems_task Init (rtems_task_argument );
     764             :   #ifdef __cplusplus
     765             :   }
     766             :   #endif
     767             :   #define CONFIGURE_INIT_TASK_ENTRY_POINT   Init
     768             :   extern const char* bsp_boot_cmdline;
     769             :   #define CONFIGURE_INIT_TASK_ARGUMENTS     ((rtems_task_argument) &bsp_boot_cmdline)
     770             : #endif
     771             : 
     772             : #ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
     773             :   #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
     774             : #endif
     775             : 
     776             : #ifndef CONFIGURE_INIT_TASK_ARGUMENTS
     777             :   #define CONFIGURE_INIT_TASK_ARGUMENTS     0
     778             : #endif
     779             : 
     780             : #ifdef CONFIGURE_INIT
     781             :   rtems_initialization_tasks_table Initialization_tasks[] = {
     782             :     { CONFIGURE_INIT_TASK_NAME,
     783             :       CONFIGURE_INIT_TASK_STACK_SIZE,
     784             :       CONFIGURE_INIT_TASK_PRIORITY,
     785             :       CONFIGURE_INIT_TASK_ATTRIBUTES,
     786             :       CONFIGURE_INIT_TASK_ENTRY_POINT,
     787             :       CONFIGURE_INIT_TASK_INITIAL_MODES,
     788             :       CONFIGURE_INIT_TASK_ARGUMENTS
     789             :     }
     790             :   };
     791             : #endif
     792             : 
     793             : #define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
     794             : 
     795             : #define CONFIGURE_INIT_TASK_TABLE_SIZE \
     796             :   sizeof(CONFIGURE_INIT_TASK_TABLE) / sizeof(rtems_initialization_tasks_table)
     797             : 
     798             : #endif    /* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
     799             : 
     800             : #else     /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
     801             : 
     802             : #define CONFIGURE_INIT_TASK_TABLE      NULL
     803             : #define CONFIGURE_INIT_TASK_TABLE_SIZE 0
     804             : #define CONFIGURE_INIT_TASK_STACK_SIZE 0
     805             : 
     806             : #endif
     807             : 
     808             : /*
     809             :  *  Default Device Driver Table.  Each driver needed by the test is explicitly
     810             :  *  choosen by that test.  There is always a null driver entry.
     811             :  */
     812             : 
     813             : #define NULL_DRIVER_TABLE_ENTRY \
     814             :  { NULL, NULL, NULL, NULL, NULL, NULL }
     815             : 
     816             : #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
     817             :   #include <rtems/console.h>
     818             : #endif
     819             : 
     820             : #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
     821             :   #include <rtems/clockdrv.h>
     822             : #endif
     823             : 
     824             : #ifdef CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
     825             :   #include <rtems/timerdrv.h>
     826             : #endif
     827             : 
     828             : #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
     829             :   #include <rtems/rtc.h>
     830             : #endif
     831             : 
     832             : #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
     833             :   #include <rtems/watchdogdrv.h>
     834             : #endif
     835             : 
     836             : #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
     837             :   #include <rtems/framebuffer.h>
     838             : #endif
     839             : 
     840             : #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
     841             :   #include <rtems/devnull.h>
     842             : #endif
     843             : 
     844             : #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
     845             :   /* the ide driver needs the ATA driver */
     846             :   #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
     847             :     #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
     848             :   #endif
     849             :   #include <libchip/ide_ctrl.h>
     850             : #endif
     851             : 
     852             : #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
     853             :   #include <libchip/ata.h>
     854             : #endif
     855             : 
     856             : #ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
     857             : 
     858             : #ifdef CONFIGURE_INIT
     859             :   rtems_driver_address_table Device_drivers[] = {
     860             :     #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
     861             :       CONFIGURE_BSP_PREREQUISITE_DRIVERS,
     862             :     #endif
     863             :     #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
     864             :       CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
     865             :     #endif
     866             :     #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
     867             :       CONSOLE_DRIVER_TABLE_ENTRY,
     868             :     #endif
     869             :     #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
     870             :       CLOCK_DRIVER_TABLE_ENTRY,
     871             :     #endif
     872             :     #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
     873             :       RTC_DRIVER_TABLE_ENTRY,
     874             :     #endif
     875             :     #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
     876             :       WATCHDOG_DRIVER_TABLE_ENTRY,
     877             :     #endif
     878             :     #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
     879             :       DEVNULL_DRIVER_TABLE_ENTRY,
     880             :     #endif
     881             :     #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
     882             :       IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
     883             :     #endif
     884             :     #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
     885             :       ATA_DRIVER_TABLE_ENTRY,
     886             :     #endif
     887             :     #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
     888             :       FRAME_BUFFER_DRIVER_TABLE_ENTRY,
     889             :     #endif
     890             :     #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
     891             :       CONFIGURE_APPLICATION_EXTRA_DRIVERS,
     892             :     #endif
     893             :     #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
     894             :       NULL_DRIVER_TABLE_ENTRY
     895             :     #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
     896             :         !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
     897             :         !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \
     898             :         !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \
     899             :         !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \
     900             :         !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \
     901             :         !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) && \
     902             :         !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
     903             :       NULL_DRIVER_TABLE_ENTRY
     904             :     #endif
     905             :   };
     906             : #endif
     907             : 
     908             : #endif  /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
     909             : 
     910             : /*
     911             :  *  Default the number of drivers per node.  This value may be
     912             :  *  overridden by the user.
     913             :  */
     914             : 
     915             : #define CONFIGURE_NUMBER_OF_DRIVERS \
     916             :   ((sizeof(Device_drivers) / sizeof(rtems_driver_address_table)))
     917             : 
     918             : /**
     919             :  *  This specifies the maximum number of device drivers that
     920             :  *  can be installed in the system at one time.  It must account
     921             :  *  for both the statically and dynamically installed drivers.
     922             :  */
     923             : #ifndef CONFIGURE_MAXIMUM_DRIVERS
     924             :   #define CONFIGURE_MAXIMUM_DRIVERS CONFIGURE_NUMBER_OF_DRIVERS
     925             : #endif
     926             : 
     927             : 
     928             : #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
     929             :   /*
     930             :    * configure the priority of the ATA driver task
     931             :    */
     932             :   #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
     933             :     #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
     934             :   #endif
     935             :   #ifdef CONFIGURE_INIT
     936             :     rtems_task_priority rtems_ata_driver_task_priority
     937             :       = CONFIGURE_ATA_DRIVER_TASK_PRIORITY;
     938             :   #endif /* CONFIGURE_INIT */
     939             : #endif
     940             : 
     941             : /*
     942             :  * add bdbuf configuration and values for swapout task priority
     943             :  */
     944             : #ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
     945             :   #include <rtems/bdbuf.h>
     946             :   /*
     947             :    * configure the bdbuf cache parameters
     948             :    */
     949             :   #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
     950             :     #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
     951             :                               RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
     952             :   #endif
     953             :   #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
     954             :     #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
     955             :                               RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
     956             :   #endif
     957             :   #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
     958             :     #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
     959             :                               RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
     960             :   #endif
     961             :   #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
     962             :     #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
     963             :                               RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
     964             :   #endif
     965             :   #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
     966             :     #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
     967             :                               RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
     968             :   #endif
     969             :   #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
     970             :     #define CONFIGURE_SWAPOUT_WORKER_TASKS \
     971             :                               RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
     972             :   #endif
     973             :   #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
     974             :     #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
     975             :                               RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
     976             :   #endif
     977             :   #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
     978             :     #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
     979             :                               RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
     980             :   #endif
     981             :   #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
     982             :     #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
     983             :                               RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
     984             :   #endif
     985             :   #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
     986             :     #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
     987             :                               RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
     988             :   #endif
     989             :   #ifdef CONFIGURE_INIT
     990             :     const rtems_bdbuf_config rtems_bdbuf_configuration = {
     991             :       CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
     992             :       CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
     993             :       CONFIGURE_SWAPOUT_TASK_PRIORITY,
     994             :       CONFIGURE_SWAPOUT_SWAP_PERIOD,
     995             :       CONFIGURE_SWAPOUT_BLOCK_HOLD,
     996             :       CONFIGURE_SWAPOUT_WORKER_TASKS,
     997             :       CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
     998             :       CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
     999             :       CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
    1000             :       CONFIGURE_BDBUF_BUFFER_MAX_SIZE
    1001             :     };
    1002             :   #endif
    1003             : 
    1004             :   /*
    1005             :    *  Semaphores:
    1006             :    *    o disk lock
    1007             :    *    o bdbuf lock
    1008             :    *    o bdbuf sync lock
    1009             :    *    o bdbuf access condition
    1010             :    *    o bdbuf transfer condition
    1011             :    *    o bdbuf buffer condition
    1012             :    */
    1013             :   #define CONFIGURE_LIBBLOCK_SEMAPHORES 6
    1014             : 
    1015             :   #if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \
    1016             :       defined(CONFIGURE_BDBUF_BUFFER_SIZE) || \
    1017             :       defined(CONFIGURE_BDBUF_BUFFER_COUNT)
    1018             :     #error BDBUF Cache does not use a buffer configuration table. Please remove.
    1019             :   #endif
    1020             : #else
    1021             :   #define CONFIGURE_LIBBLOCK_SEMAPHORES 0
    1022             : #endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
    1023             : 
    1024             : #if defined(RTEMS_MULTIPROCESSING)
    1025             :   /*
    1026             :    *  Default Multiprocessing Configuration Table.  The defaults are
    1027             :    *  appropriate for most of the RTEMS Multiprocessor Test Suite.  Each
    1028             :    *  value may be overridden within each test to customize the environment.
    1029             :    */
    1030             : 
    1031             :   #ifdef CONFIGURE_MP_APPLICATION
    1032             :     #define CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 1
    1033             : 
    1034             :     #ifndef CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE
    1035             : 
    1036             :       #ifndef CONFIGURE_MP_NODE_NUMBER
    1037             :         #define CONFIGURE_MP_NODE_NUMBER                NODE_NUMBER
    1038             :       #endif
    1039             : 
    1040             :       #ifndef CONFIGURE_MP_MAXIMUM_NODES
    1041             :         #define CONFIGURE_MP_MAXIMUM_NODES              2
    1042             :       #endif
    1043             : 
    1044             :       #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
    1045             :         #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS     32
    1046             :       #endif
    1047             :       #define CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
    1048             :         _Configure_Object_RAM((_global_objects), sizeof(Objects_MP_Control))
    1049             : 
    1050             :       #ifndef CONFIGURE_MP_MAXIMUM_PROXIES
    1051             :         #define CONFIGURE_MP_MAXIMUM_PROXIES            32
    1052             :       #endif
    1053             :       #define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
    1054             :         _Configure_Object_RAM((_proxies) + 1, sizeof(Thread_Proxy_control) )
    1055             : 
    1056             :       #ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
    1057             :         #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
    1058             :       #endif
    1059             : 
    1060             :       #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
    1061             :         #include <mpci.h>
    1062             :         #define CONFIGURE_MP_MPCI_TABLE_POINTER         &MPCI_table
    1063             :       #endif
    1064             : 
    1065             :       #ifdef CONFIGURE_INIT
    1066             :         rtems_multiprocessing_table Multiprocessing_configuration = {
    1067             :           CONFIGURE_MP_NODE_NUMBER,               /* local node number */
    1068             :           CONFIGURE_MP_MAXIMUM_NODES,             /* maximum # nodes */
    1069             :           CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS,    /* maximum # global objects */
    1070             :           CONFIGURE_MP_MAXIMUM_PROXIES,           /* maximum # proxies */
    1071             :           CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, /* MPCI stack > minimum */
    1072             :           CONFIGURE_MP_MPCI_TABLE_POINTER         /* ptr to MPCI config table */
    1073             :         };
    1074             :       #endif
    1075             : 
    1076             :       #define CONFIGURE_MULTIPROCESSING_TABLE    &Multiprocessing_configuration
    1077             : 
    1078             :     #endif /* CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE */
    1079             : 
    1080             :   #else
    1081             : 
    1082             :     #define CONFIGURE_MULTIPROCESSING_TABLE    NULL
    1083             : 
    1084             :   #endif /* CONFIGURE_MP_APPLICATION */
    1085             : #endif /* RTEMS_MULTIPROCESSING */
    1086             : 
    1087             : #ifndef CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER
    1088             :   #define CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 0
    1089             : #endif
    1090             : 
    1091             : 
    1092             : /*
    1093             :  *  Default Configuration Table.
    1094             :  */
    1095             : 
    1096             : #ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
    1097             : 
    1098             :   #ifndef CONFIGURE_MAXIMUM_TASKS
    1099             :     #define CONFIGURE_MAXIMUM_TASKS               0
    1100             :   #endif
    1101             : 
    1102             :   #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
    1103             :     #define CONFIGURE_NOTEPADS_ENABLED           TRUE
    1104             :   #else
    1105             :     #define CONFIGURE_NOTEPADS_ENABLED           FALSE
    1106             :   #endif
    1107             : 
    1108             :   #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
    1109             :     #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
    1110             :       _Configure_From_workspace( sizeof(RTEMS_API_Control) )
    1111             :   #else
    1112             :     #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
    1113             :       _Configure_From_workspace( sizeof(RTEMS_API_Control) - \
    1114             :         (RTEMS_NUMBER_NOTEPADS * sizeof(uint32_t)))
    1115             :   #endif
    1116             : 
    1117             :   /**
    1118             :    *  This macro calculates the memory required for task variables.
    1119             :    *
    1120             :    *  @note Each task variable is individually allocated from the Workspace.
    1121             :    *        Hence, we do the multiplication on the configured size.
    1122             :    */
    1123             :   #ifndef CONFIGURE_MAXIMUM_TASK_VARIABLES
    1124             :     #define CONFIGURE_MAXIMUM_TASK_VARIABLES                     0
    1125             :     #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) 0
    1126             :   #else
    1127             :     #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) \
    1128             :       (_task_variables) * \
    1129             :          _Configure_From_workspace(sizeof(rtems_task_variable_t))
    1130             :   #endif
    1131             : 
    1132             :   #ifndef CONFIGURE_MAXIMUM_TIMERS
    1133             :     #define CONFIGURE_MAXIMUM_TIMERS             0
    1134             :     #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0
    1135             :   #else
    1136             :     #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
    1137             :       _Configure_Object_RAM(_timers, sizeof(Timer_Control) )
    1138             :   #endif
    1139             : 
    1140             :   #ifndef CONFIGURE_MAXIMUM_SEMAPHORES
    1141             :     #define CONFIGURE_MAXIMUM_SEMAPHORES                 0
    1142             :   #endif
    1143             : 
    1144             :   #define CONFIGURE_SEMAPHORES \
    1145             :     (CONFIGURE_MAXIMUM_SEMAPHORES + CONFIGURE_LIBIO_SEMAPHORES + \
    1146             :       CONFIGURE_TERMIOS_SEMAPHORES + CONFIGURE_LIBBLOCK_SEMAPHORES)
    1147             : 
    1148             :   /*
    1149             :    * If there are no user or support semaphores defined, then we can assume
    1150             :    * that no memory need be allocated at all for semaphores.
    1151             :    */
    1152             :   #if CONFIGURE_SEMAPHORES == 0
    1153             :     #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0
    1154             :   #else
    1155             :     #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
    1156             :       _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) )
    1157             :   #endif
    1158             : 
    1159             :   #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
    1160             :     #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES             0
    1161             :     #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0
    1162             :   #else
    1163             :     #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
    1164             :       _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) )
    1165             :   #endif
    1166             : 
    1167             :   #ifndef CONFIGURE_MAXIMUM_PARTITIONS
    1168             :     #define CONFIGURE_MAXIMUM_PARTITIONS                 0
    1169             :     #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0
    1170             :   #else
    1171             :     #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
    1172             :       _Configure_Object_RAM(_partitions, sizeof(Partition_Control) )
    1173             :   #endif
    1174             : 
    1175             :   #ifndef CONFIGURE_MAXIMUM_REGIONS
    1176             :     #define CONFIGURE_MAXIMUM_REGIONS              0
    1177             :     #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0
    1178             :   #else
    1179             :     #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
    1180             :       _Configure_Object_RAM(_regions, sizeof(Region_Control) )
    1181             :   #endif
    1182             : 
    1183             :   #ifndef CONFIGURE_MAXIMUM_PORTS
    1184             :     #define CONFIGURE_MAXIMUM_PORTS            0
    1185             :     #define CONFIGURE_MEMORY_FOR_PORTS(_ports) 0
    1186             :   #else
    1187             :     #define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
    1188             :       _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) )
    1189             :   #endif
    1190             : 
    1191             :   #ifndef CONFIGURE_MAXIMUM_PERIODS
    1192             :     #define CONFIGURE_MAXIMUM_PERIODS              0
    1193             :     #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0
    1194             :   #else
    1195             :     #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
    1196             :       _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) )
    1197             :   #endif
    1198             : 
    1199             :   #ifndef CONFIGURE_MAXIMUM_BARRIERS
    1200             :     #define CONFIGURE_MAXIMUM_BARRIERS               0
    1201             :     #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0
    1202             :   #else
    1203             :     #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \
    1204             :       _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) )
    1205             :   #endif
    1206             : 
    1207             :   #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
    1208             :     #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
    1209             :     #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0
    1210             :   #else
    1211             :     #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
    1212             :       _Configure_Object_RAM(_extensions, sizeof(Extension_Control) )
    1213             :   #endif
    1214             : 
    1215             :   #ifndef CONFIGURE_MICROSECONDS_PER_TICK
    1216             :     #define CONFIGURE_MICROSECONDS_PER_TICK \
    1217             :             RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
    1218             :   #endif
    1219             : 
    1220             :   #ifndef CONFIGURE_TICKS_PER_TIMESLICE
    1221             :     #define CONFIGURE_TICKS_PER_TIMESLICE        50
    1222             :   #endif
    1223             : 
    1224             : /*
    1225             :  *  Initial Extension Set
    1226             :  */
    1227             : 
    1228             : #ifdef CONFIGURE_INIT
    1229             : #ifdef CONFIGURE_STACK_CHECKER_ENABLED
    1230             : #include <rtems/stackchk.h>
    1231             : #endif
    1232             : #include <rtems/libcsupport.h>
    1233             : 
    1234             : #if defined(CONFIGURE_INITIAL_EXTENSIONS) || \
    1235             :     defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
    1236             :     (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
    1237             :   rtems_extensions_table Configuration_Initial_Extensions[] = {
    1238             :     #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
    1239             :       RTEMS_NEWLIB_EXTENSION,
    1240             :     #endif
    1241             :     #if defined(CONFIGURE_STACK_CHECKER_ENABLED)
    1242             :       RTEMS_STACK_CHECKER_EXTENSION,
    1243             :     #endif
    1244             :     #if defined(CONFIGURE_INITIAL_EXTENSIONS)
    1245             :       CONFIGURE_INITIAL_EXTENSIONS,
    1246             :     #endif
    1247             :   };
    1248             : 
    1249             :   #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
    1250             :   #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
    1251             :     ((sizeof(Configuration_Initial_Extensions) / \
    1252             :       sizeof(rtems_extensions_table)))
    1253             : #else
    1254             :   #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
    1255             :   #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
    1256             : #endif
    1257             : 
    1258             : 
    1259             : #endif
    1260             : 
    1261             : /*
    1262             :  *  POSIX API Configuration Parameters
    1263             :  */
    1264             : 
    1265             : #ifdef RTEMS_POSIX_API
    1266             : 
    1267             :   #include <sys/types.h>
    1268             :   #include <signal.h>
    1269             :   #include <limits.h>
    1270             :   #include <mqueue.h>
    1271             :   #include <rtems/posix/barrier.h>
    1272             :   #include <rtems/posix/cond.h>
    1273             :   #include <rtems/posix/mqueue.h>
    1274             :   #include <rtems/posix/mutex.h>
    1275             :   #include <rtems/posix/key.h>
    1276             :   #include <rtems/posix/psignal.h>
    1277             :   #include <rtems/posix/rwlock.h>
    1278             :   #include <rtems/posix/semaphore.h>
    1279             :   #include <rtems/posix/spinlock.h>
    1280             :   #include <rtems/posix/threadsup.h>
    1281             :   #include <rtems/posix/timer.h>
    1282             : 
    1283             :   /**
    1284             :    *  Account for the object control structures plus the name
    1285             :    *  of the object to be duplicated.
    1286             :    */
    1287             :   #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
    1288             :     _Configure_Object_RAM( (_number), _size ) + \
    1289             :     ((_number) + _Configure_From_workspace(NAME_MAX) )
    1290             : 
    1291             :   #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
    1292             :     #define CONFIGURE_MAXIMUM_POSIX_THREADS      0
    1293             :   #endif
    1294             : 
    1295             :   #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \
    1296             :     _Configure_From_workspace( \
    1297             :       CONFIGURE_MINIMUM_TASK_STACK_SIZE + \
    1298             :       sizeof (POSIX_API_Control) + \
    1299             :      (sizeof (void *) * (CONFIGURE_MAXIMUM_POSIX_KEYS)) \
    1300             :     )
    1301             : 
    1302             :   #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
    1303             :     #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              0
    1304             :     #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) 0
    1305             :   #else
    1306             :     #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
    1307             :       _Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
    1308             :   #endif
    1309             : 
    1310             :   #ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
    1311             :     #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES               0
    1312             :     #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) 0
    1313             :   #else
    1314             :     #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) \
    1315             :         _Configure_Object_RAM(_condvars, \
    1316             :                             sizeof(POSIX_Condition_variables_Control) )
    1317             :   #endif
    1318             : 
    1319             :   #ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
    1320             :     #define CONFIGURE_MAXIMUM_POSIX_KEYS           0
    1321             :     #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys) 0
    1322             :   #else
    1323             :     #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys) \
    1324             :       _Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) )
    1325             :   #endif
    1326             : 
    1327             :   #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
    1328             :     #define CONFIGURE_MAXIMUM_POSIX_TIMERS             0
    1329             :     #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) 0
    1330             :   #else
    1331             :     #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
    1332             :       _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
    1333             :   #endif
    1334             : 
    1335             :   #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
    1336             :     #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS                     0
    1337             :     #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) 0
    1338             :   #else
    1339             :     #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
    1340             :       _Configure_From_workspace( \
    1341             :         (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
    1342             :   #endif
    1343             : 
    1344             :   #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
    1345             :     #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
    1346             :     #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) 0
    1347             :     #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS          0
    1348             :     #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_fds) 0
    1349             :   #else
    1350             :     #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
    1351             :       _Configure_POSIX_Named_Object_RAM( \
    1352             :          _message_queues, sizeof(POSIX_Message_queue_Control) )
    1353             : 
    1354             :     /* default to same number */
    1355             :     #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
    1356             :        #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
    1357             :                CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
    1358             :     #endif
    1359             : 
    1360             :     #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_mqueue_fds) \
    1361             :       _Configure_POSIX_Named_Object_RAM( \
    1362             :          _mqueue_fds, sizeof(POSIX_Message_queue_Control_fd) )
    1363             :   #endif
    1364             : 
    1365             :   #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
    1366             :     #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES                 0
    1367             :     #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) 0
    1368             :   #else
    1369             :     #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
    1370             :       _Configure_POSIX_Named_Object_RAM( \
    1371             :          _semaphores, sizeof(POSIX_Semaphore_Control) )
    1372             :   #endif
    1373             : 
    1374             :   #ifndef CONFIGURE_MAXIMUM_POSIX_BARRIERS
    1375             :     #define CONFIGURE_MAXIMUM_POSIX_BARRIERS               0
    1376             :     #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) 0
    1377             :   #else
    1378             :     #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \
    1379             :       _Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) )
    1380             :   #endif
    1381             : 
    1382             :   #ifndef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
    1383             :     #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS                0
    1384             :     #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) 0
    1385             :   #else
    1386             :     #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \
    1387             :       _Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) )
    1388             :   #endif
    1389             : 
    1390             :   #ifndef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
    1391             :     #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS              0
    1392             :     #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) 0
    1393             :   #else
    1394             :     #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) \
    1395             :       _Configure_Object_RAM(_rwlocks, sizeof(POSIX_RWLock_Control) )
    1396             :   #endif
    1397             : 
    1398             :   #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
    1399             : 
    1400             :     #ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
    1401             : 
    1402             :       /*
    1403             :        *  The user is defining their own table information and setting the
    1404             :        *  appropriate variables for the POSIX Initialization Thread Table.
    1405             :        */
    1406             : 
    1407             :     #else
    1408             : 
    1409             :       #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
    1410             :         #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
    1411             :       #endif
    1412             : 
    1413             :       #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
    1414             :         #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
    1415             :                 (CONFIGURE_MINIMUM_TASK_STACK_SIZE * 2)
    1416             :       #endif
    1417             : 
    1418             :       #ifdef CONFIGURE_INIT
    1419             :         posix_initialization_threads_table POSIX_Initialization_threads[] = {
    1420             :           { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT, \
    1421             :               CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
    1422             :         };
    1423             :       #endif
    1424             : 
    1425             :       #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
    1426             :               POSIX_Initialization_threads
    1427             : 
    1428             :       #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
    1429             :         sizeof(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME) / \
    1430             :             sizeof(posix_initialization_threads_table)
    1431             : 
    1432             :     #endif    /* CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
    1433             : 
    1434             :   #else     /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
    1435             : 
    1436             :     #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
    1437             :     #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
    1438             : 
    1439             :   #endif
    1440             : 
    1441             :   #define CONFIGURE_MEMORY_FOR_POSIX \
    1442             :     ( CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES ) + \
    1443             :       CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES( \
    1444             :           CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES ) + \
    1445             :       CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS ) + \
    1446             :       CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
    1447             :           CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ) + \
    1448             :       CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
    1449             :           CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ) + \
    1450             :       CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS( \
    1451             :           CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS ) + \
    1452             :       CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
    1453             :           CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ) + \
    1454             :       CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(CONFIGURE_MAXIMUM_POSIX_BARRIERS) + \
    1455             :       CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( \
    1456             :           CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ) + \
    1457             :       CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( \
    1458             :           CONFIGURE_MAXIMUM_POSIX_RWLOCKS ) + \
    1459             :       CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ) + \
    1460             :       (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE) \
    1461             :      )
    1462             : #else
    1463             : 
    1464             :   #define CONFIGURE_MAXIMUM_POSIX_THREADS         0
    1465             :   #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API 0
    1466             :   #define CONFIGURE_MEMORY_FOR_POSIX              0
    1467             : 
    1468             : #endif    /* RTEMS_POSIX_API */
    1469             : 
    1470             : #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
    1471             :   #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE    0
    1472             : #endif
    1473             : 
    1474             : /*
    1475             :  *  This block of defines are for applications which use GNAT/RTEMS.
    1476             :  *  GNAT implements each Ada task as a POSIX thread.
    1477             :  */
    1478             : #ifdef CONFIGURE_GNAT_RTEMS
    1479             : 
    1480             :   /**
    1481             :    *  The GNAT run-time needs something less than (10) POSIX mutexes.
    1482             :    *  We may be able to get by with less but why bother.
    1483             :    */
    1484             :   #define CONFIGURE_GNAT_MUTEXES 10
    1485             : 
    1486             :   /**
    1487             :    *  This is the maximum number of Ada tasks which can be concurrently
    1488             :    *  in existence.  Twenty (20) are required to run all tests in the
    1489             :    *  ACATS (formerly ACVC).
    1490             :    */
    1491             :   #ifndef CONFIGURE_MAXIMUM_ADA_TASKS
    1492             :     #define CONFIGURE_MAXIMUM_ADA_TASKS  20
    1493             :   #endif
    1494             : 
    1495             :   /**
    1496             :    * This is the number of non-Ada tasks which invoked Ada code.
    1497             :    */
    1498             :   #ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
    1499             :     #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
    1500             :   #endif
    1501             : 
    1502             :   /**
    1503             :    * Ada tasks are allocated twice the minimum stack space.
    1504             :    */
    1505             :   #define CONFIGURE_ADA_TASKS_STACK \
    1506             :     (CONFIGURE_MAXIMUM_ADA_TASKS * \
    1507             :       (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (6 * 1024)))
    1508             : 
    1509             : #else
    1510             :   #define CONFIGURE_GNAT_MUTEXES           0
    1511             :   #define CONFIGURE_MAXIMUM_ADA_TASKS      0
    1512             :   #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
    1513             :   #define CONFIGURE_ADA_TASKS_STACK        0
    1514             : #endif
    1515             : 
    1516             : /*
    1517             :  *  ITRON API Configuration Parameters
    1518             :  */
    1519             : 
    1520             : #ifdef RTEMS_ITRON_API
    1521             : 
    1522             :   #include <rtems/itron.h>
    1523             :   #include <rtems/itron/config.h>
    1524             :   #include <rtems/itron/eventflags.h>
    1525             :   #include <rtems/itron/fmempool.h>
    1526             :   #include <rtems/itron/mbox.h>
    1527             :   #include <rtems/itron/msgbuffer.h>
    1528             :   #include <rtems/itron/port.h>
    1529             :   #include <rtems/itron/semaphore.h>
    1530             :   #include <rtems/itron/task.h>
    1531             :   #include <rtems/itron/vmempool.h>
    1532             : 
    1533             :   #ifndef CONFIGURE_MAXIMUM_ITRON_TASKS
    1534             :     #define CONFIGURE_MAXIMUM_ITRON_TASKS      0
    1535             :   #endif
    1536             :   #define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API 0
    1537             : 
    1538             :   #ifndef CONFIGURE_MAXIMUM_ITRON_SEMAPHORES
    1539             :     #define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES                 0
    1540             :     #define CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES(_semaphores) 0
    1541             :   #else
    1542             :     #define CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES(_semaphores) \
    1543             :       _Configure_Object_RAM(_semaphores, sizeof(ITRON_Semaphore_Control))
    1544             :   #endif
    1545             : 
    1546             :   #ifndef CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS
    1547             :     #define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS                 0
    1548             :     #define CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS(_eventflags) 0
    1549             :   #else
    1550             :     #define CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS(_eventflags) \
    1551             :       _Configure_Object_RAM(_eventflags, sizeof(ITRON_Eventflags_Control))
    1552             :   #endif
    1553             : 
    1554             :   #ifndef CONFIGURE_MAXIMUM_ITRON_MAILBOXES
    1555             :     #define CONFIGURE_MAXIMUM_ITRON_MAILBOXES                0
    1556             :     #define CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES(_mailboxes) 0
    1557             :   #else
    1558             :     #define CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES(_mailboxes) \
    1559             :       _Configure_Object_RAM(_mailboxes, sizeof(ITRON_Mailbox_Control))
    1560             :   #endif
    1561             : 
    1562             :   #ifndef CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS
    1563             :     #define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS                      0
    1564             :     #define CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS(_message_buffers) 0
    1565             :   #else
    1566             :     #define CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS(_message_buffers) \
    1567             :       _Configure_Object_RAM(_message_buffers, \
    1568             :         sizeof(ITRON_Message_buffer_Control))
    1569             :   #endif
    1570             : 
    1571             :   #ifndef CONFIGURE_MAXIMUM_ITRON_PORTS
    1572             :     #define CONFIGURE_MAXIMUM_ITRON_PORTS            0
    1573             :     #define CONFIGURE_MEMORY_FOR_ITRON_PORTS(_ports) 0
    1574             :   #else
    1575             :     #define CONFIGURE_MEMORY_FOR_ITRON_PORTS(_ports) \
    1576             :       _Configure_Object_RAM(_ports, sizeof(ITRON_Port_Control))
    1577             :   #endif
    1578             : 
    1579             :   #ifndef CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS
    1580             :     #define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS            0
    1581             :     #define CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS(_pools) 0
    1582             :   #else
    1583             :     #define CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS(_pools) \
    1584             :       _Configure_Object_RAM( _pools, sizeof(ITRON_Variable_memory_pool_Control))
    1585             :   #endif
    1586             : 
    1587             :   #ifndef CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS
    1588             :     #define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS            0
    1589             :     #define CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS(_pools) 0
    1590             :   #else
    1591             :     #define CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS(_pools) \
    1592             :       _Configure_Object_RAM(_pools, sizeof(ITRON_Fixed_memory_pool_Control))
    1593             :   #endif
    1594             : 
    1595             :   #ifdef CONFIGURE_ITRON_INIT_TASK_TABLE
    1596             : 
    1597             :     #ifdef CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE
    1598             : 
    1599             :       /*
    1600             :        *  The user is defining their own table information and setting the
    1601             :        *  appropriate variables for the ITRON Initialization Task Table.
    1602             :        */
    1603             : 
    1604             :     #else
    1605             : 
    1606             :       #ifndef CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT
    1607             :         #define CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT   ITRON_Init
    1608             :       #endif
    1609             : 
    1610             :       #ifndef CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES
    1611             :         #define CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES    TA_HLNG
    1612             :       #endif
    1613             : 
    1614             :       #ifndef CONFIGURE_ITRON_INIT_TASK_PRIORITY
    1615             :         #define CONFIGURE_ITRON_INIT_TASK_PRIORITY      1
    1616             :       #endif
    1617             : 
    1618             :       #ifndef CONFIGURE_ITRON_INIT_TASK_STACK_SIZE
    1619             :         #define CONFIGURE_ITRON_INIT_TASK_STACK_SIZE \
    1620             :                 CONFIGURE_MINIMUM_TASK_STACK_SIZE
    1621             :       #endif
    1622             : 
    1623             :       #ifdef CONFIGURE_INIT
    1624             :         itron_initialization_tasks_table ITRON_Initialization_tasks[] = {
    1625             :           { 1,                                    /* ID */
    1626             :             { (VP) 0,                                /* exinfo */
    1627             :               CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES,  /* task attributes */
    1628             :               CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT, /* task start address */
    1629             :               CONFIGURE_ITRON_INIT_TASK_PRIORITY,    /* initial task priority */
    1630             :               CONFIGURE_ITRON_INIT_TASK_STACK_SIZE   /* stack size */
    1631             :             }
    1632             :           }
    1633             :         };
    1634             :       #endif
    1635             : 
    1636             :       #define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME ITRON_Initialization_tasks
    1637             : 
    1638             :       #define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE \
    1639             :         sizeof(CONFIGURE_ITRON_INIT_TASK_TABLE_NAME) / \
    1640             :             sizeof(itron_initialization_tasks_table)
    1641             : 
    1642             :     #endif    /* CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE */
    1643             : 
    1644             :   #else     /* CONFIGURE_ITRON_INIT_TASK_TABLE */
    1645             : 
    1646             :     #define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME NULL
    1647             :     #define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE 0
    1648             :     #define CONFIGURE_ITRON_INIT_TASK_STACK_SIZE 0
    1649             : 
    1650             :   #endif
    1651             : 
    1652             :   #define CONFIGURE_MEMORY_FOR_ITRON \
    1653             :     ( CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES( \
    1654             :           CONFIGURE_MAXIMUM_ITRON_SEMAPHORES ) + \
    1655             :       CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS( \
    1656             :           CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS ) + \
    1657             :       CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES( \
    1658             :           CONFIGURE_MAXIMUM_ITRON_MAILBOXES ) + \
    1659             :       CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS( \
    1660             :           CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS ) + \
    1661             :       CONFIGURE_MEMORY_FOR_ITRON_PORTS( \
    1662             :           CONFIGURE_MAXIMUM_ITRON_PORTS ) + \
    1663             :       CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS( \
    1664             :           CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS ) + \
    1665             :       CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS( \
    1666             :           CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS ) + \
    1667             :       CONFIGURE_ITRON_INIT_TASK_STACK_SIZE \
    1668             :      )
    1669             : 
    1670             : #else
    1671             : 
    1672             :   #define CONFIGURE_MAXIMUM_ITRON_TASKS               0
    1673             :   #define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES          0
    1674             :   #define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS          0
    1675             :   #define CONFIGURE_MAXIMUM_ITRON_MAILBOXES           0
    1676             :   #define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS     0
    1677             :   #define CONFIGURE_MAXIMUM_ITRON_PORTS               0
    1678             :   #define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS        0
    1679             :   #define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS  0
    1680             :   #define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API     0
    1681             :   #define CONFIGURE_MEMORY_FOR_ITRON                  0
    1682             : 
    1683             : #endif    /* RTEMS_ITRON_API */
    1684             : 
    1685             : /**
    1686             :  *  This macro specifies the amount of memory to be reserved for the
    1687             :  *  Newlib C Library reentrancy structure -- if we are using newlib.
    1688             :  */
    1689             : 
    1690             : #if (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
    1691             :   #include <reent.h>
    1692             : 
    1693             :   #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB \
    1694             :     _Configure_From_workspace(sizeof(struct _reent))
    1695             : #else
    1696             :   #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB 0
    1697             : #endif
    1698             : 
    1699             : /*
    1700             :  *  Calculate the RAM size based on the maximum number of objects configured.
    1701             :  */
    1702             : 
    1703             : #ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
    1704             : 
    1705             : /**
    1706             :  *  Account for allocating the following per object
    1707             :  *    + array of object control structures
    1708             :  *    + local pointer table -- pointer per object plus a zero'th
    1709             :  *      entry in the local pointer table.
    1710             :  */
    1711             : 
    1712             : #define CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \
    1713             :  ( \
    1714             :   _Configure_Object_RAM(_tasks, sizeof(Thread_Control)) + \
    1715             :   (_Configure_Max_Objects(_tasks) * \
    1716             :    (_Configure_From_workspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \
    1717             :     CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API + \
    1718             :     CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB + \
    1719             :     CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \
    1720             :     CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API))  + \
    1721             :   _Configure_From_workspace( \
    1722             :     _Configure_Max_Objects(_number_FP_tasks) * CONTEXT_FP_SIZE) + \
    1723             :   _Configure_From_workspace( \
    1724             :           (CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1) * sizeof(void *)) \
    1725             :  )
    1726             : 
    1727             : /**
    1728             :  *  This defines the amount of memory configured for the multiprocessing
    1729             :  *  support required by this application.
    1730             :  */
    1731             : #ifdef CONFIGURE_MP_APPLICATION
    1732             :   #define CONFIGURE_MEMORY_FOR_MP \
    1733             :     (CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
    1734             :      CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS( \
    1735             :              CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) + \
    1736             :      CONFIGURE_MEMORY_FOR_TASKS(1, 1) + \
    1737             :      CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK \
    1738             :   )
    1739             : #else
    1740             :   #define CONFIGURE_MEMORY_FOR_MP  0
    1741             : #endif
    1742             : 
    1743             : /**
    1744             :  *  This is so we can account for tasks with stacks greater than minimum
    1745             :  *  size.  This is in bytes.
    1746             :  */
    1747             : #ifndef CONFIGURE_EXTRA_TASK_STACKS
    1748             :   #define CONFIGURE_EXTRA_TASK_STACKS 0
    1749             : #endif
    1750             : 
    1751             : /**
    1752             :  *  The following macro is used to calculate the memory allocated by RTEMS
    1753             :  *  for the message buffers associated with a particular message queue.
    1754             :  *  There is a fixed amount of overhead per message.
    1755             :  */
    1756             : #define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
    1757             :     _Configure_From_workspace( \
    1758             :       (_messages) * ((_size) + sizeof(CORE_message_queue_Buffer_control)))
    1759             : 
    1760             : /**
    1761             :  *  This macros is set to the amount of memory required for pending message
    1762             :  *  buffers in bytes.  It should be constructed by adding together a
    1763             :  *  set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
    1764             :  */
    1765             : #ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
    1766             :   #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
    1767             : #endif
    1768             : 
    1769             : /**
    1770             :  *  This macro is available just in case the confdefs.h file underallocates
    1771             :  *  memory for a particular application.  This lets the user add some extra
    1772             :  *  memory in case something broken and underestimates.
    1773             :  *
    1774             :  *  It is also possible for cases where confdefs.h overallocates memory,
    1775             :  *  you could substract memory from the allocated.  The estimate is just
    1776             :  *  that, an estimate, and assumes worst case alignment and padding on
    1777             :  *  each allocated element.  So in some cases it could be too conservative.
    1778             :  *
    1779             :  *  @note Historically this was used for message buffers.
    1780             :  */
    1781             : #ifndef CONFIGURE_MEMORY_OVERHEAD
    1782             :   #define CONFIGURE_MEMORY_OVERHEAD 0
    1783             : #endif
    1784             : 
    1785             : /**
    1786             :  *  On architectures that use Simple Vectored Interrupts, it is RTEMS
    1787             :  *  responsibility to allocate the vector table.  This avoids reserving
    1788             :  *  the memory on architectures that use the Programmable Interrupt
    1789             :  *  Controller Vectored Interrupts.
    1790             :  */
    1791             : #if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
    1792             :   /*
    1793             :    *  This is a (hopefully) temporary hack.  On the mips, the number of
    1794             :    *  vectors is NOT statically defined.  But it has to be statically
    1795             :    *  defined for this to work.  This is an issue looking for a nice
    1796             :    *  solution.
    1797             :    */
    1798             :   #if defined(__mips__)
    1799             :     #define CONFIGURE_INTERRUPT_VECTOR_TABLE \
    1800             :       _Configure_From_workspace( (sizeof(ISR_Handler_entry) * 256))
    1801             :   #else
    1802             :     #define CONFIGURE_INTERRUPT_VECTOR_TABLE \
    1803             :       _Configure_From_workspace( \
    1804             :         (sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS))
    1805             :   #endif
    1806             : #else
    1807             :   #define CONFIGURE_INTERRUPT_VECTOR_TABLE 0
    1808             : #endif
    1809             : 
    1810             : /**
    1811             :  *  RTEMS uses one instance of an internal mutex class.  This accounts
    1812             :  *  for that mutex
    1813             :  */
    1814             : #define CONFIGURE_API_MUTEX_MEMORY \
    1815             :   _Configure_Object_RAM(1, sizeof(API_Mutex_Control))
    1816             : 
    1817             : /**
    1818             :  *  This defines the memory used by the thread ready chains.  There is
    1819             :  *  one chain per priority.
    1820             :  */
    1821             : #define CONFIGURE_MEMORY_FOR_THREAD_READY_CHAINS \
    1822             :     _Configure_From_workspace( \
    1823             :         ((CONFIGURE_MAXIMUM_PRIORITY+1) * sizeof(Chain_Control)) )
    1824             : /**
    1825             :  *  This defines the amount of memory reserved for the IDLE task
    1826             :  *  control structures and stack.
    1827             :  */
    1828             : #define CONFIGURE_MEMORY_FOR_IDLE_TASK \
    1829             :     (CONFIGURE_MEMORY_FOR_TASKS(1, 0) + \
    1830             :      (CONFIGURE_IDLE_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE))
    1831             : 
    1832             : /**
    1833             :  *  This macro accounts for general RTEMS system overhead.
    1834             :  */
    1835             : #define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
    1836             :   ( CONFIGURE_MEMORY_FOR_IDLE_TASK +                /* IDLE and stack */ \
    1837             :     CONFIGURE_MEMORY_FOR_THREAD_READY_CHAINS +     /* Ready chains */ \
    1838             :     CONFIGURE_INTERRUPT_VECTOR_TABLE +             /* interrupt vectors */ \
    1839             :     CONFIGURE_INTERRUPT_STACK_MEMORY +             /* interrupt stack */ \
    1840             :     CONFIGURE_API_MUTEX_MEMORY                     /* allocation mutex */ \
    1841             :   )
    1842             : 
    1843             : /*
    1844             :  *  Now account for any extra memory that initialization tasks or threads
    1845             :  *  may have requested.
    1846             :  */
    1847             : 
    1848             : /**
    1849             :  *  This accounts for any extra memory required by the Classic API
    1850             :  *  Initialization Task.
    1851             :  */
    1852             : #if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1853             :   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
    1854             :       (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1855             : #else
    1856             :   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
    1857             : #endif
    1858             : 
    1859             : /**
    1860             :  *  This accounts for any extra memory required by the POSIX API
    1861             :  *  Initialization Thread.
    1862             :  */
    1863             : #if defined(RTEMS_POSIX_API) && \
    1864             :     (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1865             :   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
    1866             :     (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1867             : #else
    1868             :   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
    1869             : #endif
    1870             : 
    1871             : /**
    1872             :  *  This accounts for any extra memory required by the ITRON API
    1873             :  *  Initialization Task.
    1874             :  */
    1875             : #if defined(RTEMS_ITRON_API) && \
    1876             :     (CONFIGURE_ITRON_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1877             :   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_ITRON_PART \
    1878             :       (CONFIGURE_ITRON_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1879             : #else
    1880             :   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_ITRON_PART 0
    1881             : #endif
    1882             : 
    1883             : /**
    1884             :  *  This macro provides a summation of the various initialization task
    1885             :  *  and thread stack requirements.
    1886             :  */
    1887             : #define CONFIGURE_INITIALIZATION_THREADS_STACKS \
    1888             :     (CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
    1889             :     CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART + \
    1890             :     CONFIGURE_INITIALIZATION_THREADS_STACKS_ITRON_PART)
    1891             : 
    1892             : /**
    1893             :  *  This macro provides a summation of the various task and thread
    1894             :  *  requirements.
    1895             :  */
    1896             : #define CONFIGURE_TOTAL_TASKS_AND_THREADS \
    1897             :    (CONFIGURE_MAXIMUM_TASKS + \
    1898             :     CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS + \
    1899             :     CONFIGURE_MAXIMUM_ITRON_TASKS \
    1900             :    )
    1901             : 
    1902             : /**
    1903             :  *  This macro reserves the memory required by the statically configured
    1904             :  *  user extensions.
    1905             :  */
    1906             : #define CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \
    1907             :      ((CONFIGURE_NEWLIB_EXTENSION * \
    1908             :         _Configure_From_workspace( sizeof(User_extensions_Control))) + \
    1909             :       (CONFIGURE_STACK_CHECKER_EXTENSION * \
    1910             :         _Configure_From_workspace( sizeof(User_extensions_Control))) \
    1911             :      )
    1912             : 
    1913             : /**
    1914             :  *  This macro provides a summation of the memory required by the
    1915             :  *  Classic API as configured.
    1916             :  */
    1917             : #define CONFIGURE_MEMORY_FOR_CLASSIC \
    1918             :   (CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES) + \
    1919             :    CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \
    1920             :     CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \
    1921             :    CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES) + \
    1922             :    CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
    1923             :    CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
    1924             :    CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \
    1925             :    CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
    1926             :    CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
    1927             :    CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_MAXIMUM_BARRIERS) + \
    1928             :    CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \
    1929             :   )
    1930             : 
    1931             : #if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
    1932             :   /**
    1933             :    *  This is a debug mechanism, so if you need to, the executable will
    1934             :    *  have a structure with various partial values.  Add to this as you
    1935             :    *  need to.  Viewing this structure in gdb combined with dumping
    1936             :    *  the Configuration structures generated should help a lot in tracing
    1937             :    *  down errors and analyzing where over and under allocations are.
    1938             :    */
    1939             :   typedef struct {
    1940             :     uint32_t SYSTEM_OVERHEAD;
    1941             :     uint32_t STATIC_EXTENSIONS;
    1942             :     uint32_t INITIALIZATION_THREADS_STACKS;
    1943             : 
    1944             :     uint32_t PER_INTEGER_TASK;
    1945             :     uint32_t FP_OVERHEAD;
    1946             :     uint32_t CLASSIC;
    1947             :     uint32_t POSIX;
    1948             :     uint32_t ITRON;
    1949             : 
    1950             :     /* System overhead pieces */
    1951             :     uint32_t INTERRUPT_VECTOR_TABLE;
    1952             :     uint32_t INTERRUPT_STACK_MEMORY;
    1953             :     uint32_t THREAD_READY_CHAINS;
    1954             :     uint32_t MEMORY_FOR_IDLE_TASK;
    1955             : 
    1956             :     /* Classic API Pieces */
    1957             :     uint32_t CLASSIC_TASKS;
    1958             :     uint32_t TASK_VARIABLES;
    1959             :     uint32_t TIMERS;
    1960             :     uint32_t SEMAPHORES;
    1961             :     uint32_t MESSAGE_QUEUES;
    1962             :     uint32_t PARTITIONS;
    1963             :     uint32_t REGIONS;
    1964             :     uint32_t PORTS;
    1965             :     uint32_t PERIODS;
    1966             :     uint32_t BARRIERS;
    1967             :     uint32_t USER_EXTENSIONS;
    1968             : #ifdef RTEMS_POSIX_API
    1969             :     /* POSIX API Pieces */
    1970             :     uint32_t POSIX_MUTEXES;
    1971             :     uint32_t POSIX_CONDITION_VARIABLES;
    1972             :     uint32_t POSIX_KEYS;
    1973             :     uint32_t POSIX_TIMERS;
    1974             :     uint32_t POSIX_QUEUED_SIGNALS;
    1975             :     uint32_t POSIX_MESSAGE_QUEUES;
    1976             :     uint32_t POSIX_SEMAPHORES;
    1977             :     uint32_t POSIX_BARRIERS;
    1978             :     uint32_t POSIX_SPINLOCKS;
    1979             :     uint32_t POSIX_RWLOCKS;
    1980             : #endif
    1981             : #ifdef RTEMS_ITRON_API
    1982             :     /* ITRON API Pieces */
    1983             :     uint32_t ITRON_SEMAPHORES;
    1984             :     uint32_t ITRON_EVENTFLAGS;
    1985             :     uint32_t ITRON_MAILBOXES;
    1986             :     uint32_t ITRON_MESSAGE_BUFFERS;
    1987             :     uint32_t ITRON_PORTS;
    1988             :     uint32_t ITRON_MEMORY_POOLS;
    1989             :     uint32_t ITRON_FIXED_MEMORY_POOLS;
    1990             : #endif
    1991             :   } Configuration_Debug_t;
    1992             : 
    1993             :   Configuration_Debug_t Configuration_Memory_Debug = {
    1994             :     /* General Information */
    1995             :     CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD,
    1996             :     CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS,
    1997             :     CONFIGURE_INITIALIZATION_THREADS_STACKS,
    1998             :     CONFIGURE_MEMORY_FOR_TASKS(1, 0),
    1999             :     CONFIGURE_MEMORY_FOR_TASKS(0, 1),
    2000             :     CONFIGURE_MEMORY_FOR_CLASSIC,
    2001             :     CONFIGURE_MEMORY_FOR_POSIX,
    2002             :     CONFIGURE_MEMORY_FOR_ITRON,
    2003             : 
    2004             :     /* System overhead pieces */
    2005             :     CONFIGURE_INTERRUPT_VECTOR_TABLE,
    2006             :     CONFIGURE_INTERRUPT_STACK_MEMORY,
    2007             :     CONFIGURE_MEMORY_FOR_THREAD_READY_CHAINS,
    2008             :     CONFIGURE_MEMORY_FOR_IDLE_TASK,
    2009             : 
    2010             :     /* Classic API Pieces */
    2011             :     CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
    2012             :     CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES),
    2013             :     CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
    2014             :     CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES),
    2015             :     CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES),
    2016             :     CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS),
    2017             :     CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ),
    2018             :     CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS),
    2019             :     CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS),
    2020             :     CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_MAXIMUM_BARRIERS),
    2021             :     CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
    2022             : 
    2023             : #ifdef RTEMS_POSIX_API
    2024             :     /* POSIX API Pieces */
    2025             :     CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES ),
    2026             :     CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(
    2027             :       CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES ),
    2028             :     CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS ),
    2029             :     CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
    2030             :       CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
    2031             :     CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
    2032             :       CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
    2033             :     CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
    2034             :     CONFIGURE_MEMORY_FOR_POSIX_BARRIERS( CONFIGURE_MAXIMUM_POSIX_BARRIERS ),
    2035             :     CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ),
    2036             :     CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( CONFIGURE_MAXIMUM_POSIX_RWLOCKS ),
    2037             :     CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
    2038             : #endif
    2039             : 
    2040             : #ifdef RTEMS_ITRON_API
    2041             :     /* ITRON API Pieces */
    2042             :     CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES ),
    2043             :     CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS( CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS ),
    2044             :     CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES( CONFIGURE_MAXIMUM_ITRON_MAILBOXES ),
    2045             :     CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS(
    2046             :         CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS ),
    2047             :     CONFIGURE_MEMORY_FOR_ITRON_PORTS( CONFIGURE_MAXIMUM_ITRON_PORTS ),
    2048             :     CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS(
    2049             :         CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS ),
    2050             :     CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS(
    2051             :         CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS ),
    2052             : #endif
    2053             :   };
    2054             : #endif
    2055             : 
    2056             : /**
    2057             :  *  This calculates the memory required for the executive workspace.
    2058             :  */
    2059             : #define CONFIGURE_EXECUTIVE_RAM_SIZE \
    2060             : (( \
    2061             :    CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD + \
    2062             :    CONFIGURE_MEMORY_FOR_DEVFS + \
    2063             :    CONFIGURE_MEMORY_FOR_TASKS( \
    2064             :      CONFIGURE_TOTAL_TASKS_AND_THREADS, CONFIGURE_TOTAL_TASKS_AND_THREADS) + \
    2065             :    CONFIGURE_MEMORY_FOR_CLASSIC + \
    2066             :    CONFIGURE_MEMORY_FOR_POSIX + \
    2067             :    (CONFIGURE_MAXIMUM_POSIX_THREADS * CONFIGURE_MINIMUM_TASK_STACK_SIZE ) + \
    2068             :    CONFIGURE_MEMORY_FOR_ITRON + \
    2069             :    CONFIGURE_INITIALIZATION_THREADS_STACKS + \
    2070             :    CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
    2071             :    CONFIGURE_MEMORY_FOR_MP + \
    2072             :    CONFIGURE_MESSAGE_BUFFER_MEMORY + \
    2073             :    (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
    2074             :    (CONFIGURE_EXTRA_TASK_STACKS) + (CONFIGURE_ADA_TASKS_STACK) \
    2075             : ) & ~0x7)
    2076             : #endif
    2077             : 
    2078             : #ifdef CONFIGURE_INIT
    2079             :   /**
    2080             :    *  This is the Classic API Configuration Table.
    2081             :    */
    2082             :   rtems_api_configuration_table Configuration_RTEMS_API = {
    2083             :     CONFIGURE_MAXIMUM_TASKS,
    2084             :     CONFIGURE_NOTEPADS_ENABLED,
    2085             :     CONFIGURE_MAXIMUM_TIMERS + CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER,
    2086             :     CONFIGURE_SEMAPHORES,
    2087             :     CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
    2088             :     CONFIGURE_MAXIMUM_PARTITIONS,
    2089             :     CONFIGURE_MAXIMUM_REGIONS,
    2090             :     CONFIGURE_MAXIMUM_PORTS,
    2091             :     CONFIGURE_MAXIMUM_PERIODS,
    2092             :     CONFIGURE_MAXIMUM_BARRIERS,
    2093             :     CONFIGURE_INIT_TASK_TABLE_SIZE,
    2094             :     CONFIGURE_INIT_TASK_TABLE
    2095             :   };
    2096             : 
    2097             :   #ifdef RTEMS_POSIX_API
    2098             :     /**
    2099             :      *  This is the POSIX API Configuration Table.
    2100             :      */
    2101             :     posix_api_configuration_table Configuration_POSIX_API = {
    2102             :       CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS,
    2103             :       CONFIGURE_MAXIMUM_POSIX_MUTEXES + CONFIGURE_GNAT_MUTEXES +
    2104             :         CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS,
    2105             :       CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
    2106             :         CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS,
    2107             :       CONFIGURE_MAXIMUM_POSIX_KEYS,
    2108             :       CONFIGURE_MAXIMUM_POSIX_TIMERS,
    2109             :       CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
    2110             :       CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
    2111             :       CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS,
    2112             :       CONFIGURE_MAXIMUM_POSIX_SEMAPHORES,
    2113             :       CONFIGURE_MAXIMUM_POSIX_BARRIERS,
    2114             :       CONFIGURE_MAXIMUM_POSIX_RWLOCKS,
    2115             :       CONFIGURE_MAXIMUM_POSIX_SPINLOCKS,
    2116             :       CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
    2117             :       CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
    2118             :     };
    2119             :   #endif
    2120             : 
    2121             :   #ifdef RTEMS_ITRON_API
    2122             :     /**
    2123             :      *  This is the ITRON API Configuration Table.
    2124             :      */
    2125             :     itron_api_configuration_table Configuration_ITRON_API = {
    2126             :       CONFIGURE_MAXIMUM_ITRON_TASKS,
    2127             :       CONFIGURE_MAXIMUM_ITRON_SEMAPHORES,
    2128             :       CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS,
    2129             :       CONFIGURE_MAXIMUM_ITRON_MAILBOXES,
    2130             :       CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS,
    2131             :       CONFIGURE_MAXIMUM_ITRON_PORTS,
    2132             :       CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS,
    2133             :       CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS,
    2134             :       CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE,
    2135             :       CONFIGURE_ITRON_INIT_TASK_TABLE_NAME
    2136             :     };
    2137             :   #endif
    2138             : 
    2139             :   /** This variable specifies the minimum stack size for tasks in an RTEMS
    2140             :    *  application.
    2141             :    *
    2142             :    *  @note This is left as a simple uint32_t so it can be externed as
    2143             :    *        needed without requring being high enough logical to
    2144             :    *        include the full configuration table.
    2145             :    */
    2146             :   uint32_t rtems_minimum_stack_size =
    2147             :     CONFIGURE_MINIMUM_TASK_STACK_SIZE;
    2148             : 
    2149             :   /** This variable specifies the maximum priority value that
    2150             :    *  a task may have.  This must be a power of 2 between 4
    2151             :    *  and 256 and is specified in terms of Classic API
    2152             :    *  priority values.
    2153             :    *
    2154             :    *  @note This is left as a simple uint8_t so it can be externed as
    2155             :    *        needed without requring being high enough logical to
    2156             :    *        include the full configuration table.
    2157             :    */
    2158             :   uint8_t rtems_maximum_priority = CONFIGURE_MAXIMUM_PRIORITY;
    2159             : 
    2160             :   /**
    2161             :    *  This is the primary Configuration Table for this application.
    2162             :    */
    2163             :   rtems_configuration_table Configuration = {
    2164             :     NULL,                                     /* filled in by BSP */
    2165             :     CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
    2166             :     CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
    2167             :     CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
    2168             :     CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
    2169             :     CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
    2170             :     CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
    2171             :     CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
    2172             :     CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
    2173             :     CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
    2174             :     CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */
    2175             :     CONFIGURE_MAXIMUM_DRIVERS,                /* maximum device drivers */
    2176             :     CONFIGURE_NUMBER_OF_DRIVERS,              /* static device drivers */
    2177             :     Device_drivers,                           /* pointer to driver table */
    2178             :     CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
    2179             :     CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
    2180             :     #if defined(RTEMS_MULTIPROCESSING)
    2181             :       CONFIGURE_MULTIPROCESSING_TABLE,        /* pointer to MP config table */
    2182             :     #endif
    2183             :   };
    2184             : #endif
    2185             : 
    2186             : #endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
    2187             : 
    2188             : /*
    2189             :  *  If the user has configured a set of Classic API Initialization Tasks,
    2190             :  *  then we need to install the code that runs that loop.
    2191             :  */
    2192             : #ifdef CONFIGURE_INIT
    2193             :   #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
    2194             :       defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
    2195             :     void (_RTEMS_tasks_Initialize_user_tasks_body)(void);
    2196             :     void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) =
    2197             :               _RTEMS_tasks_Initialize_user_tasks_body;
    2198             :   #else
    2199             :     void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) = NULL;
    2200             :   #endif
    2201             : #endif
    2202             : 
    2203             : /*
    2204             :  *  If the user has configured a set of POSIX Initialization Threads,
    2205             :  *  then we need to install the code that runs that loop.
    2206             :  */
    2207             : #ifdef RTEMS_POSIX_API
    2208             :   #ifdef CONFIGURE_INIT
    2209             :     #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
    2210             :         defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
    2211             :       void _POSIX_Threads_Initialize_user_threads_body(void);
    2212             :       void (*_POSIX_Threads_Initialize_user_threads_p)(void) =
    2213             :                 _POSIX_Threads_Initialize_user_threads_body;
    2214             :     #else
    2215             :       void (*_POSIX_Threads_Initialize_user_threads_p)(void) = NULL;
    2216             :     #endif
    2217             :   #endif
    2218             : #endif
    2219             : 
    2220             : /*
    2221             :  *  If the user has configured a set of ITRON Initialization Tasks,
    2222             :  *  then we need to install the code that runs that loop.
    2223             :  */
    2224             : #ifdef RTEMS_ITRON_API
    2225             :   #ifdef CONFIGURE_INIT
    2226             :     #if defined(CONFIGURE_ITRON_INIT_TASK_TABLE) || \
    2227             :         defined(CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE)
    2228             :       void _ITRON_Task_Initialize_user_tasks_body(void);
    2229             :       void (*_ITRON_Initialize_user_tasks_p)(void) =
    2230             :                 _ITRON_Task_Initialize_user_tasks_body;
    2231             :     #else
    2232             :       void (*_ITRON_Initialize_user_tasks_p)(void) = NULL;
    2233             :     #endif
    2234             :   #endif
    2235             : #endif
    2236             : 
    2237             : /*
    2238             :  *  Select PCI Configuration Library
    2239             :  */
    2240             : #ifdef RTEMS_PCI_CONFIG_LIB
    2241             :   #ifdef CONFIGURE_INIT
    2242             :     #define PCI_LIB_NONE 0
    2243             :     #define PCI_LIB_AUTO 1
    2244             :     #define PCI_LIB_STATIC 2
    2245             :     #define PCI_LIB_READ 3
    2246             :     #define PCI_LIB_PERIPHERAL 4
    2247             :     #if CONFIGURE_PCI_LIB == PCI_LIB_AUTO
    2248             :       #define PCI_CFG_AUTO_LIB
    2249             :       #include <pci/cfg.h>
    2250             :       struct pci_bus pci_hb;
    2251             :       #define PCI_LIB_INIT pci_config_auto
    2252             :       #define PCI_LIB_CONFIG pci_config_auto_register
    2253             :     #elif CONFIGURE_PCI_LIB == PCI_LIB_STATIC
    2254             :       #define PCI_CFG_STATIC_LIB
    2255             :       #include <pci/cfg.h>
    2256             :       #define PCI_LIB_INIT pci_config_static
    2257             :       #define PCI_LIB_CONFIG NULL
    2258             :       /* Let user define PCI configuration (struct pci_bus pci_hb) */
    2259             :     #elif CONFIGURE_PCI_LIB == PCI_LIB_READ
    2260             :       #define PCI_CFG_READ_LIB
    2261             :       #include <pci/cfg.h>
    2262             :       #define PCI_LIB_INIT pci_config_read
    2263             :       #define PCI_LIB_CONFIG NULL
    2264             :       struct pci_bus pci_hb;
    2265             :     #elif CONFIGURE_PCI_LIB == PCI_LIB_PERIPHERAL
    2266             :       #define PCI_LIB_INIT pci_config_peripheral
    2267             :       #define PCI_LIB_CONFIG NULL
    2268             :       /* Let user define PCI configuration (struct pci_bus pci_hb) */
    2269             :     #elif CONFIGURE_PCI_LIB == PCI_LIB_NONE
    2270             :       #define PCI_LIB_INIT NULL
    2271             :       #define PCI_LIB_CONFIG NULL
    2272             :       /* No PCI Configuration at all, user can use/debug access routines */
    2273             :     #else
    2274             :       #error NO PCI LIBRARY DEFINED
    2275             :     #endif
    2276             : 
    2277             :     const int pci_config_lib_type = CONFIGURE_PCI_LIB;
    2278             :     int (*pci_config_lib_init)(void) = PCI_LIB_INIT;
    2279             :     void (*pci_config_lib_register)(void *config) = PCI_LIB_CONFIG;
    2280             :   #endif
    2281             : #endif
    2282             : 
    2283             : #ifdef __cplusplus
    2284             : }
    2285             : #endif
    2286             : 
    2287             : /******************************************************************
    2288             :  ******************************************************************
    2289             :  ******************************************************************
    2290             :  *         CONFIGURATION WARNINGS AND ERROR CHECKING              *
    2291             :  ******************************************************************
    2292             :  ******************************************************************
    2293             :  ******************************************************************
    2294             :  */
    2295             : 
    2296             : /*
    2297             :  *  Make sure a task/thread of some sort is configured.
    2298             :  *
    2299             :  *  When analyzing RTEMS to find the smallest possible of memory
    2300             :  *  that must be allocated, you probably do want to configure 0
    2301             :  *  tasks/threads so there is a smaller set of calls to _Workspace_Allocate
    2302             :  *  to analyze.
    2303             :  */
    2304             : #if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
    2305             :   #if (CONFIGURE_MAXIMUM_TASKS == 0) && \
    2306             :       (CONFIGURE_MAXIMUM_POSIX_THREADS == 0) && \
    2307             :       (CONFIGURE_MAXIMUM_ADA_TASKS == 0) &&  \
    2308             :       (CONFIGURE_MAXIMUM_ITRON_TASKS == 0)
    2309             :     #error "CONFIGURATION ERROR: No tasks or threads configured!!"
    2310             :   #endif
    2311             : #endif
    2312             : 
    2313             : /*
    2314             :  *  Make sure at least one of the initialization task/thread
    2315             :  *  tables was defined.
    2316             :  */
    2317             : #if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
    2318             :     !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \
    2319             :     !defined(CONFIGURE_ITRON_INIT_TASK_TABLE) && \
    2320             :     !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
    2321             : #error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
    2322             : #endif
    2323             : 
    2324             : /*
    2325             :  *  If the user is trying to configure a multiprocessing application and
    2326             :  *  RTEMS was not configured and built multiprocessing, then error out.
    2327             :  */
    2328             : #if defined(CONFIGURE_MP_APPLICATION) && \
    2329             :     !defined(RTEMS_MULTIPROCESSING)
    2330             : #error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!"
    2331             : #endif
    2332             : 
    2333             : /*
    2334             :  *  If an attempt was made to configure POSIX objects and
    2335             :  *  the POSIX API was not configured into RTEMS, error out.
    2336             :  */
    2337             : #if !defined(RTEMS_POSIX_API)
    2338             :   #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
    2339             :        (CONFIGURE_MAXIMUM_POSIX_MUTEXES != 0) || \
    2340             :        (CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES != 0) || \
    2341             :        (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) || \
    2342             :        (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
    2343             :        (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
    2344             :        (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
    2345             :        (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS != 0) || \
    2346             :        (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \
    2347             :        (CONFIGURE_MAXIMUM_POSIX_BARRIERS != 0) || \
    2348             :        (CONFIGURE_MAXIMUM_POSIX_SPINLOCKS != 0) || \
    2349             :        (CONFIGURE_MAXIMUM_POSIX_RWLOCKS != 0) || \
    2350             :       defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
    2351             :   #error "CONFIGURATION ERROR: POSIX API support not configured!!"
    2352             :   #endif
    2353             : #endif
    2354             : 
    2355             : /*
    2356             :  *  If an attempt was made to configure ITRON objects and
    2357             :  *  the ITRON API was not configured into RTEMS, error out.
    2358             :  */
    2359             : #if !defined(RTEMS_ITRON_API)
    2360             :   #if ((CONFIGURE_MAXIMUM_ITRON_TASKS != 0) || \
    2361             :        (CONFIGURE_MAXIMUM_ITRON_SEMAPHORES != 0) || \
    2362             :        (CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS != 0) || \
    2363             :        (CONFIGURE_MAXIMUM_ITRON_MAILBOXES != 0) || \
    2364             :        (CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS != 0) || \
    2365             :        (CONFIGURE_MAXIMUM_ITRON_PORTS != 0) || \
    2366             :        (CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS != 0) || \
    2367             :        (CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS != 0) || \
    2368             :       defined(CONFIGURE_ITRON_INIT_TASK_TABLE))
    2369             :   #error "CONFIGURATION ERROR: ITRON API support not configured!!"
    2370             :   #endif
    2371             : #endif
    2372             : 
    2373             : /*
    2374             :  *  You must either explicity include or exclude the clock driver.
    2375             :  *  It is such a common newbie error to leave it out.  Maybe this
    2376             :  *  will put an end to it.
    2377             :  *
    2378             :  *  NOTE: If you are using the timer driver, it is considered
    2379             :  *        mutually exclusive with the clock driver because the
    2380             :  *        drivers are assumed to use the same "timer" hardware
    2381             :  *        on many boards.
    2382             :  */
    2383             : #if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE)
    2384             :   #if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
    2385             :       !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \
    2386             :       !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER)
    2387             :     #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?"
    2388             :    #endif
    2389             : #endif
    2390             : 
    2391             : /*
    2392             :  *  These names have been obsoleted so make the user application stop compiling
    2393             :  */
    2394             : #if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
    2395             :     defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
    2396             :     defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
    2397             :     defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
    2398             :     defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
    2399             : #error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
    2400             : #endif
    2401             : 
    2402             : /*
    2403             :  *  Validate the configured maximum priority
    2404             :  */
    2405             : #if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \
    2406             :      (CONFIGURE_MAXIMUM_PRIORITY != 7) && \
    2407             :      (CONFIGURE_MAXIMUM_PRIORITY != 15) && \
    2408             :      (CONFIGURE_MAXIMUM_PRIORITY != 31) && \
    2409             :      (CONFIGURE_MAXIMUM_PRIORITY != 63) && \
    2410             :      (CONFIGURE_MAXIMUM_PRIORITY != 127) && \
    2411             :      (CONFIGURE_MAXIMUM_PRIORITY != 255))
    2412             :   #error "Maximum priority is not 1 less than a power of 2 between 4 and 256"
    2413             : #endif
    2414             : 
    2415             : #if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM)
    2416             :   #error "Maximum priority configured higher than supported by target."
    2417             : #endif
    2418             : 
    2419             : /*
    2420             :  *  If you have fewer POSIX Message Queue Descriptors than actual
    2421             :  *  POSIX Message Queues, then you will not be able to open all the
    2422             :  *  queues.
    2423             :  */
    2424             : #if (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS < \
    2425             :      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
    2426             :   #error "Fewer POSIX Message Queue descriptors than Queues!"
    2427             : #endif
    2428             : 
    2429             : #endif
    2430             : /* end of include file */

Generated by: LCOV version 1.14