source: rtems/cpukit/include/rtems/confdefs.h @ 257cf74

5
Last change on this file since 257cf74 was 78bbe59, checked in by Sebastian Huber <sebastian.huber@…>, on 11/07/18 at 13:12:52

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