source: rtems/cpukit/sapi/include/confdefs.h @ 0e98970

4.115
Last change on this file since 0e98970 was 0e98970, checked in by Sebastian Huber <sebastian.huber@…>, on 04/17/14 at 06:02:46

sapi: Fix CONFIGURE_UNLIMITED_OBJECTS

POSIX keys and key value pairs support now the unlimited option.

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