source: rtems/cpukit/include/rtems/confdefs.h @ 72a4a42

Last change on this file since 72a4a42 was 72a4a42, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 8, 2018 at 9:19:39 AM

rtems: Move internal structures to dpmemdata.h

Update #3598.

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