source: rtems/cpukit/sapi/include/confdefs.h @ 84e1742

4.115
Last change on this file since 84e1742 was 84e1742, checked in by Jennifer Averett <Jennifer.Averett@…>, on 11/18/11 at 20:04:49

2011-11-18 Jennifer Averett <Jennifer.Averett@…>

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