source: rtems/cpukit/include/rtems/confdefs.h @ 257668d

5
Last change on this file since 257668d was 257668d, checked in by Sebastian Huber <sebastian.huber@…>, on 11/08/18 at 09:28:49

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