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

4.115
Last change on this file since 9c9b62d8 was 9c9b62d8, checked in by Sebastian Huber <sebastian.huber@…>, on 07/17/13 at 09:44:55

score: Changes due to Newlib DYNAMIC_REENT

Delete _Thread_libc_reent and add getreent() instead according to
DYNAMIC_REENT define.

For SMP configurations DYNAMIC_REENT must be defined.

A Newlib including the following patch is required:

2013-07-09 Sebastian Huber <sebastian.huber@…>

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