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

5
Last change on this file since ba46b936 was ba46b936, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 14, 2020 at 1:04:21 PM

config: Add _SMP_Is_enabled

Move the is SMP enabled configuration constant out of the
configuration table.

Since this was the last configuration constant in
rtems_configuration_table, remove this type.

Update #3875.

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