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

5
Last change on this file since e97806a was e97806a, checked in by Sebastian Huber <sebastian.huber@…>, on Oct 14, 2018 at 5:20:05 PM

posix: Split posix_api_configuration_table

Use separate configuration variables to avoid false dependencies.

Update #2514.

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