source: rtems/cpukit/sapi/include/confdefs.h @ 3c96bee

4.11
Last change on this file since 3c96bee was 3c96bee, checked in by Sebastian Huber <sebastian.huber@…>, on Sep 12, 2013 at 1:32:07 PM

JFFS2: Add RTEMS support

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