source: rtems/cpukit/include/rtems/confdefs.h @ dad79bb9

5
Last change on this file since dad79bb9 was 53b6484, checked in by Sebastian Huber <sebastian.huber@…>, on 02/05/18 at 08:57:45

termios: Remove obsolete configuration options

Update #2843.

  • Property mode set to 100755
File size: 109.7 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
13/*
14 *  COPYRIGHT (c) 1989-2015.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.org/license/LICENSE.
20 */
21
22#ifndef __CONFIGURATION_TEMPLATE_h
23#define __CONFIGURATION_TEMPLATE_h
24
25/*
26 * Include the executive's configuration
27 */
28#include <rtems.h>
29#include <rtems/ioimpl.h>
30#include <rtems/sysinit.h>
31#include <rtems/score/apimutex.h>
32#include <rtems/score/percpu.h>
33#include <rtems/score/userextimpl.h>
34#include <rtems/score/wkspace.h>
35
36#ifdef CONFIGURE_DISABLE_BSP_SETTINGS
37  #undef BSP_DEFAULT_UNIFIED_WORK_AREAS
38  #undef BSP_IDLE_TASK_BODY
39  #undef BSP_IDLE_TASK_STACK_SIZE
40  #undef BSP_INITIAL_EXTENSION
41  #undef BSP_INTERRUPT_STACK_SIZE
42  #undef BSP_MAXIMUM_DEVICES
43  #undef BSP_ZERO_WORKSPACE_AUTOMATICALLY
44  #undef CONFIGURE_BSP_PREREQUISITE_DRIVERS
45  #undef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
46#else
47  #include <bsp.h>
48#endif
49
50#ifdef RTEMS_NEWLIB
51  #include <sys/reent.h>
52#endif
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58/*
59 * Internal defines must be prefixed with _CONFIGURE to distinguish them from
60 * user-provided options which use a CONFIGURE prefix.
61 */
62
63/**
64 * @defgroup Configuration RTEMS Configuration
65 *
66 * This module contains all RTEMS Configuration parameters.
67 *
68 * The model is to estimate the memory required for each configured item
69 * and sum those estimates.  The estimate can be too high or too low for
70 * a variety of reasons:
71 *
72 * Reasons estimate is too high:
73 *   + FP contexts (not all tasks are FP)
74 *
75 * Reasons estimate is too low:
76 *   + stacks greater than minimum size
77 *   + messages
78 *   + application must account for device driver resources
79 *   + application must account for add-on library resource requirements
80 *
81 * NOTE:  Eventually this may be able to take into account some of
82 *        the above.  This procedure has evolved from just enough to
83 *        support the RTEMS Test Suites into something that can be
84 *        used remarkably reliably by most applications.
85 */
86
87/**
88 * This is the Classic API initialization tasks table.
89 */
90extern rtems_initialization_tasks_table Initialization_tasks[];
91
92#if defined(RTEMS_MULTIPROCESSING)
93  /**
94   * This it the distributed multiprocessing configuration table.
95   */
96  extern rtems_multiprocessing_table      Multiprocessing_configuration;
97#endif
98
99#ifdef RTEMS_POSIX_API
100  /**
101   * This it the POSIX API configuration table.
102   */
103  extern posix_api_configuration_table    Configuration_POSIX_API;
104#endif
105
106/**
107 * This macro determines whether the RTEMS reentrancy support for
108 * the Newlib C Library is enabled.
109 */
110#ifdef RTEMS_SCHEDSIM
111  #undef RTEMS_NEWLIB
112#endif
113
114#if (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
115  #define _CONFIGURE_NEWLIB_EXTENSION 1
116#else
117  #define _CONFIGURE_NEWLIB_EXTENSION 0
118#endif
119
120#ifndef RTEMS_SCHEDSIM
121#include <rtems/libio_.h>
122
123#ifdef CONFIGURE_INIT
124  #ifndef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
125    RTEMS_SYSINIT_ITEM(
126      rtems_filesystem_initialize,
127      RTEMS_SYSINIT_ROOT_FILESYSTEM,
128      RTEMS_SYSINIT_ORDER_MIDDLE
129    );
130  #endif
131#endif
132#endif
133
134/**
135 * This macro defines the number of POSIX file descriptors allocated
136 * and managed by libio.  These are the "integer" file descriptors that
137 * are used by calls like open(2) and read(2).
138 */
139#ifndef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
140  #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 3
141#endif
142
143/*
144 * POSIX key count used by the IO library.
145 */
146#define _CONFIGURE_LIBIO_POSIX_KEYS 1
147
148#ifdef CONFIGURE_INIT
149  rtems_libio_t rtems_libio_iops[CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS];
150
151  /**
152   * When instantiating the configuration tables, this variable is
153   * initialized to specify the maximum number of file descriptors.
154   */
155  const uint32_t rtems_libio_number_iops = RTEMS_ARRAY_SIZE(rtems_libio_iops);
156#endif
157
158/**
159 * This macro specifies the number of PTYs that can be concurrently
160 * active.
161 */
162#ifndef CONFIGURE_MAXIMUM_PTYS
163  #define CONFIGURE_MAXIMUM_PTYS 0
164#endif
165
166/**
167 * This variable contains the maximum number of PTYs that can be
168 * concurrently active.
169 */
170#ifdef CONFIGURE_INIT
171  int rtems_telnetd_maximum_ptys = CONFIGURE_MAXIMUM_PTYS;
172#else
173  extern int rtems_telnetd_maximum_ptys;
174#endif
175
176#ifdef CONFIGURE_SMP_MAXIMUM_PROCESSORS
177  #warning "CONFIGURE_SMP_MAXIMUM_PROCESSORS has been renamed to CONFIGURE_MAXIMUM_PROCESSORS since RTEMS 5.1"
178  #define CONFIGURE_MAXIMUM_PROCESSORS CONFIGURE_SMP_MAXIMUM_PROCESSORS
179#endif
180
181#ifndef CONFIGURE_MAXIMUM_PROCESSORS
182  #define CONFIGURE_MAXIMUM_PROCESSORS 1
183#endif
184
185/*
186 * An internal define to indicate that this is an SMP application
187 * configuration.
188 */
189#ifdef RTEMS_SMP
190  #if !defined(CONFIGURE_DISABLE_SMP_CONFIGURATION)
191    #define _CONFIGURE_SMP_APPLICATION
192  #elif CONFIGURE_MAXIMUM_PROCESSORS > 1
193    #error "CONFIGURE_DISABLE_SMP_CONFIGURATION and CONFIGURE_MAXIMUM_PROCESSORS > 1 makes no sense"
194  #endif
195#endif
196
197#ifdef CONFIGURE_SMP_APPLICATION
198  #warning "CONFIGURE_SMP_APPLICATION is obsolete since RTEMS 5.1"
199#endif
200
201/*
202 * This sets up the resources for the FIFOs/pipes.
203 */
204
205/**
206 * This is specified to configure the maximum number of POSIX FIFOs.
207 */
208#if !defined(CONFIGURE_MAXIMUM_FIFOS)
209  #define CONFIGURE_MAXIMUM_FIFOS 0
210#endif
211
212/**
213 * This is specified to configure the maximum number of POSIX named pipes.
214 */
215#if !defined(CONFIGURE_MAXIMUM_PIPES)
216  #define CONFIGURE_MAXIMUM_PIPES 0
217#endif
218
219/*
220 * This specifies the number of barriers required for the configured
221 * number of FIFOs and named pipes.
222 */
223#if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0
224  #define _CONFIGURE_BARRIERS_FOR_FIFOS \
225    (2 * (CONFIGURE_MAXIMUM_FIFOS + CONFIGURE_MAXIMUM_PIPES))
226#else
227  #define _CONFIGURE_BARRIERS_FOR_FIFOS   0
228#endif
229
230/**
231 *  @defgroup ConfigFilesystems Filesystems and Mount Table Configuration
232 *
233 *  @ingroup Configuration
234 *
235 *  Defines to control the file system:
236 *
237 *   - CONFIGURE_APPLICATION_DISABLE_FILESYSTEM:
238 *     Disable the RTEMS filesystems. You get an empty DEVFS.
239 *
240 *   - CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM:
241 *     Use the DEVFS as the root file system. Limited functions are
242 *     provided when this is used.
243 *
244 *   - CONFIGURE_FILESYSTEM_ALL:
245 *     Add file filesystems to the default filesystem table.
246 *
247 *   List of available file systems. You can define as many as you like:
248 *     - CONFIGURE_FILESYSTEM_IMFS   - In Memory File System (IMFS)
249 *     - CONFIGURE_FILESYSTEM_DEVFS  - Device File System (DSVFS)
250 *     - CONFIGURE_FILESYSTEM_TFTPFS - TFTP File System, networking enabled
251 *     - CONFIGURE_FILESYSTEM_FTPFS  - FTP File System, networking enabled
252 *     - CONFIGURE_FILESYSTEM_NFS    - Network File System, networking enabled
253 *     - CONFIGURE_FILESYSTEM_DOSFS  - DOS File System, uses libblock
254 *     - CONFIGURE_FILESYSTEM_RFS    - RTEMS File System (RFS), uses libblock
255 *     - CONFIGURE_FILESYSTEM_JFFS2  - Journalling Flash File System, Version 2
256 *
257 *   Combinations:
258 *
259 *    - If nothing is defined the base file system is the IMFS.
260 *
261 *    - If CONFIGURE_APPLICATION_DISABLE_FILESYSTEM is defined all filesystems
262 *      are disabled by force.
263 *
264 *    - If CONFIGURE_USE_DEV_AS_BASE_FILESYSTEM is defined all filesystems
265 *      are disabled by force and DEVFS is defined.
266 */
267/**@{*/
268
269#ifdef CONFIGURE_INIT
270
271  /*
272   * Include all file systems. Do this before checking if the filesystem has
273   * been disabled.
274   */
275  #ifdef CONFIGURE_FILESYSTEM_ALL
276    #define CONFIGURE_FILESYSTEM_IMFS
277    #define CONFIGURE_FILESYSTEM_DEVFS
278    #define CONFIGURE_FILESYSTEM_TFTPFS
279    #define CONFIGURE_FILESYSTEM_FTPFS
280    #define CONFIGURE_FILESYSTEM_NFS
281    #define CONFIGURE_FILESYSTEM_DOSFS
282    #define CONFIGURE_FILESYSTEM_RFS
283    #define CONFIGURE_FILESYSTEM_JFFS2
284  #endif
285
286  /*
287   * If disabling the file system, give a compile error if the user has
288   * configured other filesystem parameters.
289   */
290  #if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
291     #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
292       #error "Filesystem disabled and a base filesystem configured."
293     #endif
294
295     #if defined(CONFIGURE_FILESYSTEM_IMFS) || \
296       defined(CONFIGURE_FILESYSTEM_DEVFS) || \
297       defined(CONFIGURE_FILESYSTEM_TFTPFS) || \
298       defined(CONFIGURE_FILESYSTEM_FTPFS) || \
299       defined(CONFIGURE_FILESYSTEM_NFS) || \
300       defined(CONFIGURE_FILESYSTEM_DOSFS) || \
301       defined(CONFIGURE_FILESYSTEM_RFS) || \
302       defined(CONFIGURE_FILESYSTEM_JFFS2)
303       #error "Filesystem disabled and a filesystem configured."
304     #endif
305  #endif
306
307  /*
308   * If the base filesystem is DEVFS define it else define IMFS.
309   * We will have either DEVFS or IMFS defined after this.
310   */
311  #if !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
312    #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
313      #define CONFIGURE_FILESYSTEM_DEVFS
314    #endif
315  #endif
316
317#endif
318
319#ifndef RTEMS_SCHEDSIM
320/**
321 * IMFS
322 */
323#include <rtems/imfs.h>
324
325/**
326 * This specifies the number of bytes per block for files within the IMFS.
327 * There are a maximum number of blocks per file so this dictates the maximum
328 * size of a file.  This has to be balanced with the unused portion of each
329 * block that might be wasted.
330 */
331#ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK
332  #define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK \
333                    IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK
334#endif
335
336/**
337 * This defines the IMFS file system table entry.
338 */
339#if !defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS) && \
340  defined(CONFIGURE_FILESYSTEM_IMFS)
341  #define CONFIGURE_FILESYSTEM_ENTRY_IMFS \
342    { RTEMS_FILESYSTEM_TYPE_IMFS, IMFS_initialize }
343#endif
344#endif
345
346#ifdef CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
347  #define CONFIGURE_IMFS_DISABLE_CHMOD
348  #define CONFIGURE_IMFS_DISABLE_CHOWN
349  #define CONFIGURE_IMFS_DISABLE_UTIME
350  #define CONFIGURE_IMFS_DISABLE_LINK
351  #define CONFIGURE_IMFS_DISABLE_SYMLINK
352  #define CONFIGURE_IMFS_DISABLE_READLINK
353  #define CONFIGURE_IMFS_DISABLE_RENAME
354  #define CONFIGURE_IMFS_DISABLE_UNMOUNT
355#endif
356
357/**
358 * DEVFS
359 */
360#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS) && \
361    defined(CONFIGURE_FILESYSTEM_DEVFS)
362#include <rtems/devfs.h>
363  #define CONFIGURE_FILESYSTEM_ENTRY_DEVFS \
364    { RTEMS_FILESYSTEM_TYPE_DEVFS, devFS_initialize }
365#endif
366
367/**
368 * FTPFS
369 */
370#if !defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS) && \
371    defined(CONFIGURE_FILESYSTEM_FTPFS)
372  #include <rtems/ftpfs.h>
373  #define CONFIGURE_FILESYSTEM_ENTRY_FTPFS \
374    { RTEMS_FILESYSTEM_TYPE_FTPFS, rtems_ftpfs_initialize }
375#endif
376
377/**
378 * TFTPFS
379 */
380#if !defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS) && \
381    defined(CONFIGURE_FILESYSTEM_TFTPFS)
382  #include <rtems/tftp.h>
383  #define CONFIGURE_FILESYSTEM_ENTRY_TFTPFS \
384    { RTEMS_FILESYSTEM_TYPE_TFTPFS, rtems_tftpfs_initialize }
385#endif
386
387/**
388 * NFS
389 */
390#if !defined(CONFIGURE_FILESYSTEM_ENTRY_NFS) && \
391    defined(CONFIGURE_FILESYSTEM_NFS)
392  #include <librtemsNfs.h>
393  #define CONFIGURE_FILESYSTEM_ENTRY_NFS \
394    { RTEMS_FILESYSTEM_TYPE_NFS, rtems_nfs_initialize }
395#endif
396
397/**
398 * DOSFS
399 */
400#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS) && \
401    defined(CONFIGURE_FILESYSTEM_DOSFS)
402  #include <rtems/dosfs.h>
403  #define CONFIGURE_FILESYSTEM_ENTRY_DOSFS \
404    { RTEMS_FILESYSTEM_TYPE_DOSFS, rtems_dosfs_initialize }
405#endif
406
407/**
408 * RFS
409 */
410#if !defined(CONFIGURE_FILESYSTEM_ENTRY_RFS) && \
411    defined(CONFIGURE_FILESYSTEM_RFS)
412  #include <rtems/rtems-rfs.h>
413  #define CONFIGURE_FILESYSTEM_ENTRY_RFS \
414    { RTEMS_FILESYSTEM_TYPE_RFS, rtems_rfs_rtems_initialise }
415#endif
416
417/**
418 * JFFS2
419 */
420#if !defined(CONFIGURE_FILESYSTEM_ENTRY_JFFS2) && \
421    defined(CONFIGURE_FILESYSTEM_JFFS2)
422  #include <rtems/jffs2.h>
423  #define CONFIGURE_FILESYSTEM_ENTRY_JFFS2 \
424    { RTEMS_FILESYSTEM_TYPE_JFFS2, rtems_jffs2_initialize }
425#endif
426
427#ifdef CONFIGURE_INIT
428
429  /**
430   * DEVFS variables.
431   *
432   * The number of individual devices that may be registered
433   * in the system or the CONFIGURE_MAXIMUM_DEVICES variable
434   * is defaulted to 4 when a filesystem is enabled, unless
435   * the bsp overwrides this.  In which case the value is set
436   * to BSP_MAXIMUM_DEVICES.
437   */
438  #ifdef CONFIGURE_FILESYSTEM_DEVFS
439    #ifndef CONFIGURE_MAXIMUM_DEVICES
440      #if defined(BSP_MAXIMUM_DEVICES)
441        #define CONFIGURE_MAXIMUM_DEVICES BSP_MAXIMUM_DEVICES
442      #else
443        #define CONFIGURE_MAXIMUM_DEVICES 4
444      #endif
445    #endif
446    #include <rtems/devfs.h>
447  #endif
448
449  /**
450   * Table termination record.
451   */
452  #define CONFIGURE_FILESYSTEM_NULL { NULL, NULL }
453
454#ifndef RTEMS_SCHEDSIM
455  #if !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) && \
456    !defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
457    int imfs_rq_memfile_bytes_per_block =
458      CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
459  #endif
460
461  /**
462   * The default file system table. Must be terminated with the NULL entry if
463   * you provide your own.
464   */
465  #if !defined(CONFIGURE_HAS_OWN_FILESYSTEM_TABLE) && \
466    !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
467    const rtems_filesystem_table_t rtems_filesystem_table[] = {
468      #if !defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
469        { "/", IMFS_initialize_support },
470      #endif
471      #if defined(CONFIGURE_FILESYSTEM_IMFS) && \
472          defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS)
473        CONFIGURE_FILESYSTEM_ENTRY_IMFS,
474      #endif
475      #if defined(CONFIGURE_FILESYSTEM_DEVFS) && \
476          defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS)
477        CONFIGURE_FILESYSTEM_ENTRY_DEVFS,
478      #endif
479      #if defined(CONFIGURE_FILESYSTEM_TFTPFS) && \
480          defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS)
481        CONFIGURE_FILESYSTEM_ENTRY_TFTPFS,
482      #endif
483      #if defined(CONFIGURE_FILESYSTEM_FTPFS) && \
484          defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS)
485        CONFIGURE_FILESYSTEM_ENTRY_FTPFS,
486      #endif
487      #if defined(CONFIGURE_FILESYSTEM_NFS) && \
488          defined(CONFIGURE_FILESYSTEM_ENTRY_NFS)
489        CONFIGURE_FILESYSTEM_ENTRY_NFS,
490      #endif
491      #if defined(CONFIGURE_FILESYSTEM_DOSFS) && \
492          defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS)
493        CONFIGURE_FILESYSTEM_ENTRY_DOSFS,
494      #endif
495      #if defined(CONFIGURE_FILESYSTEM_RFS) && \
496          defined(CONFIGURE_FILESYSTEM_ENTRY_RFS)
497        CONFIGURE_FILESYSTEM_ENTRY_RFS,
498      #endif
499      #if defined(CONFIGURE_FILESYSTEM_JFFS2) && \
500          defined(CONFIGURE_FILESYSTEM_ENTRY_JFFS2)
501        CONFIGURE_FILESYSTEM_ENTRY_JFFS2,
502      #endif
503      CONFIGURE_FILESYSTEM_NULL
504    };
505  #endif
506
507  #if !defined(CONFIGURE_HAS_OWN_MOUNT_TABLE) && \
508    !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
509    #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
510      static devFS_node devFS_root_filesystem_nodes [CONFIGURE_MAXIMUM_DEVICES];
511      static const devFS_data devFS_root_filesystem_data = {
512        devFS_root_filesystem_nodes,
513        CONFIGURE_MAXIMUM_DEVICES
514      };
515    #else
516      static IMFS_fs_info_t _Configure_IMFS_fs_info;
517
518      static const rtems_filesystem_operations_table _Configure_IMFS_ops = {
519        rtems_filesystem_default_lock,
520        rtems_filesystem_default_unlock,
521        IMFS_eval_path,
522        #ifdef CONFIGURE_IMFS_DISABLE_LINK
523          rtems_filesystem_default_link,
524        #else
525          IMFS_link,
526        #endif
527        rtems_filesystem_default_are_nodes_equal,
528        #ifdef CONFIGURE_IMFS_DISABLE_MKNOD
529          rtems_filesystem_default_mknod,
530        #else
531          IMFS_mknod,
532        #endif
533        #ifdef CONFIGURE_IMFS_DISABLE_RMNOD
534          rtems_filesystem_default_rmnod,
535        #else
536          IMFS_rmnod,
537        #endif
538        #ifdef CONFIGURE_IMFS_DISABLE_CHMOD
539          rtems_filesystem_default_fchmod,
540        #else
541          IMFS_fchmod,
542        #endif
543        #ifdef CONFIGURE_IMFS_DISABLE_CHOWN
544          rtems_filesystem_default_chown,
545        #else
546          IMFS_chown,
547        #endif
548        IMFS_node_clone,
549        IMFS_node_free,
550        #ifdef CONFIGURE_IMFS_DISABLE_MOUNT
551          rtems_filesystem_default_mount,
552        #else
553          IMFS_mount,
554        #endif
555        #ifdef CONFIGURE_IMFS_DISABLE_UNMOUNT
556          rtems_filesystem_default_unmount,
557        #else
558          IMFS_unmount,
559        #endif
560        rtems_filesystem_default_fsunmount,
561        #ifdef CONFIGURE_IMFS_DISABLE_UTIME
562          rtems_filesystem_default_utime,
563        #else
564          IMFS_utime,
565        #endif
566        #ifdef CONFIGURE_IMFS_DISABLE_SYMLINK
567          rtems_filesystem_default_symlink,
568        #else
569          IMFS_symlink,
570        #endif
571        #ifdef CONFIGURE_IMFS_DISABLE_READLINK
572          rtems_filesystem_default_readlink,
573        #else
574          IMFS_readlink,
575        #endif
576        #ifdef CONFIGURE_IMFS_DISABLE_RENAME
577          rtems_filesystem_default_rename,
578        #else
579          IMFS_rename,
580        #endif
581        rtems_filesystem_default_statvfs
582      };
583
584      static const IMFS_mknod_controls _Configure_IMFS_mknod_controls = {
585        #ifdef CONFIGURE_IMFS_DISABLE_READDIR
586          &IMFS_mknod_control_dir_minimal,
587        #else
588          &IMFS_mknod_control_dir_default,
589        #endif
590        &IMFS_mknod_control_device,
591        #ifdef CONFIGURE_IMFS_DISABLE_MKNOD_FILE
592          &IMFS_mknod_control_enosys,
593        #else
594          &IMFS_mknod_control_memfile,
595        #endif
596        #if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0
597          &IMFS_mknod_control_fifo
598        #else
599          &IMFS_mknod_control_enosys
600        #endif
601      };
602
603      static const IMFS_mount_data _Configure_IMFS_mount_data = {
604        &_Configure_IMFS_fs_info,
605        &_Configure_IMFS_ops,
606        &_Configure_IMFS_mknod_controls
607      };
608    #endif
609
610    const rtems_filesystem_mount_configuration
611      rtems_filesystem_root_configuration = {
612      NULL,
613      NULL,
614      #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
615        RTEMS_FILESYSTEM_TYPE_DEVFS,
616      #else
617        "/",
618      #endif
619      RTEMS_FILESYSTEM_READ_WRITE,
620      #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
621        &devFS_root_filesystem_data
622      #else
623        &_Configure_IMFS_mount_data
624      #endif
625    };
626  #endif
627
628#endif
629#endif
630/**@}*/ /* end of file system group */
631
632/*
633 *  STACK_CHECKER_ON was still available in 4.9 so give a warning for now.
634 */
635#if defined(STACK_CHECKER_ON)
636  #define CONFIGURE_STACK_CHECKER_ENABLED
637  #warning "STACK_CHECKER_ON deprecated -- use CONFIGURE_STACK_CHECKER_ENABLED"
638#endif
639
640/**
641 * This configures the stack checker user extension.
642 */
643#ifdef CONFIGURE_STACK_CHECKER_ENABLED
644  #define _CONFIGURE_STACK_CHECKER_EXTENSION 1
645#else
646  #define _CONFIGURE_STACK_CHECKER_EXTENSION 0
647#endif
648
649/**
650 * @brief Maximum priority configuration.
651 *
652 * This configures the maximum priority value that
653 * a task may have.
654 *
655 * The following applies to the data space requirements
656 * of the Priority Scheduler.
657 *
658 * By reducing the number of priorities in a system,
659 * the amount of RAM required by RTEMS can be significantly
660 * reduced.  RTEMS allocates a Chain_Control structure per
661 * priority and this structure contains 3 pointers.  So
662 * the default is (256 * 12) = 3K on 32-bit architectures.
663 *
664 * This must be one less than a power of 2 between
665 * 4 and 256.  Valid values along with the application
666 * priority levels and memory saved when pointers are
667 * 32-bits in size are:
668 *
669 *   + 3,  2 application priorities, 3024 bytes saved
670 *   + 7, 5 application priorities, 2976 bytes saved
671 *   + 15, 13 application priorities, 2880 bytes saved
672 *   + 31, 29 application priorities, 2688 bytes saved
673 *   + 63, 61 application priorities, 2304 bytes saved
674 *   + 127, 125 application priorities, 1536 bytes saved
675 *   + 255, 253 application priorities, 0 bytes saved
676 *
677 * It is specified in terms of Classic API priority values.
678 */
679#ifndef CONFIGURE_MAXIMUM_PRIORITY
680  #define CONFIGURE_MAXIMUM_PRIORITY PRIORITY_DEFAULT_MAXIMUM
681#endif
682
683/**
684 *  @defgroup ConfigScheduler Scheduler configuration
685 *
686 *  @ingroup Configuration
687 *
688 * The scheduler configuration allows an application to select the
689 * scheduling policy to use.  The supported configurations are:
690 *
691 *  - CONFIGURE_SCHEDULER_PRIORITY - Deterministic Priority Scheduler
692 *  - CONFIGURE_SCHEDULER_PRIORITY_SMP - Deterministic Priority SMP Scheduler
693 *  - CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP - Deterministic
694 *    Priority SMP Affinity Scheduler
695 *  - CONFIGURE_SCHEDULER_STRONG_APA - Strong APA Scheduler
696 *  - CONFIGURE_SCHEDULER_SIMPLE - Light-weight Priority Scheduler
697 *  - CONFIGURE_SCHEDULER_SIMPLE_SMP - Simple SMP Priority Scheduler
698 *  - CONFIGURE_SCHEDULER_EDF - EDF Scheduler
699 *  - CONFIGURE_SCHEDULER_EDF_SMP - EDF SMP Scheduler
700 *  - CONFIGURE_SCHEDULER_CBS - CBS Scheduler
701 *  - CONFIGURE_SCHEDULER_USER  - user provided scheduler
702 *
703 * If no configuration is specified by the application in a uniprocessor
704 * configuration, then CONFIGURE_SCHEDULER_PRIORITY is the default.
705 *
706 * If no configuration is specified by the application in SMP
707 * configuration, then CONFIGURE_SCHEDULER_PRIORITY_SMP is the default.
708 *
709 * An application can define its own scheduling policy by defining
710 * CONFIGURE_SCHEDULER_USER and the following:
711 *
712 *    - CONFIGURE_SCHEDULER_CONTEXT
713 *    - CONFIGURE_SCHEDULER_CONTROLS
714 *    - CONFIGURE_SCHEDULER_USER_PER_THREAD
715 */
716
717#if !defined(CONFIGURE_SCHEDULER_USER) && \
718    !defined(CONFIGURE_SCHEDULER_PRIORITY) && \
719    !defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) && \
720    !defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) && \
721    !defined(CONFIGURE_SCHEDULER_STRONG_APA) && \
722    !defined(CONFIGURE_SCHEDULER_SIMPLE) && \
723    !defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) && \
724    !defined(CONFIGURE_SCHEDULER_EDF) && \
725    !defined(CONFIGURE_SCHEDULER_EDF_SMP) && \
726    !defined(CONFIGURE_SCHEDULER_CBS)
727  #if defined(RTEMS_SMP) && CONFIGURE_MAXIMUM_PROCESSORS > 1
728    /**
729     * If no scheduler is specified in an SMP configuration, the
730     * EDF scheduler is default.
731     */
732    #define CONFIGURE_SCHEDULER_EDF_SMP
733  #else
734    /**
735     * If no scheduler is specified in a uniprocessor configuration, the
736     * priority scheduler is default.
737     */
738    #define CONFIGURE_SCHEDULER_PRIORITY
739  #endif
740#endif
741
742#include <rtems/scheduler.h>
743
744/*
745 * If the Priority Scheduler is selected, then configure for it.
746 */
747#if defined(CONFIGURE_SCHEDULER_PRIORITY)
748  #if !defined(CONFIGURE_SCHEDULER_NAME)
749    /** Configure the name of the scheduler instance */
750    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'D', ' ')
751  #endif
752
753  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
754    /** Configure the context needed by the scheduler instance */
755    #define CONFIGURE_SCHEDULER_CONTEXT \
756      RTEMS_SCHEDULER_CONTEXT_PRIORITY( \
757        dflt, \
758        CONFIGURE_MAXIMUM_PRIORITY + 1 \
759      )
760
761    /** Configure the controls for this scheduler instance */
762    #define CONFIGURE_SCHEDULER_CONTROLS \
763      RTEMS_SCHEDULER_CONTROL_PRIORITY(dflt, CONFIGURE_SCHEDULER_NAME)
764  #endif
765#endif
766
767/*
768 * If the Deterministic Priority SMP Scheduler is selected, then configure for
769 * it.
770 */
771#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
772  #if !defined(CONFIGURE_SCHEDULER_NAME)
773    /** Configure the name of the scheduler instance */
774    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'D', ' ')
775  #endif
776
777  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
778    /** Configure the context needed by the scheduler instance */
779    #define CONFIGURE_SCHEDULER_CONTEXT \
780      RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( \
781        dflt, \
782        CONFIGURE_MAXIMUM_PRIORITY + 1 \
783      )
784
785    /** Configure the controls for this scheduler instance */
786    #define CONFIGURE_SCHEDULER_CONTROLS \
787      RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(dflt, CONFIGURE_SCHEDULER_NAME)
788  #endif
789#endif
790
791/*
792 * If the Deterministic Priority Affinity SMP Scheduler is selected, then configure for
793 * it.
794 */
795#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP)
796  #if !defined(CONFIGURE_SCHEDULER_NAME)
797    /** Configure the name of the scheduler instance */
798    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'A', ' ')
799  #endif
800
801  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
802    /** Configure the context needed by the scheduler instance */
803    #define CONFIGURE_SCHEDULER_CONTEXT \
804      RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( \
805        dflt, \
806        CONFIGURE_MAXIMUM_PRIORITY + 1 \
807      )
808
809    /** Configure the controls for this scheduler instance */
810    #define CONFIGURE_SCHEDULER_CONTROLS \
811      RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( \
812        dflt, \
813        CONFIGURE_SCHEDULER_NAME \
814      )
815  #endif
816#endif
817
818/*
819 * If the Strong APA Scheduler is selected, then configure for
820 * it.
821 */
822#if defined(CONFIGURE_SCHEDULER_STRONG_APA)
823  #if !defined(CONFIGURE_SCHEDULER_NAME)
824    /** Configure the name of the scheduler instance */
825    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'A', 'P', 'A')
826  #endif
827
828  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
829    /** Configure the context needed by the scheduler instance */
830    #define CONFIGURE_SCHEDULER_CONTEXT \
831      RTEMS_SCHEDULER_CONTEXT_STRONG_APA( \
832        dflt, \
833        CONFIGURE_MAXIMUM_PRIORITY + 1 \
834      )
835
836    /** Configure the controls for this scheduler instance */
837    #define CONFIGURE_SCHEDULER_CONTROLS \
838      RTEMS_SCHEDULER_CONTROL_STRONG_APA(dflt, CONFIGURE_SCHEDULER_NAME)
839  #endif
840#endif
841
842/*
843 * If the Simple Priority Scheduler is selected, then configure for it.
844 */
845#if defined(CONFIGURE_SCHEDULER_SIMPLE)
846  #if !defined(CONFIGURE_SCHEDULER_NAME)
847    /** Configure the name of the scheduler instance */
848    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'S', ' ')
849  #endif
850
851  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
852    /** Configure the context needed by the scheduler instance */
853    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_SIMPLE(dflt)
854
855    /** Configure the controls for this scheduler instance */
856    #define CONFIGURE_SCHEDULER_CONTROLS \
857      RTEMS_SCHEDULER_CONTROL_SIMPLE(dflt, CONFIGURE_SCHEDULER_NAME)
858  #endif
859#endif
860
861/*
862 * If the Simple SMP Priority Scheduler is selected, then configure for it.
863 */
864#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP)
865  #if !defined(CONFIGURE_SCHEDULER_NAME)
866    /** Configure the name of the scheduler instance */
867    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'S', ' ')
868  #endif
869
870  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
871    /** Configure the context needed by the scheduler instance */
872    #define CONFIGURE_SCHEDULER_CONTEXT \
873      RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(dflt)
874
875    /** Configure the controls for this scheduler instance */
876    #define CONFIGURE_SCHEDULER_CONTROLS \
877      RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(dflt, CONFIGURE_SCHEDULER_NAME)
878  #endif
879#endif
880
881/*
882 * If the EDF Scheduler is selected, then configure for it.
883 */
884#if defined(CONFIGURE_SCHEDULER_EDF)
885  #if !defined(CONFIGURE_SCHEDULER_NAME)
886    /** Configure the name of the scheduler instance */
887    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'E', 'D', 'F')
888  #endif
889
890  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
891    /** Configure the context needed by the scheduler instance */
892    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_EDF(dflt)
893
894    /** Configure the controls for this scheduler instance */
895    #define CONFIGURE_SCHEDULER_CONTROLS \
896      RTEMS_SCHEDULER_CONTROL_EDF(dflt, CONFIGURE_SCHEDULER_NAME)
897  #endif
898#endif
899
900/*
901 * If the EDF SMP Scheduler is selected, then configure for it.
902 */
903#if defined(CONFIGURE_SCHEDULER_EDF_SMP)
904  #if !defined(CONFIGURE_SCHEDULER_NAME)
905    /** Configure the name of the scheduler instance */
906    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'E', 'D', 'F')
907  #endif
908
909  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
910    /** Configure the context needed by the scheduler instance */
911    #define CONFIGURE_SCHEDULER_CONTEXT \
912      RTEMS_SCHEDULER_CONTEXT_EDF_SMP(dflt, CONFIGURE_MAXIMUM_PROCESSORS)
913
914    /** Configure the controls for this scheduler instance */
915    #define CONFIGURE_SCHEDULER_CONTROLS \
916      RTEMS_SCHEDULER_CONTROL_EDF_SMP(dflt, CONFIGURE_SCHEDULER_NAME)
917  #endif
918#endif
919
920/*
921 * If the CBS Scheduler is selected, then configure for it.
922 */
923#if defined(CONFIGURE_SCHEDULER_CBS)
924  #if !defined(CONFIGURE_SCHEDULER_NAME)
925    /** Configure the name of the scheduler instance */
926    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'C', 'B', 'S')
927  #endif
928
929  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
930    /** Configure the context needed by the scheduler instance */
931    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_CBS(dflt)
932
933    /** Configure the controls for this scheduler instance */
934    #define CONFIGURE_SCHEDULER_CONTROLS \
935      RTEMS_SCHEDULER_CONTROL_CBS(dflt, CONFIGURE_SCHEDULER_NAME)
936  #endif
937
938  #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
939    #define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS
940  #endif
941
942  #ifdef CONFIGURE_INIT
943    const uint32_t _Scheduler_CBS_Maximum_servers =
944      CONFIGURE_CBS_MAXIMUM_SERVERS;
945
946    Scheduler_CBS_Server
947      _Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ];
948  #endif
949#endif
950
951/*
952 * Set up the scheduler entry points table.  The scheduling code uses
953 * this code to know which scheduler is configured by the user.
954 */
955#ifdef CONFIGURE_INIT
956  #if defined(CONFIGURE_SCHEDULER_CONTEXT)
957    CONFIGURE_SCHEDULER_CONTEXT;
958  #endif
959
960  const Scheduler_Control _Scheduler_Table[] = {
961    CONFIGURE_SCHEDULER_CONTROLS
962  };
963
964  #define CONFIGURE_SCHEDULER_COUNT RTEMS_ARRAY_SIZE( _Scheduler_Table )
965
966  #if defined(RTEMS_SMP)
967    const size_t _Scheduler_Count = CONFIGURE_SCHEDULER_COUNT;
968
969    const Scheduler_Assignment _Scheduler_Initial_assignments[] = {
970      #if defined(CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS)
971        CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS
972      #else
973        #define _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT \
974          RTEMS_SCHEDULER_ASSIGN( \
975            0, \
976            RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \
977          )
978        _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
979        #if CONFIGURE_MAXIMUM_PROCESSORS >= 2
980          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
981        #endif
982        #if CONFIGURE_MAXIMUM_PROCESSORS >= 3
983          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
984        #endif
985        #if CONFIGURE_MAXIMUM_PROCESSORS >= 4
986          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
987        #endif
988        #if CONFIGURE_MAXIMUM_PROCESSORS >= 5
989          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
990        #endif
991        #if CONFIGURE_MAXIMUM_PROCESSORS >= 6
992          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
993        #endif
994        #if CONFIGURE_MAXIMUM_PROCESSORS >= 7
995          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
996        #endif
997        #if CONFIGURE_MAXIMUM_PROCESSORS >= 8
998          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
999        #endif
1000        #if CONFIGURE_MAXIMUM_PROCESSORS >= 9
1001          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1002        #endif
1003        #if CONFIGURE_MAXIMUM_PROCESSORS >= 10
1004          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1005        #endif
1006        #if CONFIGURE_MAXIMUM_PROCESSORS >= 11
1007          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1008        #endif
1009        #if CONFIGURE_MAXIMUM_PROCESSORS >= 12
1010          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1011        #endif
1012        #if CONFIGURE_MAXIMUM_PROCESSORS >= 13
1013          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1014        #endif
1015        #if CONFIGURE_MAXIMUM_PROCESSORS >= 14
1016          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1017        #endif
1018        #if CONFIGURE_MAXIMUM_PROCESSORS >= 15
1019          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1020        #endif
1021        #if CONFIGURE_MAXIMUM_PROCESSORS >= 16
1022          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1023        #endif
1024        #if CONFIGURE_MAXIMUM_PROCESSORS >= 17
1025          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1026        #endif
1027        #if CONFIGURE_MAXIMUM_PROCESSORS >= 18
1028          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1029        #endif
1030        #if CONFIGURE_MAXIMUM_PROCESSORS >= 19
1031          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1032        #endif
1033        #if CONFIGURE_MAXIMUM_PROCESSORS >= 20
1034          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1035        #endif
1036        #if CONFIGURE_MAXIMUM_PROCESSORS >= 21
1037          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1038        #endif
1039        #if CONFIGURE_MAXIMUM_PROCESSORS >= 22
1040          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1041        #endif
1042        #if CONFIGURE_MAXIMUM_PROCESSORS >= 23
1043          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1044        #endif
1045        #if CONFIGURE_MAXIMUM_PROCESSORS >= 24
1046          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1047        #endif
1048        #if CONFIGURE_MAXIMUM_PROCESSORS >= 25
1049          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1050        #endif
1051        #if CONFIGURE_MAXIMUM_PROCESSORS >= 26
1052          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1053        #endif
1054        #if CONFIGURE_MAXIMUM_PROCESSORS >= 27
1055          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1056        #endif
1057        #if CONFIGURE_MAXIMUM_PROCESSORS >= 28
1058          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1059        #endif
1060        #if CONFIGURE_MAXIMUM_PROCESSORS >= 29
1061          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1062        #endif
1063        #if CONFIGURE_MAXIMUM_PROCESSORS >= 30
1064          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1065        #endif
1066        #if CONFIGURE_MAXIMUM_PROCESSORS >= 31
1067          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1068        #endif
1069        #if CONFIGURE_MAXIMUM_PROCESSORS >= 32
1070          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1071        #endif
1072        #undef _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1073      #endif
1074    };
1075
1076    RTEMS_STATIC_ASSERT(
1077      CONFIGURE_MAXIMUM_PROCESSORS
1078        == RTEMS_ARRAY_SIZE( _Scheduler_Initial_assignments ),
1079      _Scheduler_Initial_assignments
1080    );
1081  #endif
1082#endif
1083/**@}*/ /* end of Scheduler Configuration */
1084
1085/**
1086 * @defgroup ConfigurationIdle IDLE Thread Configuration
1087 *
1088 * @addtogroup Configuration
1089 *
1090 * This module contains configuration parameters related to the
1091 * set of IDLE threads. On a uniprocessor system, there is one
1092 * IDLE thread. On an SMP system, there is one for each core.
1093 */
1094
1095/*
1096 *  If you said the IDLE task was going to do application initialization
1097 *  and didn't override the IDLE body, then something is amiss.
1098 */
1099#if (defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
1100     !defined(CONFIGURE_IDLE_TASK_BODY))
1101  #error "CONFIGURE_ERROR: You did not override the IDLE task body."
1102#endif
1103
1104/**
1105 * @brief Idle task body configuration.
1106 *
1107 * There is a default IDLE thread body provided by RTEMS which
1108 * has the possibility of being CPU specific.  There may be a
1109 * BSP specific override of the RTEMS default body and in turn,
1110 * the application may override and provide its own.
1111 */
1112#ifndef CONFIGURE_IDLE_TASK_BODY
1113  #if defined(BSP_IDLE_TASK_BODY)
1114    #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
1115  #elif (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
1116    #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
1117  #else
1118    /* only instantiate and compile if used */
1119    #ifdef CONFIGURE_INIT
1120      void *_Thread_Idle_body(uintptr_t ignored)
1121      {
1122        for( ; ; ) ;
1123        return 0;   /* to avoid warning */
1124      }
1125    #endif
1126    #define CONFIGURE_IDLE_TASK_BODY _Thread_Idle_body
1127  #endif
1128#endif
1129/**@}*/ /* end of IDLE thread configuration */
1130
1131/**
1132 * @defgroup ConfigurationStackSize Configuration Thread Stack Size
1133 *
1134 * @addtogroup Configuration
1135 *
1136 * This module contains parameters related to thread aand interrupt stacks.
1137 */
1138
1139/**
1140 * By default, use the minimum stack size requested by this port.
1141 */
1142#ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE
1143  #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
1144#endif
1145
1146/**
1147 * This specifies the default POSIX thread stack size. By default, it is
1148 * twice that recommended for the port.
1149 */
1150#define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \
1151  (2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1152
1153/**
1154 * @brief Idle task stack size configuration.
1155 *
1156 * By default, the IDLE task will have a stack of minimum size.
1157 * The BSP or application may override this value.
1158 */
1159#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
1160  #ifdef BSP_IDLE_TASK_STACK_SIZE
1161    #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
1162  #else
1163    #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
1164  #endif
1165#endif
1166#if CONFIGURE_IDLE_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE
1167  #error "CONFIGURE_IDLE_TASK_STACK_SIZE less than CONFIGURE_MINIMUM_TASK_STACK_SIZE"
1168#endif
1169
1170/**
1171 * @brief Interrupt stack size configuration.
1172 *
1173 * By default, the interrupt stack will be of minimum size.
1174 * The BSP or application may override this value.
1175 */
1176#ifndef CONFIGURE_INTERRUPT_STACK_SIZE
1177  #ifdef BSP_INTERRUPT_STACK_SIZE
1178    #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
1179  #else
1180    #define CONFIGURE_INTERRUPT_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
1181  #endif
1182#endif
1183
1184/**
1185 * This reserves memory for the interrupt stack if it is to be allocated
1186 * by RTEMS rather than the BSP.
1187 *
1188 * @todo Try to get to the point where all BSPs support allocating the
1189 *       memory from the Workspace.
1190 */
1191#if (CPU_ALLOCATE_INTERRUPT_STACK == 0)
1192  #define _CONFIGURE_INTERRUPT_STACK_MEMORY 0
1193#else
1194  #define _CONFIGURE_INTERRUPT_STACK_MEMORY \
1195     _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE )
1196#endif
1197
1198/**
1199 * Configure the very much optional task stack allocator initialization
1200 */
1201#ifndef CONFIGURE_TASK_STACK_ALLOCATOR_INIT
1202  #define CONFIGURE_TASK_STACK_ALLOCATOR_INIT NULL
1203#endif
1204
1205/*
1206 *  Configure the very much optional task stack allocator and deallocator.
1207 */
1208#if !defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
1209  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
1210  /**
1211   * This specifies the task stack allocator method.
1212   */
1213  #define CONFIGURE_TASK_STACK_ALLOCATOR _Workspace_Allocate
1214  /**
1215   * This specifies the task stack deallocator method.
1216   */
1217  #define CONFIGURE_TASK_STACK_DEALLOCATOR _Workspace_Free
1218#elif (defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
1219  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)) \
1220    || (!defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
1221      && defined(CONFIGURE_TASK_STACK_DEALLOCATOR))
1222  #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined"
1223#endif
1224/**@}*/ /* end of thread/interrupt stack configuration */
1225
1226/**
1227 * @addtogroup Configuration
1228 */
1229/**@{*/
1230
1231/**
1232 * Should the RTEMS Workspace and C Program Heap be cleared automatically
1233 * at system start up?
1234 */
1235#ifndef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
1236  #ifdef BSP_ZERO_WORKSPACE_AUTOMATICALLY
1237    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY \
1238            BSP_ZERO_WORKSPACE_AUTOMATICALLY
1239  #else
1240    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY FALSE
1241  #endif
1242#endif
1243/**@}*/ /* end of add to group Configuration */
1244
1245/**
1246 * @defgroup ConfigurationMalloc RTEMS Malloc configuration
1247 *
1248 * This module contains parameters related to configuration of the RTEMS
1249 * Malloc implementation.
1250 */
1251/**@{*/
1252#include <rtems/malloc.h>
1253
1254#ifdef CONFIGURE_INIT
1255  /**
1256   * By default, RTEMS uses separate heaps for the RTEMS Workspace and
1257   * the C Program Heap.  The application can choose optionally to combine
1258   * these to provide one larger memory pool. This is particularly
1259   * useful in combination with the unlimited objects configuration.
1260   */
1261  #ifdef CONFIGURE_UNIFIED_WORK_AREAS
1262    Heap_Control  *RTEMS_Malloc_Heap = &_Workspace_Area;
1263  #else
1264    Heap_Control   RTEMS_Malloc_Area;
1265    Heap_Control  *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area;
1266  #endif
1267#endif
1268
1269#ifdef CONFIGURE_INIT
1270  /**
1271   * This configures the sbrk() support for the malloc family.
1272   * By default it is assumed that the BSP provides all available
1273   * RAM to the malloc family implementation so sbrk()'ing to get
1274   * more memory would always fail anyway.
1275   */
1276  const rtems_heap_extend_handler rtems_malloc_extend_handler =
1277    #ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
1278      rtems_heap_extend_via_sbrk;
1279    #else
1280      rtems_heap_null_extend;
1281    #endif
1282#endif
1283
1284#ifdef CONFIGURE_INIT
1285  /**
1286   * This configures the malloc family plugin which dirties memory
1287   * allocated.  This is helpful for finding unitialized data structure
1288   * problems.
1289   */
1290  rtems_malloc_dirtier_t rtems_malloc_dirty_helper =
1291    #if defined(CONFIGURE_MALLOC_DIRTY)
1292      rtems_malloc_dirty_memory;
1293    #else
1294      NULL;
1295    #endif
1296#endif
1297/**@}*/  /* end of Malloc Configuration */
1298
1299/**
1300 * @defgroup ConfigurationHelpers Configuration Helpers
1301 *
1302 * @ingroup Configuration
1303 *
1304 * This module contains items which are used internally to ease
1305 * the configuration calculations.
1306 */
1307/**@{*/
1308
1309/**
1310 * Zero of one returns 0 if the parameter is 0 else 1 is returned.
1311 */
1312#define _Configure_Zero_or_One(_number) ((_number) ? 1 : 0)
1313
1314/**
1315 * General helper to align up a value.
1316 */
1317#define _Configure_Align_up(_val, _align) \
1318  (((_val) + (_align) - 1) - ((_val) + (_align) - 1) % (_align))
1319
1320#define _CONFIGURE_HEAP_MIN_BLOCK_SIZE \
1321  _Configure_Align_up(sizeof(Heap_Block), CPU_HEAP_ALIGNMENT)
1322
1323/**
1324 * This is a helper macro used in calculations in this file.  It is used
1325 * to noted when an element is allocated from the RTEMS Workspace and adds
1326 * a factor to account for heap overhead plus an alignment factor that
1327 * may be applied.
1328 */
1329#define _Configure_From_workspace(_size) \
1330  (ssize_t) (_Configure_Zero_or_One(_size) * \
1331    _Configure_Align_up(_size + HEAP_BLOCK_HEADER_SIZE, \
1332      _CONFIGURE_HEAP_MIN_BLOCK_SIZE))
1333
1334/**
1335 * This is a helper macro used in stack space calculations in this file.  It
1336 * may be provided by the application in case a special task stack allocator
1337 * is used.  The default is allocation from the RTEMS Workspace.
1338 */
1339#ifdef CONFIGURE_TASK_STACK_FROM_ALLOCATOR
1340  #define _Configure_From_stackspace(_stack_size) \
1341    CONFIGURE_TASK_STACK_FROM_ALLOCATOR(_stack_size)
1342#else
1343  #define _Configure_From_stackspace(_stack_size) \
1344    _Configure_From_workspace(_stack_size)
1345#endif
1346
1347/**
1348 * Do not use the unlimited bit as part of the multiplication
1349 * for memory usage.
1350 */
1351#define _Configure_Max_Objects(_max) \
1352  (_Configure_Zero_or_One(_max) * rtems_resource_maximum_per_allocation(_max))
1353
1354/**
1355 * This macro accounts for how memory for a set of configured objects is
1356 * allocated from the Executive Workspace.
1357 *
1358 * NOTE: It does NOT attempt to address the more complex case of unlimited
1359 *       objects.
1360 */
1361#define _Configure_Object_RAM(_number, _size) ( \
1362    _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
1363    _Configure_From_workspace( \
1364      _Configure_Zero_or_One(_number) * ( \
1365        (_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *) + \
1366        _Configure_Align_up(sizeof(void *), CPU_ALIGNMENT) + \
1367        _Configure_Align_up(sizeof(uint32_t), CPU_ALIGNMENT) \
1368      ) \
1369    ) \
1370  )
1371/**@}*/
1372
1373/**
1374 * @defgroup ConfigurationInitTasksTable Initialization Tasks Configuration
1375 *
1376 * @addtogroup Configuration
1377 *
1378 * This group contains the elements needed to define the Classic API
1379 * Initialization Tasks Table.
1380 *
1381 *  Default User Initialization Task Table.  This table guarantees that
1382 *  one user initialization table is defined.
1383 */
1384#ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
1385
1386#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
1387
1388/*
1389 *  The user is defining their own table information and setting the
1390 *  appropriate variables.
1391 */
1392
1393#else
1394
1395/**
1396 * When using the default Classic API Initialization Tasks Table, this is
1397 * used to specify the name of the single Classic API task.
1398 */
1399#ifndef CONFIGURE_INIT_TASK_NAME
1400  #define CONFIGURE_INIT_TASK_NAME          rtems_build_name('U', 'I', '1', ' ')
1401#endif
1402
1403/**
1404 * When using the default Classic API Initialization Tasks Table, this is
1405 * used to specify the stack size of the single Classic API task.
1406 */
1407#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
1408  #define CONFIGURE_INIT_TASK_STACK_SIZE    CONFIGURE_MINIMUM_TASK_STACK_SIZE
1409#endif
1410
1411/**
1412 * When using the default Classic API Initialization Tasks Table, this is
1413 * used to specify the priority of the single Classic API task.
1414 */
1415#ifndef CONFIGURE_INIT_TASK_PRIORITY
1416  #define CONFIGURE_INIT_TASK_PRIORITY      1
1417#endif
1418
1419/**
1420 * When using the default Classic API Initialization Tasks Table, this is
1421 * used to specify the attributes size of the single Classic API task.
1422 */
1423#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
1424  #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_DEFAULT_ATTRIBUTES
1425#endif
1426
1427/**
1428 * When using the default Classic API Initialization Tasks Table, this is
1429 * used to specify the entry point of the single Classic API task.
1430 */
1431#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
1432  #ifdef __cplusplus
1433  extern "C" {
1434  #endif
1435    rtems_task Init (rtems_task_argument );
1436  #ifdef __cplusplus
1437  }
1438  #endif
1439  #define CONFIGURE_INIT_TASK_ENTRY_POINT   Init
1440  extern const char* bsp_boot_cmdline;
1441  #define CONFIGURE_INIT_TASK_ARGUMENTS     ((rtems_task_argument) &bsp_boot_cmdline)
1442#endif
1443
1444/**
1445 * When using the default Classic API Initialization Tasks Table, this is
1446 * used to specify the initial execution mode of the single Classic API task.
1447 */
1448#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
1449  #ifdef _CONFIGURE_SMP_APPLICATION
1450    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
1451  #else
1452    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
1453  #endif
1454#endif
1455
1456/**
1457 * When using the default Classic API Initialization Tasks Table, this is
1458 * used to specify the initial argument to the single Classic API task.
1459 */
1460#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
1461  #define CONFIGURE_INIT_TASK_ARGUMENTS     0
1462#endif
1463
1464#ifdef CONFIGURE_INIT
1465  rtems_initialization_tasks_table Initialization_tasks[] = {
1466    { CONFIGURE_INIT_TASK_NAME,
1467      CONFIGURE_INIT_TASK_STACK_SIZE,
1468      CONFIGURE_INIT_TASK_PRIORITY,
1469      CONFIGURE_INIT_TASK_ATTRIBUTES,
1470      CONFIGURE_INIT_TASK_ENTRY_POINT,
1471      CONFIGURE_INIT_TASK_INITIAL_MODES,
1472      CONFIGURE_INIT_TASK_ARGUMENTS
1473    }
1474  };
1475#endif
1476
1477/**
1478 * This is the name of the Initialization Tasks Table generated.
1479 */
1480#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
1481
1482/*
1483 * This is the size of the Initialization Tasks Table generated.
1484 */
1485#define CONFIGURE_INIT_TASK_TABLE_SIZE \
1486  RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
1487
1488#endif    /* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
1489
1490#else     /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
1491
1492/*
1493 * This is the name of the Initialization Task when none is configured.
1494 */
1495#define CONFIGURE_INIT_TASK_TABLE      NULL
1496
1497/*
1498 * This is the size of the Initialization Task when none is configured.
1499 */
1500#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
1501
1502/*
1503 * This is the stack size of the Initialization Task when none is configured.
1504 */
1505#define CONFIGURE_INIT_TASK_STACK_SIZE 0
1506
1507#endif
1508/**@}*/  /* end of Classic API Initialization Tasks Table */
1509
1510/**
1511 * @defgroup ConfigurationDriverTable Device Driver Table Configuration
1512 *
1513 * @addtogroup Configuration
1514 *
1515 * This group contains parameters related to generating a Device Driver
1516 * Table.
1517 *
1518 * Default Device Driver Table.  Each driver needed by the test is explicitly
1519 * choosen by the application.  There is always a null driver entry.
1520 */
1521/**@{*/
1522
1523/**
1524 * This is an empty device driver slot.
1525 */
1526#define NULL_DRIVER_TABLE_ENTRY \
1527 { NULL, NULL, NULL, NULL, NULL, NULL }
1528
1529#if defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1530  defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER)
1531#error "CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER and CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER are mutually exclusive"
1532#endif
1533
1534#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1535  #include <rtems/console.h>
1536#endif
1537
1538#ifdef CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
1539  #include <rtems/console.h>
1540
1541  #ifdef CONFIGURE_INIT
1542    RTEMS_SYSINIT_ITEM(
1543      _Console_simple_Initialize,
1544      RTEMS_SYSINIT_DEVICE_DRIVERS,
1545      RTEMS_SYSINIT_ORDER_SECOND
1546    );
1547  #endif
1548#endif
1549
1550#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1551  #include <rtems/clockdrv.h>
1552#endif
1553
1554#ifdef CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
1555  #include <rtems/btimer.h>
1556#endif
1557
1558#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1559  #include <rtems/rtc.h>
1560#endif
1561
1562#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1563  #include <rtems/watchdogdrv.h>
1564#endif
1565
1566#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1567  #include <rtems/framebuffer.h>
1568#endif
1569
1570#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1571  #include <rtems/devnull.h>
1572#endif
1573
1574#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1575  #include <rtems/devzero.h>
1576#endif
1577
1578#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1579  /* the ide driver needs the ATA driver */
1580  #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1581    #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1582  #endif
1583  #include <libchip/ide_ctrl.h>
1584#endif
1585
1586#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1587  #include <libchip/ata.h>
1588#endif
1589
1590#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
1591
1592/**
1593 * This specifies the maximum number of device drivers that
1594 * can be installed in the system at one time.  It must account
1595 * for both the statically and dynamically installed drivers.
1596 */
1597#ifndef CONFIGURE_MAXIMUM_DRIVERS
1598  #define CONFIGURE_MAXIMUM_DRIVERS
1599#endif
1600
1601#ifdef CONFIGURE_INIT
1602  rtems_driver_address_table
1603    _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
1604    #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
1605      CONFIGURE_BSP_PREREQUISITE_DRIVERS,
1606    #endif
1607    #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
1608      CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
1609    #endif
1610    #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1611      CONSOLE_DRIVER_TABLE_ENTRY,
1612    #endif
1613    #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1614      CLOCK_DRIVER_TABLE_ENTRY,
1615    #endif
1616    #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1617      RTC_DRIVER_TABLE_ENTRY,
1618    #endif
1619    #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1620      WATCHDOG_DRIVER_TABLE_ENTRY,
1621    #endif
1622    #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1623      DEVNULL_DRIVER_TABLE_ENTRY,
1624    #endif
1625    #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1626      DEVZERO_DRIVER_TABLE_ENTRY,
1627    #endif
1628    #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1629      IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
1630    #endif
1631    #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1632      ATA_DRIVER_TABLE_ENTRY,
1633    #endif
1634    #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1635      FRAME_BUFFER_DRIVER_TABLE_ENTRY,
1636    #endif
1637    #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
1638      CONFIGURE_APPLICATION_EXTRA_DRIVERS,
1639    #endif
1640    #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
1641      NULL_DRIVER_TABLE_ENTRY
1642    #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1643        !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
1644        !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \
1645        !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \
1646        !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) && \
1647        !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \
1648        !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \
1649        !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) && \
1650        !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
1651      NULL_DRIVER_TABLE_ENTRY
1652    #endif
1653  };
1654
1655  const size_t _IO_Number_of_drivers =
1656    RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
1657#endif
1658
1659#endif  /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
1660
1661#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1662  /*
1663   * configure the priority of the ATA driver task
1664   */
1665  #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
1666    #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
1667  #endif
1668  #ifdef CONFIGURE_INIT
1669    rtems_task_priority rtems_ata_driver_task_priority
1670      = CONFIGURE_ATA_DRIVER_TASK_PRIORITY;
1671  #endif /* CONFIGURE_INIT */
1672#endif
1673/**@}*/ /* end of Device Driver Table Configuration */
1674
1675/**
1676 * @defgroup ConfigurationLibBlock Configuration of LIBBLOCK
1677 *
1678 * @addtogroup Configuration
1679 *
1680 * This module contains parameters related to the LIBBLOCK buffering
1681 * and caching subsystem. It requires tasks to swap out data to be
1682 * written to non-volatile storage.
1683 */
1684/**@{*/
1685#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
1686  #include <rtems/bdbuf.h>
1687  /*
1688   * configure the bdbuf cache parameters
1689   */
1690  #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
1691    #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
1692                              RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
1693  #endif
1694  #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
1695    #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
1696                              RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
1697  #endif
1698  #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
1699    #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
1700                              RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
1701  #endif
1702  #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
1703    #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
1704                              RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
1705  #endif
1706  #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
1707    #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
1708                              RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
1709  #endif
1710  #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
1711    #define CONFIGURE_SWAPOUT_WORKER_TASKS \
1712                              RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
1713  #endif
1714  #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
1715    #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
1716                              RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
1717  #endif
1718  #ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE
1719    #define CONFIGURE_BDBUF_TASK_STACK_SIZE \
1720                              RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT
1721  #endif
1722  #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
1723    #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
1724                              RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
1725  #endif
1726  #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
1727    #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
1728                              RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
1729  #endif
1730  #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
1731    #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
1732                              RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
1733  #endif
1734  #ifndef CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1735    #define CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY \
1736                              RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT
1737  #endif
1738  #ifdef CONFIGURE_INIT
1739    const rtems_bdbuf_config rtems_bdbuf_configuration = {
1740      CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
1741      CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
1742      CONFIGURE_SWAPOUT_TASK_PRIORITY,
1743      CONFIGURE_SWAPOUT_SWAP_PERIOD,
1744      CONFIGURE_SWAPOUT_BLOCK_HOLD,
1745      CONFIGURE_SWAPOUT_WORKER_TASKS,
1746      CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
1747      CONFIGURE_BDBUF_TASK_STACK_SIZE,
1748      CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
1749      CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
1750      CONFIGURE_BDBUF_BUFFER_MAX_SIZE,
1751      CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1752    };
1753  #endif
1754
1755  #define _CONFIGURE_LIBBLOCK_TASKS \
1756    (1 + CONFIGURE_SWAPOUT_WORKER_TASKS + \
1757    (CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS != 0))
1758
1759  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS \
1760    (_CONFIGURE_LIBBLOCK_TASKS * \
1761    (CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \
1762    0 : CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE))
1763
1764  #if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \
1765      defined(CONFIGURE_BDBUF_BUFFER_SIZE) || \
1766      defined(CONFIGURE_BDBUF_BUFFER_COUNT)
1767    #error BDBUF Cache does not use a buffer configuration table. Please remove.
1768  #endif
1769#else
1770  /** This specifies the number of libblock tasks. */
1771  #define _CONFIGURE_LIBBLOCK_TASKS 0
1772  /** This specifies the extra stack space configured for libblock tasks. */
1773  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS 0
1774  /** This specifies the number of Classic API semaphores needed by libblock. */
1775#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
1776/**@}*/
1777
1778/**
1779 * @defgroup ConfigurationMultiprocessing Multiprocessing Configuration
1780 *
1781 * @addtogroup Configuration
1782 *
1783 * This module contains the parameters related to the Multiprocessing
1784 * configuration of RTEMS.
1785 *
1786 * In a single processor or SMP configuration, only two parameters are
1787 * needed and they are defaulted. The user should not have to specify
1788 * any parameters.
1789 */
1790/**@{*/
1791
1792/**
1793 * This defines the extra stack space required for the MPCI server thread.
1794 */
1795#ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
1796  #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
1797#endif
1798
1799/**
1800 * This defines the timers required for the shared memory driver in
1801 * a multiprocessing configuration.
1802 */
1803#ifndef _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER
1804  #define _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 0
1805#endif
1806
1807
1808#if defined(RTEMS_MULTIPROCESSING)
1809  /*
1810   *  Default Multiprocessing Configuration Table.  The defaults are
1811   *  appropriate for most of the RTEMS Multiprocessor Test Suite.  Each
1812   *  value may be overridden within each test to customize the environment.
1813   */
1814
1815  #ifdef CONFIGURE_MP_APPLICATION
1816    #define _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 1
1817
1818    #ifndef CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE
1819
1820      #ifndef CONFIGURE_MP_NODE_NUMBER
1821        #define CONFIGURE_MP_NODE_NUMBER                NODE_NUMBER
1822      #endif
1823
1824      #ifndef CONFIGURE_MP_MAXIMUM_NODES
1825        #define CONFIGURE_MP_MAXIMUM_NODES              2
1826      #endif
1827
1828      #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
1829        #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS     32
1830      #endif
1831      #define _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
1832        _Configure_From_workspace( \
1833          (_global_objects) * sizeof(Objects_MP_Control) \
1834        )
1835
1836      #ifndef CONFIGURE_MP_MAXIMUM_PROXIES
1837        #define CONFIGURE_MP_MAXIMUM_PROXIES            32
1838      #endif
1839      #define _CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
1840        _Configure_From_workspace((_proxies) \
1841          * (sizeof(Thread_Proxy_control) \
1842            + THREAD_QUEUE_HEADS_SIZE(CONFIGURE_SCHEDULER_COUNT)))
1843
1844      #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
1845        #include <mpci.h>
1846        #define CONFIGURE_MP_MPCI_TABLE_POINTER         &MPCI_table
1847      #endif
1848
1849      #ifdef CONFIGURE_INIT
1850        rtems_multiprocessing_table Multiprocessing_configuration = {
1851          CONFIGURE_MP_NODE_NUMBER,               /* local node number */
1852          CONFIGURE_MP_MAXIMUM_NODES,             /* maximum # nodes */
1853          CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS,    /* maximum # global objects */
1854          CONFIGURE_MP_MAXIMUM_PROXIES,           /* maximum # proxies */
1855          CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, /* MPCI stack > minimum */
1856          CONFIGURE_MP_MPCI_TABLE_POINTER         /* ptr to MPCI config table */
1857        };
1858      #endif
1859
1860      #define CONFIGURE_MULTIPROCESSING_TABLE    &Multiprocessing_configuration
1861
1862      #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 1
1863
1864    #endif /* CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE */
1865
1866  #else
1867
1868    #define CONFIGURE_MULTIPROCESSING_TABLE    NULL
1869
1870    #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0
1871
1872  #endif /* CONFIGURE_MP_APPLICATION */
1873#else
1874  #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0
1875#endif /* RTEMS_MULTIPROCESSING */
1876/**@}*/ /* end of Multiprocessing Configuration */
1877
1878/**
1879 * This macro specifies that the user wants to use unlimited objects for any
1880 * classic or posix objects that have not already been given resource limits.
1881 */
1882#if defined(CONFIGURE_UNLIMITED_OBJECTS)
1883  #if !defined(CONFIGURE_UNIFIED_WORK_AREAS) && \
1884     !defined(CONFIGURE_EXECUTIVE_RAM_SIZE) && \
1885     !defined(CONFIGURE_MEMORY_OVERHEAD)
1886     #error "CONFIGURE_UNLIMITED_OBJECTS requires a unified work area, an executive RAM size, or a defined workspace memory overhead"
1887  #endif
1888
1889  #if !defined(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1890  /**
1891   * This macro specifies a default allocation size for when auto-extending
1892   * unlimited objects if none was given by the user.
1893   */
1894    #define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 8
1895  #endif
1896  #if !defined(CONFIGURE_MAXIMUM_TASKS)
1897    #define CONFIGURE_MAXIMUM_TASKS \
1898      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1899  #endif
1900  #if !defined(CONFIGURE_MAXIMUM_TIMERS)
1901    #define CONFIGURE_MAXIMUM_TIMERS \
1902      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1903  #endif
1904  #if !defined(CONFIGURE_MAXIMUM_SEMAPHORES)
1905    #define CONFIGURE_MAXIMUM_SEMAPHORES \
1906      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1907  #endif
1908  #if !defined(CONFIGURE_MAXIMUM_MESSAGE_QUEUES)
1909    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES \
1910      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1911  #endif
1912  #if !defined(CONFIGURE_MAXIMUM_PARTITIONS)
1913    #define CONFIGURE_MAXIMUM_PARTITIONS \
1914      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1915  #endif
1916  #if !defined(CONFIGURE_MAXIMUM_REGIONS)
1917    #define CONFIGURE_MAXIMUM_REGIONS \
1918      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1919  #endif
1920  #if !defined(CONFIGURE_MAXIMUM_PORTS)
1921    #define CONFIGURE_MAXIMUM_PORTS \
1922      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1923  #endif
1924  #if !defined(CONFIGURE_MAXIMUM_PERIODS)
1925    #define CONFIGURE_MAXIMUM_PERIODS \
1926      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1927  #endif
1928  #if !defined(CONFIGURE_MAXIMUM_BARRIERS)
1929    #define CONFIGURE_MAXIMUM_BARRIERS \
1930      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1931  #endif
1932  #if !defined(CONFIGURE_MAXIMUM_POSIX_KEYS)
1933    #define CONFIGURE_MAXIMUM_POSIX_KEYS \
1934      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1935  #endif
1936  #if !defined(CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS)
1937    #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
1938      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1939  #endif
1940
1941  #ifdef RTEMS_POSIX_API
1942    #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS)
1943      #define CONFIGURE_MAXIMUM_POSIX_THREADS \
1944        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1945    #endif
1946    #if !defined(CONFIGURE_MAXIMUM_POSIX_TIMERS)
1947      #define CONFIGURE_MAXIMUM_POSIX_TIMERS \
1948        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1949    #endif
1950/*
1951    #if !defined(CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS)
1952      #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS \
1953        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1954    #endif
1955*/
1956    #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
1957      #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES \
1958        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1959    #endif
1960    #if !defined(CONFIGURE_MAXIMUM_POSIX_SEMAPHORES)
1961      #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES \
1962        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1963    #endif
1964    #if !defined(CONFIGURE_MAXIMUM_POSIX_SHMS)
1965      #define CONFIGURE_MAXIMUM_POSIX_SHMS \
1966        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1967    #endif
1968  #endif /* RTEMS_POSIX_API */
1969#endif /* CONFIGURE_UNLIMITED_OBJECTS */
1970
1971
1972/**
1973 * @defgroup ConfigurationClassicAPI Classic API Configuration
1974 *
1975 * @ingroup Configuration
1976 *
1977 * This module contains the parameters related to configuration
1978 * of the Classic API services.
1979 */
1980/**@{*/
1981#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
1982
1983  /** This configures the maximum number of Classic API tasks. */
1984  #ifndef CONFIGURE_MAXIMUM_TASKS
1985    #define CONFIGURE_MAXIMUM_TASKS               0
1986  #endif
1987
1988  /*
1989   * This is calculated to account for the maximum number of Classic API
1990   * tasks used by the application and configured RTEMS capabilities.
1991   */
1992  #define _CONFIGURE_TASKS \
1993    (CONFIGURE_MAXIMUM_TASKS + _CONFIGURE_LIBBLOCK_TASKS)
1994
1995  #ifndef CONFIGURE_MAXIMUM_TIMERS
1996    /** This specifies the maximum number of Classic API timers. */
1997    #define CONFIGURE_MAXIMUM_TIMERS             0
1998    /*
1999     * This macro is calculated to specify the memory required for
2000     * Classic API timers.
2001     */
2002    #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0
2003  #else
2004    #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
2005      _Configure_Object_RAM(_timers, sizeof(Timer_Control) )
2006  #endif
2007
2008  #ifndef CONFIGURE_MAXIMUM_SEMAPHORES
2009    /** This specifies the maximum number of Classic API semaphores. */
2010    #define CONFIGURE_MAXIMUM_SEMAPHORES                 0
2011  #endif
2012
2013  /*
2014   * This macro is calculated to specify the memory required for
2015   * Classic API Semaphores using MRSP. This is only available in
2016   * SMP configurations.
2017   */
2018  #if !defined(RTEMS_SMP) || \
2019    !defined(CONFIGURE_MAXIMUM_MRSP_SEMAPHORES)
2020    #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES 0
2021  #else
2022    #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES \
2023      CONFIGURE_MAXIMUM_MRSP_SEMAPHORES * \
2024        _Configure_From_workspace( \
2025          RTEMS_ARRAY_SIZE(_Scheduler_Table) * sizeof(Priority_Control) \
2026        )
2027  #endif
2028
2029  /*
2030   * This macro is calculated to specify the memory required for
2031   * Classic API Semaphores.
2032   *
2033   * If there are no user or support semaphores defined, then we can assume
2034   * that no memory need be allocated at all for semaphores.
2035   */
2036  #if CONFIGURE_MAXIMUM_SEMAPHORES == 0
2037    #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0
2038  #else
2039    #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
2040      _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) ) + \
2041        _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES
2042  #endif
2043
2044  #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
2045    /**
2046     * This configuration parameter specifies the maximum number of
2047     * Classic API Message Queues.
2048     */
2049    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES             0
2050    /*
2051     * This macro is calculated to specify the RTEMS Workspace required for
2052     * the Classic API Message Queues.
2053     */
2054    #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0
2055  #else
2056    #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
2057      _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) )
2058  #endif
2059
2060  #ifndef CONFIGURE_MAXIMUM_PARTITIONS
2061    /**
2062     * This configuration parameter specifies the maximum number of
2063     * Classic API Partitions.
2064     */
2065    #define CONFIGURE_MAXIMUM_PARTITIONS                 0
2066    /*
2067     * This macro is calculated to specify the memory required for
2068     * Classic API
2069     */
2070    #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0
2071  #else
2072    #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
2073      _Configure_Object_RAM(_partitions, sizeof(Partition_Control) )
2074  #endif
2075
2076  #ifndef CONFIGURE_MAXIMUM_REGIONS
2077    /**
2078     * This configuration parameter specifies the maximum number of
2079     * Classic API Regions.
2080     */
2081    #define CONFIGURE_MAXIMUM_REGIONS              0
2082    /*
2083     * This macro is calculated to specify the memory required for
2084     * Classic API Regions.
2085     */
2086    #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0
2087  #else
2088    #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
2089      _Configure_Object_RAM(_regions, sizeof(Region_Control) )
2090  #endif
2091
2092  #ifndef CONFIGURE_MAXIMUM_PORTS
2093    /**
2094     * This configuration parameter specifies the maximum number of
2095     * Classic API Dual-Ported Memory Ports.
2096     */
2097    #define CONFIGURE_MAXIMUM_PORTS            0
2098    /**
2099     * This macro is calculated to specify the memory required for
2100     * Classic API Dual-Ported Memory Ports.
2101     */
2102    #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) 0
2103  #else
2104    #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) \
2105      _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) )
2106  #endif
2107
2108  #ifndef CONFIGURE_MAXIMUM_PERIODS
2109    /**
2110     * This configuration parameter specifies the maximum number of
2111     * Classic API Rate Monotonic Periods.
2112     */
2113    #define CONFIGURE_MAXIMUM_PERIODS              0
2114    /*
2115     * This macro is calculated to specify the memory required for
2116     * Classic API Rate Monotonic Periods.
2117     */
2118  #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0
2119#else
2120    #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
2121      _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) )
2122  #endif
2123
2124  /**
2125   * This configuration parameter specifies the maximum number of
2126   * Classic API Barriers.
2127   */
2128  #ifndef CONFIGURE_MAXIMUM_BARRIERS
2129    #define CONFIGURE_MAXIMUM_BARRIERS               0
2130  #endif
2131
2132  /*
2133   * This macro is calculated to specify the number of Classic API
2134   * Barriers required by the application and configured capabilities.
2135   */
2136  #define _CONFIGURE_BARRIERS \
2137     (CONFIGURE_MAXIMUM_BARRIERS + _CONFIGURE_BARRIERS_FOR_FIFOS)
2138
2139  /*
2140   * This macro is calculated to specify the memory required for
2141   * Classic API Barriers.
2142   */
2143  #if _CONFIGURE_BARRIERS == 0
2144    #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0
2145  #else
2146    #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \
2147      _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) )
2148  #endif
2149
2150  #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
2151    /**
2152     * This configuration parameter specifies the maximum number of
2153     * Classic API User Extensions.
2154     */
2155    #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
2156    /*
2157     * This macro is calculated to specify the memory required for
2158     * Classic API User Extensions.
2159     */
2160    #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0
2161  #else
2162    #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
2163      _Configure_Object_RAM(_extensions, sizeof(Extension_Control) )
2164  #endif
2165  /**@}*/ /* end of Classic API Configuration */
2166
2167  /**
2168   * @defgroup ConfigurationGeneral General System Configuration
2169   *
2170   * @ingroup Configuration
2171   *
2172   * This module contains configuration parameters that are independent
2173   * of any API but impact general system configuration.
2174   */
2175  /**@{*/
2176
2177  /** The configures the number of microseconds per clock tick. */
2178  #ifndef CONFIGURE_MICROSECONDS_PER_TICK
2179    #define CONFIGURE_MICROSECONDS_PER_TICK \
2180            RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
2181  #endif
2182
2183  #if 1000000 % CONFIGURE_MICROSECONDS_PER_TICK != 0
2184    #warning "The clock ticks per second is not an integer"
2185  #endif
2186
2187  #if CONFIGURE_MICROSECONDS_PER_TICK <= 0
2188    #error "The CONFIGURE_MICROSECONDS_PER_TICK must be positive"
2189  #endif
2190
2191  #define _CONFIGURE_TICKS_PER_SECOND (1000000 / CONFIGURE_MICROSECONDS_PER_TICK)
2192
2193  /** The configures the number of clock ticks per timeslice. */
2194  #ifndef CONFIGURE_TICKS_PER_TIMESLICE
2195    #define CONFIGURE_TICKS_PER_TIMESLICE        50
2196  #endif
2197
2198/**@}*/ /* end of General Configuration */
2199
2200/*
2201 *  Initial Extension Set
2202 */
2203
2204#ifdef CONFIGURE_INIT
2205#ifdef CONFIGURE_STACK_CHECKER_ENABLED
2206#include <rtems/stackchk.h>
2207#endif
2208#include <rtems/libcsupport.h>
2209
2210#if defined(BSP_INITIAL_EXTENSION) || \
2211    defined(CONFIGURE_INITIAL_EXTENSIONS) || \
2212    defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
2213    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
2214  static const rtems_extensions_table Configuration_Initial_Extensions[] = {
2215    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
2216      RTEMS_NEWLIB_EXTENSION,
2217    #endif
2218    #if defined(CONFIGURE_STACK_CHECKER_ENABLED)
2219      RTEMS_STACK_CHECKER_EXTENSION,
2220    #endif
2221    #if defined(CONFIGURE_INITIAL_EXTENSIONS)
2222      CONFIGURE_INITIAL_EXTENSIONS,
2223    #endif
2224    #if defined(BSP_INITIAL_EXTENSION)
2225      BSP_INITIAL_EXTENSION
2226    #endif
2227  };
2228
2229  #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
2230  #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
2231    RTEMS_ARRAY_SIZE(Configuration_Initial_Extensions)
2232
2233  RTEMS_SYSINIT_ITEM(
2234    _User_extensions_Handler_initialization,
2235    RTEMS_SYSINIT_INITIAL_EXTENSIONS,
2236    RTEMS_SYSINIT_ORDER_MIDDLE
2237  );
2238#else
2239  #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
2240  #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
2241#endif
2242
2243#if defined(RTEMS_NEWLIB)
2244  struct _reent *__getreent(void)
2245  {
2246    #ifdef CONFIGURE_DISABLE_NEWLIB_REENTRANCY
2247      return _GLOBAL_REENT;
2248    #else
2249      return _Thread_Get_executing()->libc_reent;
2250    #endif
2251  }
2252#endif
2253
2254#endif
2255
2256/**
2257 * @defgroup ConfigurationPOSIXAPI POSIX API Configuration Parameters
2258 *
2259 * This module contains the parameters related to configuration
2260 * of the POSIX API services.
2261 */
2262/**@{*/
2263
2264#include <rtems/posix/key.h>
2265
2266/**
2267 * This configuration parameter specifies the maximum number of
2268 * POSIX API keys.
2269 *
2270 * POSIX Keys are available whether or not the POSIX API is enabled.
2271 */
2272#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
2273  #define CONFIGURE_MAXIMUM_POSIX_KEYS 0
2274#endif
2275
2276/*
2277 * This macro is calculated to specify the memory required for
2278 * POSIX API key/value pairs.
2279 */
2280#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
2281  #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
2282    (CONFIGURE_MAXIMUM_POSIX_KEYS * \
2283     (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS))
2284#endif
2285
2286/*
2287 * This macro is calculated to specify the total number of
2288 * POSIX API keys required by the application and configured
2289 * system capabilities.
2290 */
2291#define _CONFIGURE_POSIX_KEYS \
2292  (CONFIGURE_MAXIMUM_POSIX_KEYS + _CONFIGURE_LIBIO_POSIX_KEYS)
2293
2294/*
2295 * This macro is calculated to specify the memory required for
2296 * POSIX API keys.
2297 */
2298#define _CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
2299   (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
2300    + _Configure_From_workspace( \
2301      _Configure_Max_Objects(_key_value_pairs) \
2302        * sizeof(POSIX_Keys_Key_value_pair)))
2303
2304/*
2305 *  The rest of the POSIX threads API features are only available when
2306 *  POSIX is enabled.
2307 */
2308#ifdef RTEMS_POSIX_API
2309  #include <sys/types.h>
2310  #include <signal.h>
2311  #include <limits.h>
2312  #include <mqueue.h>
2313  #include <rtems/posix/mqueue.h>
2314  #include <rtems/posix/psignal.h>
2315  #include <rtems/posix/pthread.h>
2316  #include <rtems/posix/semaphore.h>
2317  #include <rtems/posix/shm.h>
2318  #include <rtems/posix/threadsup.h>
2319  #include <rtems/posix/timer.h>
2320
2321  /*
2322   * Account for the object control structures plus the name
2323   * of the object to be duplicated.
2324   */
2325  #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
2326    (_Configure_Object_RAM(_number, _size) \
2327      + _Configure_Max_Objects(_number) \
2328        * _Configure_From_workspace(_POSIX_PATH_MAX + 1))
2329
2330  /**
2331   * This configuration parameter specifies the maximum number of
2332   * POSIX API threads.
2333   */
2334  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2335    #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
2336  #endif
2337
2338  /**
2339   * This configuration parameter specifies the maximum number of
2340   * POSIX API timers.
2341   */
2342  #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
2343    #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
2344  #endif
2345
2346  /*
2347   * This macro is calculated to specify the memory required for
2348   * POSIX API timers.
2349   */
2350  #define _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
2351    _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
2352
2353  /**
2354   * This configuration parameter specifies the maximum number of
2355   * POSIX API queued signals.
2356   */
2357  #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
2358    #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0
2359  #endif
2360
2361  /*
2362   * This macro is calculated to specify the memory required for
2363   * POSIX API queued signals.
2364   */
2365  #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
2366    _Configure_From_workspace( \
2367      (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
2368
2369  /**
2370   * This configuration parameter specifies the maximum number of
2371   * POSIX API message queues.
2372   */
2373  #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
2374    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
2375  #endif
2376
2377  /*
2378   * This macro is calculated to specify the memory required for
2379   * POSIX API message queues.
2380   */
2381  #define _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
2382    _Configure_POSIX_Named_Object_RAM( \
2383       _message_queues, sizeof(POSIX_Message_queue_Control) )
2384
2385  /**
2386   * This configuration parameter specifies the maximum number of
2387   * POSIX API semaphores.
2388   */
2389  #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
2390    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0
2391  #endif
2392
2393  /*
2394   * This macro is calculated to specify the memory required for
2395   * POSIX API semaphores.
2396   */
2397  #define _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
2398    _Configure_POSIX_Named_Object_RAM( \
2399       _semaphores, sizeof(POSIX_Semaphore_Control) )
2400
2401  /**
2402   * Configure the maximum number of POSIX shared memory objects.
2403   */
2404  #if !defined(CONFIGURE_MAXIMUM_POSIX_SHMS)
2405    #define CONFIGURE_MAXIMUM_POSIX_SHMS 0
2406  #else
2407    #ifdef CONFIGURE_INIT
2408      #if !defined(CONFIGURE_HAS_OWN_POSIX_SHM_OBJECT_OPERATIONS)
2409        const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations = {
2410          _POSIX_Shm_Object_create_from_workspace,
2411          _POSIX_Shm_Object_resize_from_workspace,
2412          _POSIX_Shm_Object_delete_from_workspace,
2413          _POSIX_Shm_Object_read_from_workspace,
2414          _POSIX_Shm_Object_mmap_from_workspace
2415        };
2416      #endif
2417    #endif
2418  #endif
2419
2420  /*
2421   * This macro is calculated to specify the memory required for
2422   * POSIX API shared memory.
2423   */
2424  #define _CONFIGURE_MEMORY_FOR_POSIX_SHMS(_shms) \
2425    _Configure_POSIX_Named_Object_RAM(_shms, sizeof(POSIX_Shm_Control) )
2426
2427
2428  #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
2429
2430    #ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
2431
2432      /*
2433       *  The user is defining their own table information and setting the
2434       *  appropriate variables for the POSIX Initialization Thread Table.
2435       */
2436
2437    #else
2438
2439      #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
2440        #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
2441      #endif
2442
2443      #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2444        #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
2445          CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
2446      #endif
2447
2448      #ifdef CONFIGURE_INIT
2449        posix_initialization_threads_table POSIX_Initialization_threads[] = {
2450          { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT, \
2451              CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
2452        };
2453      #endif
2454
2455      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
2456              POSIX_Initialization_threads
2457
2458      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
2459              RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
2460
2461    #endif    /* CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
2462
2463  #else     /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
2464
2465    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
2466    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
2467
2468  #endif
2469
2470#else
2471
2472  /**
2473   * This configuration parameter specifies the maximum number of
2474   * POSIX API threads.
2475   */
2476  #define CONFIGURE_MAXIMUM_POSIX_THREADS         0
2477
2478#endif    /* RTEMS_POSIX_API */
2479
2480/**
2481 * This configuration parameter specifies the stack size of the
2482 * POSIX API Initialization thread (if used).
2483 */
2484#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2485  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE    0
2486#endif
2487/**@}*/  /* end of POSIX API Configuration */
2488
2489/**
2490 * @defgroup ConfigurationGNAT GNAT/RTEMS Configuration
2491 *
2492 * @addtogroup Configuration
2493 *
2494 *  This modules includes configuration parameters for applications which
2495 *  use GNAT/RTEMS. GNAT implements each Ada task as a POSIX thread.
2496 */
2497/**@{*/
2498#ifdef CONFIGURE_GNAT_RTEMS
2499  /**
2500   * This is the maximum number of Ada tasks which can be concurrently
2501   * in existence.  Twenty (20) are required to run all tests in the
2502   * ACATS (formerly ACVC).
2503   */
2504  #ifndef CONFIGURE_MAXIMUM_ADA_TASKS
2505    #define CONFIGURE_MAXIMUM_ADA_TASKS  20
2506  #endif
2507
2508  /**
2509   * This is the number of non-Ada tasks which invoked Ada code.
2510   */
2511  #ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
2512    #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2513  #endif
2514#else
2515  /** This defines he number of POSIX mutexes GNAT needs. */
2516  /** This defines he number of Ada tasks needed by the application. */
2517  #define CONFIGURE_MAXIMUM_ADA_TASKS      0
2518  /**
2519   * This defines he number of non-Ada tasks/threads that will invoke
2520   * Ada subprograms or functions.
2521   */
2522  #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2523#endif
2524/**@}*/  /* end of GNAT Configuration */
2525
2526/**
2527 * @defgroup ConfigurationGo GCC Go Configuration
2528 *
2529 * @addtogroup Configuration
2530 *
2531 *  This modules includes configuration parameters for applications which
2532 *  use GCC Go.
2533 */
2534/**@{*/
2535#ifdef CONFIGURE_ENABLE_GO
2536
2537  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2538    #define CONFIGURE_MAXIMUM_POSIX_THREADS 1
2539  #endif
2540
2541  #ifndef CONFIGURE_MAXIMUM_GOROUTINES
2542    #define CONFIGURE_MAXIMUM_GOROUTINES 400
2543  #endif
2544
2545  #ifndef CONFIGURE_MAXIMUM_GO_CHANNELS
2546    #define CONFIGURE_MAXIMUM_GO_CHANNELS 500
2547  #endif
2548
2549#else
2550  /** This specifies the maximum number of Go co-routines. */
2551  #define CONFIGURE_MAXIMUM_GOROUTINES          0
2552
2553  /** This specifies the maximum number of Go channels required. */
2554  #define CONFIGURE_MAXIMUM_GO_CHANNELS         0
2555#endif
2556/**@}*/  /* end of Go Configuration */
2557
2558/**
2559 * This is so we can account for tasks with stacks greater than minimum
2560 * size.  This is in bytes.
2561 */
2562#ifndef CONFIGURE_EXTRA_TASK_STACKS
2563  #define CONFIGURE_EXTRA_TASK_STACKS 0
2564#endif
2565
2566/**
2567 * This macro provides a summation of the various POSIX thread requirements.
2568 */
2569#define _CONFIGURE_POSIX_THREADS \
2570   (CONFIGURE_MAXIMUM_POSIX_THREADS + \
2571     CONFIGURE_MAXIMUM_ADA_TASKS + \
2572     CONFIGURE_MAXIMUM_GOROUTINES)
2573
2574#ifdef RTEMS_POSIX_API
2575  /*
2576   * This macro is calculated to specify the memory required for
2577   * the POSIX API in its entirety.
2578   */
2579  #define _CONFIGURE_MEMORY_FOR_POSIX \
2580    (_CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
2581        CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) + \
2582      _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
2583        CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
2584      _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
2585        CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \
2586      _CONFIGURE_MEMORY_FOR_POSIX_SHMS( \
2587        CONFIGURE_MAXIMUM_POSIX_SHMS) + \
2588      _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(CONFIGURE_MAXIMUM_POSIX_TIMERS))
2589#else
2590  /*
2591   * This macro is calculated to specify the memory required for
2592   * the POSIX API in its entirety.
2593   */
2594  #define _CONFIGURE_MEMORY_FOR_POSIX 0
2595#endif
2596
2597/*
2598 * We must be able to split the free block used for the second last allocation
2599 * into two parts so that we have a free block for the last allocation.  See
2600 * _Heap_Block_split().
2601 */
2602#define _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2603  _Configure_Align_up( HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT )
2604
2605/*
2606 *  Calculate the RAM size based on the maximum number of objects configured.
2607 */
2608#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
2609
2610/*
2611 * Account for allocating the following per object
2612 *   + array of object control structures
2613 *   + local pointer table -- pointer per object plus a zero'th
2614 *     entry in the local pointer table.
2615 */
2616#define _CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \
2617  ( \
2618    _Configure_Object_RAM(_tasks, sizeof(Configuration_Thread_control)) \
2619      + _Configure_From_workspace(_Configure_Max_Objects(_tasks) \
2620        * THREAD_QUEUE_HEADS_SIZE(CONFIGURE_SCHEDULER_COUNT)) \
2621      + _Configure_Max_Objects(_number_FP_tasks) \
2622        * _Configure_From_workspace(CONTEXT_FP_SIZE) \
2623  )
2624
2625/*
2626 * This defines the amount of memory configured for the multiprocessing
2627 * support required by this application.
2628 */
2629#ifdef CONFIGURE_MP_APPLICATION
2630  #define _CONFIGURE_MEMORY_FOR_MP \
2631    (_CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
2632     _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS))
2633#else
2634  #define _CONFIGURE_MEMORY_FOR_MP  0
2635#endif
2636
2637/**
2638 * The following macro is used to calculate the memory allocated by RTEMS
2639 * for the message buffers associated with a particular message queue.
2640 * There is a fixed amount of overhead per message.
2641 */
2642#define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
2643    _Configure_From_workspace( \
2644      (_messages) * (_Configure_Align_up(_size, sizeof(uintptr_t)) \
2645        + sizeof(CORE_message_queue_Buffer_control)))
2646
2647/*
2648 * This macro is set to the amount of memory required for pending message
2649 * buffers in bytes.  It should be constructed by adding together a
2650 * set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
2651 */
2652#ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
2653  #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
2654#endif
2655
2656/**
2657 * This macro is available just in case the confdefs.h file underallocates
2658 * memory for a particular application.  This lets the user add some extra
2659 * memory in case something broken and underestimates.
2660 *
2661 * It is also possible for cases where confdefs.h overallocates memory,
2662 * you could substract memory from the allocated.  The estimate is just
2663 * that, an estimate, and assumes worst case alignment and padding on
2664 * each allocated element.  So in some cases it could be too conservative.
2665 *
2666 * NOTE: Historically this was used for message buffers.
2667 */
2668#ifndef CONFIGURE_MEMORY_OVERHEAD
2669  #define CONFIGURE_MEMORY_OVERHEAD 0
2670#endif
2671
2672/**
2673 * This calculates the amount of memory reserved for the IDLE tasks.
2674 * In an SMP system, each CPU core has its own idle task.
2675 */
2676#define _CONFIGURE_IDLE_TASKS_COUNT CONFIGURE_MAXIMUM_PROCESSORS
2677
2678/**
2679 * This defines the formula used to compute the amount of memory
2680 * reserved for internal task control structures.
2681 */
2682#if CPU_IDLE_TASK_IS_FP == TRUE
2683  #define _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS \
2684    _CONFIGURE_MEMORY_FOR_TASKS( \
2685      _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT, \
2686      _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT \
2687    )
2688#else
2689  #define _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS \
2690    _CONFIGURE_MEMORY_FOR_TASKS( \
2691      _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT, \
2692      _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT \
2693    )
2694#endif
2695
2696/**
2697 * This macro accounts for general RTEMS system overhead.
2698 */
2699#define _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
2700  ( _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS + \
2701    _CONFIGURE_INTERRUPT_STACK_MEMORY \
2702  )
2703
2704/**
2705 * This macro reserves the memory required by the statically configured
2706 * user extensions.
2707 */
2708#define _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \
2709  (_CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS == 0 ? 0 : \
2710    _Configure_From_workspace( \
2711      _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
2712        * sizeof(User_extensions_Switch_control) \
2713    ))
2714
2715/**
2716 * This macro provides a summation of the memory required by the
2717 * Classic API as configured.
2718 */
2719#define _CONFIGURE_MEMORY_FOR_CLASSIC \
2720   (_CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \
2721    _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \
2722   _CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES) + \
2723   _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
2724   _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
2725   _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \
2726   _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
2727   _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
2728   _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS) + \
2729   _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \
2730  )
2731
2732/*
2733 * This macro provides a summation of the memory required by SMP as configured.
2734 */
2735#if defined(RTEMS_SMP)
2736  #define _CONFIGURE_MEMORY_FOR_SMP \
2737     (CONFIGURE_MAXIMUM_PROCESSORS * \
2738      _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE ) \
2739     )
2740#else
2741  #define _CONFIGURE_MEMORY_FOR_SMP 0
2742#endif
2743
2744/**
2745 * This calculates the memory required for the executive workspace.
2746 *
2747 * This is an internal parameter.
2748 */
2749#define CONFIGURE_EXECUTIVE_RAM_SIZE \
2750( \
2751   _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD + \
2752   _CONFIGURE_MEMORY_FOR_TASKS( \
2753     _CONFIGURE_TASKS, _CONFIGURE_TASKS) + \
2754   _CONFIGURE_MEMORY_FOR_TASKS( \
2755     _CONFIGURE_POSIX_THREADS, _CONFIGURE_POSIX_THREADS) + \
2756   _CONFIGURE_MEMORY_FOR_CLASSIC + \
2757   _CONFIGURE_MEMORY_FOR_POSIX_KEYS( \
2758      _CONFIGURE_POSIX_KEYS, \
2759      CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \
2760   _CONFIGURE_MEMORY_FOR_POSIX + \
2761   _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
2762   _CONFIGURE_MEMORY_FOR_MP + \
2763   _CONFIGURE_MEMORY_FOR_SMP + \
2764   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
2765   (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
2766   _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2767)
2768
2769/*
2770 *  Now account for any extra memory that initialization tasks or threads
2771 *  may have requested.
2772 */
2773
2774/*
2775 * This accounts for any extra memory required by the Classic API
2776 * Initialization Task.
2777 */
2778#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2779  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
2780      (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2781#else
2782  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
2783#endif
2784
2785/*
2786 * This accounts for any extra memory required by the POSIX API
2787 * Initialization Thread.
2788 */
2789#if defined(RTEMS_POSIX_API) && \
2790    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \
2791      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2792  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
2793    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - \
2794      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2795#else
2796  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
2797#endif
2798
2799/*
2800 * This macro provides a summation of the various initialization task
2801 * and thread stack requirements.
2802 */
2803#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS \
2804    (_CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
2805    _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART)
2806
2807/*
2808 * This macro is calculated to specify the memory required for
2809 * the Idle tasks(s) stack.
2810 */
2811#define _CONFIGURE_IDLE_TASKS_STACK \
2812  (_CONFIGURE_IDLE_TASKS_COUNT * \
2813    _Configure_From_stackspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) )
2814
2815/*
2816 * This macro is calculated to specify the stack memory required for the MPCI
2817 * task.
2818 */
2819#define _CONFIGURE_MPCI_RECEIVE_SERVER_STACK \
2820  (_CONFIGURE_MPCI_RECEIVE_SERVER_COUNT * \
2821    _Configure_From_stackspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE))
2822
2823/*
2824 * This macro is calculated to specify the memory required for
2825 * the stacks of all tasks.
2826 */
2827#define _CONFIGURE_TASKS_STACK \
2828  (_Configure_Max_Objects( _CONFIGURE_TASKS ) * \
2829    _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
2830
2831/*
2832 * This macro is calculated to specify the memory required for
2833 * the stacks of all POSIX threads.
2834 */
2835#define _CONFIGURE_POSIX_THREADS_STACK \
2836  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \
2837    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2838
2839/*
2840 * This macro is calculated to specify the memory required for
2841 * the stacks of all Ada tasks.
2842 */
2843#define _CONFIGURE_ADA_TASKS_STACK \
2844  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_ADA_TASKS ) * \
2845    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2846
2847/*
2848 * This macro is calculated to specify the memory required for
2849 * the stacks of all Go routines.
2850 */
2851#define _CONFIGURE_GOROUTINES_STACK \
2852  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_GOROUTINES ) * \
2853    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2854
2855#else /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2856
2857#define _CONFIGURE_IDLE_TASKS_STACK 0
2858#define _CONFIGURE_MPCI_RECEIVE_SERVER_STACK 0
2859#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS 0
2860#define _CONFIGURE_TASKS_STACK 0
2861#define _CONFIGURE_POSIX_THREADS_STACK 0
2862#define _CONFIGURE_GOROUTINES_STACK 0
2863#define _CONFIGURE_ADA_TASKS_STACK 0
2864
2865#if CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK != 0
2866  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK"
2867#endif
2868
2869#if CONFIGURE_EXTRA_TASK_STACKS != 0
2870  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_TASK_STACKS"
2871#endif
2872
2873#endif /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2874
2875/*
2876 * This macro is calculated to specify the memory required for
2877 * all tasks and threads of all varieties.
2878 */
2879#define _CONFIGURE_STACK_SPACE_SIZE \
2880  ( \
2881    _CONFIGURE_IDLE_TASKS_STACK + \
2882    _CONFIGURE_MPCI_RECEIVE_SERVER_STACK + \
2883    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \
2884    _CONFIGURE_TASKS_STACK + \
2885    _CONFIGURE_POSIX_THREADS_STACK + \
2886    _CONFIGURE_GOROUTINES_STACK + \
2887    _CONFIGURE_ADA_TASKS_STACK + \
2888    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK + \
2889    _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS + \
2890    CONFIGURE_EXTRA_TASK_STACKS + \
2891    _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2892  )
2893
2894#ifndef CONFIGURE_MAXIMUM_THREAD_NAME_SIZE
2895  #define CONFIGURE_MAXIMUM_THREAD_NAME_SIZE 16
2896#endif
2897
2898#ifdef CONFIGURE_INIT
2899  typedef union {
2900    Scheduler_Node Base;
2901    #ifdef CONFIGURE_SCHEDULER_CBS
2902      Scheduler_CBS_Node CBS;
2903    #endif
2904    #ifdef CONFIGURE_SCHEDULER_EDF
2905      Scheduler_EDF_Node EDF;
2906    #endif
2907    #ifdef CONFIGURE_SCHEDULER_EDF_SMP
2908      Scheduler_EDF_SMP_Node EDF_SMP;
2909    #endif
2910    #ifdef CONFIGURE_SCHEDULER_PRIORITY
2911      Scheduler_priority_Node Priority;
2912    #endif
2913    #ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
2914      Scheduler_SMP_Node Simple_SMP;
2915    #endif
2916    #ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
2917      Scheduler_priority_SMP_Node Priority_SMP;
2918    #endif
2919    #ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
2920      Scheduler_priority_affinity_SMP_Node Priority_affinity_SMP;
2921    #endif
2922    #ifdef CONFIGURE_SCHEDULER_STRONG_APA
2923      Scheduler_strong_APA_Node Strong_APA;
2924    #endif
2925    #ifdef CONFIGURE_SCHEDULER_USER_PER_THREAD
2926      CONFIGURE_SCHEDULER_USER_PER_THREAD User;
2927    #endif
2928  } Configuration_Scheduler_node;
2929
2930  #ifdef RTEMS_SMP
2931    const size_t _Scheduler_Node_size = sizeof( Configuration_Scheduler_node );
2932  #endif
2933
2934  const size_t _Thread_Maximum_name_size = CONFIGURE_MAXIMUM_THREAD_NAME_SIZE;
2935
2936  typedef struct {
2937    Thread_Control Control;
2938    #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
2939      void *extensions[ CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1 ];
2940    #endif
2941    Configuration_Scheduler_node Scheduler_nodes[ CONFIGURE_SCHEDULER_COUNT ];
2942    RTEMS_API_Control API_RTEMS;
2943    #ifdef RTEMS_POSIX_API
2944      POSIX_API_Control API_POSIX;
2945    #endif
2946    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
2947      char name[ CONFIGURE_MAXIMUM_THREAD_NAME_SIZE ];
2948    #endif
2949    #if !defined(RTEMS_SCHEDSIM) \
2950      && defined(RTEMS_NEWLIB) \
2951      && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
2952      struct _reent Newlib;
2953    #else
2954      struct { /* Empty */ } Newlib;
2955    #endif
2956  } Configuration_Thread_control;
2957
2958  const size_t _Thread_Control_size = sizeof( Configuration_Thread_control );
2959
2960  const Thread_Control_add_on _Thread_Control_add_ons[] = {
2961    {
2962      offsetof( Configuration_Thread_control, Control.Scheduler.nodes ),
2963      offsetof( Configuration_Thread_control, Scheduler_nodes )
2964    }, {
2965      offsetof(
2966        Configuration_Thread_control,
2967        Control.API_Extensions[ THREAD_API_RTEMS ]
2968      ),
2969      offsetof( Configuration_Thread_control, API_RTEMS )
2970    }, {
2971      offsetof(
2972        Configuration_Thread_control,
2973        Control.libc_reent
2974      ),
2975      offsetof( Configuration_Thread_control, Newlib )
2976    }
2977    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
2978      , {
2979        offsetof(
2980          Configuration_Thread_control,
2981          Control.Join_queue.Queue.name
2982        ),
2983        offsetof( Configuration_Thread_control, name )
2984      }
2985    #endif
2986    #ifdef RTEMS_POSIX_API
2987      , {
2988        offsetof(
2989          Configuration_Thread_control,
2990          Control.API_Extensions[ THREAD_API_POSIX ]
2991        ),
2992        offsetof( Configuration_Thread_control, API_POSIX )
2993      }
2994    #endif
2995  };
2996
2997  const size_t _Thread_Control_add_on_count =
2998    RTEMS_ARRAY_SIZE( _Thread_Control_add_ons );
2999
3000  const uint32_t _Watchdog_Nanoseconds_per_tick =
3001    1000 * CONFIGURE_MICROSECONDS_PER_TICK;
3002
3003  const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND;
3004
3005  /**
3006   * This is the Classic API Configuration Table.
3007   */
3008  rtems_api_configuration_table Configuration_RTEMS_API = {
3009    _CONFIGURE_TASKS,
3010    CONFIGURE_MAXIMUM_TIMERS + _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER,
3011    CONFIGURE_MAXIMUM_SEMAPHORES,
3012    CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
3013    CONFIGURE_MAXIMUM_PARTITIONS,
3014    CONFIGURE_MAXIMUM_REGIONS,
3015    CONFIGURE_MAXIMUM_PORTS,
3016    CONFIGURE_MAXIMUM_PERIODS,
3017    _CONFIGURE_BARRIERS,
3018    CONFIGURE_INIT_TASK_TABLE_SIZE,
3019    CONFIGURE_INIT_TASK_TABLE
3020  };
3021
3022  #ifdef RTEMS_POSIX_API
3023    /**
3024     * This is the POSIX API Configuration Table.
3025     */
3026    posix_api_configuration_table Configuration_POSIX_API = {
3027      _CONFIGURE_POSIX_THREADS,
3028      CONFIGURE_MAXIMUM_POSIX_TIMERS,
3029      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
3030      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
3031      CONFIGURE_MAXIMUM_POSIX_SEMAPHORES,
3032      CONFIGURE_MAXIMUM_POSIX_SHMS,
3033      CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
3034      CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
3035    };
3036  #endif
3037
3038  /**
3039   * This variable specifies the minimum stack size for tasks in an RTEMS
3040   * application.
3041   *
3042   * NOTE: This is left as a simple uint32_t so it can be externed as
3043   *       needed without requring being high enough logical to
3044   *       include the full configuration table.
3045   */
3046  uint32_t rtems_minimum_stack_size =
3047    CONFIGURE_MINIMUM_TASK_STACK_SIZE;
3048
3049  /**
3050   * This is the primary Configuration Table for this application.
3051   */
3052  const rtems_configuration_table Configuration = {
3053    CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
3054    _CONFIGURE_STACK_SPACE_SIZE,               /* required stack space */
3055    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
3056    _CONFIGURE_POSIX_KEYS,                     /* POSIX keys are always */
3057    CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS,  /*   enabled */
3058    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
3059    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
3060    CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
3061    CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
3062    CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
3063    CONFIGURE_TASK_STACK_ALLOCATOR_INIT,      /* stack allocator init */
3064    CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
3065    CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
3066    CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */
3067    #ifdef CONFIGURE_UNIFIED_WORK_AREAS       /* true for unified work areas */
3068      true,
3069    #else
3070      false,
3071    #endif
3072    #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE /* true to avoid
3073                                                 work space for thread stack
3074                                                 allocation */
3075      true,
3076    #else
3077      false,
3078    #endif
3079    #ifdef RTEMS_SMP
3080      #ifdef _CONFIGURE_SMP_APPLICATION
3081        true,
3082      #else
3083        false,
3084      #endif
3085    #endif
3086    _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
3087    CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
3088    #if defined(RTEMS_MULTIPROCESSING)
3089      CONFIGURE_MULTIPROCESSING_TABLE,        /* pointer to MP config table */
3090    #endif
3091    #ifdef RTEMS_SMP
3092      CONFIGURE_MAXIMUM_PROCESSORS,
3093    #endif
3094  };
3095#endif
3096
3097#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
3098
3099#if defined(RTEMS_SMP)
3100 /*
3101  * Instantiate the Per CPU information based upon the user configuration.
3102  */
3103 #if defined(CONFIGURE_INIT)
3104   Per_CPU_Control_envelope _Per_CPU_Information[CONFIGURE_MAXIMUM_PROCESSORS];
3105 #endif
3106
3107#endif
3108
3109/*
3110 *  If the user has configured a set of Classic API Initialization Tasks,
3111 *  then we need to install the code that runs that loop.
3112 */
3113#ifdef CONFIGURE_INIT
3114  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
3115      defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
3116    RTEMS_SYSINIT_ITEM(
3117      _RTEMS_tasks_Initialize_user_tasks_body,
3118      RTEMS_SYSINIT_CLASSIC_USER_TASKS,
3119      RTEMS_SYSINIT_ORDER_MIDDLE
3120    );
3121  #endif
3122#endif
3123
3124/*
3125 *  If the user has configured a set of POSIX Initialization Threads,
3126 *  then we need to install the code that runs that loop.
3127 */
3128#ifdef RTEMS_POSIX_API
3129  #ifdef CONFIGURE_INIT
3130    #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
3131        defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
3132      RTEMS_SYSINIT_ITEM(
3133        _POSIX_Threads_Initialize_user_threads_body,
3134        RTEMS_SYSINIT_POSIX_USER_THREADS,
3135        RTEMS_SYSINIT_ORDER_MIDDLE
3136      );
3137    #endif
3138  #endif
3139#endif
3140
3141/*
3142 *  Select PCI Configuration Library
3143 */
3144#ifdef RTEMS_PCI_CONFIG_LIB
3145  #ifdef CONFIGURE_INIT
3146    #define PCI_LIB_NONE 0
3147    #define PCI_LIB_AUTO 1
3148    #define PCI_LIB_STATIC 2
3149    #define PCI_LIB_READ 3
3150    #define PCI_LIB_PERIPHERAL 4
3151    #if CONFIGURE_PCI_LIB == PCI_LIB_AUTO
3152      #define PCI_CFG_AUTO_LIB
3153      #include <pci/cfg.h>
3154      struct pci_bus pci_hb;
3155      #define PCI_LIB_INIT pci_config_auto
3156      #define PCI_LIB_CONFIG pci_config_auto_register
3157    #elif CONFIGURE_PCI_LIB == PCI_LIB_STATIC
3158      #define PCI_CFG_STATIC_LIB
3159      #include <pci/cfg.h>
3160      #define PCI_LIB_INIT pci_config_static
3161      #define PCI_LIB_CONFIG NULL
3162      /* Let user define PCI configuration (struct pci_bus pci_hb) */
3163    #elif CONFIGURE_PCI_LIB == PCI_LIB_READ
3164      #define PCI_CFG_READ_LIB
3165      #include <pci/cfg.h>
3166      #define PCI_LIB_INIT pci_config_read
3167      #define PCI_LIB_CONFIG NULL
3168      struct pci_bus pci_hb;
3169    #elif CONFIGURE_PCI_LIB == PCI_LIB_PERIPHERAL
3170      #define PCI_LIB_INIT pci_config_peripheral
3171      #define PCI_LIB_CONFIG NULL
3172      /* Let user define PCI configuration (struct pci_bus pci_hb) */
3173    #elif CONFIGURE_PCI_LIB == PCI_LIB_NONE
3174      #define PCI_LIB_INIT NULL
3175      #define PCI_LIB_CONFIG NULL
3176      /* No PCI Configuration at all, user can use/debug access routines */
3177    #else
3178      #error NO PCI LIBRARY DEFINED
3179    #endif
3180
3181    const int pci_config_lib_type = CONFIGURE_PCI_LIB;
3182    int (*pci_config_lib_init)(void) = PCI_LIB_INIT;
3183    void (*pci_config_lib_register)(void *config) = PCI_LIB_CONFIG;
3184  #endif
3185#endif
3186
3187#ifdef __cplusplus
3188}
3189#endif
3190
3191/******************************************************************
3192 ******************************************************************
3193 ******************************************************************
3194 *         CONFIGURATION WARNINGS AND ERROR CHECKING              *
3195 ******************************************************************
3196 ******************************************************************
3197 ******************************************************************
3198 */
3199
3200#if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
3201  /**
3202   * This is a debug mechanism, so if you need to, the executable will
3203   * have a structure with various partial values.  Add to this as you
3204   * need to.  Viewing this structure in gdb combined with dumping
3205   * the Configuration structures generated should help a lot in tracing
3206   * down errors and analyzing where over and under allocations are.
3207   */
3208  typedef struct {
3209    uint32_t SYSTEM_OVERHEAD;
3210    uint32_t STATIC_EXTENSIONS;
3211    uint32_t INITIALIZATION_THREADS_STACKS;
3212
3213    uint32_t PER_INTEGER_TASK;
3214    uint32_t FP_OVERHEAD;
3215    uint32_t CLASSIC;
3216    uint32_t POSIX;
3217
3218    /* System overhead pieces */
3219    uint32_t INTERRUPT_STACK_MEMORY;
3220    uint32_t MEMORY_FOR_IDLE_TASK;
3221
3222    /* Classic API Pieces */
3223    uint32_t CLASSIC_TASKS;
3224    uint32_t TIMERS;
3225    uint32_t SEMAPHORES;
3226    uint32_t MESSAGE_QUEUES;
3227    uint32_t PARTITIONS;
3228    uint32_t REGIONS;
3229    uint32_t PORTS;
3230    uint32_t PERIODS;
3231    uint32_t BARRIERS;
3232    uint32_t USER_EXTENSIONS;
3233
3234    /* POSIX API managers that are always enabled */
3235    uint32_t POSIX_KEYS;
3236
3237#ifdef RTEMS_POSIX_API
3238    /* POSIX API Pieces */
3239    uint32_t POSIX_TIMERS;
3240    uint32_t POSIX_QUEUED_SIGNALS;
3241    uint32_t POSIX_MESSAGE_QUEUES;
3242    uint32_t POSIX_SEMAPHORES;
3243    uint32_t POSIX_SHMS;
3244#endif
3245
3246    /* Stack space sizes */
3247    uint32_t IDLE_TASKS_STACK;
3248    uint32_t INITIALIZATION_THREADS_EXTRA_STACKS;
3249    uint32_t TASKS_STACK;
3250    uint32_t POSIX_THREADS_STACK;
3251    uint32_t GOROUTINES_STACK;
3252    uint32_t ADA_TASKS_STACK;
3253    uint32_t EXTRA_MPCI_RECEIVE_SERVER_STACK;
3254    uint32_t EXTRA_TASK_STACKS;
3255  } Configuration_Debug_t;
3256
3257  Configuration_Debug_t Configuration_Memory_Debug = {
3258    /* General Information */
3259    _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD,
3260    _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS,
3261    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
3262    _CONFIGURE_MEMORY_FOR_TASKS(1, 0),
3263    _CONFIGURE_MEMORY_FOR_TASKS(0, 1),
3264    _CONFIGURE_MEMORY_FOR_CLASSIC,
3265    _CONFIGURE_MEMORY_FOR_POSIX,
3266
3267    /* System overhead pieces */
3268    _CONFIGURE_INTERRUPT_STACK_MEMORY,
3269    _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS,
3270
3271    /* Classic API Pieces */
3272    _CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
3273    _CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
3274    _CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES),
3275    _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES),
3276    _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS),
3277    _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ),
3278    _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS),
3279    _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS),
3280    _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS),
3281    _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
3282    _CONFIGURE_MEMORY_FOR_POSIX_KEYS( _CONFIGURE_POSIX_KEYS, \
3283                                     CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ),
3284
3285#ifdef RTEMS_POSIX_API
3286    /* POSIX API Pieces */
3287    _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
3288      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
3289    _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
3290      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
3291    _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
3292    _CONFIGURE_MEMORY_FOR_POSIX_SHMS( CONFIGURE_MAXIMUM_POSIX_SHMS ),
3293    _CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
3294#endif
3295
3296    /* Stack space sizes */
3297    _CONFIGURE_IDLE_TASKS_STACK,
3298    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
3299    _CONFIGURE_TASKS_STACK,
3300    _CONFIGURE_POSIX_THREADS_STACK,
3301    _CONFIGURE_GOROUTINES_STACK,
3302    _CONFIGURE_ADA_TASKS_STACK,
3303    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK,
3304    CONFIGURE_EXTRA_TASK_STACKS
3305  };
3306#endif
3307
3308/*
3309 *  Make sure a task/thread of some sort is configured.
3310 *
3311 *  When analyzing RTEMS to find the smallest possible of memory
3312 *  that must be allocated, you probably do want to configure 0
3313 *  tasks/threads so there is a smaller set of calls to _Workspace_Allocate
3314 *  to analyze.
3315 */
3316#if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
3317  #if (CONFIGURE_MAXIMUM_TASKS == 0) && \
3318      (CONFIGURE_MAXIMUM_POSIX_THREADS == 0) && \
3319      (CONFIGURE_MAXIMUM_ADA_TASKS == 0) && \
3320      (CONFIGURE_MAXIMUM_GOROUTINES == 0)
3321    #error "CONFIGURATION ERROR: No tasks or threads configured!!"
3322  #endif
3323#endif
3324
3325#ifndef RTEMS_SCHEDSIM
3326/*
3327 *  Make sure at least one of the initialization task/thread
3328 *  tables was defined.
3329 */
3330#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
3331    !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \
3332    !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
3333#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
3334#endif
3335#endif
3336
3337/*
3338 *  If the user is trying to configure a multiprocessing application and
3339 *  RTEMS was not configured and built multiprocessing, then error out.
3340 */
3341#if defined(CONFIGURE_MP_APPLICATION) && \
3342    !defined(RTEMS_MULTIPROCESSING)
3343#error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!"
3344#endif
3345
3346/*
3347 *  If an attempt was made to configure POSIX objects and
3348 *  the POSIX API was not configured into RTEMS, error out.
3349 *
3350 *  @note POSIX Keys are always available so the parameters
3351 *        CONFIGURE_MAXIMUM_POSIX_KEYS and
3352 *        CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS  are not in this list.
3353 */
3354#if !defined(RTEMS_POSIX_API)
3355  #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
3356       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
3357       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
3358       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
3359       (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \
3360       (CONFIGURE_MAXIMUM_POSIX_SHMS != 0) || \
3361      defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
3362  #error "CONFIGURATION ERROR: POSIX API support not configured!!"
3363  #endif
3364#endif
3365
3366#if !defined(RTEMS_SCHEDSIM)
3367  #if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE)
3368    /*
3369     *  You must either explicity include or exclude the clock driver.
3370     *  It is such a common newbie error to leave it out.  Maybe this
3371     *  will put an end to it.
3372     *
3373     *  NOTE: If you are using the timer driver, it is considered
3374     *        mutually exclusive with the clock driver because the
3375     *        drivers are assumed to use the same "timer" hardware
3376     *        on many boards.
3377     */
3378    #if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
3379        !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \
3380        !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER)
3381      #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?"
3382     #endif
3383
3384    /*
3385     * Only one of the following three configuration parameters should be
3386     * defined at a time.
3387     */
3388    #if ((defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) + \
3389          defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER) + \
3390          defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER)) > 1)
3391       #error "CONFIGURATION ERROR: More than one clock/timer driver configuration parameter specified?!?"
3392    #endif
3393  #endif /* !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE) */
3394#endif   /* !defined(RTEMS_SCHEDSIM) */
3395
3396/*
3397 *  These names have been obsoleted so make the user application stop compiling
3398 */
3399#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
3400    defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
3401    defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
3402    defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
3403    defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
3404#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
3405#endif
3406
3407/*
3408 *  Validate the configured maximum priority
3409 */
3410#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \
3411     (CONFIGURE_MAXIMUM_PRIORITY != 7) && \
3412     (CONFIGURE_MAXIMUM_PRIORITY != 15) && \
3413     (CONFIGURE_MAXIMUM_PRIORITY != 31) && \
3414     (CONFIGURE_MAXIMUM_PRIORITY != 63) && \
3415     (CONFIGURE_MAXIMUM_PRIORITY != 127) && \
3416     (CONFIGURE_MAXIMUM_PRIORITY != 255))
3417  #error "Maximum priority is not 1 less than a power of 2 between 4 and 256"
3418#endif
3419
3420#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM)
3421  #error "Maximum priority configured higher than supported by target."
3422#endif
3423
3424#ifdef CONFIGURE_NUMBER_OF_TERMIOS_PORTS
3425  #warning "The CONFIGURE_NUMBER_OF_TERMIOS_PORTS configuration option is obsolete since RTEMS 5.1"
3426#endif
3427
3428#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
3429  #warning "The CONFIGURE_MAXIMUM_POSIX_BARRIERS configuration option is obsolete since RTEMS 5.1"
3430#endif
3431
3432#ifdef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
3433  #warning "The CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES configuration option is obsolete since RTEMS 5.1"
3434#endif
3435
3436#ifdef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
3437  #warning "The CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS configuration option is obsolete since RTEMS 5.1"
3438#endif
3439
3440#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
3441  #warning "The CONFIGURE_MAXIMUM_POSIX_MUTEXES configuration option is obsolete since RTEMS 5.1"
3442#endif
3443
3444#ifdef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
3445  #warning "The CONFIGURE_MAXIMUM_POSIX_RWLOCKS configuration option is obsolete since RTEMS 5.1"
3446#endif
3447
3448#ifdef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
3449  #warning "The CONFIGURE_MAXIMUM_POSIX_SPINLOCKS configuration option is obsolete since RTEMS 5.1"
3450#endif
3451
3452#ifdef CONFIGURE_TERMIOS_DISABLED
3453  #warning "The CONFIGURE_TERMIOS_DISABLED configuration option is obsolete since RTEMS 5.1"
3454#endif
3455
3456/*
3457 * POSIX Key pair shouldn't be less than POSIX Key, which is highly
3458 * likely to be error.
3459 */
3460#if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \
3461    (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0)
3462  #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < CONFIGURE_MAXIMUM_POSIX_KEYS)
3463    #error "Fewer POSIX Key pairs than POSIX Key!"
3464  #endif
3465#endif
3466
3467/*
3468 * IMFS block size for in memory files (memfiles) must be a power of
3469 * two between 16 and 512 inclusive.
3470 */
3471#if ((CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 16) && \
3472     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 32) && \
3473     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 64) && \
3474     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 128) && \
3475     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 256) && \
3476     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 512))
3477  #error "IMFS Memfile block size must be a power of 2 between 16 and 512"
3478#endif
3479
3480
3481#endif
3482/* end of include file */
Note: See TracBrowser for help on using the repository browser.