source: rtems/cpukit/include/rtems/confdefs.h @ 0561cc1

5
Last change on this file since 0561cc1 was 0561cc1, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 21, 2020 at 6:34:50 AM

config: Remove _Configure_Max_Objects()

Use rtems_resource_maximum_per_allocation() directly. The use of
_Configure_Zero_or_one() was superfluous.

Update #3875.

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