source: rtems/cpukit/sapi/include/confdefs.h @ 47a3cd8

4.115
Last change on this file since 47a3cd8 was 47a3cd8, checked in by Sebastian Huber <sebastian.huber@…>, on 08/09/12 at 14:48:00

score: Work area initialization API change

The work areas (RTEMS work space and C program heap) will be initialized
now in a separate step and are no longer part of
rtems_initialize_data_structures(). Initialization is performed with
tables of Heap_Area entries. This allows usage of scattered memory
areas present on various small scale micro-controllers.

The sbrk() support API changes also. The bsp_sbrk_init() must now deal
with a minimum size for the first memory chunk to take the configured
work space size into account.

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