source: rtems/cpukit/include/rtems/confdefs.h @ 395a49e1

5
Last change on this file since 395a49e1 was 395a49e1, checked in by Sebastian Huber <sebastian.huber@…>, on 11/08/18 at 09:12:21

rtems: Move internal structures to barrierdata.h

Update #3598.

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