source: rtems/cpukit/include/rtems/confdefs.h @ 6b0873f

5
Last change on this file since 6b0873f was 6b0873f, checked in by Sebastian Huber <sebastian.huber@…>, on 02/14/20 at 07:40:41

config: Remove CONFIGURE_HAS_OWN_INIT_TASK_TABLE

The CONFIGURE_HAS_OWN_INIT_TASK_TABLE and
CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE are the last *_HAS_OWN_*
configuration options. These two options are probably unused, see also:

Removing them simplifies the configuration. If there is a real user need
which shows up after the removal, we can resurrect them on demand.

Using CONFIGURE_HAS_OWN_INIT_TASK_TABLE would have required the use of
the undocumented CONFIGURE_INIT_TASK_TABLE and
CONFIGURE_INIT_TASK_TABLE_SIZE configuration options.

Update #3873.

  • Property mode set to 100644
File size: 95.3 KB
Line 
1/**
2 * @file
3 *
4 * @brief Configuration Table Template that will be Instantiated
5 * by an Application
6 *
7 * This include file contains the configuration table template that will
8 * be instantiated by an application based on the setting of a number
9 * of macros.  The macros are documented in the Configuring a System
10 * chapter of the Classic API User's Guide
11 */
12
13/*
14 *  COPYRIGHT (c) 1989-2015.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.org/license/LICENSE.
20 */
21
22#ifndef __CONFIGURATION_TEMPLATE_h
23#define __CONFIGURATION_TEMPLATE_h
24
25/*
26 * Include the executive's configuration
27 */
28#include <rtems.h>
29#include <rtems/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#if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE)
1295
1296/**
1297 * When using the default Classic API Initialization Tasks Table, this is
1298 * used to specify the name of the single Classic API task.
1299 */
1300#ifndef CONFIGURE_INIT_TASK_NAME
1301  #define CONFIGURE_INIT_TASK_NAME          rtems_build_name('U', 'I', '1', ' ')
1302#endif
1303
1304/**
1305 * When using the default Classic API Initialization Tasks Table, this is
1306 * used to specify the stack size of the single Classic API task.
1307 */
1308#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
1309  #define CONFIGURE_INIT_TASK_STACK_SIZE    CONFIGURE_MINIMUM_TASK_STACK_SIZE
1310#endif
1311
1312/**
1313 * When using the default Classic API Initialization Tasks Table, this is
1314 * used to specify the priority of the single Classic API task.
1315 */
1316#ifndef CONFIGURE_INIT_TASK_PRIORITY
1317  #define CONFIGURE_INIT_TASK_PRIORITY      1
1318#endif
1319
1320/**
1321 * When using the default Classic API Initialization Tasks Table, this is
1322 * used to specify the attributes size of the single Classic API task.
1323 */
1324#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
1325  #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_DEFAULT_ATTRIBUTES
1326#endif
1327
1328/**
1329 * When using the default Classic API Initialization Tasks Table, this is
1330 * used to specify the entry point of the single Classic API task.
1331 */
1332#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
1333  #ifdef __cplusplus
1334  extern "C" {
1335  #endif
1336    rtems_task Init (rtems_task_argument );
1337  #ifdef __cplusplus
1338  }
1339  #endif
1340  #define CONFIGURE_INIT_TASK_ENTRY_POINT   Init
1341  extern const char* bsp_boot_cmdline;
1342  #define CONFIGURE_INIT_TASK_ARGUMENTS     ((rtems_task_argument) &bsp_boot_cmdline)
1343#endif
1344
1345/**
1346 * When using the default Classic API Initialization Tasks Table, this is
1347 * used to specify the initial execution mode of the single Classic API task.
1348 */
1349#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
1350  #ifdef _CONFIGURE_SMP_APPLICATION
1351    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
1352  #else
1353    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
1354  #endif
1355#endif
1356
1357/**
1358 * When using the default Classic API Initialization Tasks Table, this is
1359 * used to specify the initial argument to the single Classic API task.
1360 */
1361#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
1362  #define CONFIGURE_INIT_TASK_ARGUMENTS     0
1363#endif
1364
1365#ifdef CONFIGURE_INIT
1366  rtems_initialization_tasks_table Initialization_tasks[] = {
1367    { CONFIGURE_INIT_TASK_NAME,
1368      CONFIGURE_INIT_TASK_STACK_SIZE,
1369      CONFIGURE_INIT_TASK_PRIORITY,
1370      CONFIGURE_INIT_TASK_ATTRIBUTES,
1371      CONFIGURE_INIT_TASK_ENTRY_POINT,
1372      CONFIGURE_INIT_TASK_INITIAL_MODES,
1373      CONFIGURE_INIT_TASK_ARGUMENTS
1374    }
1375  };
1376#endif
1377
1378/**
1379 * This is the name of the Initialization Tasks Table generated.
1380 */
1381#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
1382
1383/*
1384 * This is the size of the Initialization Tasks Table generated.
1385 */
1386#define CONFIGURE_INIT_TASK_TABLE_SIZE \
1387  RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
1388
1389#else     /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
1390
1391/*
1392 * This is the name of the Initialization Task when none is configured.
1393 */
1394#define CONFIGURE_INIT_TASK_TABLE      NULL
1395
1396/*
1397 * This is the size of the Initialization Task when none is configured.
1398 */
1399#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
1400
1401/*
1402 * This is the stack size of the Initialization Task when none is configured.
1403 */
1404#define CONFIGURE_INIT_TASK_STACK_SIZE 0
1405
1406#endif
1407/**@}*/  /* end of Classic API Initialization Tasks Table */
1408
1409/**
1410 * @defgroup ConfigurationDriverTable Device Driver Table Configuration
1411 *
1412 * @addtogroup Configuration
1413 *
1414 * This group contains parameters related to generating a Device Driver
1415 * Table.
1416 *
1417 * Default Device Driver Table.  Each driver needed by the test is explicitly
1418 * chosen by the application.  There is always a null driver entry.
1419 */
1420/**@{*/
1421
1422/**
1423 * This is an empty device driver slot.
1424 */
1425#define NULL_DRIVER_TABLE_ENTRY \
1426 { NULL, NULL, NULL, NULL, NULL, NULL }
1427
1428#if (defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1429    defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER)) || \
1430  (defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1431    defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER)) || \
1432  (defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER) && \
1433    defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER))
1434#error "CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER, CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER, and CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER are mutually exclusive"
1435#endif
1436
1437#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1438  #include <rtems/console.h>
1439#endif
1440
1441#ifdef CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
1442  #include <rtems/console.h>
1443
1444  #ifdef CONFIGURE_INIT
1445    RTEMS_SYSINIT_ITEM(
1446      _Console_simple_Initialize,
1447      RTEMS_SYSINIT_DEVICE_DRIVERS,
1448      RTEMS_SYSINIT_ORDER_SECOND
1449    );
1450  #endif
1451#endif
1452
1453#ifdef CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER
1454  #include <rtems/console.h>
1455
1456  #ifdef CONFIGURE_INIT
1457    RTEMS_SYSINIT_ITEM(
1458      _Console_simple_task_Initialize,
1459      RTEMS_SYSINIT_DEVICE_DRIVERS,
1460      RTEMS_SYSINIT_ORDER_SECOND
1461    );
1462  #endif
1463#endif
1464
1465#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1466  #include <rtems/clockdrv.h>
1467
1468  #ifdef CONFIGURE_INIT
1469    RTEMS_SYSINIT_ITEM(
1470      _Clock_Initialize,
1471      RTEMS_SYSINIT_DEVICE_DRIVERS,
1472      RTEMS_SYSINIT_ORDER_THIRD
1473    );
1474  #endif
1475#endif
1476
1477#ifdef CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
1478  #include <rtems/btimer.h>
1479#endif
1480
1481#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1482  #include <rtems/rtc.h>
1483#endif
1484
1485#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1486  #include <rtems/watchdogdrv.h>
1487#endif
1488
1489#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1490  #include <rtems/framebuffer.h>
1491#endif
1492
1493#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1494  #include <rtems/devnull.h>
1495#endif
1496
1497#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1498  #include <rtems/devzero.h>
1499#endif
1500
1501#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1502  /* the ide driver needs the ATA driver */
1503  #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1504    #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1505  #endif
1506  #include <libchip/ide_ctrl.h>
1507#endif
1508
1509#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1510  #include <libchip/ata.h>
1511#endif
1512
1513/**
1514 * This specifies the maximum number of device drivers that
1515 * can be installed in the system at one time.  It must account
1516 * for both the statically and dynamically installed drivers.
1517 */
1518#ifndef CONFIGURE_MAXIMUM_DRIVERS
1519  #define CONFIGURE_MAXIMUM_DRIVERS
1520#endif
1521
1522#ifdef CONFIGURE_INIT
1523  rtems_driver_address_table
1524    _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
1525    #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
1526      CONFIGURE_BSP_PREREQUISITE_DRIVERS,
1527    #endif
1528    #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
1529      CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
1530    #endif
1531    #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1532      CONSOLE_DRIVER_TABLE_ENTRY,
1533    #endif
1534    #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1535      RTC_DRIVER_TABLE_ENTRY,
1536    #endif
1537    #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1538      WATCHDOG_DRIVER_TABLE_ENTRY,
1539    #endif
1540    #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1541      DEVNULL_DRIVER_TABLE_ENTRY,
1542    #endif
1543    #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1544      DEVZERO_DRIVER_TABLE_ENTRY,
1545    #endif
1546    #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1547      IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
1548    #endif
1549    #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1550      ATA_DRIVER_TABLE_ENTRY,
1551    #endif
1552    #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1553      FRAME_BUFFER_DRIVER_TABLE_ENTRY,
1554    #endif
1555    #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
1556      CONFIGURE_APPLICATION_EXTRA_DRIVERS,
1557    #endif
1558    #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
1559      NULL_DRIVER_TABLE_ENTRY
1560    #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1561        !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \
1562        !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \
1563        !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) && \
1564        !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \
1565        !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \
1566        !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) && \
1567        !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
1568      NULL_DRIVER_TABLE_ENTRY
1569    #endif
1570  };
1571
1572  const size_t _IO_Number_of_drivers =
1573    RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
1574#endif
1575
1576#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1577  /*
1578   * configure the priority of the ATA driver task
1579   */
1580  #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
1581    #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
1582  #endif
1583  #ifdef CONFIGURE_INIT
1584    rtems_task_priority rtems_ata_driver_task_priority
1585      = CONFIGURE_ATA_DRIVER_TASK_PRIORITY;
1586  #endif /* CONFIGURE_INIT */
1587#endif
1588/**@}*/ /* end of Device Driver Table Configuration */
1589
1590/**
1591 * @defgroup ConfigurationLibBlock Configuration of LIBBLOCK
1592 *
1593 * @addtogroup Configuration
1594 *
1595 * This module contains parameters related to the LIBBLOCK buffering
1596 * and caching subsystem. It requires tasks to swap out data to be
1597 * written to non-volatile storage.
1598 */
1599/**@{*/
1600#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
1601  #include <rtems/bdbuf.h>
1602  /*
1603   * configure the bdbuf cache parameters
1604   */
1605  #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
1606    #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
1607                              RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
1608  #endif
1609  #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
1610    #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
1611                              RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
1612  #endif
1613  #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
1614    #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
1615                              RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
1616  #endif
1617  #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
1618    #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
1619                              RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
1620  #endif
1621  #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
1622    #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
1623                              RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
1624  #endif
1625  #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
1626    #define CONFIGURE_SWAPOUT_WORKER_TASKS \
1627                              RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
1628  #endif
1629  #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
1630    #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
1631                              RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
1632  #endif
1633  #ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE
1634    #define CONFIGURE_BDBUF_TASK_STACK_SIZE \
1635                              RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT
1636  #endif
1637  #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
1638    #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
1639                              RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
1640  #endif
1641  #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
1642    #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
1643                              RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
1644  #endif
1645  #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
1646    #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
1647                              RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
1648  #endif
1649  #ifndef CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1650    #define CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY \
1651                              RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT
1652  #endif
1653  #ifdef CONFIGURE_INIT
1654    const rtems_bdbuf_config rtems_bdbuf_configuration = {
1655      CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
1656      CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
1657      CONFIGURE_SWAPOUT_TASK_PRIORITY,
1658      CONFIGURE_SWAPOUT_SWAP_PERIOD,
1659      CONFIGURE_SWAPOUT_BLOCK_HOLD,
1660      CONFIGURE_SWAPOUT_WORKER_TASKS,
1661      CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
1662      CONFIGURE_BDBUF_TASK_STACK_SIZE,
1663      CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
1664      CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
1665      CONFIGURE_BDBUF_BUFFER_MAX_SIZE,
1666      CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1667    };
1668  #endif
1669
1670  #define _CONFIGURE_LIBBLOCK_TASKS \
1671    (1 + CONFIGURE_SWAPOUT_WORKER_TASKS + \
1672    (CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS != 0))
1673
1674  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS \
1675    (_CONFIGURE_LIBBLOCK_TASKS * \
1676    (CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \
1677    0 : CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE))
1678
1679  #if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \
1680      defined(CONFIGURE_BDBUF_BUFFER_SIZE) || \
1681      defined(CONFIGURE_BDBUF_BUFFER_COUNT)
1682    #error BDBUF Cache does not use a buffer configuration table. Please remove.
1683  #endif
1684#else
1685  /** This specifies the number of libblock tasks. */
1686  #define _CONFIGURE_LIBBLOCK_TASKS 0
1687  /** This specifies the extra stack space configured for libblock tasks. */
1688  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS 0
1689  /** This specifies the number of Classic API semaphores needed by libblock. */
1690#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
1691/**@}*/
1692
1693/**
1694 * @defgroup ConfigurationMultiprocessing Multiprocessing Configuration
1695 *
1696 * @addtogroup Configuration
1697 *
1698 * This module contains the parameters related to the Multiprocessing
1699 * configuration of RTEMS.
1700 *
1701 * In a single processor or SMP configuration, only two parameters are
1702 * needed and they are defaulted. The user should not have to specify
1703 * any parameters.
1704 */
1705/**@{*/
1706
1707/**
1708 * This defines the extra stack space required for the MPCI server thread.
1709 */
1710#ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
1711  #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
1712#endif
1713
1714#if defined(RTEMS_MULTIPROCESSING)
1715  /*
1716   *  Default Multiprocessing Configuration Table.  The defaults are
1717   *  appropriate for most of the RTEMS Multiprocessor Test Suite.  Each
1718   *  value may be overridden within each test to customize the environment.
1719   */
1720
1721  #ifdef CONFIGURE_MP_APPLICATION
1722    #ifndef CONFIGURE_MP_NODE_NUMBER
1723      #define CONFIGURE_MP_NODE_NUMBER                NODE_NUMBER
1724    #endif
1725
1726    #ifndef CONFIGURE_MP_MAXIMUM_NODES
1727      #define CONFIGURE_MP_MAXIMUM_NODES              2
1728    #endif
1729
1730    #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
1731      #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS     32
1732    #endif
1733
1734    #ifndef CONFIGURE_MP_MAXIMUM_PROXIES
1735      #define CONFIGURE_MP_MAXIMUM_PROXIES            32
1736    #endif
1737
1738    #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
1739      #include <mpci.h>
1740      #define CONFIGURE_MP_MPCI_TABLE_POINTER         &MPCI_table
1741    #endif
1742
1743    #ifdef CONFIGURE_INIT
1744      #if CONFIGURE_MP_NODE_NUMBER < 1
1745        #error "CONFIGURE_MP_NODE_NUMBER must be greater than or equal to one"
1746      #endif
1747
1748      #if CONFIGURE_MP_NODE_NUMBER > CONFIGURE_MP_MAXIMUM_NODES
1749        #error "CONFIGURE_MP_NODE_NUMBER must be less than or equal to CONFIGURE_MP_MAXIMUM_NODES"
1750      #endif
1751
1752      Objects_MP_Control _Objects_MP_Controls[
1753        CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
1754      ];
1755
1756      struct Thread_Configured_proxy_control {
1757        Thread_Proxy_control Control;
1758        Thread_queue_Configured_heads Heads;
1759      };
1760
1761      static Thread_Configured_proxy_control _Thread_MP_Configured_proxies[
1762        CONFIGURE_MP_MAXIMUM_PROXIES
1763      ];
1764
1765      Thread_Configured_proxy_control * const _Thread_MP_Proxies =
1766        &_Thread_MP_Configured_proxies[ 0 ];
1767
1768      const MPCI_Configuration _MPCI_Configuration = {
1769        CONFIGURE_MP_NODE_NUMBER,               /* local node number */
1770        CONFIGURE_MP_MAXIMUM_NODES,             /* maximum # nodes */
1771        CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS,    /* maximum # global objects */
1772        CONFIGURE_MP_MAXIMUM_PROXIES,           /* maximum # proxies */
1773        CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, /* MPCI stack > minimum */
1774        CONFIGURE_MP_MPCI_TABLE_POINTER         /* ptr to MPCI config table */
1775      };
1776
1777      char _MPCI_Receive_server_stack[
1778        CONFIGURE_MINIMUM_TASK_STACK_SIZE
1779          + CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
1780          + CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK
1781          + CPU_ALL_TASKS_ARE_FP * CONTEXT_FP_SIZE
1782      ] RTEMS_ALIGNED( CPU_INTERRUPT_STACK_ALIGNMENT )
1783      RTEMS_SECTION( ".rtemsstack.mpci" );
1784    #endif
1785
1786    #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 1
1787  #else
1788    #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0
1789  #endif /* CONFIGURE_MP_APPLICATION */
1790#else
1791  #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0
1792#endif /* RTEMS_MULTIPROCESSING */
1793/**@}*/ /* end of Multiprocessing Configuration */
1794
1795/**
1796 * This macro specifies that the user wants to use unlimited objects for any
1797 * classic or posix objects that have not already been given resource limits.
1798 */
1799#if defined(CONFIGURE_UNLIMITED_OBJECTS)
1800  #if !defined(CONFIGURE_UNIFIED_WORK_AREAS) && \
1801     !defined(CONFIGURE_EXECUTIVE_RAM_SIZE) && \
1802     !defined(CONFIGURE_MEMORY_OVERHEAD)
1803     #error "CONFIGURE_UNLIMITED_OBJECTS requires a unified work area, an executive RAM size, or a defined workspace memory overhead"
1804  #endif
1805
1806  #if !defined(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1807  /**
1808   * This macro specifies a default allocation size for when auto-extending
1809   * unlimited objects if none was given by the user.
1810   */
1811    #define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 8
1812  #endif
1813  #if !defined(CONFIGURE_MAXIMUM_TASKS)
1814    #define CONFIGURE_MAXIMUM_TASKS \
1815      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1816  #endif
1817  #if !defined(CONFIGURE_MAXIMUM_TIMERS)
1818    #define CONFIGURE_MAXIMUM_TIMERS \
1819      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1820  #endif
1821  #if !defined(CONFIGURE_MAXIMUM_SEMAPHORES)
1822    #define CONFIGURE_MAXIMUM_SEMAPHORES \
1823      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1824  #endif
1825  #if !defined(CONFIGURE_MAXIMUM_MESSAGE_QUEUES)
1826    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES \
1827      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1828  #endif
1829  #if !defined(CONFIGURE_MAXIMUM_PARTITIONS)
1830    #define CONFIGURE_MAXIMUM_PARTITIONS \
1831      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1832  #endif
1833  #if !defined(CONFIGURE_MAXIMUM_REGIONS)
1834    #define CONFIGURE_MAXIMUM_REGIONS \
1835      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1836  #endif
1837  #if !defined(CONFIGURE_MAXIMUM_PORTS)
1838    #define CONFIGURE_MAXIMUM_PORTS \
1839      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1840  #endif
1841  #if !defined(CONFIGURE_MAXIMUM_PERIODS)
1842    #define CONFIGURE_MAXIMUM_PERIODS \
1843      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1844  #endif
1845  #if !defined(CONFIGURE_MAXIMUM_BARRIERS)
1846    #define CONFIGURE_MAXIMUM_BARRIERS \
1847      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1848  #endif
1849  #if !defined(CONFIGURE_MAXIMUM_POSIX_KEYS)
1850    #define CONFIGURE_MAXIMUM_POSIX_KEYS \
1851      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1852  #endif
1853  #if !defined(CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS)
1854    #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
1855      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1856  #endif
1857  #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
1858    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES \
1859      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1860  #endif
1861  #if !defined(CONFIGURE_MAXIMUM_POSIX_SEMAPHORES)
1862    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES \
1863      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1864  #endif
1865  #if !defined(CONFIGURE_MAXIMUM_POSIX_SHMS)
1866    #define CONFIGURE_MAXIMUM_POSIX_SHMS \
1867      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1868  #endif
1869  #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS)
1870    #define CONFIGURE_MAXIMUM_POSIX_THREADS \
1871      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1872  #endif
1873
1874  #ifdef RTEMS_POSIX_API
1875    #if !defined(CONFIGURE_MAXIMUM_POSIX_TIMERS)
1876      #define CONFIGURE_MAXIMUM_POSIX_TIMERS \
1877        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1878    #endif
1879  #endif /* RTEMS_POSIX_API */
1880#endif /* CONFIGURE_UNLIMITED_OBJECTS */
1881
1882
1883/**
1884 * @defgroup ConfigurationClassicAPI Classic API Configuration
1885 *
1886 * @ingroup Configuration
1887 *
1888 * This module contains the parameters related to configuration
1889 * of the Classic API services.
1890 */
1891/**@{*/
1892
1893/** This configures the maximum number of Classic API tasks. */
1894#ifndef CONFIGURE_MAXIMUM_TASKS
1895  #define CONFIGURE_MAXIMUM_TASKS               0
1896#endif
1897
1898/*
1899 * This is calculated to account for the maximum number of Classic API
1900 * tasks used by the application and configured RTEMS capabilities.
1901 */
1902#define _CONFIGURE_TASKS \
1903  (CONFIGURE_MAXIMUM_TASKS + _CONFIGURE_LIBBLOCK_TASKS)
1904
1905#ifndef CONFIGURE_MAXIMUM_TIMERS
1906  /** This specifies the maximum number of Classic API timers. */
1907  #define CONFIGURE_MAXIMUM_TIMERS             0
1908#endif
1909
1910#ifndef CONFIGURE_MAXIMUM_SEMAPHORES
1911  /** This specifies the maximum number of Classic API semaphores. */
1912  #define CONFIGURE_MAXIMUM_SEMAPHORES                 0
1913#endif
1914
1915#ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
1916  /**
1917   * This configuration parameter specifies the maximum number of
1918   * Classic API Message Queues.
1919   */
1920  #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES             0
1921#endif
1922
1923#ifndef CONFIGURE_MAXIMUM_PARTITIONS
1924  /**
1925   * This configuration parameter specifies the maximum number of
1926   * Classic API Partitions.
1927   */
1928  #define CONFIGURE_MAXIMUM_PARTITIONS                 0
1929#endif
1930
1931#ifndef CONFIGURE_MAXIMUM_REGIONS
1932  /**
1933   * This configuration parameter specifies the maximum number of
1934   * Classic API Regions.
1935   */
1936  #define CONFIGURE_MAXIMUM_REGIONS              0
1937#endif
1938
1939#ifndef CONFIGURE_MAXIMUM_PORTS
1940  /**
1941   * This configuration parameter specifies the maximum number of
1942   * Classic API Dual-Ported Memory Ports.
1943   */
1944  #define CONFIGURE_MAXIMUM_PORTS            0
1945#endif
1946
1947#ifndef CONFIGURE_MAXIMUM_PERIODS
1948  /**
1949   * This configuration parameter specifies the maximum number of
1950   * Classic API Rate Monotonic Periods.
1951   */
1952  #define CONFIGURE_MAXIMUM_PERIODS              0
1953#endif
1954
1955/**
1956 * This configuration parameter specifies the maximum number of
1957 * Classic API Barriers.
1958 */
1959#ifndef CONFIGURE_MAXIMUM_BARRIERS
1960  #define CONFIGURE_MAXIMUM_BARRIERS               0
1961#endif
1962
1963#ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
1964  /**
1965   * This configuration parameter specifies the maximum number of
1966   * Classic API User Extensions.
1967   */
1968  #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
1969#endif
1970
1971/**@}*/ /* end of Classic API Configuration */
1972
1973/**
1974 * @defgroup ConfigurationGeneral General System Configuration
1975 *
1976 * @ingroup Configuration
1977 *
1978 * This module contains configuration parameters that are independent
1979 * of any API but impact general system configuration.
1980 */
1981/**@{*/
1982
1983/** The configures the number of microseconds per clock tick. */
1984#ifndef CONFIGURE_MICROSECONDS_PER_TICK
1985  #define CONFIGURE_MICROSECONDS_PER_TICK \
1986          RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
1987#endif
1988
1989#if 1000000 % CONFIGURE_MICROSECONDS_PER_TICK != 0
1990  #warning "The clock ticks per second is not an integer"
1991#endif
1992
1993#if CONFIGURE_MICROSECONDS_PER_TICK <= 0
1994  #error "The CONFIGURE_MICROSECONDS_PER_TICK must be positive"
1995#endif
1996
1997#define _CONFIGURE_TICKS_PER_SECOND (1000000 / CONFIGURE_MICROSECONDS_PER_TICK)
1998
1999/** The configures the number of clock ticks per timeslice. */
2000#ifndef CONFIGURE_TICKS_PER_TIMESLICE
2001  #define CONFIGURE_TICKS_PER_TIMESLICE        50
2002#endif
2003
2004/**@}*/ /* end of General Configuration */
2005
2006/*
2007 *  Initial Extension Set
2008 */
2009
2010#ifdef CONFIGURE_INIT
2011#if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
2012#include <rtems/record.h>
2013#endif
2014#ifdef CONFIGURE_STACK_CHECKER_ENABLED
2015#include <rtems/stackchk.h>
2016#endif
2017
2018#include <rtems/libcsupport.h>
2019
2020#if defined(BSP_INITIAL_EXTENSION) || \
2021    defined(CONFIGURE_INITIAL_EXTENSIONS) || \
2022    defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
2023    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
2024  const User_extensions_Table _User_extensions_Initial_extensions[] = {
2025    #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0 && \
2026      defined(CONFIGURE_RECORD_EXTENSIONS_ENABLED)
2027      RECORD_EXTENSION,
2028    #endif
2029    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
2030      RTEMS_NEWLIB_EXTENSION,
2031    #endif
2032    #if defined(CONFIGURE_STACK_CHECKER_ENABLED)
2033      RTEMS_STACK_CHECKER_EXTENSION,
2034    #endif
2035    #if defined(CONFIGURE_INITIAL_EXTENSIONS)
2036      CONFIGURE_INITIAL_EXTENSIONS,
2037    #endif
2038    #if defined(BSP_INITIAL_EXTENSION)
2039      BSP_INITIAL_EXTENSION
2040    #endif
2041  };
2042
2043  const size_t _User_extensions_Initial_count =
2044    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions );
2045
2046  User_extensions_Switch_control _User_extensions_Initial_switch_controls[
2047    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions )
2048  ];
2049
2050  RTEMS_SYSINIT_ITEM(
2051    _User_extensions_Handler_initialization,
2052    RTEMS_SYSINIT_INITIAL_EXTENSIONS,
2053    RTEMS_SYSINIT_ORDER_MIDDLE
2054  );
2055#endif
2056
2057#if defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
2058struct _reent *__getreent(void)
2059{
2060  return _Thread_Get_executing()->libc_reent;
2061}
2062#endif
2063
2064#endif
2065
2066/**
2067 * @defgroup ConfigurationPOSIXAPI POSIX API Configuration Parameters
2068 *
2069 * This module contains the parameters related to configuration
2070 * of the POSIX API services.
2071 */
2072/**@{*/
2073
2074/**
2075 * This configuration parameter specifies the maximum number of
2076 * POSIX API keys.
2077 *
2078 * POSIX Keys are available whether or not the POSIX API is enabled.
2079 */
2080#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
2081  #define CONFIGURE_MAXIMUM_POSIX_KEYS 0
2082#endif
2083
2084/*
2085 * This macro is calculated to specify the memory required for
2086 * POSIX API key/value pairs.
2087 */
2088#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
2089  #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
2090    (CONFIGURE_MAXIMUM_POSIX_KEYS * \
2091     (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS))
2092#endif
2093
2094/*
2095 * This macro is calculated to specify the total number of
2096 * POSIX API keys required by the application and configured
2097 * system capabilities.
2098 */
2099#define _CONFIGURE_POSIX_KEYS \
2100  (CONFIGURE_MAXIMUM_POSIX_KEYS + _CONFIGURE_LIBIO_POSIX_KEYS)
2101
2102/**
2103 * This configuration parameter specifies the maximum number of
2104 * POSIX API threads.
2105 */
2106#ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2107  #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
2108#endif
2109
2110/*
2111 * Account for the object control structures plus the name
2112 * of the object to be duplicated.
2113 */
2114#define _Configure_POSIX_Named_Object_RAM(_number, _size) \
2115  (_Configure_Max_Objects(_number) \
2116    * _Configure_From_workspace(_POSIX_PATH_MAX + 1))
2117
2118/**
2119 * This configuration parameter specifies the maximum number of
2120 * POSIX API message queues.
2121 */
2122#ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
2123  #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 0
2124#endif
2125
2126/*
2127 * This macro is calculated to specify the memory required for
2128 * POSIX API message queues.
2129 */
2130#define _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
2131  _Configure_POSIX_Named_Object_RAM( \
2132     _message_queues, sizeof(POSIX_Message_queue_Control) )
2133
2134/**
2135 * This configuration parameter specifies the maximum number of
2136 * POSIX API semaphores.
2137 */
2138#ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
2139  #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0
2140#endif
2141
2142/*
2143 * This macro is calculated to specify the memory required for
2144 * POSIX API semaphores.
2145 */
2146#define _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
2147  _Configure_POSIX_Named_Object_RAM( \
2148     _semaphores, sizeof(POSIX_Semaphore_Control) )
2149
2150/**
2151 * Configure the maximum number of POSIX shared memory objects.
2152 */
2153#ifndef CONFIGURE_MAXIMUM_POSIX_SHMS
2154  #define CONFIGURE_MAXIMUM_POSIX_SHMS 0
2155#endif
2156
2157/*
2158 * This macro is calculated to specify the memory required for
2159 * POSIX API shared memory.
2160 */
2161#define _CONFIGURE_MEMORY_FOR_POSIX_SHMS(_shms) \
2162  _Configure_POSIX_Named_Object_RAM(_shms, sizeof(POSIX_Shm_Control) )
2163
2164/**
2165 * This configuration parameter specifies the maximum number of
2166 * POSIX API timers.
2167 */
2168#ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
2169  #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
2170#endif
2171
2172#if !defined(RTEMS_POSIX_API) && CONFIGURE_MAXIMUM_POSIX_TIMERS != 0
2173  #error "CONFIGURE_MAXIMUM_POSIX_TIMERS must be zero if POSIX API is disabled"
2174#endif
2175
2176/**
2177 * This configuration parameter specifies the maximum number of
2178 * POSIX API queued signals.
2179 */
2180#ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
2181  #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0
2182#endif
2183
2184#if !defined(RTEMS_POSIX_API) && CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0
2185  #error "CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS must be zero if POSIX API is disabled"
2186#endif
2187
2188#if CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS > 0
2189  #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS \
2190    _Configure_From_workspace( (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) * \
2191      sizeof( POSIX_signals_Siginfo_node ) )
2192#else
2193  #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS 0
2194#endif
2195
2196#ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
2197  #ifndef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
2198    #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
2199      #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
2200    #endif
2201
2202    #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2203      #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
2204        CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
2205    #endif
2206
2207    #ifdef CONFIGURE_INIT
2208      posix_initialization_threads_table POSIX_Initialization_threads[] = {
2209        { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT,
2210          CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
2211      };
2212    #endif
2213
2214    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
2215      POSIX_Initialization_threads
2216
2217    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
2218      RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
2219  #endif /* !CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
2220#else /* !CONFIGURE_POSIX_INIT_THREAD_TABLE */
2221  #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
2222  #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
2223#endif /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
2224
2225/**
2226 * This configuration parameter specifies the stack size of the
2227 * POSIX API Initialization thread (if used).
2228 */
2229#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2230  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE    0
2231#endif
2232/**@}*/  /* end of POSIX API Configuration */
2233
2234/**
2235 * This is so we can account for tasks with stacks greater than minimum
2236 * size.  This is in bytes.
2237 */
2238#ifndef CONFIGURE_EXTRA_TASK_STACKS
2239  #define CONFIGURE_EXTRA_TASK_STACKS 0
2240#endif
2241
2242/*
2243 * We must be able to split the free block used for the second last allocation
2244 * into two parts so that we have a free block for the last allocation.  See
2245 * _Heap_Block_split().
2246 */
2247#define _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2248  _Configure_Align_up( HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT )
2249
2250/**
2251 * This calculates the amount of memory reserved for the IDLE tasks.
2252 * In an SMP system, each CPU core has its own idle task.
2253 */
2254#define _CONFIGURE_IDLE_TASKS_COUNT _CONFIGURE_MAXIMUM_PROCESSORS
2255
2256/*
2257 *  Calculate the RAM size based on the maximum number of objects configured.
2258 */
2259#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
2260
2261/**
2262 * The following macro is used to calculate the memory allocated by RTEMS
2263 * for the message buffers associated with a particular message queue.
2264 * There is a fixed amount of overhead per message.
2265 */
2266#define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
2267    _Configure_From_workspace( \
2268      (_messages) * (_Configure_Align_up(_size, sizeof(uintptr_t)) \
2269        + sizeof(CORE_message_queue_Buffer_control)))
2270
2271/*
2272 * This macro is set to the amount of memory required for pending message
2273 * buffers in bytes.  It should be constructed by adding together a
2274 * set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
2275 */
2276#ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
2277  #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
2278#endif
2279
2280/**
2281 * This macro is available just in case the confdefs.h file underallocates
2282 * memory for a particular application.  This lets the user add some extra
2283 * memory in case something broken and underestimates.
2284 *
2285 * It is also possible for cases where confdefs.h overallocates memory,
2286 * you could substract memory from the allocated.  The estimate is just
2287 * that, an estimate, and assumes worst case alignment and padding on
2288 * each allocated element.  So in some cases it could be too conservative.
2289 *
2290 * NOTE: Historically this was used for message buffers.
2291 */
2292#ifndef CONFIGURE_MEMORY_OVERHEAD
2293  #define CONFIGURE_MEMORY_OVERHEAD 0
2294#endif
2295
2296/**
2297 * This calculates the memory required for the executive workspace.
2298 *
2299 * This is an internal parameter.
2300 */
2301#define CONFIGURE_EXECUTIVE_RAM_SIZE \
2302( \
2303   _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
2304     CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
2305   _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
2306     CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \
2307   _CONFIGURE_MEMORY_FOR_POSIX_SHMS( \
2308     CONFIGURE_MAXIMUM_POSIX_SHMS) + \
2309   _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS + \
2310   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
2311   (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
2312   _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2313)
2314
2315/*
2316 *  Now account for any extra memory that initialization tasks or threads
2317 *  may have requested.
2318 */
2319
2320/*
2321 * This accounts for any extra memory required by the Classic API
2322 * Initialization Task.
2323 */
2324#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2325  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
2326      (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2327#else
2328  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
2329#endif
2330
2331/*
2332 * This accounts for any extra memory required by the POSIX API
2333 * Initialization Thread.
2334 */
2335#if (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \
2336      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2337  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
2338    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - \
2339      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2340#else
2341  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
2342#endif
2343
2344/*
2345 * This macro provides a summation of the various initialization task
2346 * and thread stack requirements.
2347 */
2348#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS \
2349    (_CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
2350    _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART)
2351
2352/*
2353 * This macro is calculated to specify the memory required for
2354 * the stacks of all tasks.
2355 */
2356#define _CONFIGURE_TASKS_STACK \
2357  (_Configure_Max_Objects( _CONFIGURE_TASKS ) * \
2358    _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
2359
2360/*
2361 * This macro is calculated to specify the memory required for
2362 * the stacks of all POSIX threads.
2363 */
2364#define _CONFIGURE_POSIX_THREADS_STACK \
2365  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \
2366    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2367
2368#else /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2369
2370#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS 0
2371#define _CONFIGURE_TASKS_STACK 0
2372#define _CONFIGURE_POSIX_THREADS_STACK 0
2373
2374#if CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK != 0
2375  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK"
2376#endif
2377
2378#if CONFIGURE_EXTRA_TASK_STACKS != 0
2379  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_TASK_STACKS"
2380#endif
2381
2382#endif /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2383
2384/*
2385 * This macro is calculated to specify the memory required for
2386 * all tasks and threads of all varieties.
2387 */
2388#define _CONFIGURE_STACK_SPACE_SIZE \
2389  ( \
2390    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \
2391    _CONFIGURE_TASKS_STACK + \
2392    _CONFIGURE_POSIX_THREADS_STACK + \
2393    _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS + \
2394    CONFIGURE_EXTRA_TASK_STACKS + \
2395    _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2396  )
2397
2398#ifndef CONFIGURE_MAXIMUM_THREAD_NAME_SIZE
2399  #define CONFIGURE_MAXIMUM_THREAD_NAME_SIZE THREAD_DEFAULT_MAXIMUM_NAME_SIZE
2400#endif
2401
2402#ifdef CONFIGURE_INIT
2403  typedef union {
2404    Scheduler_Node Base;
2405    #ifdef CONFIGURE_SCHEDULER_CBS
2406      Scheduler_CBS_Node CBS;
2407    #endif
2408    #ifdef CONFIGURE_SCHEDULER_EDF
2409      Scheduler_EDF_Node EDF;
2410    #endif
2411    #ifdef CONFIGURE_SCHEDULER_EDF_SMP
2412      Scheduler_EDF_SMP_Node EDF_SMP;
2413    #endif
2414    #ifdef CONFIGURE_SCHEDULER_PRIORITY
2415      Scheduler_priority_Node Priority;
2416    #endif
2417    #ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
2418      Scheduler_SMP_Node Simple_SMP;
2419    #endif
2420    #ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
2421      Scheduler_priority_SMP_Node Priority_SMP;
2422    #endif
2423    #ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
2424      Scheduler_priority_affinity_SMP_Node Priority_affinity_SMP;
2425    #endif
2426    #ifdef CONFIGURE_SCHEDULER_STRONG_APA
2427      Scheduler_strong_APA_Node Strong_APA;
2428    #endif
2429    #ifdef CONFIGURE_SCHEDULER_USER_PER_THREAD
2430      CONFIGURE_SCHEDULER_USER_PER_THREAD User;
2431    #endif
2432  } Configuration_Scheduler_node;
2433
2434  #ifdef RTEMS_SMP
2435    const size_t _Scheduler_Node_size = sizeof( Configuration_Scheduler_node );
2436  #endif
2437
2438  const size_t _Thread_Maximum_name_size = CONFIGURE_MAXIMUM_THREAD_NAME_SIZE;
2439
2440  struct Thread_Configured_control {
2441    Thread_Control Control;
2442    #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
2443      void *extensions[ CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1 ];
2444    #endif
2445    Configuration_Scheduler_node Scheduler_nodes[ _CONFIGURE_SCHEDULER_COUNT ];
2446    RTEMS_API_Control API_RTEMS;
2447    #ifdef RTEMS_POSIX_API
2448      POSIX_API_Control API_POSIX;
2449    #endif
2450    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
2451      char name[ CONFIGURE_MAXIMUM_THREAD_NAME_SIZE ];
2452    #endif
2453    #if !defined(RTEMS_SCHEDSIM) \
2454      && defined(RTEMS_NEWLIB) \
2455      && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
2456      struct _reent Newlib;
2457    #else
2458      struct { /* Empty */ } Newlib;
2459    #endif
2460  };
2461
2462  const Thread_Control_add_on _Thread_Control_add_ons[] = {
2463    {
2464      offsetof( Thread_Configured_control, Control.Scheduler.nodes ),
2465      offsetof( Thread_Configured_control, Scheduler_nodes )
2466    }, {
2467      offsetof(
2468        Thread_Configured_control,
2469        Control.API_Extensions[ THREAD_API_RTEMS ]
2470      ),
2471      offsetof( Thread_Configured_control, API_RTEMS )
2472    }, {
2473      offsetof(
2474        Thread_Configured_control,
2475        Control.libc_reent
2476      ),
2477      offsetof( Thread_Configured_control, Newlib )
2478    }
2479    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
2480      , {
2481        offsetof(
2482          Thread_Configured_control,
2483          Control.Join_queue.Queue.name
2484        ),
2485        offsetof( Thread_Configured_control, name )
2486      }
2487    #endif
2488    #ifdef RTEMS_POSIX_API
2489      , {
2490        offsetof(
2491          Thread_Configured_control,
2492          Control.API_Extensions[ THREAD_API_POSIX ]
2493        ),
2494        offsetof( Thread_Configured_control, API_POSIX )
2495      }
2496    #endif
2497  };
2498
2499  const size_t _Thread_Control_add_on_count =
2500    RTEMS_ARRAY_SIZE( _Thread_Control_add_ons );
2501
2502  #if defined(RTEMS_SMP)
2503    struct Thread_queue_Configured_heads {
2504      Thread_queue_Heads Heads;
2505        Thread_queue_Priority_queue Priority[ _CONFIGURE_SCHEDULER_COUNT ];
2506    };
2507
2508    const size_t _Thread_queue_Heads_size =
2509      sizeof( Thread_queue_Configured_heads );
2510  #endif
2511
2512  const uint32_t _Watchdog_Nanoseconds_per_tick =
2513    (uint32_t) 1000 * CONFIGURE_MICROSECONDS_PER_TICK;
2514
2515  const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND;
2516
2517  const size_t _Thread_Initial_thread_count =
2518    rtems_resource_maximum_per_allocation( _CONFIGURE_TASKS ) +
2519    rtems_resource_maximum_per_allocation( CONFIGURE_MAXIMUM_POSIX_THREADS );
2520
2521  THREAD_INFORMATION_DEFINE(
2522    _Thread,
2523    OBJECTS_INTERNAL_API,
2524    OBJECTS_INTERNAL_THREADS,
2525    _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT
2526  );
2527
2528  char _Thread_Idle_stacks[
2529    _CONFIGURE_IDLE_TASKS_COUNT
2530      * ( CONFIGURE_IDLE_TASK_STACK_SIZE
2531        + CPU_IDLE_TASK_IS_FP * CONTEXT_FP_SIZE )
2532  ] RTEMS_ALIGNED( CPU_INTERRUPT_STACK_ALIGNMENT )
2533  RTEMS_SECTION( ".rtemsstack.idle" );
2534
2535  #if CONFIGURE_MAXIMUM_BARRIERS > 0
2536    BARRIER_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_BARRIERS );
2537  #endif
2538
2539  #if CONFIGURE_MAXIMUM_MESSAGE_QUEUES > 0
2540    MESSAGE_QUEUE_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_MESSAGE_QUEUES );
2541  #endif
2542
2543  #if CONFIGURE_MAXIMUM_PARTITIONS > 0
2544    PARTITION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_PARTITIONS );
2545  #endif
2546
2547  #if CONFIGURE_MAXIMUM_PERIODS > 0
2548    RATE_MONOTONIC_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_PERIODS );
2549  #endif
2550
2551  #if CONFIGURE_MAXIMUM_PORTS > 0
2552    DUAL_PORTED_MEMORY_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_PORTS );
2553  #endif
2554
2555  #if CONFIGURE_MAXIMUM_REGIONS > 0
2556    REGION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_REGIONS );
2557  #endif
2558
2559  #if CONFIGURE_MAXIMUM_SEMAPHORES > 0
2560    SEMAPHORE_INFORMATION_DEFINE(
2561      CONFIGURE_MAXIMUM_SEMAPHORES,
2562      _CONFIGURE_SCHEDULER_COUNT
2563    );
2564  #endif
2565
2566  #if CONFIGURE_MAXIMUM_TIMERS > 0
2567    TIMER_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_TIMERS );
2568  #endif
2569
2570  #if _CONFIGURE_TASKS > 0
2571    THREAD_INFORMATION_DEFINE(
2572      _RTEMS_tasks,
2573      OBJECTS_CLASSIC_API,
2574      OBJECTS_RTEMS_TASKS,
2575      _CONFIGURE_TASKS
2576    );
2577  #endif
2578
2579  #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
2580    EXTENSION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_USER_EXTENSIONS );
2581  #endif
2582
2583  /**
2584   * This is the Classic API Configuration Table.
2585   */
2586  rtems_api_configuration_table Configuration_RTEMS_API = {
2587    CONFIGURE_INIT_TASK_TABLE_SIZE,
2588    CONFIGURE_INIT_TASK_TABLE
2589  };
2590
2591  #if CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS > 0
2592    POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[
2593      rtems_resource_maximum_per_allocation(
2594        CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
2595      )
2596    ];
2597
2598    const uint32_t _POSIX_Keys_Key_value_pair_maximum =
2599      CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS;
2600  #endif
2601
2602  #if _CONFIGURE_POSIX_KEYS > 0
2603    POSIX_KEYS_INFORMATION_DEFINE( _CONFIGURE_POSIX_KEYS );
2604  #endif
2605
2606  #if CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES > 0
2607    POSIX_MESSAGE_QUEUE_INFORMATION_DEFINE(
2608      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
2609    );
2610  #endif
2611
2612  #if CONFIGURE_MAXIMUM_POSIX_SEMAPHORES > 0
2613    POSIX_SEMAPHORE_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES );
2614  #endif
2615
2616  #if CONFIGURE_MAXIMUM_POSIX_SHMS > 0
2617    POSIX_SHM_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_SHMS );
2618  #endif
2619
2620  #if CONFIGURE_MAXIMUM_POSIX_THREADS > 0
2621    THREAD_INFORMATION_DEFINE(
2622      _POSIX_Threads,
2623      OBJECTS_POSIX_API,
2624      OBJECTS_POSIX_THREADS,
2625      CONFIGURE_MAXIMUM_POSIX_THREADS
2626    );
2627  #endif
2628
2629  #ifdef RTEMS_POSIX_API
2630    #if CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS > 0
2631      const uint32_t _POSIX_signals_Maximum_queued_signals =
2632        CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS;
2633
2634      POSIX_signals_Siginfo_node _POSIX_signals_Siginfo_nodes[
2635        CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
2636      ];
2637    #endif
2638
2639    #if CONFIGURE_MAXIMUM_POSIX_TIMERS > 0
2640      POSIX_TIMER_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_TIMERS );
2641    #endif
2642  #endif
2643
2644  const size_t _POSIX_Threads_Minimum_stack_size =
2645    CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE;
2646
2647  /**
2648   * This variable specifies the minimum stack size for tasks in an RTEMS
2649   * application.
2650   *
2651   * NOTE: This is left as a simple uint32_t so it can be externed as
2652   *       needed without requring being high enough logical to
2653   *       include the full configuration table.
2654   */
2655  uint32_t rtems_minimum_stack_size =
2656    CONFIGURE_MINIMUM_TASK_STACK_SIZE;
2657
2658  const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
2659
2660  #if defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
2661    && defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
2662    #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE
2663      const bool _Stack_Allocator_avoids_workspace = true;
2664    #else
2665      const bool _Stack_Allocator_avoids_workspace = false;
2666    #endif
2667
2668    #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_INIT
2669      const Stack_Allocator_initialize _Stack_Allocator_initialize =
2670        CONFIGURE_TASK_STACK_ALLOCATOR_INIT;
2671    #else
2672      const Stack_Allocator_initialize _Stack_Allocator_initialize = NULL;
2673    #endif
2674
2675    const Stack_Allocator_allocate _Stack_Allocator_allocate =
2676      CONFIGURE_TASK_STACK_ALLOCATOR;
2677
2678    const Stack_Allocator_free _Stack_Allocator_free =
2679      CONFIGURE_TASK_STACK_DEALLOCATOR;
2680  #elif defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
2681    || defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
2682    #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined"
2683  #endif
2684
2685  /**
2686   * This is the primary Configuration Table for this application.
2687   */
2688  const rtems_configuration_table Configuration = {
2689    CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
2690    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
2691    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
2692    CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
2693    CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
2694    #ifdef CONFIGURE_UNIFIED_WORK_AREAS       /* true for unified work areas */
2695      true,
2696    #else
2697      false,
2698    #endif
2699    #ifdef RTEMS_SMP
2700      #ifdef _CONFIGURE_SMP_APPLICATION
2701        true,
2702      #else
2703        false,
2704      #endif
2705    #endif
2706    #ifdef RTEMS_SMP
2707      _CONFIGURE_MAXIMUM_PROCESSORS,
2708    #endif
2709  };
2710
2711  #ifdef CONFIGURE_DIRTY_MEMORY
2712    RTEMS_SYSINIT_ITEM(
2713      _Memory_Dirty_free_areas,
2714      RTEMS_SYSINIT_DIRTY_MEMORY,
2715      RTEMS_SYSINIT_ORDER_MIDDLE
2716    );
2717  #endif
2718
2719  #ifdef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
2720    const bool _Memory_Zero_before_use = true;
2721
2722    RTEMS_SYSINIT_ITEM(
2723      _Memory_Zero_free_areas,
2724      RTEMS_SYSINIT_ZERO_MEMORY,
2725      RTEMS_SYSINIT_ORDER_MIDDLE
2726    );
2727  #endif
2728
2729  #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
2730    #if (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS & (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS - 1)) != 0
2731      #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be a power of two"
2732    #endif
2733
2734    #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS < 16
2735      #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be at least 16"
2736    #endif
2737
2738    typedef struct {
2739      Record_Control    Control;
2740      rtems_record_item Items[ CONFIGURE_RECORD_PER_PROCESSOR_ITEMS ];
2741    } Record_Configured_control;
2742
2743    static Record_Configured_control _Record_Controls[ _CONFIGURE_MAXIMUM_PROCESSORS ];
2744
2745    const Record_Configuration _Record_Configuration = {
2746      CONFIGURE_RECORD_PER_PROCESSOR_ITEMS,
2747      &_Record_Controls[ 0 ].Control
2748    };
2749
2750    RTEMS_SYSINIT_ITEM(
2751      _Record_Initialize,
2752      RTEMS_SYSINIT_RECORD,
2753      RTEMS_SYSINIT_ORDER_MIDDLE
2754    );
2755  #endif
2756
2757  #ifdef CONFIGURE_VERBOSE_SYSTEM_INITIALIZATION
2758    RTEMS_SYSINIT_ITEM(
2759      _Sysinit_Verbose,
2760      RTEMS_SYSINIT_RECORD,
2761      RTEMS_SYSINIT_ORDER_LAST
2762    );
2763  #endif
2764#endif
2765
2766#if defined(RTEMS_SMP)
2767 /*
2768  * Instantiate the Per CPU information based upon the user configuration.
2769  */
2770 #if defined(CONFIGURE_INIT)
2771   Per_CPU_Control_envelope _Per_CPU_Information[_CONFIGURE_MAXIMUM_PROCESSORS];
2772 #endif
2773
2774#endif
2775
2776/*
2777 *  If the user has configured a set of Classic API Initialization Tasks,
2778 *  then we need to install the code that runs that loop.
2779 */
2780#ifdef CONFIGURE_INIT
2781  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE)
2782    RTEMS_SYSINIT_ITEM(
2783      _RTEMS_tasks_Initialize_user_tasks_body,
2784      RTEMS_SYSINIT_CLASSIC_USER_TASKS,
2785      RTEMS_SYSINIT_ORDER_MIDDLE
2786    );
2787  #endif
2788#endif
2789
2790/*
2791 *  If the user has configured a set of POSIX Initialization Threads,
2792 *  then we need to install the code that runs that loop.
2793 */
2794#ifdef CONFIGURE_INIT
2795  #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
2796      defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
2797    posix_initialization_threads_table * const
2798      _Configuration_POSIX_Initialization_threads =
2799        CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME;
2800
2801    const size_t _Configuration_POSIX_Initialization_thread_count =
2802      CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE;
2803
2804    RTEMS_SYSINIT_ITEM(
2805      _POSIX_Threads_Initialize_user_threads_body,
2806      RTEMS_SYSINIT_POSIX_USER_THREADS,
2807      RTEMS_SYSINIT_ORDER_MIDDLE
2808    );
2809  #endif
2810#endif
2811
2812/*
2813 *  Select PCI Configuration Library
2814 */
2815#ifdef RTEMS_PCI_CONFIG_LIB
2816  #ifdef CONFIGURE_INIT
2817    #define PCI_LIB_NONE 0
2818    #define PCI_LIB_AUTO 1
2819    #define PCI_LIB_STATIC 2
2820    #define PCI_LIB_READ 3
2821    #define PCI_LIB_PERIPHERAL 4
2822    #if CONFIGURE_PCI_LIB == PCI_LIB_AUTO
2823      #define PCI_CFG_AUTO_LIB
2824      #include <pci/cfg.h>
2825      struct pci_bus pci_hb;
2826      #define PCI_LIB_INIT pci_config_auto
2827      #define PCI_LIB_CONFIG pci_config_auto_register
2828    #elif CONFIGURE_PCI_LIB == PCI_LIB_STATIC
2829      #define PCI_CFG_STATIC_LIB
2830      #include <pci/cfg.h>
2831      #define PCI_LIB_INIT pci_config_static
2832      #define PCI_LIB_CONFIG NULL
2833      /* Let user define PCI configuration (struct pci_bus pci_hb) */
2834    #elif CONFIGURE_PCI_LIB == PCI_LIB_READ
2835      #define PCI_CFG_READ_LIB
2836      #include <pci/cfg.h>
2837      #define PCI_LIB_INIT pci_config_read
2838      #define PCI_LIB_CONFIG NULL
2839      struct pci_bus pci_hb;
2840    #elif CONFIGURE_PCI_LIB == PCI_LIB_PERIPHERAL
2841      #define PCI_LIB_INIT pci_config_peripheral
2842      #define PCI_LIB_CONFIG NULL
2843      /* Let user define PCI configuration (struct pci_bus pci_hb) */
2844    #elif CONFIGURE_PCI_LIB == PCI_LIB_NONE
2845      #define PCI_LIB_INIT NULL
2846      #define PCI_LIB_CONFIG NULL
2847      /* No PCI Configuration at all, user can use/debug access routines */
2848    #else
2849      #error NO PCI LIBRARY DEFINED
2850    #endif
2851
2852    const int pci_config_lib_type = CONFIGURE_PCI_LIB;
2853    int (*pci_config_lib_init)(void) = PCI_LIB_INIT;
2854    void (*pci_config_lib_register)(void *config) = PCI_LIB_CONFIG;
2855  #endif
2856#endif
2857
2858#ifdef __cplusplus
2859}
2860#endif
2861
2862/******************************************************************
2863 ******************************************************************
2864 ******************************************************************
2865 *         CONFIGURATION WARNINGS AND ERROR CHECKING              *
2866 ******************************************************************
2867 ******************************************************************
2868 ******************************************************************
2869 */
2870
2871/*
2872 *  Make sure a task/thread of some sort is configured.
2873 *
2874 *  When analyzing RTEMS to find the smallest possible of memory
2875 *  that must be allocated, you probably do want to configure 0
2876 *  tasks/threads so there is a smaller set of calls to _Workspace_Allocate
2877 *  to analyze.
2878 */
2879#if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) \
2880  && CONFIGURE_MAXIMUM_TASKS == 0 \
2881  && CONFIGURE_MAXIMUM_POSIX_THREADS == 0
2882  #error "CONFIGURATION ERROR: No tasks or threads configured!!"
2883#endif
2884
2885#ifndef RTEMS_SCHEDSIM
2886/*
2887 *  Make sure at least one of the initialization task/thread
2888 *  tables was defined.
2889 */
2890#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
2891    !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \
2892    !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
2893#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
2894#endif
2895#endif
2896
2897/*
2898 *  If the user is trying to configure a multiprocessing application and
2899 *  RTEMS was not configured and built multiprocessing, then error out.
2900 */
2901#if defined(CONFIGURE_MP_APPLICATION) && \
2902    !defined(RTEMS_MULTIPROCESSING)
2903#error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!"
2904#endif
2905
2906#if !defined(RTEMS_SCHEDSIM)
2907/*
2908 *  You must either explicitly include or exclude the clock driver.
2909 *  It is such a common newbie error to leave it out.  Maybe this
2910 *  will put an end to it.
2911 *
2912 *  NOTE: If you are using the timer driver, it is considered
2913 *        mutually exclusive with the clock driver because the
2914 *        drivers are assumed to use the same "timer" hardware
2915 *        on many boards.
2916 */
2917#if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
2918    !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \
2919    !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER)
2920  #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?"
2921 #endif
2922
2923/*
2924 * Only one of the following three configuration parameters should be
2925 * defined at a time.
2926 */
2927#if ((defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) + \
2928      defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER) + \
2929      defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER)) > 1)
2930   #error "CONFIGURATION ERROR: More than one clock/timer driver configuration parameter specified?!?"
2931#endif
2932#endif   /* !defined(RTEMS_SCHEDSIM) */
2933
2934/*
2935 *  These names have been obsoleted so make the user application stop compiling
2936 */
2937#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
2938    defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
2939    defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
2940    defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
2941    defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
2942#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
2943#endif
2944
2945/*
2946 *  Validate the configured maximum priority
2947 */
2948#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \
2949     (CONFIGURE_MAXIMUM_PRIORITY != 7) && \
2950     (CONFIGURE_MAXIMUM_PRIORITY != 15) && \
2951     (CONFIGURE_MAXIMUM_PRIORITY != 31) && \
2952     (CONFIGURE_MAXIMUM_PRIORITY != 63) && \
2953     (CONFIGURE_MAXIMUM_PRIORITY != 127) && \
2954     (CONFIGURE_MAXIMUM_PRIORITY != 255))
2955  #error "Maximum priority is not 1 less than a power of 2 between 4 and 256"
2956#endif
2957
2958#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM)
2959  #error "Maximum priority configured higher than supported by target."
2960#endif
2961
2962#ifdef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
2963  #warning "The CONFIGURE_HAS_OWN_CONFIGURATION_TABLE configuration option is obsolete since RTEMS 5.1"
2964#endif
2965
2966#ifdef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
2967  #warning "The CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE configuration option is obsolete since RTEMS 5.1"
2968#endif
2969
2970#ifdef CONFIGURE_HAS_OWN_FILESYSTEM_TABLE
2971  #warning "The CONFIGURE_HAS_OWN_FILESYSTEM_TABLE configuration option is obsolete since RTEMS 5.1"
2972#endif
2973
2974#ifdef CONFIGURE_HAS_OWN_INIT_TABLE
2975  #warning "The CONFIGURE_HAS_OWN_INIT_TABLE configuration option is obsolete since RTEMS 5.1"
2976#endif
2977
2978#ifdef CONFIGURE_HAS_OWN_MOUNT_TABLE
2979  #warning "The CONFIGURE_HAS_OWN_MOUNT_TABLE configuration option is obsolete since RTEMS 5.1"
2980#endif
2981
2982#ifdef CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE
2983  #warning "The CONFIGURE_HAS_OWN_MOUNT_TABLE configuration option is obsolete since RTEMS 5.1"
2984#endif
2985
2986#ifdef CONFIGURE_NUMBER_OF_TERMIOS_PORTS
2987  #warning "The CONFIGURE_NUMBER_OF_TERMIOS_PORTS configuration option is obsolete since RTEMS 5.1"
2988#endif
2989
2990#ifdef CONFIGURE_MAXIMUM_ADA_TASKS
2991  #warning "The CONFIGURE_MAXIMUM_ADA_TASKS configuration option is obsolete since RTEMS 5.1"
2992#endif
2993
2994#ifdef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
2995  #warning "The CONFIGURE_MAXIMUM_FAKE_ADA_TASKS configuration option is obsolete since RTEMS 5.1"
2996#endif
2997
2998#ifdef CONFIGURE_MAXIMUM_MRSP_SEMAPHORES
2999  #warning "The CONFIGURE_MAXIMUM_MRSP_SEMAPHORES configuration option is obsolete since RTEMS 5.1"
3000#endif
3001
3002#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
3003  #warning "The CONFIGURE_MAXIMUM_POSIX_BARRIERS configuration option is obsolete since RTEMS 5.1"
3004#endif
3005
3006#ifdef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
3007  #warning "The CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES configuration option is obsolete since RTEMS 5.1"
3008#endif
3009
3010#ifdef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
3011  #warning "The CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS configuration option is obsolete since RTEMS 5.1"
3012#endif
3013
3014#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
3015  #warning "The CONFIGURE_MAXIMUM_POSIX_MUTEXES configuration option is obsolete since RTEMS 5.1"
3016#endif
3017
3018#ifdef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
3019  #warning "The CONFIGURE_MAXIMUM_POSIX_RWLOCKS configuration option is obsolete since RTEMS 5.1"
3020#endif
3021
3022#ifdef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
3023  #warning "The CONFIGURE_MAXIMUM_POSIX_SPINLOCKS configuration option is obsolete since RTEMS 5.1"
3024#endif
3025
3026#ifdef CONFIGURE_MAXIMUM_PTYS
3027  #warning "The CONFIGURE_MAXIMUM_PTYS configuration option is obsolete since RTEMS 5.1"
3028#endif
3029
3030#ifdef CONFIGURE_TERMIOS_DISABLED
3031  #warning "The CONFIGURE_TERMIOS_DISABLED configuration option is obsolete since RTEMS 5.1"
3032#endif
3033
3034/*
3035 * POSIX Key pair shouldn't be less than POSIX Key, which is highly
3036 * likely to be error.
3037 */
3038#if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \
3039    (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0)
3040  #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < CONFIGURE_MAXIMUM_POSIX_KEYS)
3041    #error "Fewer POSIX Key pairs than POSIX Key!"
3042  #endif
3043#endif
3044
3045/*
3046 * IMFS block size for in memory files (memfiles) must be a power of
3047 * two between 16 and 512 inclusive.
3048 */
3049#if ((CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 16) && \
3050     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 32) && \
3051     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 64) && \
3052     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 128) && \
3053     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 256) && \
3054     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 512))
3055  #error "IMFS Memfile block size must be a power of 2 between 16 and 512"
3056#endif
3057
3058#ifdef CONFIGURE_ENABLE_GO
3059  #warning "The CONFIGURE_ENABLE_GO configuration option is obsolete since RTEMS 5.1"
3060#endif
3061
3062#ifdef CONFIGURE_GNAT_RTEMS
3063  #warning "The CONFIGURE_GNAT_RTEMS configuration option is obsolete since RTEMS 5.1"
3064#endif
3065
3066#ifdef CONFIGURE_MAXIMUM_GOROUTINES
3067  #warning "The CONFIGURE_MAXIMUM_GOROUTINES configuration option is obsolete since RTEMS 5.1"
3068#endif
3069
3070#ifdef CONFIGURE_MAXIMUM_GO_CHANNELS
3071  #warning "The CONFIGURE_MAXIMUM_GO_CHANNELS configuration option is obsolete since RTEMS 5.1"
3072#endif
3073
3074#endif
3075/* end of include file */
Note: See TracBrowser for help on using the repository browser.