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

4.11
Last change on this file since f9340ed7 was f9340ed7, checked in by Sebastian Huber <sebastian.huber@…>, on Dec 3, 2012 at 10:35:43 AM

posix: Add and use <rtems/posix/psignalimpl.h>

This file contains the parts of <rtems/posix/psignal.h> that are only
necessary for the POSIX API implementation.

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