source: rtems/cpukit/sapi/include/confdefs.h @ 3ac68119

4.11
Last change on this file since 3ac68119 was 3ac68119, checked in by Gedare Bloom <gedare@…>, on Mar 6, 2015 at 5:41:49 PM

cpukit: deprecate notepads

Deprecate Classic API Notepads. Mark task_set/get_note() with
the deprecated attribute, and also mark the notepads field.

Replace disable with enable option for notepads in confdefs.h,
and make notepads disabled by default. The previous option
CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS is now unused and
will emit a compile-time warning. A new option
CONFIGURE_ENABLE_CLASSIC_API_NOTEPADS is available to turn
on notepads, but it also will emit a compile-time warning
to indicate that notepads are deprecated.

Closes #2265

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