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

Last change on this file since e8e914b3 was e8e914b3, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 8, 2018 at 9:37:22 AM

rtems: Move internal structures to regiondata.h

Update #3598.

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