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

5
Last change on this file since e1b7c188 was e1b7c188, checked in by Sebastian Huber <sebastian.huber@…>, on 11/08/18 at 10:07:57

rtems: Move internal structures to timerdata.h

Update #3598.

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