source: rtems/cpukit/sapi/include/confdefs.h @ 12eee4fd

4.115
Last change on this file since 12eee4fd was 12eee4fd, checked in by Sebastian Huber <sebastian.huber@…>, on 02/13/15 at 19:53:41

IMFS: CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM

Resurrect CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM.

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