source: rtems/cpukit/sapi/include/confdefs.h @ e2735012

5
Last change on this file since e2735012 was 48fed9a, checked in by Sebastian Huber <sebastian.huber@…>, on 06/25/15 at 12:11:53

score: Simplify <rtems/system.h>

Drop the <rtems/score/percpu.h> include since this file exposes a lot of
implementation details.

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