source: rtems/cpukit/sapi/include/confdefs.h @ 9ab091e

4.11
Last change on this file since 9ab091e was 9ab091e, checked in by Mathew Kallada <matkallada@…>, on Dec 28, 2012 at 4:35:32 PM

Header File Doxygen Enhancement Task #2

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