source: rtems/cpukit/include/rtems/confdefs.h @ 8ddd92d

5
Last change on this file since 8ddd92d was 8ddd92d, checked in by Sebastian Huber <sebastian.huber@…>, on 12/14/17 at 05:12:59

pipe: Use self-contained mutex

Update #2843.

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