source: rtems/cpukit/sapi/include/confdefs.h @ 6d24e8b

4.115
Last change on this file since 6d24e8b was 6d24e8b, checked in by Jennifer Averett <jennifer.averett@…>, on 03/18/14 at 18:54:01

sapi: Add priority affinity smp scheduler.

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