source: rtems/cpukit/sapi/include/confdefs.h @ 5c0c0cf

4.115
Last change on this file since 5c0c0cf was 5c0c0cf, checked in by Christian Mauderer <Christian.Mauderer@…>, on 03/27/14 at 13:23:21

privateenv: Use POSIX keys instead of task variables.

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