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

5
Last change on this file since b1b6f3b0 was b1b6f3b0, checked in by Sebastian Huber <sebastian.huber@…>, on May 3, 2016 at 10:57:16 AM

confdefs.h: Fix message queue size estimate

Account for maximum message size alignment. Simplify
_CORE_message_queue_Initialize().

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