source: rtems/cpukit/include/rtems/confdefs.h @ 3ef7e744

Last change on this file since 3ef7e744 was 3ef7e744, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 30, 2018 at 5:44:56 AM

config: Fix -Wint-in-bool-context warnings

  • Property mode set to 100755
File size: 110.8 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
713 *    - CONFIGURE_SCHEDULER_TABLE_ENTRIES
714 *    - CONFIGURE_SCHEDULER_USER_PER_THREAD
715 */
716
717#ifdef CONFIGURE_SCHEDULER_CONTEXT
718  #warning "CONFIGURE_SCHEDULER_CONTEXT has been renamed to CONFIGURE_SCHEDULER since RTEMS 5.1"
719  #define CONFIGURE_SCHEDULER CONFIGURE_SCHEDULER_CONTEXT
720#endif
721
722#ifdef CONFIGURE_SCHEDULER_CONTROLS
723  #warning "CONFIGURE_SCHEDULER_CONTROLS has been renamed to CONFIGURE_SCHEDULER_TABLE_ENTRIES since RTEMS 5.1"
724  #define CONFIGURE_SCHEDULER_TABLE_ENTRIES CONFIGURE_SCHEDULER_CONTROLS
725#endif
726
727#ifdef CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS
728  #warning "CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS has been renamed to CONFIGURE_SCHEDULER_ASSIGNMENTS since RTEMS 5.1"
729  #define CONFIGURE_SCHEDULER_ASSIGNMENTS CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS
730#endif
731
732#if !defined(CONFIGURE_SCHEDULER_USER) && \
733    !defined(CONFIGURE_SCHEDULER_PRIORITY) && \
734    !defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) && \
735    !defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) && \
736    !defined(CONFIGURE_SCHEDULER_STRONG_APA) && \
737    !defined(CONFIGURE_SCHEDULER_SIMPLE) && \
738    !defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) && \
739    !defined(CONFIGURE_SCHEDULER_EDF) && \
740    !defined(CONFIGURE_SCHEDULER_EDF_SMP) && \
741    !defined(CONFIGURE_SCHEDULER_CBS)
742  #if defined(RTEMS_SMP) && CONFIGURE_MAXIMUM_PROCESSORS > 1
743    /**
744     * If no scheduler is specified in an SMP configuration, the
745     * EDF scheduler is default.
746     */
747    #define CONFIGURE_SCHEDULER_EDF_SMP
748  #else
749    /**
750     * If no scheduler is specified in a uniprocessor configuration, the
751     * priority scheduler is default.
752     */
753    #define CONFIGURE_SCHEDULER_PRIORITY
754  #endif
755#endif
756
757#include <rtems/scheduler.h>
758
759/*
760 * If the Priority Scheduler is selected, then configure for it.
761 */
762#if defined(CONFIGURE_SCHEDULER_PRIORITY)
763  #if !defined(CONFIGURE_SCHEDULER_NAME)
764    /** Configure the name of the scheduler instance */
765    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'D', ' ')
766  #endif
767
768  #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
769    /** Configure the context needed by the scheduler instance */
770    #define CONFIGURE_SCHEDULER \
771      RTEMS_SCHEDULER_PRIORITY( \
772        dflt, \
773        CONFIGURE_MAXIMUM_PRIORITY + 1 \
774      )
775
776    /** Configure the controls for this scheduler instance */
777    #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
778      RTEMS_SCHEDULER_TABLE_PRIORITY(dflt, CONFIGURE_SCHEDULER_NAME)
779  #endif
780#endif
781
782/*
783 * If the Deterministic Priority SMP Scheduler is selected, then configure for
784 * it.
785 */
786#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
787  #if !defined(CONFIGURE_SCHEDULER_NAME)
788    /** Configure the name of the scheduler instance */
789    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'D', ' ')
790  #endif
791
792  #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
793    /** Configure the context needed by the scheduler instance */
794    #define CONFIGURE_SCHEDULER \
795      RTEMS_SCHEDULER_PRIORITY_SMP( \
796        dflt, \
797        CONFIGURE_MAXIMUM_PRIORITY + 1 \
798      )
799
800    /** Configure the controls for this scheduler instance */
801    #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
802      RTEMS_SCHEDULER_TABLE_PRIORITY_SMP(dflt, CONFIGURE_SCHEDULER_NAME)
803  #endif
804#endif
805
806/*
807 * If the Deterministic Priority Affinity SMP Scheduler is selected, then configure for
808 * it.
809 */
810#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP)
811  #if !defined(CONFIGURE_SCHEDULER_NAME)
812    /** Configure the name of the scheduler instance */
813    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'A', ' ')
814  #endif
815
816  #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
817    /** Configure the context needed by the scheduler instance */
818    #define CONFIGURE_SCHEDULER \
819      RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( \
820        dflt, \
821        CONFIGURE_MAXIMUM_PRIORITY + 1 \
822      )
823
824    /** Configure the controls for this scheduler instance */
825    #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
826      RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( \
827        dflt, \
828        CONFIGURE_SCHEDULER_NAME \
829      )
830  #endif
831#endif
832
833/*
834 * If the Strong APA Scheduler is selected, then configure for
835 * it.
836 */
837#if defined(CONFIGURE_SCHEDULER_STRONG_APA)
838  #if !defined(CONFIGURE_SCHEDULER_NAME)
839    /** Configure the name of the scheduler instance */
840    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'A', 'P', 'A')
841  #endif
842
843  #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
844    /** Configure the context needed by the scheduler instance */
845    #define CONFIGURE_SCHEDULER \
846      RTEMS_SCHEDULER_STRONG_APA( \
847        dflt, \
848        CONFIGURE_MAXIMUM_PRIORITY + 1 \
849      )
850
851    /** Configure the controls for this scheduler instance */
852    #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
853      RTEMS_SCHEDULER_TABLE_STRONG_APA(dflt, CONFIGURE_SCHEDULER_NAME)
854  #endif
855#endif
856
857/*
858 * If the Simple Priority Scheduler is selected, then configure for it.
859 */
860#if defined(CONFIGURE_SCHEDULER_SIMPLE)
861  #if !defined(CONFIGURE_SCHEDULER_NAME)
862    /** Configure the name of the scheduler instance */
863    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'S', ' ')
864  #endif
865
866  #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
867    /** Configure the context needed by the scheduler instance */
868    #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_SIMPLE(dflt)
869
870    /** Configure the controls for this scheduler instance */
871    #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
872      RTEMS_SCHEDULER_TABLE_SIMPLE(dflt, CONFIGURE_SCHEDULER_NAME)
873  #endif
874#endif
875
876/*
877 * If the Simple SMP Priority Scheduler is selected, then configure for it.
878 */
879#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP)
880  #if !defined(CONFIGURE_SCHEDULER_NAME)
881    /** Configure the name of the scheduler instance */
882    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'S', ' ')
883  #endif
884
885  #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
886    /** Configure the context needed by the scheduler instance */
887    #define CONFIGURE_SCHEDULER \
888      RTEMS_SCHEDULER_SIMPLE_SMP(dflt)
889
890    /** Configure the controls for this scheduler instance */
891    #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
892      RTEMS_SCHEDULER_TABLE_SIMPLE_SMP(dflt, CONFIGURE_SCHEDULER_NAME)
893  #endif
894#endif
895
896/*
897 * If the EDF Scheduler is selected, then configure for it.
898 */
899#if defined(CONFIGURE_SCHEDULER_EDF)
900  #if !defined(CONFIGURE_SCHEDULER_NAME)
901    /** Configure the name of the scheduler instance */
902    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'E', 'D', 'F')
903  #endif
904
905  #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
906    /** Configure the context needed by the scheduler instance */
907    #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_EDF(dflt)
908
909    /** Configure the controls for this scheduler instance */
910    #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
911      RTEMS_SCHEDULER_TABLE_EDF(dflt, CONFIGURE_SCHEDULER_NAME)
912  #endif
913#endif
914
915/*
916 * If the EDF SMP Scheduler is selected, then configure for it.
917 */
918#if defined(CONFIGURE_SCHEDULER_EDF_SMP)
919  #if !defined(CONFIGURE_SCHEDULER_NAME)
920    /** Configure the name of the scheduler instance */
921    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'E', 'D', 'F')
922  #endif
923
924  #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
925    /** Configure the context needed by the scheduler instance */
926    #define CONFIGURE_SCHEDULER \
927      RTEMS_SCHEDULER_EDF_SMP(dflt, CONFIGURE_MAXIMUM_PROCESSORS)
928
929    /** Configure the controls for this scheduler instance */
930    #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
931      RTEMS_SCHEDULER_TABLE_EDF_SMP(dflt, CONFIGURE_SCHEDULER_NAME)
932  #endif
933#endif
934
935/*
936 * If the CBS Scheduler is selected, then configure for it.
937 */
938#if defined(CONFIGURE_SCHEDULER_CBS)
939  #if !defined(CONFIGURE_SCHEDULER_NAME)
940    /** Configure the name of the scheduler instance */
941    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'C', 'B', 'S')
942  #endif
943
944  #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES)
945    /** Configure the context needed by the scheduler instance */
946    #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_CBS(dflt)
947
948    /** Configure the controls for this scheduler instance */
949    #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
950      RTEMS_SCHEDULER_TABLE_CBS(dflt, CONFIGURE_SCHEDULER_NAME)
951  #endif
952
953  #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
954    #define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS
955  #endif
956
957  #ifdef CONFIGURE_INIT
958    const uint32_t _Scheduler_CBS_Maximum_servers =
959      CONFIGURE_CBS_MAXIMUM_SERVERS;
960
961    Scheduler_CBS_Server
962      _Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ];
963  #endif
964#endif
965
966/*
967 * Set up the scheduler entry points table.  The scheduling code uses
968 * this code to know which scheduler is configured by the user.
969 */
970#ifdef CONFIGURE_INIT
971  #if defined(CONFIGURE_SCHEDULER)
972    CONFIGURE_SCHEDULER;
973  #endif
974
975  const Scheduler_Control _Scheduler_Table[] = {
976    CONFIGURE_SCHEDULER_TABLE_ENTRIES
977  };
978
979  #define CONFIGURE_SCHEDULER_COUNT RTEMS_ARRAY_SIZE( _Scheduler_Table )
980
981  #if defined(RTEMS_SMP)
982    const size_t _Scheduler_Count = CONFIGURE_SCHEDULER_COUNT;
983
984    const Scheduler_Assignment _Scheduler_Initial_assignments[] = {
985      #if defined(CONFIGURE_SCHEDULER_ASSIGNMENTS)
986        CONFIGURE_SCHEDULER_ASSIGNMENTS
987      #else
988        #define _CONFIGURE_SCHEDULER_ASSIGN \
989          RTEMS_SCHEDULER_ASSIGN( \
990            0, \
991            RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \
992          )
993        _CONFIGURE_SCHEDULER_ASSIGN
994        #if CONFIGURE_MAXIMUM_PROCESSORS >= 2
995          , _CONFIGURE_SCHEDULER_ASSIGN
996        #endif
997        #if CONFIGURE_MAXIMUM_PROCESSORS >= 3
998          , _CONFIGURE_SCHEDULER_ASSIGN
999        #endif
1000        #if CONFIGURE_MAXIMUM_PROCESSORS >= 4
1001          , _CONFIGURE_SCHEDULER_ASSIGN
1002        #endif
1003        #if CONFIGURE_MAXIMUM_PROCESSORS >= 5
1004          , _CONFIGURE_SCHEDULER_ASSIGN
1005        #endif
1006        #if CONFIGURE_MAXIMUM_PROCESSORS >= 6
1007          , _CONFIGURE_SCHEDULER_ASSIGN
1008        #endif
1009        #if CONFIGURE_MAXIMUM_PROCESSORS >= 7
1010          , _CONFIGURE_SCHEDULER_ASSIGN
1011        #endif
1012        #if CONFIGURE_MAXIMUM_PROCESSORS >= 8
1013          , _CONFIGURE_SCHEDULER_ASSIGN
1014        #endif
1015        #if CONFIGURE_MAXIMUM_PROCESSORS >= 9
1016          , _CONFIGURE_SCHEDULER_ASSIGN
1017        #endif
1018        #if CONFIGURE_MAXIMUM_PROCESSORS >= 10
1019          , _CONFIGURE_SCHEDULER_ASSIGN
1020        #endif
1021        #if CONFIGURE_MAXIMUM_PROCESSORS >= 11
1022          , _CONFIGURE_SCHEDULER_ASSIGN
1023        #endif
1024        #if CONFIGURE_MAXIMUM_PROCESSORS >= 12
1025          , _CONFIGURE_SCHEDULER_ASSIGN
1026        #endif
1027        #if CONFIGURE_MAXIMUM_PROCESSORS >= 13
1028          , _CONFIGURE_SCHEDULER_ASSIGN
1029        #endif
1030        #if CONFIGURE_MAXIMUM_PROCESSORS >= 14
1031          , _CONFIGURE_SCHEDULER_ASSIGN
1032        #endif
1033        #if CONFIGURE_MAXIMUM_PROCESSORS >= 15
1034          , _CONFIGURE_SCHEDULER_ASSIGN
1035        #endif
1036        #if CONFIGURE_MAXIMUM_PROCESSORS >= 16
1037          , _CONFIGURE_SCHEDULER_ASSIGN
1038        #endif
1039        #if CONFIGURE_MAXIMUM_PROCESSORS >= 17
1040          , _CONFIGURE_SCHEDULER_ASSIGN
1041        #endif
1042        #if CONFIGURE_MAXIMUM_PROCESSORS >= 18
1043          , _CONFIGURE_SCHEDULER_ASSIGN
1044        #endif
1045        #if CONFIGURE_MAXIMUM_PROCESSORS >= 19
1046          , _CONFIGURE_SCHEDULER_ASSIGN
1047        #endif
1048        #if CONFIGURE_MAXIMUM_PROCESSORS >= 20
1049          , _CONFIGURE_SCHEDULER_ASSIGN
1050        #endif
1051        #if CONFIGURE_MAXIMUM_PROCESSORS >= 21
1052          , _CONFIGURE_SCHEDULER_ASSIGN
1053        #endif
1054        #if CONFIGURE_MAXIMUM_PROCESSORS >= 22
1055          , _CONFIGURE_SCHEDULER_ASSIGN
1056        #endif
1057        #if CONFIGURE_MAXIMUM_PROCESSORS >= 23
1058          , _CONFIGURE_SCHEDULER_ASSIGN
1059        #endif
1060        #if CONFIGURE_MAXIMUM_PROCESSORS >= 24
1061          , _CONFIGURE_SCHEDULER_ASSIGN
1062        #endif
1063        #if CONFIGURE_MAXIMUM_PROCESSORS >= 25
1064          , _CONFIGURE_SCHEDULER_ASSIGN
1065        #endif
1066        #if CONFIGURE_MAXIMUM_PROCESSORS >= 26
1067          , _CONFIGURE_SCHEDULER_ASSIGN
1068        #endif
1069        #if CONFIGURE_MAXIMUM_PROCESSORS >= 27
1070          , _CONFIGURE_SCHEDULER_ASSIGN
1071        #endif
1072        #if CONFIGURE_MAXIMUM_PROCESSORS >= 28
1073          , _CONFIGURE_SCHEDULER_ASSIGN
1074        #endif
1075        #if CONFIGURE_MAXIMUM_PROCESSORS >= 29
1076          , _CONFIGURE_SCHEDULER_ASSIGN
1077        #endif
1078        #if CONFIGURE_MAXIMUM_PROCESSORS >= 30
1079          , _CONFIGURE_SCHEDULER_ASSIGN
1080        #endif
1081        #if CONFIGURE_MAXIMUM_PROCESSORS >= 31
1082          , _CONFIGURE_SCHEDULER_ASSIGN
1083        #endif
1084        #if CONFIGURE_MAXIMUM_PROCESSORS >= 32
1085          , _CONFIGURE_SCHEDULER_ASSIGN
1086        #endif
1087        #undef _CONFIGURE_SCHEDULER_ASSIGN
1088      #endif
1089    };
1090
1091    RTEMS_STATIC_ASSERT(
1092      CONFIGURE_MAXIMUM_PROCESSORS
1093        == RTEMS_ARRAY_SIZE( _Scheduler_Initial_assignments ),
1094      _Scheduler_Initial_assignments
1095    );
1096  #endif
1097#endif
1098/**@}*/ /* end of Scheduler Configuration */
1099
1100/**
1101 * @defgroup ConfigurationIdle IDLE Thread Configuration
1102 *
1103 * @addtogroup Configuration
1104 *
1105 * This module contains configuration parameters related to the
1106 * set of IDLE threads. On a uniprocessor system, there is one
1107 * IDLE thread. On an SMP system, there is one for each core.
1108 */
1109
1110/*
1111 *  If you said the IDLE task was going to do application initialization
1112 *  and didn't override the IDLE body, then something is amiss.
1113 */
1114#if (defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
1115     !defined(CONFIGURE_IDLE_TASK_BODY))
1116  #error "CONFIGURE_ERROR: You did not override the IDLE task body."
1117#endif
1118
1119/**
1120 * @brief Idle task body configuration.
1121 *
1122 * There is a default IDLE thread body provided by RTEMS which
1123 * has the possibility of being CPU specific.  There may be a
1124 * BSP specific override of the RTEMS default body and in turn,
1125 * the application may override and provide its own.
1126 */
1127#ifndef CONFIGURE_IDLE_TASK_BODY
1128  #if defined(BSP_IDLE_TASK_BODY)
1129    #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
1130  #elif (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
1131    #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
1132  #else
1133    /* only instantiate and compile if used */
1134    #ifdef CONFIGURE_INIT
1135      void *_Thread_Idle_body(uintptr_t ignored)
1136      {
1137        for( ; ; ) ;
1138        return 0;   /* to avoid warning */
1139      }
1140    #endif
1141    #define CONFIGURE_IDLE_TASK_BODY _Thread_Idle_body
1142  #endif
1143#endif
1144/**@}*/ /* end of IDLE thread configuration */
1145
1146/**
1147 * @defgroup ConfigurationStackSize Configuration Thread Stack Size
1148 *
1149 * @addtogroup Configuration
1150 *
1151 * This module contains parameters related to thread aand interrupt stacks.
1152 */
1153
1154/**
1155 * By default, use the minimum stack size requested by this port.
1156 */
1157#ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE
1158  #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
1159#endif
1160
1161/**
1162 * This specifies the default POSIX thread stack size. By default, it is
1163 * twice that recommended for the port.
1164 */
1165#define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \
1166  (2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1167
1168/**
1169 * @brief Idle task stack size configuration.
1170 *
1171 * By default, the IDLE task will have a stack of minimum size.
1172 * The BSP or application may override this value.
1173 */
1174#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
1175  #ifdef BSP_IDLE_TASK_STACK_SIZE
1176    #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
1177  #else
1178    #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
1179  #endif
1180#endif
1181#if CONFIGURE_IDLE_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE
1182  #error "CONFIGURE_IDLE_TASK_STACK_SIZE less than CONFIGURE_MINIMUM_TASK_STACK_SIZE"
1183#endif
1184
1185/**
1186 * @brief Interrupt stack size configuration.
1187 *
1188 * By default, the interrupt stack will be of minimum size.
1189 * The BSP or application may override this value.
1190 */
1191#ifndef CONFIGURE_INTERRUPT_STACK_SIZE
1192  #ifdef BSP_INTERRUPT_STACK_SIZE
1193    #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
1194  #else
1195    #define CONFIGURE_INTERRUPT_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
1196  #endif
1197#endif
1198
1199/**
1200 * This reserves memory for the interrupt stack if it is to be allocated
1201 * by RTEMS rather than the BSP.
1202 *
1203 * @todo Try to get to the point where all BSPs support allocating the
1204 *       memory from the Workspace.
1205 */
1206#if (CPU_ALLOCATE_INTERRUPT_STACK == 0)
1207  #define _CONFIGURE_INTERRUPT_STACK_MEMORY 0
1208#else
1209  #define _CONFIGURE_INTERRUPT_STACK_MEMORY \
1210     _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE )
1211#endif
1212
1213/**
1214 * Configure the very much optional task stack allocator initialization
1215 */
1216#ifndef CONFIGURE_TASK_STACK_ALLOCATOR_INIT
1217  #define CONFIGURE_TASK_STACK_ALLOCATOR_INIT NULL
1218#endif
1219
1220/*
1221 *  Configure the very much optional task stack allocator and deallocator.
1222 */
1223#if !defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
1224  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
1225  /**
1226   * This specifies the task stack allocator method.
1227   */
1228  #define CONFIGURE_TASK_STACK_ALLOCATOR _Workspace_Allocate
1229  /**
1230   * This specifies the task stack deallocator method.
1231   */
1232  #define CONFIGURE_TASK_STACK_DEALLOCATOR _Workspace_Free
1233#elif (defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
1234  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)) \
1235    || (!defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
1236      && defined(CONFIGURE_TASK_STACK_DEALLOCATOR))
1237  #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined"
1238#endif
1239/**@}*/ /* end of thread/interrupt stack configuration */
1240
1241/**
1242 * @addtogroup Configuration
1243 */
1244/**@{*/
1245
1246/**
1247 * Should the RTEMS Workspace and C Program Heap be cleared automatically
1248 * at system start up?
1249 */
1250#ifndef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
1251  #ifdef BSP_ZERO_WORKSPACE_AUTOMATICALLY
1252    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY \
1253            BSP_ZERO_WORKSPACE_AUTOMATICALLY
1254  #else
1255    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY FALSE
1256  #endif
1257#endif
1258/**@}*/ /* end of add to group Configuration */
1259
1260/**
1261 * @defgroup ConfigurationMalloc RTEMS Malloc configuration
1262 *
1263 * This module contains parameters related to configuration of the RTEMS
1264 * Malloc implementation.
1265 */
1266/**@{*/
1267#include <rtems/malloc.h>
1268
1269#ifdef CONFIGURE_INIT
1270  /**
1271   * By default, RTEMS uses separate heaps for the RTEMS Workspace and
1272   * the C Program Heap.  The application can choose optionally to combine
1273   * these to provide one larger memory pool. This is particularly
1274   * useful in combination with the unlimited objects configuration.
1275   */
1276  #ifdef CONFIGURE_UNIFIED_WORK_AREAS
1277    Heap_Control  *RTEMS_Malloc_Heap = &_Workspace_Area;
1278  #else
1279    Heap_Control   RTEMS_Malloc_Area;
1280    Heap_Control  *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area;
1281  #endif
1282#endif
1283
1284#ifdef CONFIGURE_INIT
1285  /**
1286   * This configures the sbrk() support for the malloc family.
1287   * By default it is assumed that the BSP provides all available
1288   * RAM to the malloc family implementation so sbrk()'ing to get
1289   * more memory would always fail anyway.
1290   */
1291  const rtems_heap_extend_handler rtems_malloc_extend_handler =
1292    #ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
1293      rtems_heap_extend_via_sbrk;
1294    #else
1295      rtems_heap_null_extend;
1296    #endif
1297#endif
1298
1299#ifdef CONFIGURE_INIT
1300  /**
1301   * This configures the malloc family plugin which dirties memory
1302   * allocated.  This is helpful for finding unitialized data structure
1303   * problems.
1304   */
1305  rtems_malloc_dirtier_t rtems_malloc_dirty_helper =
1306    #if defined(CONFIGURE_MALLOC_DIRTY)
1307      rtems_malloc_dirty_memory;
1308    #else
1309      NULL;
1310    #endif
1311#endif
1312/**@}*/  /* end of Malloc Configuration */
1313
1314/**
1315 * @defgroup ConfigurationHelpers Configuration Helpers
1316 *
1317 * @ingroup Configuration
1318 *
1319 * This module contains items which are used internally to ease
1320 * the configuration calculations.
1321 */
1322/**@{*/
1323
1324/**
1325 * Zero of one returns 0 if the parameter is 0 else 1 is returned.
1326 */
1327#define _Configure_Zero_or_One(_number) ((_number) != 0 ? 1 : 0)
1328
1329/**
1330 * General helper to align up a value.
1331 */
1332#define _Configure_Align_up(_val, _align) \
1333  (((_val) + (_align) - 1) - ((_val) + (_align) - 1) % (_align))
1334
1335#define _CONFIGURE_HEAP_MIN_BLOCK_SIZE \
1336  _Configure_Align_up(sizeof(Heap_Block), CPU_HEAP_ALIGNMENT)
1337
1338/**
1339 * This is a helper macro used in calculations in this file.  It is used
1340 * to noted when an element is allocated from the RTEMS Workspace and adds
1341 * a factor to account for heap overhead plus an alignment factor that
1342 * may be applied.
1343 */
1344#define _Configure_From_workspace(_size) \
1345  (ssize_t) (_Configure_Zero_or_One(_size) * \
1346    _Configure_Align_up(_size + HEAP_BLOCK_HEADER_SIZE, \
1347      _CONFIGURE_HEAP_MIN_BLOCK_SIZE))
1348
1349/**
1350 * This is a helper macro used in stack space calculations in this file.  It
1351 * may be provided by the application in case a special task stack allocator
1352 * is used.  The default is allocation from the RTEMS Workspace.
1353 */
1354#ifdef CONFIGURE_TASK_STACK_FROM_ALLOCATOR
1355  #define _Configure_From_stackspace(_stack_size) \
1356    CONFIGURE_TASK_STACK_FROM_ALLOCATOR(_stack_size)
1357#else
1358  #define _Configure_From_stackspace(_stack_size) \
1359    _Configure_From_workspace(_stack_size)
1360#endif
1361
1362/**
1363 * Do not use the unlimited bit as part of the multiplication
1364 * for memory usage.
1365 */
1366#define _Configure_Max_Objects(_max) \
1367  (_Configure_Zero_or_One(_max) * rtems_resource_maximum_per_allocation(_max))
1368
1369/**
1370 * This macro accounts for how memory for a set of configured objects is
1371 * allocated from the Executive Workspace.
1372 *
1373 * NOTE: It does NOT attempt to address the more complex case of unlimited
1374 *       objects.
1375 */
1376#define _Configure_Object_RAM(_number, _size) ( \
1377    _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
1378    _Configure_From_workspace( \
1379      _Configure_Zero_or_One(_number) * ( \
1380        (_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *) + \
1381        _Configure_Align_up(sizeof(void *), CPU_ALIGNMENT) + \
1382        _Configure_Align_up(sizeof(uint32_t), CPU_ALIGNMENT) \
1383      ) \
1384    ) \
1385  )
1386/**@}*/
1387
1388/**
1389 * @defgroup ConfigurationInitTasksTable Initialization Tasks Configuration
1390 *
1391 * @addtogroup Configuration
1392 *
1393 * This group contains the elements needed to define the Classic API
1394 * Initialization Tasks Table.
1395 *
1396 * Default User Initialization Task Table.  This table guarantees that
1397 * one user initialization table is defined.
1398 *
1399 *  WHEN CONFIGURE_HAS_OWN_INIT_TASK_TABLE is defined, the user is
1400 *  responsible for defining their own table information and setting the
1401 *  appropriate variables.
1402 */
1403#if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
1404    !defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
1405
1406/**
1407 * When using the default Classic API Initialization Tasks Table, this is
1408 * used to specify the name of the single Classic API task.
1409 */
1410#ifndef CONFIGURE_INIT_TASK_NAME
1411  #define CONFIGURE_INIT_TASK_NAME          rtems_build_name('U', 'I', '1', ' ')
1412#endif
1413
1414/**
1415 * When using the default Classic API Initialization Tasks Table, this is
1416 * used to specify the stack size of the single Classic API task.
1417 */
1418#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
1419  #define CONFIGURE_INIT_TASK_STACK_SIZE    CONFIGURE_MINIMUM_TASK_STACK_SIZE
1420#endif
1421
1422/**
1423 * When using the default Classic API Initialization Tasks Table, this is
1424 * used to specify the priority of the single Classic API task.
1425 */
1426#ifndef CONFIGURE_INIT_TASK_PRIORITY
1427  #define CONFIGURE_INIT_TASK_PRIORITY      1
1428#endif
1429
1430/**
1431 * When using the default Classic API Initialization Tasks Table, this is
1432 * used to specify the attributes size of the single Classic API task.
1433 */
1434#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
1435  #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_DEFAULT_ATTRIBUTES
1436#endif
1437
1438/**
1439 * When using the default Classic API Initialization Tasks Table, this is
1440 * used to specify the entry point of the single Classic API task.
1441 */
1442#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
1443  #ifdef __cplusplus
1444  extern "C" {
1445  #endif
1446    rtems_task Init (rtems_task_argument );
1447  #ifdef __cplusplus
1448  }
1449  #endif
1450  #define CONFIGURE_INIT_TASK_ENTRY_POINT   Init
1451  extern const char* bsp_boot_cmdline;
1452  #define CONFIGURE_INIT_TASK_ARGUMENTS     ((rtems_task_argument) &bsp_boot_cmdline)
1453#endif
1454
1455/**
1456 * When using the default Classic API Initialization Tasks Table, this is
1457 * used to specify the initial execution mode of the single Classic API task.
1458 */
1459#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
1460  #ifdef _CONFIGURE_SMP_APPLICATION
1461    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
1462  #else
1463    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
1464  #endif
1465#endif
1466
1467/**
1468 * When using the default Classic API Initialization Tasks Table, this is
1469 * used to specify the initial argument to the single Classic API task.
1470 */
1471#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
1472  #define CONFIGURE_INIT_TASK_ARGUMENTS     0
1473#endif
1474
1475#ifdef CONFIGURE_INIT
1476  rtems_initialization_tasks_table Initialization_tasks[] = {
1477    { CONFIGURE_INIT_TASK_NAME,
1478      CONFIGURE_INIT_TASK_STACK_SIZE,
1479      CONFIGURE_INIT_TASK_PRIORITY,
1480      CONFIGURE_INIT_TASK_ATTRIBUTES,
1481      CONFIGURE_INIT_TASK_ENTRY_POINT,
1482      CONFIGURE_INIT_TASK_INITIAL_MODES,
1483      CONFIGURE_INIT_TASK_ARGUMENTS
1484    }
1485  };
1486#endif
1487
1488/**
1489 * This is the name of the Initialization Tasks Table generated.
1490 */
1491#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
1492
1493/*
1494 * This is the size of the Initialization Tasks Table generated.
1495 */
1496#define CONFIGURE_INIT_TASK_TABLE_SIZE \
1497  RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
1498
1499#else     /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
1500#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
1501
1502/*
1503 * The user application is responsible for defining everything
1504 * when CONFIGURE_HAS_OWN_INIT_TABLE is defined.
1505 */
1506#else     /* not using standard or providing own Init Task Table */
1507
1508/*
1509 * This is the name of the Initialization Task when none is configured.
1510 */
1511#define CONFIGURE_INIT_TASK_TABLE      NULL
1512
1513/*
1514 * This is the size of the Initialization Task when none is configured.
1515 */
1516#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
1517
1518/*
1519 * This is the stack size of the Initialization Task when none is configured.
1520 */
1521#define CONFIGURE_INIT_TASK_STACK_SIZE 0
1522
1523#endif    /* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
1524
1525#endif
1526/**@}*/  /* end of Classic API Initialization Tasks Table */
1527
1528/**
1529 * @defgroup ConfigurationDriverTable Device Driver Table Configuration
1530 *
1531 * @addtogroup Configuration
1532 *
1533 * This group contains parameters related to generating a Device Driver
1534 * Table.
1535 *
1536 * Default Device Driver Table.  Each driver needed by the test is explicitly
1537 * choosen by the application.  There is always a null driver entry.
1538 */
1539/**@{*/
1540
1541/**
1542 * This is an empty device driver slot.
1543 */
1544#define NULL_DRIVER_TABLE_ENTRY \
1545 { NULL, NULL, NULL, NULL, NULL, NULL }
1546
1547#if (defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1548    defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER)) || \
1549  (defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1550    defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER)) || \
1551  (defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER) && \
1552    defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER))
1553#error "CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER, CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER, and CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER are mutually exclusive"
1554#endif
1555
1556#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1557  #include <rtems/console.h>
1558#endif
1559
1560#ifdef CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
1561  #include <rtems/console.h>
1562
1563  #ifdef CONFIGURE_INIT
1564    RTEMS_SYSINIT_ITEM(
1565      _Console_simple_Initialize,
1566      RTEMS_SYSINIT_DEVICE_DRIVERS,
1567      RTEMS_SYSINIT_ORDER_SECOND
1568    );
1569  #endif
1570#endif
1571
1572#ifdef CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER
1573  #include <rtems/console.h>
1574
1575  #ifdef CONFIGURE_INIT
1576    RTEMS_SYSINIT_ITEM(
1577      _Console_simple_task_Initialize,
1578      RTEMS_SYSINIT_DEVICE_DRIVERS,
1579      RTEMS_SYSINIT_ORDER_SECOND
1580    );
1581  #endif
1582#endif
1583
1584#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1585  #include <rtems/clockdrv.h>
1586#endif
1587
1588#ifdef CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
1589  #include <rtems/btimer.h>
1590#endif
1591
1592#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1593  #include <rtems/rtc.h>
1594#endif
1595
1596#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1597  #include <rtems/watchdogdrv.h>
1598#endif
1599
1600#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1601  #include <rtems/framebuffer.h>
1602#endif
1603
1604#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1605  #include <rtems/devnull.h>
1606#endif
1607
1608#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1609  #include <rtems/devzero.h>
1610#endif
1611
1612#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1613  /* the ide driver needs the ATA driver */
1614  #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1615    #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1616  #endif
1617  #include <libchip/ide_ctrl.h>
1618#endif
1619
1620#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1621  #include <libchip/ata.h>
1622#endif
1623
1624#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
1625
1626/**
1627 * This specifies the maximum number of device drivers that
1628 * can be installed in the system at one time.  It must account
1629 * for both the statically and dynamically installed drivers.
1630 */
1631#ifndef CONFIGURE_MAXIMUM_DRIVERS
1632  #define CONFIGURE_MAXIMUM_DRIVERS
1633#endif
1634
1635#ifdef CONFIGURE_INIT
1636  rtems_driver_address_table
1637    _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
1638    #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
1639      CONFIGURE_BSP_PREREQUISITE_DRIVERS,
1640    #endif
1641    #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
1642      CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
1643    #endif
1644    #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1645      CONSOLE_DRIVER_TABLE_ENTRY,
1646    #endif
1647    #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1648      CLOCK_DRIVER_TABLE_ENTRY,
1649    #endif
1650    #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1651      RTC_DRIVER_TABLE_ENTRY,
1652    #endif
1653    #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1654      WATCHDOG_DRIVER_TABLE_ENTRY,
1655    #endif
1656    #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1657      DEVNULL_DRIVER_TABLE_ENTRY,
1658    #endif
1659    #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1660      DEVZERO_DRIVER_TABLE_ENTRY,
1661    #endif
1662    #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1663      IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
1664    #endif
1665    #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1666      ATA_DRIVER_TABLE_ENTRY,
1667    #endif
1668    #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1669      FRAME_BUFFER_DRIVER_TABLE_ENTRY,
1670    #endif
1671    #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
1672      CONFIGURE_APPLICATION_EXTRA_DRIVERS,
1673    #endif
1674    #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
1675      NULL_DRIVER_TABLE_ENTRY
1676    #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1677        !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
1678        !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \
1679        !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \
1680        !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) && \
1681        !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \
1682        !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \
1683        !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) && \
1684        !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
1685      NULL_DRIVER_TABLE_ENTRY
1686    #endif
1687  };
1688
1689  const size_t _IO_Number_of_drivers =
1690    RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
1691#endif
1692
1693#endif  /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
1694
1695#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1696  /*
1697   * configure the priority of the ATA driver task
1698   */
1699  #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
1700    #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
1701  #endif
1702  #ifdef CONFIGURE_INIT
1703    rtems_task_priority rtems_ata_driver_task_priority
1704      = CONFIGURE_ATA_DRIVER_TASK_PRIORITY;
1705  #endif /* CONFIGURE_INIT */
1706#endif
1707/**@}*/ /* end of Device Driver Table Configuration */
1708
1709/**
1710 * @defgroup ConfigurationLibBlock Configuration of LIBBLOCK
1711 *
1712 * @addtogroup Configuration
1713 *
1714 * This module contains parameters related to the LIBBLOCK buffering
1715 * and caching subsystem. It requires tasks to swap out data to be
1716 * written to non-volatile storage.
1717 */
1718/**@{*/
1719#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
1720  #include <rtems/bdbuf.h>
1721  /*
1722   * configure the bdbuf cache parameters
1723   */
1724  #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
1725    #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
1726                              RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
1727  #endif
1728  #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
1729    #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
1730                              RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
1731  #endif
1732  #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
1733    #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
1734                              RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
1735  #endif
1736  #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
1737    #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
1738                              RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
1739  #endif
1740  #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
1741    #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
1742                              RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
1743  #endif
1744  #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
1745    #define CONFIGURE_SWAPOUT_WORKER_TASKS \
1746                              RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
1747  #endif
1748  #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
1749    #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
1750                              RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
1751  #endif
1752  #ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE
1753    #define CONFIGURE_BDBUF_TASK_STACK_SIZE \
1754                              RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT
1755  #endif
1756  #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
1757    #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
1758                              RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
1759  #endif
1760  #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
1761    #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
1762                              RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
1763  #endif
1764  #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
1765    #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
1766                              RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
1767  #endif
1768  #ifndef CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1769    #define CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY \
1770                              RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT
1771  #endif
1772  #ifdef CONFIGURE_INIT
1773    const rtems_bdbuf_config rtems_bdbuf_configuration = {
1774      CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
1775      CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
1776      CONFIGURE_SWAPOUT_TASK_PRIORITY,
1777      CONFIGURE_SWAPOUT_SWAP_PERIOD,
1778      CONFIGURE_SWAPOUT_BLOCK_HOLD,
1779      CONFIGURE_SWAPOUT_WORKER_TASKS,
1780      CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
1781      CONFIGURE_BDBUF_TASK_STACK_SIZE,
1782      CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
1783      CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
1784      CONFIGURE_BDBUF_BUFFER_MAX_SIZE,
1785      CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1786    };
1787  #endif
1788
1789  #define _CONFIGURE_LIBBLOCK_TASKS \
1790    (1 + CONFIGURE_SWAPOUT_WORKER_TASKS + \
1791    (CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS != 0))
1792
1793  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS \
1794    (_CONFIGURE_LIBBLOCK_TASKS * \
1795    (CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \
1796    0 : CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE))
1797
1798  #if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \
1799      defined(CONFIGURE_BDBUF_BUFFER_SIZE) || \
1800      defined(CONFIGURE_BDBUF_BUFFER_COUNT)
1801    #error BDBUF Cache does not use a buffer configuration table. Please remove.
1802  #endif
1803#else
1804  /** This specifies the number of libblock tasks. */
1805  #define _CONFIGURE_LIBBLOCK_TASKS 0
1806  /** This specifies the extra stack space configured for libblock tasks. */
1807  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS 0
1808  /** This specifies the number of Classic API semaphores needed by libblock. */
1809#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
1810/**@}*/
1811
1812/**
1813 * @defgroup ConfigurationMultiprocessing Multiprocessing Configuration
1814 *
1815 * @addtogroup Configuration
1816 *
1817 * This module contains the parameters related to the Multiprocessing
1818 * configuration of RTEMS.
1819 *
1820 * In a single processor or SMP configuration, only two parameters are
1821 * needed and they are defaulted. The user should not have to specify
1822 * any parameters.
1823 */
1824/**@{*/
1825
1826/**
1827 * This defines the extra stack space required for the MPCI server thread.
1828 */
1829#ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
1830  #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
1831#endif
1832
1833#if defined(RTEMS_MULTIPROCESSING)
1834  /*
1835   *  Default Multiprocessing Configuration Table.  The defaults are
1836   *  appropriate for most of the RTEMS Multiprocessor Test Suite.  Each
1837   *  value may be overridden within each test to customize the environment.
1838   */
1839
1840  #ifdef CONFIGURE_MP_APPLICATION
1841    #define _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 1
1842
1843    #ifndef CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE
1844
1845      #ifndef CONFIGURE_MP_NODE_NUMBER
1846        #define CONFIGURE_MP_NODE_NUMBER                NODE_NUMBER
1847      #endif
1848
1849      #ifndef CONFIGURE_MP_MAXIMUM_NODES
1850        #define CONFIGURE_MP_MAXIMUM_NODES              2
1851      #endif
1852
1853      #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
1854        #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS     32
1855      #endif
1856      #define _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
1857        _Configure_From_workspace( \
1858          (_global_objects) * sizeof(Objects_MP_Control) \
1859        )
1860
1861      #ifndef CONFIGURE_MP_MAXIMUM_PROXIES
1862        #define CONFIGURE_MP_MAXIMUM_PROXIES            32
1863      #endif
1864      #define _CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
1865        _Configure_From_workspace((_proxies) \
1866          * (sizeof(Thread_Proxy_control) \
1867            + THREAD_QUEUE_HEADS_SIZE(CONFIGURE_SCHEDULER_COUNT)))
1868
1869      #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
1870        #include <mpci.h>
1871        #define CONFIGURE_MP_MPCI_TABLE_POINTER         &MPCI_table
1872      #endif
1873
1874      #ifdef CONFIGURE_INIT
1875        rtems_multiprocessing_table Multiprocessing_configuration = {
1876          CONFIGURE_MP_NODE_NUMBER,               /* local node number */
1877          CONFIGURE_MP_MAXIMUM_NODES,             /* maximum # nodes */
1878          CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS,    /* maximum # global objects */
1879          CONFIGURE_MP_MAXIMUM_PROXIES,           /* maximum # proxies */
1880          CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, /* MPCI stack > minimum */
1881          CONFIGURE_MP_MPCI_TABLE_POINTER         /* ptr to MPCI config table */
1882        };
1883      #endif
1884
1885      #define CONFIGURE_MULTIPROCESSING_TABLE    &Multiprocessing_configuration
1886
1887      #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 1
1888
1889    #endif /* CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE */
1890  #else
1891    #define CONFIGURE_MULTIPROCESSING_TABLE NULL
1892    #define _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 0
1893    #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0
1894  #endif /* CONFIGURE_MP_APPLICATION */
1895#else
1896  #define _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 0
1897  #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0
1898#endif /* RTEMS_MULTIPROCESSING */
1899/**@}*/ /* end of Multiprocessing Configuration */
1900
1901/**
1902 * This macro specifies that the user wants to use unlimited objects for any
1903 * classic or posix objects that have not already been given resource limits.
1904 */
1905#if defined(CONFIGURE_UNLIMITED_OBJECTS)
1906  #if !defined(CONFIGURE_UNIFIED_WORK_AREAS) && \
1907     !defined(CONFIGURE_EXECUTIVE_RAM_SIZE) && \
1908     !defined(CONFIGURE_MEMORY_OVERHEAD)
1909     #error "CONFIGURE_UNLIMITED_OBJECTS requires a unified work area, an executive RAM size, or a defined workspace memory overhead"
1910  #endif
1911
1912  #if !defined(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1913  /**
1914   * This macro specifies a default allocation size for when auto-extending
1915   * unlimited objects if none was given by the user.
1916   */
1917    #define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 8
1918  #endif
1919  #if !defined(CONFIGURE_MAXIMUM_TASKS)
1920    #define CONFIGURE_MAXIMUM_TASKS \
1921      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1922  #endif
1923  #if !defined(CONFIGURE_MAXIMUM_TIMERS)
1924    #define CONFIGURE_MAXIMUM_TIMERS \
1925      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1926  #endif
1927  #if !defined(CONFIGURE_MAXIMUM_SEMAPHORES)
1928    #define CONFIGURE_MAXIMUM_SEMAPHORES \
1929      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1930  #endif
1931  #if !defined(CONFIGURE_MAXIMUM_MESSAGE_QUEUES)
1932    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES \
1933      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1934  #endif
1935  #if !defined(CONFIGURE_MAXIMUM_PARTITIONS)
1936    #define CONFIGURE_MAXIMUM_PARTITIONS \
1937      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1938  #endif
1939  #if !defined(CONFIGURE_MAXIMUM_REGIONS)
1940    #define CONFIGURE_MAXIMUM_REGIONS \
1941      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1942  #endif
1943  #if !defined(CONFIGURE_MAXIMUM_PORTS)
1944    #define CONFIGURE_MAXIMUM_PORTS \
1945      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1946  #endif
1947  #if !defined(CONFIGURE_MAXIMUM_PERIODS)
1948    #define CONFIGURE_MAXIMUM_PERIODS \
1949      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1950  #endif
1951  #if !defined(CONFIGURE_MAXIMUM_BARRIERS)
1952    #define CONFIGURE_MAXIMUM_BARRIERS \
1953      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1954  #endif
1955  #if !defined(CONFIGURE_MAXIMUM_POSIX_KEYS)
1956    #define CONFIGURE_MAXIMUM_POSIX_KEYS \
1957      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1958  #endif
1959  #if !defined(CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS)
1960    #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
1961      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1962  #endif
1963
1964  #ifdef RTEMS_POSIX_API
1965    #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS)
1966      #define CONFIGURE_MAXIMUM_POSIX_THREADS \
1967        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1968    #endif
1969    #if !defined(CONFIGURE_MAXIMUM_POSIX_TIMERS)
1970      #define CONFIGURE_MAXIMUM_POSIX_TIMERS \
1971        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1972    #endif
1973/*
1974    #if !defined(CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS)
1975      #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS \
1976        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1977    #endif
1978*/
1979    #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
1980      #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES \
1981        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1982    #endif
1983    #if !defined(CONFIGURE_MAXIMUM_POSIX_SEMAPHORES)
1984      #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES \
1985        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1986    #endif
1987    #if !defined(CONFIGURE_MAXIMUM_POSIX_SHMS)
1988      #define CONFIGURE_MAXIMUM_POSIX_SHMS \
1989        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1990    #endif
1991  #endif /* RTEMS_POSIX_API */
1992#endif /* CONFIGURE_UNLIMITED_OBJECTS */
1993
1994
1995/**
1996 * @defgroup ConfigurationClassicAPI Classic API Configuration
1997 *
1998 * @ingroup Configuration
1999 *
2000 * This module contains the parameters related to configuration
2001 * of the Classic API services.
2002 */
2003/**@{*/
2004#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
2005
2006  /** This configures the maximum number of Classic API tasks. */
2007  #ifndef CONFIGURE_MAXIMUM_TASKS
2008    #define CONFIGURE_MAXIMUM_TASKS               0
2009  #endif
2010
2011  /*
2012   * This is calculated to account for the maximum number of Classic API
2013   * tasks used by the application and configured RTEMS capabilities.
2014   */
2015  #define _CONFIGURE_TASKS \
2016    (CONFIGURE_MAXIMUM_TASKS + _CONFIGURE_LIBBLOCK_TASKS)
2017
2018  #ifndef CONFIGURE_MAXIMUM_TIMERS
2019    /** This specifies the maximum number of Classic API timers. */
2020    #define CONFIGURE_MAXIMUM_TIMERS             0
2021    /*
2022     * This macro is calculated to specify the memory required for
2023     * Classic API timers.
2024     */
2025    #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0
2026  #else
2027    #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
2028      _Configure_Object_RAM(_timers, sizeof(Timer_Control) )
2029  #endif
2030
2031  #ifndef CONFIGURE_MAXIMUM_SEMAPHORES
2032    /** This specifies the maximum number of Classic API semaphores. */
2033    #define CONFIGURE_MAXIMUM_SEMAPHORES                 0
2034  #endif
2035
2036  /*
2037   * This macro is calculated to specify the memory required for
2038   * Classic API Semaphores using MRSP. This is only available in
2039   * SMP configurations.
2040   */
2041  #if !defined(RTEMS_SMP) || \
2042    !defined(CONFIGURE_MAXIMUM_MRSP_SEMAPHORES)
2043    #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES 0
2044  #else
2045    #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES \
2046      CONFIGURE_MAXIMUM_MRSP_SEMAPHORES * \
2047        _Configure_From_workspace( \
2048          RTEMS_ARRAY_SIZE(_Scheduler_Table) * sizeof(Priority_Control) \
2049        )
2050  #endif
2051
2052  /*
2053   * This macro is calculated to specify the memory required for
2054   * Classic API Semaphores.
2055   *
2056   * If there are no user or support semaphores defined, then we can assume
2057   * that no memory need be allocated at all for semaphores.
2058   */
2059  #if CONFIGURE_MAXIMUM_SEMAPHORES == 0
2060    #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0
2061  #else
2062    #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
2063      _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) ) + \
2064        _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES
2065  #endif
2066
2067  #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
2068    /**
2069     * This configuration parameter specifies the maximum number of
2070     * Classic API Message Queues.
2071     */
2072    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES             0
2073    /*
2074     * This macro is calculated to specify the RTEMS Workspace required for
2075     * the Classic API Message Queues.
2076     */
2077    #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0
2078  #else
2079    #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
2080      _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) )
2081  #endif
2082
2083  #ifndef CONFIGURE_MAXIMUM_PARTITIONS
2084    /**
2085     * This configuration parameter specifies the maximum number of
2086     * Classic API Partitions.
2087     */
2088    #define CONFIGURE_MAXIMUM_PARTITIONS                 0
2089    /*
2090     * This macro is calculated to specify the memory required for
2091     * Classic API
2092     */
2093    #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0
2094  #else
2095    #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
2096      _Configure_Object_RAM(_partitions, sizeof(Partition_Control) )
2097  #endif
2098
2099  #ifndef CONFIGURE_MAXIMUM_REGIONS
2100    /**
2101     * This configuration parameter specifies the maximum number of
2102     * Classic API Regions.
2103     */
2104    #define CONFIGURE_MAXIMUM_REGIONS              0
2105    /*
2106     * This macro is calculated to specify the memory required for
2107     * Classic API Regions.
2108     */
2109    #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0
2110  #else
2111    #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
2112      _Configure_Object_RAM(_regions, sizeof(Region_Control) )
2113  #endif
2114
2115  #ifndef CONFIGURE_MAXIMUM_PORTS
2116    /**
2117     * This configuration parameter specifies the maximum number of
2118     * Classic API Dual-Ported Memory Ports.
2119     */
2120    #define CONFIGURE_MAXIMUM_PORTS            0
2121    /**
2122     * This macro is calculated to specify the memory required for
2123     * Classic API Dual-Ported Memory Ports.
2124     */
2125    #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) 0
2126  #else
2127    #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) \
2128      _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) )
2129  #endif
2130
2131  #ifndef CONFIGURE_MAXIMUM_PERIODS
2132    /**
2133     * This configuration parameter specifies the maximum number of
2134     * Classic API Rate Monotonic Periods.
2135     */
2136    #define CONFIGURE_MAXIMUM_PERIODS              0
2137    /*
2138     * This macro is calculated to specify the memory required for
2139     * Classic API Rate Monotonic Periods.
2140     */
2141  #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0
2142#else
2143    #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
2144      _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) )
2145  #endif
2146
2147  /**
2148   * This configuration parameter specifies the maximum number of
2149   * Classic API Barriers.
2150   */
2151  #ifndef CONFIGURE_MAXIMUM_BARRIERS
2152    #define CONFIGURE_MAXIMUM_BARRIERS               0
2153  #endif
2154
2155  /*
2156   * This macro is calculated to specify the number of Classic API
2157   * Barriers required by the application and configured capabilities.
2158   */
2159  #define _CONFIGURE_BARRIERS \
2160     (CONFIGURE_MAXIMUM_BARRIERS + _CONFIGURE_BARRIERS_FOR_FIFOS)
2161
2162  /*
2163   * This macro is calculated to specify the memory required for
2164   * Classic API Barriers.
2165   */
2166  #if _CONFIGURE_BARRIERS == 0
2167    #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0
2168  #else
2169    #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \
2170      _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) )
2171  #endif
2172
2173  #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
2174    /**
2175     * This configuration parameter specifies the maximum number of
2176     * Classic API User Extensions.
2177     */
2178    #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
2179    /*
2180     * This macro is calculated to specify the memory required for
2181     * Classic API User Extensions.
2182     */
2183    #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0
2184  #else
2185    #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
2186      _Configure_Object_RAM(_extensions, sizeof(Extension_Control) )
2187  #endif
2188  /**@}*/ /* end of Classic API Configuration */
2189
2190  /**
2191   * @defgroup ConfigurationGeneral General System Configuration
2192   *
2193   * @ingroup Configuration
2194   *
2195   * This module contains configuration parameters that are independent
2196   * of any API but impact general system configuration.
2197   */
2198  /**@{*/
2199
2200  /** The configures the number of microseconds per clock tick. */
2201  #ifndef CONFIGURE_MICROSECONDS_PER_TICK
2202    #define CONFIGURE_MICROSECONDS_PER_TICK \
2203            RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
2204  #endif
2205
2206  #if 1000000 % CONFIGURE_MICROSECONDS_PER_TICK != 0
2207    #warning "The clock ticks per second is not an integer"
2208  #endif
2209
2210  #if CONFIGURE_MICROSECONDS_PER_TICK <= 0
2211    #error "The CONFIGURE_MICROSECONDS_PER_TICK must be positive"
2212  #endif
2213
2214  #define _CONFIGURE_TICKS_PER_SECOND (1000000 / CONFIGURE_MICROSECONDS_PER_TICK)
2215
2216  /** The configures the number of clock ticks per timeslice. */
2217  #ifndef CONFIGURE_TICKS_PER_TIMESLICE
2218    #define CONFIGURE_TICKS_PER_TIMESLICE        50
2219  #endif
2220
2221/**@}*/ /* end of General Configuration */
2222
2223/*
2224 *  Initial Extension Set
2225 */
2226
2227#ifdef CONFIGURE_INIT
2228#ifdef CONFIGURE_STACK_CHECKER_ENABLED
2229#include <rtems/stackchk.h>
2230#endif
2231#include <rtems/libcsupport.h>
2232
2233#if defined(BSP_INITIAL_EXTENSION) || \
2234    defined(CONFIGURE_INITIAL_EXTENSIONS) || \
2235    defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
2236    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
2237  static const rtems_extensions_table Configuration_Initial_Extensions[] = {
2238    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
2239      RTEMS_NEWLIB_EXTENSION,
2240    #endif
2241    #if defined(CONFIGURE_STACK_CHECKER_ENABLED)
2242      RTEMS_STACK_CHECKER_EXTENSION,
2243    #endif
2244    #if defined(CONFIGURE_INITIAL_EXTENSIONS)
2245      CONFIGURE_INITIAL_EXTENSIONS,
2246    #endif
2247    #if defined(BSP_INITIAL_EXTENSION)
2248      BSP_INITIAL_EXTENSION
2249    #endif
2250  };
2251
2252  #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
2253  #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
2254    RTEMS_ARRAY_SIZE(Configuration_Initial_Extensions)
2255
2256  RTEMS_SYSINIT_ITEM(
2257    _User_extensions_Handler_initialization,
2258    RTEMS_SYSINIT_INITIAL_EXTENSIONS,
2259    RTEMS_SYSINIT_ORDER_MIDDLE
2260  );
2261#else
2262  #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
2263  #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
2264#endif
2265
2266#if defined(RTEMS_NEWLIB)
2267  struct _reent *__getreent(void)
2268  {
2269    #ifdef CONFIGURE_DISABLE_NEWLIB_REENTRANCY
2270      return _GLOBAL_REENT;
2271    #else
2272      return _Thread_Get_executing()->libc_reent;
2273    #endif
2274  }
2275#endif
2276
2277#endif
2278
2279/**
2280 * @defgroup ConfigurationPOSIXAPI POSIX API Configuration Parameters
2281 *
2282 * This module contains the parameters related to configuration
2283 * of the POSIX API services.
2284 */
2285/**@{*/
2286
2287#include <rtems/posix/key.h>
2288
2289/**
2290 * This configuration parameter specifies the maximum number of
2291 * POSIX API keys.
2292 *
2293 * POSIX Keys are available whether or not the POSIX API is enabled.
2294 */
2295#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
2296  #define CONFIGURE_MAXIMUM_POSIX_KEYS 0
2297#endif
2298
2299/*
2300 * This macro is calculated to specify the memory required for
2301 * POSIX API key/value pairs.
2302 */
2303#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
2304  #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
2305    (CONFIGURE_MAXIMUM_POSIX_KEYS * \
2306     (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS))
2307#endif
2308
2309/*
2310 * This macro is calculated to specify the total number of
2311 * POSIX API keys required by the application and configured
2312 * system capabilities.
2313 */
2314#define _CONFIGURE_POSIX_KEYS \
2315  (CONFIGURE_MAXIMUM_POSIX_KEYS + _CONFIGURE_LIBIO_POSIX_KEYS)
2316
2317/*
2318 * This macro is calculated to specify the memory required for
2319 * POSIX API keys.
2320 */
2321#define _CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
2322   (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
2323    + _Configure_From_workspace( \
2324      _Configure_Max_Objects(_key_value_pairs) \
2325        * sizeof(POSIX_Keys_Key_value_pair)))
2326
2327/*
2328 *  The rest of the POSIX threads API features are only available when
2329 *  POSIX is enabled.
2330 */
2331#ifdef RTEMS_POSIX_API
2332  #include <sys/types.h>
2333  #include <signal.h>
2334  #include <limits.h>
2335  #include <mqueue.h>
2336  #include <rtems/posix/mqueue.h>
2337  #include <rtems/posix/psignal.h>
2338  #include <rtems/posix/pthread.h>
2339  #include <rtems/posix/semaphore.h>
2340  #include <rtems/posix/shm.h>
2341  #include <rtems/posix/threadsup.h>
2342  #include <rtems/posix/timer.h>
2343
2344  /*
2345   * Account for the object control structures plus the name
2346   * of the object to be duplicated.
2347   */
2348  #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
2349    (_Configure_Object_RAM(_number, _size) \
2350      + _Configure_Max_Objects(_number) \
2351        * _Configure_From_workspace(_POSIX_PATH_MAX + 1))
2352
2353  /**
2354   * This configuration parameter specifies the maximum number of
2355   * POSIX API threads.
2356   */
2357  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2358    #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
2359  #endif
2360
2361  /**
2362   * This configuration parameter specifies the maximum number of
2363   * POSIX API timers.
2364   */
2365  #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
2366    #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
2367  #endif
2368
2369  /*
2370   * This macro is calculated to specify the memory required for
2371   * POSIX API timers.
2372   */
2373  #define _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
2374    _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
2375
2376  /**
2377   * This configuration parameter specifies the maximum number of
2378   * POSIX API queued signals.
2379   */
2380  #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
2381    #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0
2382  #endif
2383
2384  /*
2385   * This macro is calculated to specify the memory required for
2386   * POSIX API queued signals.
2387   */
2388  #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
2389    _Configure_From_workspace( \
2390      (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
2391
2392  /**
2393   * This configuration parameter specifies the maximum number of
2394   * POSIX API message queues.
2395   */
2396  #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
2397    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
2398  #endif
2399
2400  /*
2401   * This macro is calculated to specify the memory required for
2402   * POSIX API message queues.
2403   */
2404  #define _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
2405    _Configure_POSIX_Named_Object_RAM( \
2406       _message_queues, sizeof(POSIX_Message_queue_Control) )
2407
2408  /**
2409   * This configuration parameter specifies the maximum number of
2410   * POSIX API semaphores.
2411   */
2412  #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
2413    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0
2414  #endif
2415
2416  /*
2417   * This macro is calculated to specify the memory required for
2418   * POSIX API semaphores.
2419   */
2420  #define _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
2421    _Configure_POSIX_Named_Object_RAM( \
2422       _semaphores, sizeof(POSIX_Semaphore_Control) )
2423
2424  /**
2425   * Configure the maximum number of POSIX shared memory objects.
2426   */
2427  #if !defined(CONFIGURE_MAXIMUM_POSIX_SHMS)
2428    #define CONFIGURE_MAXIMUM_POSIX_SHMS 0
2429  #else
2430    #ifdef CONFIGURE_INIT
2431      #if !defined(CONFIGURE_HAS_OWN_POSIX_SHM_OBJECT_OPERATIONS)
2432        const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations = {
2433          _POSIX_Shm_Object_create_from_workspace,
2434          _POSIX_Shm_Object_resize_from_workspace,
2435          _POSIX_Shm_Object_delete_from_workspace,
2436          _POSIX_Shm_Object_read_from_workspace,
2437          _POSIX_Shm_Object_mmap_from_workspace
2438        };
2439      #endif
2440    #endif
2441  #endif
2442
2443  /*
2444   * This macro is calculated to specify the memory required for
2445   * POSIX API shared memory.
2446   */
2447  #define _CONFIGURE_MEMORY_FOR_POSIX_SHMS(_shms) \
2448    _Configure_POSIX_Named_Object_RAM(_shms, sizeof(POSIX_Shm_Control) )
2449
2450
2451  #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
2452
2453    #ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
2454
2455      /*
2456       *  The user is defining their own table information and setting the
2457       *  appropriate variables for the POSIX Initialization Thread Table.
2458       */
2459
2460    #else
2461
2462      #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
2463        #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
2464      #endif
2465
2466      #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2467        #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
2468          CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
2469      #endif
2470
2471      #ifdef CONFIGURE_INIT
2472        posix_initialization_threads_table POSIX_Initialization_threads[] = {
2473          { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT, \
2474              CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
2475        };
2476      #endif
2477
2478      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
2479              POSIX_Initialization_threads
2480
2481      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
2482              RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
2483
2484    #endif    /* CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
2485
2486  #else     /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
2487
2488    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
2489    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
2490
2491  #endif
2492
2493#else
2494
2495  /**
2496   * This configuration parameter specifies the maximum number of
2497   * POSIX API threads.
2498   */
2499  #define CONFIGURE_MAXIMUM_POSIX_THREADS         0
2500
2501#endif    /* RTEMS_POSIX_API */
2502
2503/**
2504 * This configuration parameter specifies the stack size of the
2505 * POSIX API Initialization thread (if used).
2506 */
2507#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2508  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE    0
2509#endif
2510/**@}*/  /* end of POSIX API Configuration */
2511
2512/**
2513 * @defgroup ConfigurationGNAT GNAT/RTEMS Configuration
2514 *
2515 * @addtogroup Configuration
2516 *
2517 *  This modules includes configuration parameters for applications which
2518 *  use GNAT/RTEMS. GNAT implements each Ada task as a POSIX thread.
2519 */
2520/**@{*/
2521#ifdef CONFIGURE_GNAT_RTEMS
2522  /**
2523   * This is the maximum number of Ada tasks which can be concurrently
2524   * in existence.  Twenty (20) are required to run all tests in the
2525   * ACATS (formerly ACVC).
2526   */
2527  #ifndef CONFIGURE_MAXIMUM_ADA_TASKS
2528    #define CONFIGURE_MAXIMUM_ADA_TASKS  20
2529  #endif
2530
2531  /**
2532   * This is the number of non-Ada tasks which invoked Ada code.
2533   */
2534  #ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
2535    #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2536  #endif
2537#else
2538  /** This defines he number of POSIX mutexes GNAT needs. */
2539  /** This defines he number of Ada tasks needed by the application. */
2540  #define CONFIGURE_MAXIMUM_ADA_TASKS      0
2541  /**
2542   * This defines he number of non-Ada tasks/threads that will invoke
2543   * Ada subprograms or functions.
2544   */
2545  #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2546#endif
2547/**@}*/  /* end of GNAT Configuration */
2548
2549/**
2550 * @defgroup ConfigurationGo GCC Go Configuration
2551 *
2552 * @addtogroup Configuration
2553 *
2554 *  This modules includes configuration parameters for applications which
2555 *  use GCC Go.
2556 */
2557/**@{*/
2558#ifdef CONFIGURE_ENABLE_GO
2559
2560  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2561    #define CONFIGURE_MAXIMUM_POSIX_THREADS 1
2562  #endif
2563
2564  #ifndef CONFIGURE_MAXIMUM_GOROUTINES
2565    #define CONFIGURE_MAXIMUM_GOROUTINES 400
2566  #endif
2567
2568  #ifndef CONFIGURE_MAXIMUM_GO_CHANNELS
2569    #define CONFIGURE_MAXIMUM_GO_CHANNELS 500
2570  #endif
2571
2572#else
2573  /** This specifies the maximum number of Go co-routines. */
2574  #define CONFIGURE_MAXIMUM_GOROUTINES          0
2575
2576  /** This specifies the maximum number of Go channels required. */
2577  #define CONFIGURE_MAXIMUM_GO_CHANNELS         0
2578#endif
2579/**@}*/  /* end of Go Configuration */
2580
2581/**
2582 * This is so we can account for tasks with stacks greater than minimum
2583 * size.  This is in bytes.
2584 */
2585#ifndef CONFIGURE_EXTRA_TASK_STACKS
2586  #define CONFIGURE_EXTRA_TASK_STACKS 0
2587#endif
2588
2589/**
2590 * This macro provides a summation of the various POSIX thread requirements.
2591 */
2592#define _CONFIGURE_POSIX_THREADS \
2593   (CONFIGURE_MAXIMUM_POSIX_THREADS + \
2594     CONFIGURE_MAXIMUM_ADA_TASKS + \
2595     CONFIGURE_MAXIMUM_GOROUTINES)
2596
2597#ifdef RTEMS_POSIX_API
2598  /*
2599   * This macro is calculated to specify the memory required for
2600   * the POSIX API in its entirety.
2601   */
2602  #define _CONFIGURE_MEMORY_FOR_POSIX \
2603    (_CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
2604        CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) + \
2605      _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
2606        CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
2607      _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
2608        CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \
2609      _CONFIGURE_MEMORY_FOR_POSIX_SHMS( \
2610        CONFIGURE_MAXIMUM_POSIX_SHMS) + \
2611      _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(CONFIGURE_MAXIMUM_POSIX_TIMERS))
2612#else
2613  /*
2614   * This macro is calculated to specify the memory required for
2615   * the POSIX API in its entirety.
2616   */
2617  #define _CONFIGURE_MEMORY_FOR_POSIX 0
2618#endif
2619
2620/*
2621 * We must be able to split the free block used for the second last allocation
2622 * into two parts so that we have a free block for the last allocation.  See
2623 * _Heap_Block_split().
2624 */
2625#define _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2626  _Configure_Align_up( HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT )
2627
2628/*
2629 *  Calculate the RAM size based on the maximum number of objects configured.
2630 */
2631#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
2632
2633/*
2634 * Account for allocating the following per object
2635 *   + array of object control structures
2636 *   + local pointer table -- pointer per object plus a zero'th
2637 *     entry in the local pointer table.
2638 */
2639#define _CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \
2640  ( \
2641    _Configure_Object_RAM(_tasks, sizeof(Configuration_Thread_control)) \
2642      + _Configure_From_workspace(_Configure_Max_Objects(_tasks) \
2643        * THREAD_QUEUE_HEADS_SIZE(CONFIGURE_SCHEDULER_COUNT)) \
2644      + _Configure_Max_Objects(_number_FP_tasks) \
2645        * _Configure_From_workspace(CONTEXT_FP_SIZE) \
2646  )
2647
2648/*
2649 * This defines the amount of memory configured for the multiprocessing
2650 * support required by this application.
2651 */
2652#ifdef CONFIGURE_MP_APPLICATION
2653  #define _CONFIGURE_MEMORY_FOR_MP \
2654    (_CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
2655     _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS))
2656#else
2657  #define _CONFIGURE_MEMORY_FOR_MP  0
2658#endif
2659
2660/**
2661 * The following macro is used to calculate the memory allocated by RTEMS
2662 * for the message buffers associated with a particular message queue.
2663 * There is a fixed amount of overhead per message.
2664 */
2665#define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
2666    _Configure_From_workspace( \
2667      (_messages) * (_Configure_Align_up(_size, sizeof(uintptr_t)) \
2668        + sizeof(CORE_message_queue_Buffer_control)))
2669
2670/*
2671 * This macro is set to the amount of memory required for pending message
2672 * buffers in bytes.  It should be constructed by adding together a
2673 * set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
2674 */
2675#ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
2676  #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
2677#endif
2678
2679/**
2680 * This macro is available just in case the confdefs.h file underallocates
2681 * memory for a particular application.  This lets the user add some extra
2682 * memory in case something broken and underestimates.
2683 *
2684 * It is also possible for cases where confdefs.h overallocates memory,
2685 * you could substract memory from the allocated.  The estimate is just
2686 * that, an estimate, and assumes worst case alignment and padding on
2687 * each allocated element.  So in some cases it could be too conservative.
2688 *
2689 * NOTE: Historically this was used for message buffers.
2690 */
2691#ifndef CONFIGURE_MEMORY_OVERHEAD
2692  #define CONFIGURE_MEMORY_OVERHEAD 0
2693#endif
2694
2695/**
2696 * This calculates the amount of memory reserved for the IDLE tasks.
2697 * In an SMP system, each CPU core has its own idle task.
2698 */
2699#define _CONFIGURE_IDLE_TASKS_COUNT CONFIGURE_MAXIMUM_PROCESSORS
2700
2701/**
2702 * This defines the formula used to compute the amount of memory
2703 * reserved for internal task control structures.
2704 */
2705#if CPU_IDLE_TASK_IS_FP == TRUE
2706  #define _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS \
2707    _CONFIGURE_MEMORY_FOR_TASKS( \
2708      _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT, \
2709      _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT \
2710    )
2711#else
2712  #define _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS \
2713    _CONFIGURE_MEMORY_FOR_TASKS( \
2714      _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT, \
2715      _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT \
2716    )
2717#endif
2718
2719/**
2720 * This macro accounts for general RTEMS system overhead.
2721 */
2722#define _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
2723  ( _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS + \
2724    _CONFIGURE_INTERRUPT_STACK_MEMORY \
2725  )
2726
2727/**
2728 * This macro reserves the memory required by the statically configured
2729 * user extensions.
2730 */
2731#define _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \
2732  (_CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS == 0 ? 0 : \
2733    _Configure_From_workspace( \
2734      _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
2735        * sizeof(User_extensions_Switch_control) \
2736    ))
2737
2738/**
2739 * This macro provides a summation of the memory required by the
2740 * Classic API as configured.
2741 */
2742#define _CONFIGURE_MEMORY_FOR_CLASSIC \
2743   (_CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \
2744    _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \
2745   _CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES) + \
2746   _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
2747   _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
2748   _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \
2749   _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
2750   _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
2751   _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS) + \
2752   _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \
2753  )
2754
2755/*
2756 * This macro provides a summation of the memory required by SMP as configured.
2757 */
2758#if defined(RTEMS_SMP)
2759  #define _CONFIGURE_MEMORY_FOR_SMP \
2760     (CONFIGURE_MAXIMUM_PROCESSORS * \
2761      _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE ) \
2762     )
2763#else
2764  #define _CONFIGURE_MEMORY_FOR_SMP 0
2765#endif
2766
2767/**
2768 * This calculates the memory required for the executive workspace.
2769 *
2770 * This is an internal parameter.
2771 */
2772#define CONFIGURE_EXECUTIVE_RAM_SIZE \
2773( \
2774   _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD + \
2775   _CONFIGURE_MEMORY_FOR_TASKS( \
2776     _CONFIGURE_TASKS, _CONFIGURE_TASKS) + \
2777   _CONFIGURE_MEMORY_FOR_TASKS( \
2778     _CONFIGURE_POSIX_THREADS, _CONFIGURE_POSIX_THREADS) + \
2779   _CONFIGURE_MEMORY_FOR_CLASSIC + \
2780   _CONFIGURE_MEMORY_FOR_POSIX_KEYS( \
2781      _CONFIGURE_POSIX_KEYS, \
2782      CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \
2783   _CONFIGURE_MEMORY_FOR_POSIX + \
2784   _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
2785   _CONFIGURE_MEMORY_FOR_MP + \
2786   _CONFIGURE_MEMORY_FOR_SMP + \
2787   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
2788   (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
2789   _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2790)
2791
2792/*
2793 *  Now account for any extra memory that initialization tasks or threads
2794 *  may have requested.
2795 */
2796
2797/*
2798 * This accounts for any extra memory required by the Classic API
2799 * Initialization Task.
2800 */
2801#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2802  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
2803      (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2804#else
2805  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
2806#endif
2807
2808/*
2809 * This accounts for any extra memory required by the POSIX API
2810 * Initialization Thread.
2811 */
2812#if defined(RTEMS_POSIX_API) && \
2813    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \
2814      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2815  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
2816    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - \
2817      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2818#else
2819  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
2820#endif
2821
2822/*
2823 * This macro provides a summation of the various initialization task
2824 * and thread stack requirements.
2825 */
2826#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS \
2827    (_CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
2828    _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART)
2829
2830/*
2831 * This macro is calculated to specify the memory required for
2832 * the Idle tasks(s) stack.
2833 */
2834#define _CONFIGURE_IDLE_TASKS_STACK \
2835  (_CONFIGURE_IDLE_TASKS_COUNT * \
2836    _Configure_From_stackspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) )
2837
2838/*
2839 * This macro is calculated to specify the stack memory required for the MPCI
2840 * task.
2841 */
2842#define _CONFIGURE_MPCI_RECEIVE_SERVER_STACK \
2843  (_CONFIGURE_MPCI_RECEIVE_SERVER_COUNT * \
2844    _Configure_From_stackspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE))
2845
2846/*
2847 * This macro is calculated to specify the memory required for
2848 * the stacks of all tasks.
2849 */
2850#define _CONFIGURE_TASKS_STACK \
2851  (_Configure_Max_Objects( _CONFIGURE_TASKS ) * \
2852    _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
2853
2854/*
2855 * This macro is calculated to specify the memory required for
2856 * the stacks of all POSIX threads.
2857 */
2858#define _CONFIGURE_POSIX_THREADS_STACK \
2859  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \
2860    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2861
2862/*
2863 * This macro is calculated to specify the memory required for
2864 * the stacks of all Ada tasks.
2865 */
2866#define _CONFIGURE_ADA_TASKS_STACK \
2867  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_ADA_TASKS ) * \
2868    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2869
2870/*
2871 * This macro is calculated to specify the memory required for
2872 * the stacks of all Go routines.
2873 */
2874#define _CONFIGURE_GOROUTINES_STACK \
2875  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_GOROUTINES ) * \
2876    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2877
2878#else /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2879
2880#define _CONFIGURE_IDLE_TASKS_STACK 0
2881#define _CONFIGURE_MPCI_RECEIVE_SERVER_STACK 0
2882#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS 0
2883#define _CONFIGURE_TASKS_STACK 0
2884#define _CONFIGURE_POSIX_THREADS_STACK 0
2885#define _CONFIGURE_GOROUTINES_STACK 0
2886#define _CONFIGURE_ADA_TASKS_STACK 0
2887
2888#if CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK != 0
2889  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK"
2890#endif
2891
2892#if CONFIGURE_EXTRA_TASK_STACKS != 0
2893  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_TASK_STACKS"
2894#endif
2895
2896#endif /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2897
2898/*
2899 * This macro is calculated to specify the memory required for
2900 * all tasks and threads of all varieties.
2901 */
2902#define _CONFIGURE_STACK_SPACE_SIZE \
2903  ( \
2904    _CONFIGURE_IDLE_TASKS_STACK + \
2905    _CONFIGURE_MPCI_RECEIVE_SERVER_STACK + \
2906    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \
2907    _CONFIGURE_TASKS_STACK + \
2908    _CONFIGURE_POSIX_THREADS_STACK + \
2909    _CONFIGURE_GOROUTINES_STACK + \
2910    _CONFIGURE_ADA_TASKS_STACK + \
2911    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK + \
2912    _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS + \
2913    CONFIGURE_EXTRA_TASK_STACKS + \
2914    _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2915  )
2916
2917#ifndef CONFIGURE_MAXIMUM_THREAD_NAME_SIZE
2918  #define CONFIGURE_MAXIMUM_THREAD_NAME_SIZE 16
2919#endif
2920
2921#ifdef CONFIGURE_INIT
2922  typedef union {
2923    Scheduler_Node Base;
2924    #ifdef CONFIGURE_SCHEDULER_CBS
2925      Scheduler_CBS_Node CBS;
2926    #endif
2927    #ifdef CONFIGURE_SCHEDULER_EDF
2928      Scheduler_EDF_Node EDF;
2929    #endif
2930    #ifdef CONFIGURE_SCHEDULER_EDF_SMP
2931      Scheduler_EDF_SMP_Node EDF_SMP;
2932    #endif
2933    #ifdef CONFIGURE_SCHEDULER_PRIORITY
2934      Scheduler_priority_Node Priority;
2935    #endif
2936    #ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
2937      Scheduler_SMP_Node Simple_SMP;
2938    #endif
2939    #ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
2940      Scheduler_priority_SMP_Node Priority_SMP;
2941    #endif
2942    #ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
2943      Scheduler_priority_affinity_SMP_Node Priority_affinity_SMP;
2944    #endif
2945    #ifdef CONFIGURE_SCHEDULER_STRONG_APA
2946      Scheduler_strong_APA_Node Strong_APA;
2947    #endif
2948    #ifdef CONFIGURE_SCHEDULER_USER_PER_THREAD
2949      CONFIGURE_SCHEDULER_USER_PER_THREAD User;
2950    #endif
2951  } Configuration_Scheduler_node;
2952
2953  #ifdef RTEMS_SMP
2954    const size_t _Scheduler_Node_size = sizeof( Configuration_Scheduler_node );
2955  #endif
2956
2957  const size_t _Thread_Maximum_name_size = CONFIGURE_MAXIMUM_THREAD_NAME_SIZE;
2958
2959  typedef struct {
2960    Thread_Control Control;
2961    #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
2962      void *extensions[ CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1 ];
2963    #endif
2964    Configuration_Scheduler_node Scheduler_nodes[ CONFIGURE_SCHEDULER_COUNT ];
2965    RTEMS_API_Control API_RTEMS;
2966    #ifdef RTEMS_POSIX_API
2967      POSIX_API_Control API_POSIX;
2968    #endif
2969    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
2970      char name[ CONFIGURE_MAXIMUM_THREAD_NAME_SIZE ];
2971    #endif
2972    #if !defined(RTEMS_SCHEDSIM) \
2973      && defined(RTEMS_NEWLIB) \
2974      && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
2975      struct _reent Newlib;
2976    #else
2977      struct { /* Empty */ } Newlib;
2978    #endif
2979  } Configuration_Thread_control;
2980
2981  const size_t _Thread_Control_size = sizeof( Configuration_Thread_control );
2982
2983  const Thread_Control_add_on _Thread_Control_add_ons[] = {
2984    {
2985      offsetof( Configuration_Thread_control, Control.Scheduler.nodes ),
2986      offsetof( Configuration_Thread_control, Scheduler_nodes )
2987    }, {
2988      offsetof(
2989        Configuration_Thread_control,
2990        Control.API_Extensions[ THREAD_API_RTEMS ]
2991      ),
2992      offsetof( Configuration_Thread_control, API_RTEMS )
2993    }, {
2994      offsetof(
2995        Configuration_Thread_control,
2996        Control.libc_reent
2997      ),
2998      offsetof( Configuration_Thread_control, Newlib )
2999    }
3000    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
3001      , {
3002        offsetof(
3003          Configuration_Thread_control,
3004          Control.Join_queue.Queue.name
3005        ),
3006        offsetof( Configuration_Thread_control, name )
3007      }
3008    #endif
3009    #ifdef RTEMS_POSIX_API
3010      , {
3011        offsetof(
3012          Configuration_Thread_control,
3013          Control.API_Extensions[ THREAD_API_POSIX ]
3014        ),
3015        offsetof( Configuration_Thread_control, API_POSIX )
3016      }
3017    #endif
3018  };
3019
3020  const size_t _Thread_Control_add_on_count =
3021    RTEMS_ARRAY_SIZE( _Thread_Control_add_ons );
3022
3023  const uint32_t _Watchdog_Nanoseconds_per_tick =
3024    1000 * CONFIGURE_MICROSECONDS_PER_TICK;
3025
3026  const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND;
3027
3028  /**
3029   * This is the Classic API Configuration Table.
3030   */
3031  rtems_api_configuration_table Configuration_RTEMS_API = {
3032    _CONFIGURE_TASKS,
3033    CONFIGURE_MAXIMUM_TIMERS + _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER,
3034    CONFIGURE_MAXIMUM_SEMAPHORES,
3035    CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
3036    CONFIGURE_MAXIMUM_PARTITIONS,
3037    CONFIGURE_MAXIMUM_REGIONS,
3038    CONFIGURE_MAXIMUM_PORTS,
3039    CONFIGURE_MAXIMUM_PERIODS,
3040    _CONFIGURE_BARRIERS,
3041    CONFIGURE_INIT_TASK_TABLE_SIZE,
3042    CONFIGURE_INIT_TASK_TABLE
3043  };
3044
3045  #ifdef RTEMS_POSIX_API
3046    /**
3047     * This is the POSIX API Configuration Table.
3048     */
3049    posix_api_configuration_table Configuration_POSIX_API = {
3050      _CONFIGURE_POSIX_THREADS,
3051      CONFIGURE_MAXIMUM_POSIX_TIMERS,
3052      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
3053      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
3054      CONFIGURE_MAXIMUM_POSIX_SEMAPHORES,
3055      CONFIGURE_MAXIMUM_POSIX_SHMS,
3056      CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
3057      CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
3058    };
3059  #endif
3060
3061  /**
3062   * This variable specifies the minimum stack size for tasks in an RTEMS
3063   * application.
3064   *
3065   * NOTE: This is left as a simple uint32_t so it can be externed as
3066   *       needed without requring being high enough logical to
3067   *       include the full configuration table.
3068   */
3069  uint32_t rtems_minimum_stack_size =
3070    CONFIGURE_MINIMUM_TASK_STACK_SIZE;
3071
3072  /**
3073   * This is the primary Configuration Table for this application.
3074   */
3075  const rtems_configuration_table Configuration = {
3076    CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
3077    _CONFIGURE_STACK_SPACE_SIZE,               /* required stack space */
3078    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
3079    _CONFIGURE_POSIX_KEYS,                     /* POSIX keys are always */
3080    CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS,  /*   enabled */
3081    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
3082    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
3083    CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
3084    CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
3085    CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
3086    CONFIGURE_TASK_STACK_ALLOCATOR_INIT,      /* stack allocator init */
3087    CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
3088    CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
3089    CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */
3090    #ifdef CONFIGURE_UNIFIED_WORK_AREAS       /* true for unified work areas */
3091      true,
3092    #else
3093      false,
3094    #endif
3095    #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE /* true to avoid
3096                                                 work space for thread stack
3097                                                 allocation */
3098      true,
3099    #else
3100      false,
3101    #endif
3102    #ifdef RTEMS_SMP
3103      #ifdef _CONFIGURE_SMP_APPLICATION
3104        true,
3105      #else
3106        false,
3107      #endif
3108    #endif
3109    _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
3110    CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
3111    #if defined(RTEMS_MULTIPROCESSING)
3112      CONFIGURE_MULTIPROCESSING_TABLE,        /* pointer to MP config table */
3113    #endif
3114    #ifdef RTEMS_SMP
3115      CONFIGURE_MAXIMUM_PROCESSORS,
3116    #endif
3117  };
3118#endif
3119
3120#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
3121
3122#if defined(RTEMS_SMP)
3123 /*
3124  * Instantiate the Per CPU information based upon the user configuration.
3125  */
3126 #if defined(CONFIGURE_INIT)
3127   Per_CPU_Control_envelope _Per_CPU_Information[CONFIGURE_MAXIMUM_PROCESSORS];
3128 #endif
3129
3130#endif
3131
3132/*
3133 *  If the user has configured a set of Classic API Initialization Tasks,
3134 *  then we need to install the code that runs that loop.
3135 */
3136#ifdef CONFIGURE_INIT
3137  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
3138      defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
3139    RTEMS_SYSINIT_ITEM(
3140      _RTEMS_tasks_Initialize_user_tasks_body,
3141      RTEMS_SYSINIT_CLASSIC_USER_TASKS,
3142      RTEMS_SYSINIT_ORDER_MIDDLE
3143    );
3144  #endif
3145#endif
3146
3147/*
3148 *  If the user has configured a set of POSIX Initialization Threads,
3149 *  then we need to install the code that runs that loop.
3150 */
3151#ifdef RTEMS_POSIX_API
3152  #ifdef CONFIGURE_INIT
3153    #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
3154        defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
3155      RTEMS_SYSINIT_ITEM(
3156        _POSIX_Threads_Initialize_user_threads_body,
3157        RTEMS_SYSINIT_POSIX_USER_THREADS,
3158        RTEMS_SYSINIT_ORDER_MIDDLE
3159      );
3160    #endif
3161  #endif
3162#endif
3163
3164/*
3165 *  Select PCI Configuration Library
3166 */
3167#ifdef RTEMS_PCI_CONFIG_LIB
3168  #ifdef CONFIGURE_INIT
3169    #define PCI_LIB_NONE 0
3170    #define PCI_LIB_AUTO 1
3171    #define PCI_LIB_STATIC 2
3172    #define PCI_LIB_READ 3
3173    #define PCI_LIB_PERIPHERAL 4
3174    #if CONFIGURE_PCI_LIB == PCI_LIB_AUTO
3175      #define PCI_CFG_AUTO_LIB
3176      #include <pci/cfg.h>
3177      struct pci_bus pci_hb;
3178      #define PCI_LIB_INIT pci_config_auto
3179      #define PCI_LIB_CONFIG pci_config_auto_register
3180    #elif CONFIGURE_PCI_LIB == PCI_LIB_STATIC
3181      #define PCI_CFG_STATIC_LIB
3182      #include <pci/cfg.h>
3183      #define PCI_LIB_INIT pci_config_static
3184      #define PCI_LIB_CONFIG NULL
3185      /* Let user define PCI configuration (struct pci_bus pci_hb) */
3186    #elif CONFIGURE_PCI_LIB == PCI_LIB_READ
3187      #define PCI_CFG_READ_LIB
3188      #include <pci/cfg.h>
3189      #define PCI_LIB_INIT pci_config_read
3190      #define PCI_LIB_CONFIG NULL
3191      struct pci_bus pci_hb;
3192    #elif CONFIGURE_PCI_LIB == PCI_LIB_PERIPHERAL
3193      #define PCI_LIB_INIT pci_config_peripheral
3194      #define PCI_LIB_CONFIG NULL
3195      /* Let user define PCI configuration (struct pci_bus pci_hb) */
3196    #elif CONFIGURE_PCI_LIB == PCI_LIB_NONE
3197      #define PCI_LIB_INIT NULL
3198      #define PCI_LIB_CONFIG NULL
3199      /* No PCI Configuration at all, user can use/debug access routines */
3200    #else
3201      #error NO PCI LIBRARY DEFINED
3202    #endif
3203
3204    const int pci_config_lib_type = CONFIGURE_PCI_LIB;
3205    int (*pci_config_lib_init)(void) = PCI_LIB_INIT;
3206    void (*pci_config_lib_register)(void *config) = PCI_LIB_CONFIG;
3207  #endif
3208#endif
3209
3210#ifdef __cplusplus
3211}
3212#endif
3213
3214/******************************************************************
3215 ******************************************************************
3216 ******************************************************************
3217 *         CONFIGURATION WARNINGS AND ERROR CHECKING              *
3218 ******************************************************************
3219 ******************************************************************
3220 ******************************************************************
3221 */
3222
3223#if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
3224  /**
3225   * This is a debug mechanism, so if you need to, the executable will
3226   * have a structure with various partial values.  Add to this as you
3227   * need to.  Viewing this structure in gdb combined with dumping
3228   * the Configuration structures generated should help a lot in tracing
3229   * down errors and analyzing where over and under allocations are.
3230   */
3231  typedef struct {
3232    uint32_t SYSTEM_OVERHEAD;
3233    uint32_t STATIC_EXTENSIONS;
3234    uint32_t INITIALIZATION_THREADS_STACKS;
3235
3236    uint32_t PER_INTEGER_TASK;
3237    uint32_t FP_OVERHEAD;
3238    uint32_t CLASSIC;
3239    uint32_t POSIX;
3240
3241    /* System overhead pieces */
3242    uint32_t INTERRUPT_STACK_MEMORY;
3243    uint32_t MEMORY_FOR_IDLE_TASK;
3244
3245    /* Classic API Pieces */
3246    uint32_t CLASSIC_TASKS;
3247    uint32_t TIMERS;
3248    uint32_t SEMAPHORES;
3249    uint32_t MESSAGE_QUEUES;
3250    uint32_t PARTITIONS;
3251    uint32_t REGIONS;
3252    uint32_t PORTS;
3253    uint32_t PERIODS;
3254    uint32_t BARRIERS;
3255    uint32_t USER_EXTENSIONS;
3256
3257    /* POSIX API managers that are always enabled */
3258    uint32_t POSIX_KEYS;
3259
3260#ifdef RTEMS_POSIX_API
3261    /* POSIX API Pieces */
3262    uint32_t POSIX_TIMERS;
3263    uint32_t POSIX_QUEUED_SIGNALS;
3264    uint32_t POSIX_MESSAGE_QUEUES;
3265    uint32_t POSIX_SEMAPHORES;
3266    uint32_t POSIX_SHMS;
3267#endif
3268
3269    /* Stack space sizes */
3270    uint32_t IDLE_TASKS_STACK;
3271    uint32_t INITIALIZATION_THREADS_EXTRA_STACKS;
3272    uint32_t TASKS_STACK;
3273    uint32_t POSIX_THREADS_STACK;
3274    uint32_t GOROUTINES_STACK;
3275    uint32_t ADA_TASKS_STACK;
3276    uint32_t EXTRA_MPCI_RECEIVE_SERVER_STACK;
3277    uint32_t EXTRA_TASK_STACKS;
3278  } Configuration_Debug_t;
3279
3280  Configuration_Debug_t Configuration_Memory_Debug = {
3281    /* General Information */
3282    _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD,
3283    _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS,
3284    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
3285    _CONFIGURE_MEMORY_FOR_TASKS(1, 0),
3286    _CONFIGURE_MEMORY_FOR_TASKS(0, 1),
3287    _CONFIGURE_MEMORY_FOR_CLASSIC,
3288    _CONFIGURE_MEMORY_FOR_POSIX,
3289
3290    /* System overhead pieces */
3291    _CONFIGURE_INTERRUPT_STACK_MEMORY,
3292    _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS,
3293
3294    /* Classic API Pieces */
3295    _CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
3296    _CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
3297    _CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES),
3298    _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES),
3299    _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS),
3300    _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ),
3301    _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS),
3302    _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS),
3303    _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS),
3304    _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
3305    _CONFIGURE_MEMORY_FOR_POSIX_KEYS( _CONFIGURE_POSIX_KEYS, \
3306                                     CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ),
3307
3308#ifdef RTEMS_POSIX_API
3309    /* POSIX API Pieces */
3310    _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
3311      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
3312    _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
3313      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
3314    _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
3315    _CONFIGURE_MEMORY_FOR_POSIX_SHMS( CONFIGURE_MAXIMUM_POSIX_SHMS ),
3316    _CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
3317#endif
3318
3319    /* Stack space sizes */
3320    _CONFIGURE_IDLE_TASKS_STACK,
3321    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
3322    _CONFIGURE_TASKS_STACK,
3323    _CONFIGURE_POSIX_THREADS_STACK,
3324    _CONFIGURE_GOROUTINES_STACK,
3325    _CONFIGURE_ADA_TASKS_STACK,
3326    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK,
3327    CONFIGURE_EXTRA_TASK_STACKS
3328  };
3329#endif
3330
3331/*
3332 *  Make sure a task/thread of some sort is configured.
3333 *
3334 *  When analyzing RTEMS to find the smallest possible of memory
3335 *  that must be allocated, you probably do want to configure 0
3336 *  tasks/threads so there is a smaller set of calls to _Workspace_Allocate
3337 *  to analyze.
3338 */
3339#if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
3340  #if (CONFIGURE_MAXIMUM_TASKS == 0) && \
3341      (CONFIGURE_MAXIMUM_POSIX_THREADS == 0) && \
3342      (CONFIGURE_MAXIMUM_ADA_TASKS == 0) && \
3343      (CONFIGURE_MAXIMUM_GOROUTINES == 0)
3344    #error "CONFIGURATION ERROR: No tasks or threads configured!!"
3345  #endif
3346#endif
3347
3348#ifndef RTEMS_SCHEDSIM
3349/*
3350 *  Make sure at least one of the initialization task/thread
3351 *  tables was defined.
3352 */
3353#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
3354    !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \
3355    !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
3356#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
3357#endif
3358#endif
3359
3360/*
3361 *  If the user is trying to configure a multiprocessing application and
3362 *  RTEMS was not configured and built multiprocessing, then error out.
3363 */
3364#if defined(CONFIGURE_MP_APPLICATION) && \
3365    !defined(RTEMS_MULTIPROCESSING)
3366#error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!"
3367#endif
3368
3369/*
3370 *  If an attempt was made to configure POSIX objects and
3371 *  the POSIX API was not configured into RTEMS, error out.
3372 *
3373 *  @note POSIX Keys are always available so the parameters
3374 *        CONFIGURE_MAXIMUM_POSIX_KEYS and
3375 *        CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS  are not in this list.
3376 */
3377#if !defined(RTEMS_POSIX_API)
3378  #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
3379       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
3380       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
3381       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
3382       (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \
3383       (CONFIGURE_MAXIMUM_POSIX_SHMS != 0) || \
3384      defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
3385  #error "CONFIGURATION ERROR: POSIX API support not configured!!"
3386  #endif
3387#endif
3388
3389#if !defined(RTEMS_SCHEDSIM)
3390  #if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE)
3391    /*
3392     *  You must either explicity include or exclude the clock driver.
3393     *  It is such a common newbie error to leave it out.  Maybe this
3394     *  will put an end to it.
3395     *
3396     *  NOTE: If you are using the timer driver, it is considered
3397     *        mutually exclusive with the clock driver because the
3398     *        drivers are assumed to use the same "timer" hardware
3399     *        on many boards.
3400     */
3401    #if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
3402        !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \
3403        !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER)
3404      #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?"
3405     #endif
3406
3407    /*
3408     * Only one of the following three configuration parameters should be
3409     * defined at a time.
3410     */
3411    #if ((defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) + \
3412          defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER) + \
3413          defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER)) > 1)
3414       #error "CONFIGURATION ERROR: More than one clock/timer driver configuration parameter specified?!?"
3415    #endif
3416  #endif /* !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE) */
3417#endif   /* !defined(RTEMS_SCHEDSIM) */
3418
3419/*
3420 *  These names have been obsoleted so make the user application stop compiling
3421 */
3422#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
3423    defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
3424    defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
3425    defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
3426    defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
3427#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
3428#endif
3429
3430/*
3431 *  Validate the configured maximum priority
3432 */
3433#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \
3434     (CONFIGURE_MAXIMUM_PRIORITY != 7) && \
3435     (CONFIGURE_MAXIMUM_PRIORITY != 15) && \
3436     (CONFIGURE_MAXIMUM_PRIORITY != 31) && \
3437     (CONFIGURE_MAXIMUM_PRIORITY != 63) && \
3438     (CONFIGURE_MAXIMUM_PRIORITY != 127) && \
3439     (CONFIGURE_MAXIMUM_PRIORITY != 255))
3440  #error "Maximum priority is not 1 less than a power of 2 between 4 and 256"
3441#endif
3442
3443#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM)
3444  #error "Maximum priority configured higher than supported by target."
3445#endif
3446
3447#ifdef CONFIGURE_NUMBER_OF_TERMIOS_PORTS
3448  #warning "The CONFIGURE_NUMBER_OF_TERMIOS_PORTS configuration option is obsolete since RTEMS 5.1"
3449#endif
3450
3451#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
3452  #warning "The CONFIGURE_MAXIMUM_POSIX_BARRIERS configuration option is obsolete since RTEMS 5.1"
3453#endif
3454
3455#ifdef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
3456  #warning "The CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES configuration option is obsolete since RTEMS 5.1"
3457#endif
3458
3459#ifdef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
3460  #warning "The CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS configuration option is obsolete since RTEMS 5.1"
3461#endif
3462
3463#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
3464  #warning "The CONFIGURE_MAXIMUM_POSIX_MUTEXES configuration option is obsolete since RTEMS 5.1"
3465#endif
3466
3467#ifdef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
3468  #warning "The CONFIGURE_MAXIMUM_POSIX_RWLOCKS configuration option is obsolete since RTEMS 5.1"
3469#endif
3470
3471#ifdef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
3472  #warning "The CONFIGURE_MAXIMUM_POSIX_SPINLOCKS configuration option is obsolete since RTEMS 5.1"
3473#endif
3474
3475#ifdef CONFIGURE_TERMIOS_DISABLED
3476  #warning "The CONFIGURE_TERMIOS_DISABLED configuration option is obsolete since RTEMS 5.1"
3477#endif
3478
3479/*
3480 * POSIX Key pair shouldn't be less than POSIX Key, which is highly
3481 * likely to be error.
3482 */
3483#if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \
3484    (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0)
3485  #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < CONFIGURE_MAXIMUM_POSIX_KEYS)
3486    #error "Fewer POSIX Key pairs than POSIX Key!"
3487  #endif
3488#endif
3489
3490/*
3491 * IMFS block size for in memory files (memfiles) must be a power of
3492 * two between 16 and 512 inclusive.
3493 */
3494#if ((CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 16) && \
3495     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 32) && \
3496     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 64) && \
3497     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 128) && \
3498     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 256) && \
3499     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 512))
3500  #error "IMFS Memfile block size must be a power of 2 between 16 and 512"
3501#endif
3502
3503
3504#endif
3505/* end of include file */
Note: See TracBrowser for help on using the repository browser.