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

4.115
Last change on this file since a290fbe9 was a290fbe9, checked in by Sebastian Huber <sebastian.huber@…>, on 04/24/13 at 12:30:42

libcsupport: Make LibIO helper const

Add and use rtems_libio_helper function type. Add and use
rtems_libio_helper_null() instead of NULL pointer.

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