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

4.115
Last change on this file since e6c87f7 was e6c87f7, checked in by Joel Sherrill <joel.sherrill@…>, on 03/04/14 at 21:54:12

POSIX keys now enabled in all configurations.

Formerly POSIX keys were only enabled when POSIX threads
were enabled. Because they are a truly safe alternative
to per-task variables in an SMP system, they are being
enabled in all configurations.

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