source: rtems/cpukit/sapi/include/confdefs.h @ 8fbe2e6

4.11
Last change on this file since 8fbe2e6 was 8fbe2e6, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2014 at 1:59:49 PM

Use correct prototype of benchmark_timer_read()

This change starts with removing the effectively empty file
timerdrv.h. The prototypes for benchmark_timer_XXX() were in
btimer.h which was not universally used. Thus every use of
timerdrv.h had to be changed to btimer.h. Then the prototypes
for benchmark_timer_read() had to be adjusted to return
benchmark_timer_t rather than int or uint32_t.

I took this opportunity to also correct the file headers to
separate the copyright from the file description comments which
is needed to ensure the copyright isn't propagated into Doxygen
output.

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