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

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

config: Improve _Configure_From_workspace()

Commit 4c09f4b3fefc7ba5c5868a97ad00c1ee14a06677 changed the cast from
size_t to ssize_t to try to fix an workspace issue on 16-bit
architectures. This change was reverted by commit
7ff6115b8b913d848b8fe76daf72ca0b4bbf2548 for the workspace but not
_Configure_From_workspace(). Change the cast to uintptr_t to be in line
with the Heap Handler.

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