source: rtems/cpukit/sapi/include/confdefs.h @ 2d84c4e

4.115
Last change on this file since 2d84c4e was 249766c5, checked in by Sebastian Huber <sebastian.huber@…>, on 02/13/15 at 20:26:17

IMFS: Rename CONFIGURE_IMFS_DISABLE_FCHMOD

Rename CONFIGURE_IMFS_DISABLE_FCHMOD to CONFIGURE_IMFS_DISABLE_CHMOD.

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