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

5
Last change on this file since ba74ebde was ba74ebde, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 14, 2020 at 6:09:56 PM

libio: Add POSIX user environment pointer to TCB

The IO library used a POSIX key to store an optional POSIX user
environment pointer. This pulled in the POSIX keys support in every
application configuration. Add a user environment pointer to the thread
control block (TCB) instead. Applications which do not need the POSIX
user environment will just get an overhead of one pointer per thread.

Close #3882.

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