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

5
Last change on this file since 58864627 was 58864627, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 14, 2020 at 4:24:45 PM

config: Remove unused declaration and defines

Update #3875.

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