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

5
Last change on this file since c70d112 was c70d112, checked in by Sebastian Huber <sebastian.huber@…>, on 02/14/20 at 12:26:17

config: Add _Thread_Idle_stack_size

Move the idle thread stack size configuration constant out of the
configuration table.

Add THREAD_IDLE_STACK_SIZE_DEFAULT and use it to provide a default
definition of the idle thread stack size constant.

Update #3875.

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