source: rtems/cpukit/include/rtems/confdefs.h @ 0446f68

Last change on this file since 0446f68 was 0446f68, checked in by Marçal Comajoan Cara <mcomajoancara@…>, on Dec 3, 2018 at 8:37:32 PM

Spelling and grammar fixes in source code comments (GCI 2018)

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