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

4.11
Last change on this file since f785492 was f785492, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 14, 2015 at 7:07:19 PM

IMFS: Add CONFIGURE_IMFS_DISABLE_READDIR

  • Property mode set to 100644
File size: 99.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief Configuration Table Template that will be Instantiated
5 * by an Application
6 *
7 * This include file contains the configuration table template that will
8 * be instantiated by an application based on the setting of a number
9 * of macros.  The macros are documented in the Configuring a System
10 * chapter of the Classic API User's Guide
11 *
12 * 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  #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
1814    #define CONFIGURE_NOTEPADS_ENABLED           TRUE
1815  #else
1816    #define CONFIGURE_NOTEPADS_ENABLED           FALSE
1817  #endif
1818
1819/**
1820 * This macro calculates the memory required for task variables.
1821 *
1822 * Each task variable is individually allocated from the Workspace.
1823 * Hence, we do the multiplication on the configured size.
1824 *
1825 * @note Per-task variables are disabled for SMP configurations.
1826 */
1827#if defined(RTEMS_SMP)
1828  #ifdef CONFIGURE_MAXIMUM_TASK_VARIABLES
1829    #error "Per-Task Variables are not safe for SMP systems and disabled"
1830  #endif
1831  #define CONFIGURE_MAXIMUM_TASK_VARIABLES                     0
1832  #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) 0
1833#else
1834  #ifndef CONFIGURE_MAXIMUM_TASK_VARIABLES
1835    #define CONFIGURE_MAXIMUM_TASK_VARIABLES                     0
1836    #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) 0
1837  #else
1838    #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) \
1839      (_task_variables) * \
1840         _Configure_From_workspace(sizeof(rtems_task_variable_t))
1841  #endif
1842#endif
1843
1844  #ifndef CONFIGURE_MAXIMUM_TIMERS
1845    #define CONFIGURE_MAXIMUM_TIMERS             0
1846    #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0
1847  #else
1848    #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
1849      _Configure_Object_RAM(_timers, sizeof(Timer_Control) )
1850  #endif
1851
1852  #ifndef CONFIGURE_MAXIMUM_SEMAPHORES
1853    #define CONFIGURE_MAXIMUM_SEMAPHORES                 0
1854  #endif
1855
1856  #ifdef RTEMS_NETWORKING
1857    #define CONFIGURE_NETWORKING_SEMAPHORES 1
1858  #else
1859    #define CONFIGURE_NETWORKING_SEMAPHORES 0
1860  #endif
1861
1862  #define CONFIGURE_SEMAPHORES \
1863    (CONFIGURE_MAXIMUM_SEMAPHORES + CONFIGURE_LIBIO_SEMAPHORES + \
1864      CONFIGURE_TERMIOS_SEMAPHORES + CONFIGURE_LIBBLOCK_SEMAPHORES + \
1865      CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS + \
1866      CONFIGURE_NETWORKING_SEMAPHORES)
1867
1868  #if !defined(RTEMS_SMP) || \
1869    !defined(CONFIGURE_MAXIMUM_MRSP_SEMAPHORES)
1870    #define CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES 0
1871  #else
1872    #define CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES \
1873      CONFIGURE_MAXIMUM_MRSP_SEMAPHORES * \
1874        _Configure_From_workspace( \
1875          RTEMS_ARRAY_SIZE(_Scheduler_Table) * sizeof(Priority_Control) \
1876        )
1877  #endif
1878
1879  /*
1880   * If there are no user or support semaphores defined, then we can assume
1881   * that no memory need be allocated at all for semaphores.
1882   */
1883  #if CONFIGURE_SEMAPHORES == 0
1884    #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0
1885  #else
1886    #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
1887      _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) ) + \
1888        CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES
1889  #endif
1890
1891  #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
1892    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES             0
1893    #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0
1894  #else
1895    #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
1896      _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) )
1897  #endif
1898
1899  #ifndef CONFIGURE_MAXIMUM_PARTITIONS
1900    #define CONFIGURE_MAXIMUM_PARTITIONS                 0
1901    #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0
1902  #else
1903    #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
1904      _Configure_Object_RAM(_partitions, sizeof(Partition_Control) )
1905  #endif
1906
1907  #ifndef CONFIGURE_MAXIMUM_REGIONS
1908    #define CONFIGURE_MAXIMUM_REGIONS              0
1909    #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0
1910  #else
1911    #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
1912      _Configure_Object_RAM(_regions, sizeof(Region_Control) )
1913  #endif
1914
1915  #ifndef CONFIGURE_MAXIMUM_PORTS
1916    #define CONFIGURE_MAXIMUM_PORTS            0
1917    #define CONFIGURE_MEMORY_FOR_PORTS(_ports) 0
1918  #else
1919    #define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
1920      _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) )
1921  #endif
1922
1923  #ifndef CONFIGURE_MAXIMUM_PERIODS
1924    #define CONFIGURE_MAXIMUM_PERIODS              0
1925    #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0
1926  #else
1927    #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
1928      _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) )
1929  #endif
1930
1931  #ifndef CONFIGURE_MAXIMUM_BARRIERS
1932    #define CONFIGURE_MAXIMUM_BARRIERS               0
1933  #endif
1934
1935  #define CONFIGURE_BARRIERS \
1936     (CONFIGURE_MAXIMUM_BARRIERS + CONFIGURE_BARRIERS_FOR_FIFOS)
1937
1938  #if CONFIGURE_BARRIERS == 0
1939    #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0
1940  #else
1941    #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \
1942      _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) )
1943  #endif
1944
1945  #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
1946    #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
1947    #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0
1948  #else
1949    #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
1950      _Configure_Object_RAM(_extensions, sizeof(Extension_Control) )
1951  #endif
1952
1953  #ifndef CONFIGURE_MICROSECONDS_PER_TICK
1954    #define CONFIGURE_MICROSECONDS_PER_TICK \
1955            RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
1956  #endif
1957
1958  #ifndef CONFIGURE_TICKS_PER_TIMESLICE
1959    #define CONFIGURE_TICKS_PER_TIMESLICE        50
1960  #endif
1961
1962/*
1963 *  Initial Extension Set
1964 */
1965
1966#ifdef CONFIGURE_INIT
1967#ifdef CONFIGURE_STACK_CHECKER_ENABLED
1968#include <rtems/stackchk.h>
1969#endif
1970#include <rtems/libcsupport.h>
1971
1972#if defined(BSP_INITIAL_EXTENSION) || \
1973    defined(CONFIGURE_INITIAL_EXTENSIONS) || \
1974    defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
1975    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
1976  static const rtems_extensions_table Configuration_Initial_Extensions[] = {
1977    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
1978      RTEMS_NEWLIB_EXTENSION,
1979    #endif
1980    #if defined(CONFIGURE_STACK_CHECKER_ENABLED)
1981      RTEMS_STACK_CHECKER_EXTENSION,
1982    #endif
1983    #if defined(CONFIGURE_INITIAL_EXTENSIONS)
1984      CONFIGURE_INITIAL_EXTENSIONS,
1985    #endif
1986    #if defined(BSP_INITIAL_EXTENSION)
1987      BSP_INITIAL_EXTENSION
1988    #endif
1989  };
1990
1991  #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
1992  #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
1993    RTEMS_ARRAY_SIZE(Configuration_Initial_Extensions)
1994#else
1995  #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
1996  #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
1997#endif
1998
1999#if defined(RTEMS_NEWLIB) && defined(__DYNAMIC_REENT__)
2000  struct _reent *__getreent(void)
2001  {
2002    #ifdef CONFIGURE_DISABLE_NEWLIB_REENTRANCY
2003      return _GLOBAL_REENT;
2004    #else
2005      return _Thread_Get_executing()->libc_reent;
2006    #endif
2007  }
2008#endif
2009
2010#endif
2011
2012/*
2013 *  POSIX API Configuration Parameters
2014 */
2015
2016/*
2017 *  POSIX Keys are available whether or not the POSIX API is enabled.
2018 */
2019#include <rtems/posix/key.h>
2020
2021#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
2022  #define CONFIGURE_MAXIMUM_POSIX_KEYS 0
2023#endif
2024
2025#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
2026  #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
2027    (CONFIGURE_MAXIMUM_POSIX_KEYS * \
2028     (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS))
2029#endif
2030
2031#define CONFIGURE_POSIX_KEYS \
2032  (CONFIGURE_MAXIMUM_POSIX_KEYS + CONFIGURE_LIBIO_POSIX_KEYS)
2033
2034#define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
2035   (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
2036    + _Configure_From_workspace( \
2037        _key_value_pairs * sizeof(POSIX_Keys_Key_value_pair)))
2038
2039/*
2040 *  The rest of the POSIX threads API features are only available when
2041 *  POSIX is enabled.
2042 */
2043
2044#ifdef RTEMS_POSIX_API
2045  #include <sys/types.h>
2046  #include <signal.h>
2047  #include <limits.h>
2048  #include <mqueue.h>
2049  #include <rtems/posix/barrier.h>
2050  #include <rtems/posix/cond.h>
2051  #include <rtems/posix/mqueue.h>
2052  #include <rtems/posix/mutex.h>
2053  #include <rtems/posix/psignal.h>
2054  #include <rtems/posix/pthread.h>
2055  #include <rtems/posix/rwlock.h>
2056  #include <rtems/posix/semaphore.h>
2057  #include <rtems/posix/spinlock.h>
2058  #include <rtems/posix/threadsup.h>
2059  #include <rtems/posix/timer.h>
2060
2061  /**
2062   * Account for the object control structures plus the name
2063   * of the object to be duplicated.
2064   */
2065  #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
2066    _Configure_Object_RAM( (_number), _size ) + \
2067    (_Configure_Max_Objects(_number) * _Configure_From_workspace(NAME_MAX) )
2068
2069  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2070    #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
2071  #endif
2072
2073  #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
2074    #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 0
2075  #endif
2076  #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
2077    _Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
2078
2079  #ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
2080    #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 0
2081  #endif
2082  #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) \
2083      _Configure_Object_RAM(_condvars, \
2084                          sizeof(POSIX_Condition_variables_Control) )
2085
2086  #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
2087    #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
2088  #endif
2089  #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
2090    _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
2091
2092  #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
2093    #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0
2094  #endif
2095  #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
2096    _Configure_From_workspace( \
2097      (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
2098
2099  #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
2100    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
2101    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS          0
2102  #else
2103    /* default to same number */
2104    #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
2105       #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
2106               CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
2107    #endif
2108  #endif
2109
2110  #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
2111    _Configure_POSIX_Named_Object_RAM( \
2112       _message_queues, sizeof(POSIX_Message_queue_Control) )
2113
2114  #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_mqueue_fds) \
2115    _Configure_Object_RAM( \
2116       _mqueue_fds, sizeof(POSIX_Message_queue_Control_fd) )
2117
2118  #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
2119    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0
2120  #endif
2121  #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
2122    _Configure_POSIX_Named_Object_RAM( \
2123       _semaphores, sizeof(POSIX_Semaphore_Control) )
2124
2125  #ifndef CONFIGURE_MAXIMUM_POSIX_BARRIERS
2126    #define CONFIGURE_MAXIMUM_POSIX_BARRIERS 0
2127  #endif
2128  #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \
2129    _Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) )
2130
2131  #ifndef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
2132    #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 0
2133  #endif
2134  #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \
2135    _Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) )
2136
2137  #ifndef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
2138    #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS 0
2139  #endif
2140  #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) \
2141    _Configure_Object_RAM(_rwlocks, sizeof(POSIX_RWLock_Control) )
2142
2143  #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
2144
2145    #ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
2146
2147      /*
2148       *  The user is defining their own table information and setting the
2149       *  appropriate variables for the POSIX Initialization Thread Table.
2150       */
2151
2152    #else
2153
2154      #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
2155        #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
2156      #endif
2157
2158      #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2159        #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
2160          CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
2161      #endif
2162
2163      #ifdef CONFIGURE_INIT
2164        posix_initialization_threads_table POSIX_Initialization_threads[] = {
2165          { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT, \
2166              CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
2167        };
2168      #endif
2169
2170      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
2171              POSIX_Initialization_threads
2172
2173      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
2174              RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
2175
2176    #endif    /* CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
2177
2178  #else     /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
2179
2180    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
2181    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
2182
2183  #endif
2184
2185#else
2186
2187  #define CONFIGURE_MAXIMUM_POSIX_THREADS         0
2188
2189#endif    /* RTEMS_POSIX_API */
2190
2191#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2192  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE    0
2193#endif
2194
2195/*
2196 *  This block of defines are for applications which use GNAT/RTEMS.
2197 *  GNAT implements each Ada task as a POSIX thread.
2198 */
2199#ifdef CONFIGURE_GNAT_RTEMS
2200
2201  /**
2202   * The GNAT run-time needs something less than (10) POSIX mutexes.
2203   * We may be able to get by with less but why bother.
2204   */
2205  #define CONFIGURE_GNAT_MUTEXES 10
2206
2207  /**
2208   * This is the maximum number of Ada tasks which can be concurrently
2209   * in existence.  Twenty (20) are required to run all tests in the
2210   * ACATS (formerly ACVC).
2211   */
2212  #ifndef CONFIGURE_MAXIMUM_ADA_TASKS
2213    #define CONFIGURE_MAXIMUM_ADA_TASKS  20
2214  #endif
2215
2216  /**
2217   * This is the number of non-Ada tasks which invoked Ada code.
2218   */
2219  #ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
2220    #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2221  #endif
2222
2223#else
2224  #define CONFIGURE_GNAT_MUTEXES           0
2225  #define CONFIGURE_MAXIMUM_ADA_TASKS      0
2226  #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2227#endif
2228
2229#ifdef CONFIGURE_ENABLE_GO
2230
2231  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2232    #define CONFIGURE_MAXIMUM_POSIX_THREADS 1
2233  #endif
2234  #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
2235    #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
2236  #endif
2237  #ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
2238    #define CONFIGURE_MAXIMUM_CONDITION_VARIABLES 1
2239  #endif
2240
2241  #define CONFIGURE_GO_INIT_MUTEXES 77
2242  #define CONFIGURE_GO_INIT_CONDITION_VARIABLES 4
2243
2244  #ifndef CONFIGURE_MAXIMUM_GOROUTINES
2245    #define CONFIGURE_MAXIMUM_GOROUTINES 400
2246  #endif
2247
2248  #define CONFIGURE_GOROUTINES_TASK_VARIABLES \
2249    (2 * CONFIGURE_MAXIMUM_GOROUTINES)
2250
2251  #ifndef CONFIGURE_MAXIMUM_GO_CHANNELS
2252    #define CONFIGURE_MAXIMUM_GO_CHANNELS 500
2253  #endif
2254
2255#else
2256  #define CONFIGURE_GO_INIT_MUTEXES             0
2257  #define CONFIGURE_GO_INIT_CONDITION_VARIABLES 0
2258  #define CONFIGURE_MAXIMUM_GOROUTINES          0
2259  #define CONFIGURE_GOROUTINES_TASK_VARIABLES   0
2260  #define CONFIGURE_MAXIMUM_GO_CHANNELS         0
2261#endif
2262
2263/**
2264 * This is so we can account for tasks with stacks greater than minimum
2265 * size.  This is in bytes.
2266 */
2267#ifndef CONFIGURE_EXTRA_TASK_STACKS
2268  #define CONFIGURE_EXTRA_TASK_STACKS 0
2269#endif
2270
2271/**
2272 * This macro provides a summation of the various POSIX thread requirements.
2273 */
2274#define CONFIGURE_POSIX_THREADS \
2275   (CONFIGURE_MAXIMUM_POSIX_THREADS + \
2276     CONFIGURE_MAXIMUM_ADA_TASKS + \
2277     CONFIGURE_MAXIMUM_GOROUTINES)
2278
2279#ifdef RTEMS_POSIX_API
2280  /**
2281   * This macro provides summation of the POSIX Mutexes.
2282   */
2283  #define CONFIGURE_POSIX_MUTEXES \
2284    (CONFIGURE_MAXIMUM_POSIX_MUTEXES + \
2285      CONFIGURE_LIBBLOCK_POSIX_MUTEXES + \
2286      CONFIGURE_GNAT_MUTEXES + \
2287      CONFIGURE_MAXIMUM_ADA_TASKS + \
2288      CONFIGURE_MAXIMUM_FAKE_ADA_TASKS + \
2289      CONFIGURE_GO_INIT_MUTEXES + \
2290      CONFIGURE_MAXIMUM_GO_CHANNELS)
2291
2292  /**
2293   * This macro provides summation of the POSIX Condition Variables.
2294   */
2295  #define CONFIGURE_POSIX_CONDITION_VARIABLES \
2296    (CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES + \
2297      CONFIGURE_LIBBLOCK_POSIX_CONDITION_VARIABLES + \
2298      CONFIGURE_MAXIMUM_ADA_TASKS + \
2299      CONFIGURE_MAXIMUM_FAKE_ADA_TASKS + \
2300      CONFIGURE_GO_INIT_CONDITION_VARIABLES + \
2301      CONFIGURE_MAXIMUM_GO_CHANNELS)
2302
2303  #define CONFIGURE_MEMORY_FOR_POSIX \
2304    (CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(CONFIGURE_POSIX_MUTEXES) + \
2305      CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES( \
2306        CONFIGURE_POSIX_CONDITION_VARIABLES) + \
2307      CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
2308        CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) + \
2309      CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
2310        CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
2311      CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS( \
2312        CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS) + \
2313      CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
2314        CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \
2315      CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(CONFIGURE_MAXIMUM_POSIX_BARRIERS) + \
2316      CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( \
2317        CONFIGURE_MAXIMUM_POSIX_SPINLOCKS) + \
2318      CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( \
2319        CONFIGURE_MAXIMUM_POSIX_RWLOCKS) + \
2320      CONFIGURE_MEMORY_FOR_POSIX_TIMERS(CONFIGURE_MAXIMUM_POSIX_TIMERS))
2321#else
2322  #define CONFIGURE_MEMORY_FOR_POSIX 0
2323#endif
2324
2325/*
2326 *  Calculate the RAM size based on the maximum number of objects configured.
2327 */
2328
2329#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
2330
2331/**
2332 * Account for allocating the following per object
2333 *   + array of object control structures
2334 *   + local pointer table -- pointer per object plus a zero'th
2335 *     entry in the local pointer table.
2336 */
2337
2338#define CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \
2339  ( \
2340    _Configure_Object_RAM(_tasks, sizeof(Configuration_Thread_control)) \
2341      + _Configure_Max_Objects(_number_FP_tasks) \
2342        * _Configure_From_workspace(CONTEXT_FP_SIZE) \
2343        * (CONTEXT_FP_SIZE != 0) \
2344  )
2345
2346/**
2347 * This defines the amount of memory configured for the multiprocessing
2348 * support required by this application.
2349 */
2350#ifdef CONFIGURE_MP_APPLICATION
2351  #define CONFIGURE_MEMORY_FOR_MP \
2352    (CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
2353     CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS( \
2354             CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) + \
2355     CONFIGURE_MEMORY_FOR_TASKS(1, 1) \
2356  )
2357#else
2358  #define CONFIGURE_MEMORY_FOR_MP  0
2359#endif
2360
2361/**
2362 * The following macro is used to calculate the memory allocated by RTEMS
2363 * for the message buffers associated with a particular message queue.
2364 * There is a fixed amount of overhead per message.
2365 */
2366#define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
2367    _Configure_From_workspace( \
2368      (_messages) * ((_size) + sizeof(CORE_message_queue_Buffer_control)))
2369
2370/**
2371 * This macros is set to the amount of memory required for pending message
2372 * buffers in bytes.  It should be constructed by adding together a
2373 * set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
2374 */
2375#ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
2376  #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
2377#endif
2378
2379/**
2380 * This macro is available just in case the confdefs.h file underallocates
2381 * memory for a particular application.  This lets the user add some extra
2382 * memory in case something broken and underestimates.
2383 *
2384 * It is also possible for cases where confdefs.h overallocates memory,
2385 * you could substract memory from the allocated.  The estimate is just
2386 * that, an estimate, and assumes worst case alignment and padding on
2387 * each allocated element.  So in some cases it could be too conservative.
2388 *
2389 * NOTE: Historically this was used for message buffers.
2390 */
2391#ifndef CONFIGURE_MEMORY_OVERHEAD
2392  #define CONFIGURE_MEMORY_OVERHEAD 0
2393#endif
2394
2395/**
2396 * RTEMS uses two instance of an internal mutex class.  This accounts
2397 * for these mutexes.
2398 */
2399#define CONFIGURE_API_MUTEX_MEMORY \
2400  _Configure_Object_RAM(2, sizeof(API_Mutex_Control))
2401
2402/**
2403 * This calculates the amount of memory reserved for the IDLE tasks.
2404 * In an SMP system, each CPU core has its own idle task.
2405 */
2406#if defined(RTEMS_SMP)
2407  #define CONFIGURE_IDLE_TASKS_COUNT CONFIGURE_SMP_MAXIMUM_PROCESSORS
2408#else
2409  #define CONFIGURE_IDLE_TASKS_COUNT 1
2410#endif
2411
2412/**
2413 * This defines the formula used to compute the amount of memory
2414 * reserved for IDLE task control structures.
2415 */
2416#if CPU_IDLE_TASK_IS_FP == TRUE
2417  #define CONFIGURE_MEMORY_FOR_IDLE_TASK \
2418    CONFIGURE_MEMORY_FOR_TASKS( \
2419      CONFIGURE_IDLE_TASKS_COUNT, CONFIGURE_IDLE_TASKS_COUNT)
2420#else
2421  #define CONFIGURE_MEMORY_FOR_IDLE_TASK \
2422    CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_IDLE_TASKS_COUNT, 0)
2423#endif
2424
2425/**
2426 * This macro accounts for general RTEMS system overhead.
2427 */
2428#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
2429  ( CONFIGURE_MEMORY_FOR_IDLE_TASK +                /* IDLE and stack */ \
2430    CONFIGURE_INTERRUPT_STACK_MEMORY +             /* interrupt stack */ \
2431    CONFIGURE_API_MUTEX_MEMORY                     /* allocation mutex */ \
2432  )
2433
2434/**
2435 * This macro reserves the memory required by the statically configured
2436 * user extensions.
2437 */
2438#define CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \
2439  (CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS == 0 ? 0 : \
2440    _Configure_From_workspace( \
2441      CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
2442        * sizeof(User_extensions_Switch_control) \
2443    ))
2444
2445/**
2446 * This macro provides a summation of the memory required by the
2447 * Classic API as configured.
2448 */
2449#define CONFIGURE_MEMORY_FOR_CLASSIC \
2450  (CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES + \
2451    CONFIGURE_GOROUTINES_TASK_VARIABLES) + \
2452   CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \
2453    CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \
2454   CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES) + \
2455   CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
2456   CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
2457   CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \
2458   CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
2459   CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
2460   CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_BARRIERS) + \
2461   CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \
2462  )
2463
2464#if defined(RTEMS_SMP)
2465  #define CONFIGURE_MEMORY_FOR_SMP \
2466     (CONFIGURE_SMP_MAXIMUM_PROCESSORS * \
2467      _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE ) \
2468     )
2469#else
2470  #define CONFIGURE_MEMORY_FOR_SMP 0
2471#endif
2472
2473/**
2474 * This calculates the memory required for the executive workspace.
2475 */
2476#define CONFIGURE_EXECUTIVE_RAM_SIZE \
2477(( \
2478   CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD + \
2479   CONFIGURE_MEMORY_FOR_TASKS( \
2480     CONFIGURE_TASKS, CONFIGURE_TASKS) + \
2481   CONFIGURE_MEMORY_FOR_TASKS( \
2482     CONFIGURE_POSIX_THREADS, CONFIGURE_POSIX_THREADS) + \
2483   CONFIGURE_MEMORY_FOR_CLASSIC + \
2484   CONFIGURE_MEMORY_FOR_POSIX_KEYS( \
2485      CONFIGURE_POSIX_KEYS, \
2486      CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \
2487   CONFIGURE_MEMORY_FOR_POSIX + \
2488   CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
2489   CONFIGURE_MEMORY_FOR_MP + \
2490   CONFIGURE_MEMORY_FOR_SMP + \
2491   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
2492   (CONFIGURE_MEMORY_OVERHEAD * 1024) \
2493) & ~0x7)
2494
2495/*
2496 *  Now account for any extra memory that initialization tasks or threads
2497 *  may have requested.
2498 */
2499
2500/**
2501 * This accounts for any extra memory required by the Classic API
2502 * Initialization Task.
2503 */
2504#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2505  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
2506      (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2507#else
2508  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
2509#endif
2510
2511/**
2512 * This accounts for any extra memory required by the POSIX API
2513 * Initialization Thread.
2514 */
2515#if defined(RTEMS_POSIX_API) && \
2516    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \
2517      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2518  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
2519    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - \
2520      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2521#else
2522  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
2523#endif
2524
2525/**
2526 * This macro provides a summation of the various initialization task
2527 * and thread stack requirements.
2528 */
2529#define CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS \
2530    (CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
2531    CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART)
2532
2533#define CONFIGURE_IDLE_TASKS_STACK \
2534  (CONFIGURE_IDLE_TASKS_COUNT * \
2535    _Configure_From_stackspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) )
2536
2537#define CONFIGURE_TASKS_STACK \
2538  (_Configure_Max_Objects( CONFIGURE_TASKS ) * \
2539    _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
2540
2541#define CONFIGURE_POSIX_THREADS_STACK \
2542  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \
2543    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2544
2545#define CONFIGURE_GOROUTINES_STACK \
2546  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_GOROUTINES ) * \
2547    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2548
2549#define CONFIGURE_ADA_TASKS_STACK \
2550  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_ADA_TASKS ) * \
2551    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2552
2553#else /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2554
2555#define CONFIGURE_IDLE_TASKS_STACK 0
2556#define CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS 0
2557#define CONFIGURE_TASKS_STACK 0
2558#define CONFIGURE_POSIX_THREADS_STACK 0
2559#define CONFIGURE_GOROUTINES_STACK 0
2560#define CONFIGURE_ADA_TASKS_STACK 0
2561
2562#if CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK != 0
2563  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK"
2564#endif
2565
2566#if CONFIGURE_EXTRA_TASK_STACKS != 0
2567  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_TASK_STACKS"
2568#endif
2569
2570#endif /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2571
2572#define CONFIGURE_STACK_SPACE_SIZE \
2573  ( \
2574    CONFIGURE_IDLE_TASKS_STACK + \
2575    CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \
2576    CONFIGURE_TASKS_STACK + \
2577    CONFIGURE_POSIX_THREADS_STACK + \
2578    CONFIGURE_GOROUTINES_STACK + \
2579    CONFIGURE_ADA_TASKS_STACK + \
2580    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK + \
2581    CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS + \
2582    CONFIGURE_EXTRA_TASK_STACKS \
2583  )
2584
2585#ifdef CONFIGURE_INIT
2586  typedef struct {
2587    Thread_Control Control;
2588    #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
2589      void *extensions[ CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1 ];
2590    #endif
2591    union {
2592      Scheduler_Node Base;
2593      #ifdef CONFIGURE_SCHEDULER_CBS
2594        Scheduler_CBS_Node CBS;
2595      #endif
2596      #ifdef CONFIGURE_SCHEDULER_EDF
2597        Scheduler_EDF_Node EDF;
2598      #endif
2599      #ifdef CONFIGURE_SCHEDULER_PRIORITY
2600        Scheduler_priority_Node Priority;
2601      #endif
2602      #ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
2603        Scheduler_SMP_Node Simple_SMP;
2604      #endif
2605      #ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
2606        Scheduler_priority_SMP_Node Priority_SMP;
2607      #endif
2608      #ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
2609        Scheduler_priority_affinity_SMP_Node Priority_affinity_SMP;
2610      #endif
2611      #ifdef CONFIGURE_SCHEDULER_USER_PER_THREAD
2612        CONFIGURE_SCHEDULER_USER_PER_THREAD User;
2613      #endif
2614    } Scheduler;
2615    RTEMS_API_Control API_RTEMS;
2616    #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
2617      uint32_t Notepads[ RTEMS_NUMBER_NOTEPADS ];
2618    #endif
2619    #ifdef RTEMS_POSIX_API
2620      POSIX_API_Control API_POSIX;
2621    #endif
2622    #if !defined(RTEMS_SCHEDSIM) \
2623      && defined(RTEMS_NEWLIB) \
2624      && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
2625      struct _reent Newlib;
2626    #else
2627      struct { /* Empty */ } Newlib;
2628    #endif
2629  } Configuration_Thread_control;
2630
2631  const size_t _Thread_Control_size = sizeof( Configuration_Thread_control );
2632
2633  const Thread_Control_add_on _Thread_Control_add_ons[] = {
2634    {
2635      offsetof( Configuration_Thread_control, Control.Scheduler.node ),
2636      offsetof( Configuration_Thread_control, Scheduler )
2637    }, {
2638      offsetof(
2639        Configuration_Thread_control,
2640        Control.API_Extensions[ THREAD_API_RTEMS ]
2641      ),
2642      offsetof( Configuration_Thread_control, API_RTEMS )
2643    }, {
2644      offsetof(
2645        Configuration_Thread_control,
2646        Control.libc_reent
2647      ),
2648      offsetof( Configuration_Thread_control, Newlib )
2649    }
2650    #ifdef RTEMS_POSIX_API
2651      , {
2652        offsetof(
2653          Configuration_Thread_control,
2654          Control.API_Extensions[ THREAD_API_POSIX ]
2655        ),
2656        offsetof( Configuration_Thread_control, API_POSIX )
2657      }
2658    #endif
2659  };
2660
2661  const size_t _Thread_Control_add_on_count =
2662    RTEMS_ARRAY_SIZE( _Thread_Control_add_ons );
2663
2664  /**
2665   * This is the Classic API Configuration Table.
2666   */
2667  rtems_api_configuration_table Configuration_RTEMS_API = {
2668    CONFIGURE_TASKS,
2669    CONFIGURE_NOTEPADS_ENABLED,
2670    CONFIGURE_MAXIMUM_TIMERS + CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER,
2671    CONFIGURE_SEMAPHORES,
2672    CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
2673    CONFIGURE_MAXIMUM_PARTITIONS,
2674    CONFIGURE_MAXIMUM_REGIONS,
2675    CONFIGURE_MAXIMUM_PORTS,
2676    CONFIGURE_MAXIMUM_PERIODS,
2677    CONFIGURE_BARRIERS,
2678    CONFIGURE_INIT_TASK_TABLE_SIZE,
2679    CONFIGURE_INIT_TASK_TABLE
2680  };
2681
2682  #ifdef RTEMS_POSIX_API
2683    /**
2684     * This is the POSIX API Configuration Table.
2685     */
2686    posix_api_configuration_table Configuration_POSIX_API = {
2687      CONFIGURE_POSIX_THREADS,
2688      CONFIGURE_POSIX_MUTEXES,
2689      CONFIGURE_POSIX_CONDITION_VARIABLES,
2690      CONFIGURE_MAXIMUM_POSIX_TIMERS,
2691      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
2692      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
2693      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS,
2694      CONFIGURE_MAXIMUM_POSIX_SEMAPHORES,
2695      CONFIGURE_MAXIMUM_POSIX_BARRIERS,
2696      CONFIGURE_MAXIMUM_POSIX_RWLOCKS,
2697      CONFIGURE_MAXIMUM_POSIX_SPINLOCKS,
2698      CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
2699      CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
2700    };
2701  #endif
2702
2703  /**
2704   * This variable specifies the minimum stack size for tasks in an RTEMS
2705   * application.
2706   *
2707   * NOTE: This is left as a simple uint32_t so it can be externed as
2708   *       needed without requring being high enough logical to
2709   *       include the full configuration table.
2710   */
2711  uint32_t rtems_minimum_stack_size =
2712    CONFIGURE_MINIMUM_TASK_STACK_SIZE;
2713
2714  /**
2715   * This variable specifies the maximum priority value that
2716   * a task may have.  This must be a power of 2 between 4
2717   * and 256 and is specified in terms of Classic API
2718   * priority values.
2719   *
2720   * NOTE: This is left as a simple uint8_t so it can be externed as
2721   *       needed without requring being high enough logical to
2722   *       include the full configuration table.
2723   */
2724  uint8_t rtems_maximum_priority = CONFIGURE_MAXIMUM_PRIORITY;
2725
2726  /**
2727   * This is the primary Configuration Table for this application.
2728   */
2729  const rtems_configuration_table Configuration = {
2730    CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
2731    CONFIGURE_STACK_SPACE_SIZE,               /* required stack space */
2732    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
2733    CONFIGURE_POSIX_KEYS,                     /* POSIX keys are always */
2734    CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS,  /*   enabled */
2735    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
2736    1000 * CONFIGURE_MICROSECONDS_PER_TICK,   /* nanoseconds per clock tick */
2737    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
2738    CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
2739    CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
2740    CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
2741    CONFIGURE_TASK_STACK_ALLOCATOR_INIT,      /* stack allocator init */
2742    CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
2743    CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
2744    CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */
2745    #ifdef CONFIGURE_UNIFIED_WORK_AREAS       /* true for unified work areas */
2746      true,
2747    #else
2748      false,
2749    #endif
2750    #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE /* true to avoid
2751                                                 work space for thread stack
2752                                                 allocation */
2753      true,
2754    #else
2755      false,
2756    #endif
2757    #ifdef RTEMS_SMP
2758      #ifdef CONFIGURE_SMP_APPLICATION
2759        true,
2760      #else
2761        false,
2762      #endif
2763    #endif
2764    CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
2765    CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
2766    #if defined(RTEMS_MULTIPROCESSING)
2767      CONFIGURE_MULTIPROCESSING_TABLE,        /* pointer to MP config table */
2768    #endif
2769    #ifdef RTEMS_SMP
2770      CONFIGURE_SMP_MAXIMUM_PROCESSORS,
2771    #endif
2772  };
2773#endif
2774
2775#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
2776
2777#if defined(RTEMS_SMP)
2778 /*
2779  * Instantiate the Per CPU information based upon the user configuration.
2780  */
2781 #if defined(CONFIGURE_INIT)
2782   Per_CPU_Control_envelope _Per_CPU_Information[CONFIGURE_SMP_MAXIMUM_PROCESSORS];
2783 #endif
2784
2785#endif
2786
2787/*
2788 *  If the user has configured a set of Classic API Initialization Tasks,
2789 *  then we need to install the code that runs that loop.
2790 */
2791#ifdef CONFIGURE_INIT
2792  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
2793      defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
2794    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) =
2795              _RTEMS_tasks_Initialize_user_tasks_body;
2796  #else
2797    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) = NULL;
2798  #endif
2799#endif
2800
2801/*
2802 *  If the user has configured a set of POSIX Initialization Threads,
2803 *  then we need to install the code that runs that loop.
2804 */
2805#ifdef RTEMS_POSIX_API
2806  #ifdef CONFIGURE_INIT
2807    #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
2808        defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
2809      void (*_POSIX_Threads_Initialize_user_threads_p)(void) =
2810                _POSIX_Threads_Initialize_user_threads_body;
2811    #else
2812      void (*_POSIX_Threads_Initialize_user_threads_p)(void) = NULL;
2813    #endif
2814  #endif
2815#endif
2816
2817#ifdef __cplusplus
2818}
2819#endif
2820
2821/******************************************************************
2822 ******************************************************************
2823 ******************************************************************
2824 *         CONFIGURATION WARNINGS AND ERROR CHECKING              *
2825 ******************************************************************
2826 ******************************************************************
2827 ******************************************************************
2828 */
2829
2830#if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
2831  /**
2832   * This is a debug mechanism, so if you need to, the executable will
2833   * have a structure with various partial values.  Add to this as you
2834   * need to.  Viewing this structure in gdb combined with dumping
2835   * the Configuration structures generated should help a lot in tracing
2836   * down errors and analyzing where over and under allocations are.
2837   */
2838  typedef struct {
2839    uint32_t SYSTEM_OVERHEAD;
2840    uint32_t STATIC_EXTENSIONS;
2841    uint32_t INITIALIZATION_THREADS_STACKS;
2842
2843    uint32_t PER_INTEGER_TASK;
2844    uint32_t FP_OVERHEAD;
2845    uint32_t CLASSIC;
2846    uint32_t POSIX;
2847
2848    /* System overhead pieces */
2849    uint32_t INTERRUPT_STACK_MEMORY;
2850    uint32_t MEMORY_FOR_IDLE_TASK;
2851
2852    /* Classic API Pieces */
2853    uint32_t CLASSIC_TASKS;
2854    uint32_t TASK_VARIABLES;
2855    uint32_t TIMERS;
2856    uint32_t SEMAPHORES;
2857    uint32_t MESSAGE_QUEUES;
2858    uint32_t PARTITIONS;
2859    uint32_t REGIONS;
2860    uint32_t PORTS;
2861    uint32_t PERIODS;
2862    uint32_t BARRIERS;
2863    uint32_t USER_EXTENSIONS;
2864
2865    /* POSIX API managers that are always enabled */
2866    uint32_t POSIX_KEYS;
2867
2868#ifdef RTEMS_POSIX_API
2869    /* POSIX API Pieces */
2870    uint32_t POSIX_MUTEXES;
2871    uint32_t POSIX_CONDITION_VARIABLES;
2872    uint32_t POSIX_TIMERS;
2873    uint32_t POSIX_QUEUED_SIGNALS;
2874    uint32_t POSIX_MESSAGE_QUEUES;
2875    uint32_t POSIX_SEMAPHORES;
2876    uint32_t POSIX_BARRIERS;
2877    uint32_t POSIX_SPINLOCKS;
2878    uint32_t POSIX_RWLOCKS;
2879#endif
2880
2881    /* Stack space sizes */
2882    uint32_t IDLE_TASKS_STACK;
2883    uint32_t INITIALIZATION_THREADS_EXTRA_STACKS;
2884    uint32_t TASKS_STACK;
2885    uint32_t POSIX_THREADS_STACK;
2886    uint32_t GOROUTINES_STACK;
2887    uint32_t ADA_TASKS_STACK;
2888    uint32_t EXTRA_MPCI_RECEIVE_SERVER_STACK;
2889    uint32_t EXTRA_TASK_STACKS;
2890  } Configuration_Debug_t;
2891
2892  Configuration_Debug_t Configuration_Memory_Debug = {
2893    /* General Information */
2894    CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD,
2895    CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS,
2896    CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
2897    CONFIGURE_MEMORY_FOR_TASKS(1, 0),
2898    CONFIGURE_MEMORY_FOR_TASKS(0, 1),
2899    CONFIGURE_MEMORY_FOR_CLASSIC,
2900    CONFIGURE_MEMORY_FOR_POSIX,
2901
2902    /* System overhead pieces */
2903    CONFIGURE_INTERRUPT_STACK_MEMORY,
2904    CONFIGURE_MEMORY_FOR_IDLE_TASK,
2905
2906    /* Classic API Pieces */
2907    CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
2908    CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES +
2909      CONFIGURE_GOROUTINES_TASK_VARIABLES),
2910    CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
2911    CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES),
2912    CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES),
2913    CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS),
2914    CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ),
2915    CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS),
2916    CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS),
2917    CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_BARRIERS),
2918    CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
2919    CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_POSIX_KEYS, \
2920                                     CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ),
2921
2922#ifdef RTEMS_POSIX_API
2923    /* POSIX API Pieces */
2924    CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_POSIX_MUTEXES ),
2925    CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(
2926      CONFIGURE_POSIX_CONDITION_VARIABLES ),
2927    CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
2928      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
2929    CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
2930      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
2931    CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
2932    CONFIGURE_MEMORY_FOR_POSIX_BARRIERS( CONFIGURE_MAXIMUM_POSIX_BARRIERS ),
2933    CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ),
2934    CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( CONFIGURE_MAXIMUM_POSIX_RWLOCKS ),
2935    CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
2936#endif
2937
2938    /* Stack space sizes */
2939    CONFIGURE_IDLE_TASKS_STACK,
2940    CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
2941    CONFIGURE_TASKS_STACK,
2942    CONFIGURE_POSIX_THREADS_STACK,
2943    CONFIGURE_GOROUTINES_STACK,
2944    CONFIGURE_ADA_TASKS_STACK,
2945    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK,
2946    CONFIGURE_EXTRA_TASK_STACKS
2947  };
2948#endif
2949
2950/*
2951 *  Make sure a task/thread of some sort is configured.
2952 *
2953 *  When analyzing RTEMS to find the smallest possible of memory
2954 *  that must be allocated, you probably do want to configure 0
2955 *  tasks/threads so there is a smaller set of calls to _Workspace_Allocate
2956 *  to analyze.
2957 */
2958#if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
2959  #if (CONFIGURE_MAXIMUM_TASKS == 0) && \
2960      (CONFIGURE_MAXIMUM_POSIX_THREADS == 0) && \
2961      (CONFIGURE_MAXIMUM_ADA_TASKS == 0) && \
2962      (CONFIGURE_MAXIMUM_GOROUTINES == 0)
2963    #error "CONFIGURATION ERROR: No tasks or threads configured!!"
2964  #endif
2965#endif
2966
2967#ifndef RTEMS_SCHEDSIM
2968/*
2969 *  Make sure at least one of the initialization task/thread
2970 *  tables was defined.
2971 */
2972#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
2973    !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \
2974    !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
2975#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
2976#endif
2977#endif
2978
2979/*
2980 *  If the user is trying to configure a multiprocessing application and
2981 *  RTEMS was not configured and built multiprocessing, then error out.
2982 */
2983#if defined(CONFIGURE_MP_APPLICATION) && \
2984    !defined(RTEMS_MULTIPROCESSING)
2985#error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!"
2986#endif
2987
2988/*
2989 *  If an attempt was made to configure POSIX objects and
2990 *  the POSIX API was not configured into RTEMS, error out.
2991 *
2992 *  @note POSIX Keys are always available so the parameters
2993 *        CONFIGURE_MAXIMUM_POSIX_KEYS and
2994 *        CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS  are not in this list.
2995 */
2996#if !defined(RTEMS_POSIX_API)
2997  #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
2998       (CONFIGURE_MAXIMUM_POSIX_MUTEXES != 0) || \
2999       (CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES != 0) || \
3000       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
3001       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
3002       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
3003       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS != 0) || \
3004       (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \
3005       (CONFIGURE_MAXIMUM_POSIX_BARRIERS != 0) || \
3006       (CONFIGURE_MAXIMUM_POSIX_SPINLOCKS != 0) || \
3007       (CONFIGURE_MAXIMUM_POSIX_RWLOCKS != 0) || \
3008      defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
3009  #error "CONFIGURATION ERROR: POSIX API support not configured!!"
3010  #endif
3011#endif
3012
3013#if !defined(RTEMS_SCHEDSIM)
3014  #if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE)
3015    /*
3016     *  You must either explicity include or exclude the clock driver.
3017     *  It is such a common newbie error to leave it out.  Maybe this
3018     *  will put an end to it.
3019     *
3020     *  NOTE: If you are using the timer driver, it is considered
3021     *        mutually exclusive with the clock driver because the
3022     *        drivers are assumed to use the same "timer" hardware
3023     *        on many boards.
3024     */
3025    #if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
3026        !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \
3027        !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER)
3028      #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?"
3029     #endif
3030
3031    /*
3032     * Only one of the following three configuration parameters should be
3033     * defined at a time.
3034     */
3035    #if ((defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) + \
3036          defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER) + \
3037          defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER)) > 1)
3038       #error "CONFIGURATION ERROR: More than one clock/timer driver configuration parameter specified?!?"
3039    #endif
3040  #endif /* !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE) */
3041#endif   /* !defined(RTEMS_SCHEDSIM) */
3042
3043/*
3044 *  These names have been obsoleted so make the user application stop compiling
3045 */
3046#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
3047    defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
3048    defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
3049    defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
3050    defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
3051#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
3052#endif
3053
3054/*
3055 *  Validate the configured maximum priority
3056 */
3057#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \
3058     (CONFIGURE_MAXIMUM_PRIORITY != 7) && \
3059     (CONFIGURE_MAXIMUM_PRIORITY != 15) && \
3060     (CONFIGURE_MAXIMUM_PRIORITY != 31) && \
3061     (CONFIGURE_MAXIMUM_PRIORITY != 63) && \
3062     (CONFIGURE_MAXIMUM_PRIORITY != 127) && \
3063     (CONFIGURE_MAXIMUM_PRIORITY != 255))
3064  #error "Maximum priority is not 1 less than a power of 2 between 4 and 256"
3065#endif
3066
3067#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM)
3068  #error "Maximum priority configured higher than supported by target."
3069#endif
3070
3071/*
3072 *  If you have fewer POSIX Message Queue Descriptors than actual
3073 *  POSIX Message Queues, then you will not be able to open all the
3074 *  queues.
3075 */
3076#if (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS < \
3077     CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
3078  #error "Fewer POSIX Message Queue descriptors than Queues!"
3079#endif
3080
3081/*
3082 * POSIX Key pair shouldn't be less than POSIX Key, which is highly
3083 * likely to be error.
3084 */
3085#if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \
3086    (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0)
3087  #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < CONFIGURE_MAXIMUM_POSIX_KEYS)
3088    #error "Fewer POSIX Key pairs than POSIX Key!"
3089  #endif
3090#endif
3091
3092#endif
3093/* end of include file */
Note: See TracBrowser for help on using the repository browser.