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

5
Last change on this file since f00c5c6 was f00c5c6, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 8, 2018 at 9:32:14 AM

rtems: Move internal structures to partdata.h

Update #3598.

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