source: rtems/cpukit/sapi/include/confdefs.h @ 9c0cefb

5
Last change on this file since 9c0cefb was 9c0cefb, checked in by Sebastian Huber <sebastian.huber@…>, on 10/11/17 at 05:46:41

confdefs: Add warnings for obsolete options

Update #2674.
Close #3112.
Close #3113.
Close #3114.
Close #3115.
Close #3116.

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