source: rtems/cpukit/sapi/include/confdefs.h @ 98b52e3

5
Last change on this file since 98b52e3 was 98b52e3, checked in by Sebastian Huber <sebastian.huber@…>, on 12/04/17 at 07:48:10

drvmgr: Use API mutex

  • Property mode set to 100755
File size: 112.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
13/*
14 *  COPYRIGHT (c) 1989-2015.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.org/license/LICENSE.
20 */
21
22#ifndef __CONFIGURATION_TEMPLATE_h
23#define __CONFIGURATION_TEMPLATE_h
24
25/*
26 * Include the executive's configuration
27 */
28#include <rtems.h>
29#include <rtems/ioimpl.h>
30#include <rtems/sysinit.h>
31#include <rtems/score/apimutex.h>
32#include <rtems/score/percpu.h>
33#include <rtems/score/userextimpl.h>
34#include <rtems/score/wkspace.h>
35
36#ifdef CONFIGURE_DISABLE_BSP_SETTINGS
37  #undef BSP_DEFAULT_UNIFIED_WORK_AREAS
38  #undef BSP_IDLE_TASK_BODY
39  #undef BSP_IDLE_TASK_STACK_SIZE
40  #undef BSP_INITIAL_EXTENSION
41  #undef BSP_INTERRUPT_STACK_SIZE
42  #undef BSP_MAXIMUM_DEVICES
43  #undef BSP_ZERO_WORKSPACE_AUTOMATICALLY
44  #undef CONFIGURE_BSP_PREREQUISITE_DRIVERS
45  #undef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
46#else
47  #include <bsp.h>
48#endif
49
50#ifdef RTEMS_NEWLIB
51  #include <sys/reent.h>
52#endif
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58/*
59 * Internal defines must be prefixed with _CONFIGURE to distinguish them from
60 * user-provided options which use a CONFIGURE prefix.
61 */
62
63/**
64 * @defgroup Configuration RTEMS Configuration
65 *
66 * This module contains all RTEMS Configuration parameters.
67 *
68 * The model is to estimate the memory required for each configured item
69 * and sum those estimates.  The estimate can be too high or too low for
70 * a variety of reasons:
71 *
72 * Reasons estimate is too high:
73 *   + FP contexts (not all tasks are FP)
74 *
75 * Reasons estimate is too low:
76 *   + stacks greater than minimum size
77 *   + messages
78 *   + application must account for device driver resources
79 *   + application must account for add-on library resource requirements
80 *
81 * NOTE:  Eventually this may be able to take into account some of
82 *        the above.  This procedure has evolved from just enough to
83 *        support the RTEMS Test Suites into something that can be
84 *        used remarkably reliably by most applications.
85 */
86
87/**
88 * This is the Classic API initialization tasks table.
89 */
90extern rtems_initialization_tasks_table Initialization_tasks[];
91
92#if defined(RTEMS_MULTIPROCESSING)
93  /**
94   * This it the distributed multiprocessing configuration table.
95   */
96  extern rtems_multiprocessing_table      Multiprocessing_configuration;
97#endif
98
99#ifdef RTEMS_POSIX_API
100  /**
101   * This it the POSIX API configuration table.
102   */
103  extern posix_api_configuration_table    Configuration_POSIX_API;
104#endif
105
106/**
107 * This macro determines whether the RTEMS reentrancy support for
108 * the Newlib C Library is enabled.
109 */
110#ifdef RTEMS_SCHEDSIM
111  #undef RTEMS_NEWLIB
112#endif
113
114#if (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
115  #define _CONFIGURE_NEWLIB_EXTENSION 1
116#else
117  #define _CONFIGURE_NEWLIB_EXTENSION 0
118#endif
119
120#ifndef RTEMS_SCHEDSIM
121#include <rtems/libio_.h>
122
123#ifdef CONFIGURE_INIT
124  #ifndef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
125    RTEMS_SYSINIT_ITEM(
126      rtems_filesystem_initialize,
127      RTEMS_SYSINIT_ROOT_FILESYSTEM,
128      RTEMS_SYSINIT_ORDER_MIDDLE
129    );
130  #endif
131#endif
132#endif
133
134/**
135 * This macro defines the number of POSIX file descriptors allocated
136 * and managed by libio.  These are the "integer" file descriptors that
137 * are used by calls like open(2) and read(2).
138 */
139#ifndef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
140  #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 3
141#endif
142
143/*
144 * Semaphore count used by the IO library.
145 */
146#define _CONFIGURE_LIBIO_SEMAPHORES 1
147
148/*
149 * POSIX key count used by the IO library.
150 */
151#define _CONFIGURE_LIBIO_POSIX_KEYS 1
152
153#ifdef CONFIGURE_INIT
154  rtems_libio_t rtems_libio_iops[CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS];
155
156  /**
157   * When instantiating the configuration tables, this variable is
158   * initialized to specify the maximum number of file descriptors.
159   */
160  const uint32_t rtems_libio_number_iops = RTEMS_ARRAY_SIZE(rtems_libio_iops);
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#ifdef CONFIGURE_SMP_MAXIMUM_PROCESSORS
206  #warning "CONFIGURE_SMP_MAXIMUM_PROCESSORS has been renamed to CONFIGURE_MAXIMUM_PROCESSORS since RTEMS 4.12"
207  #define CONFIGURE_MAXIMUM_PROCESSORS CONFIGURE_SMP_MAXIMUM_PROCESSORS
208#endif
209
210#ifndef CONFIGURE_MAXIMUM_PROCESSORS
211  #define CONFIGURE_MAXIMUM_PROCESSORS 1
212#endif
213
214/*
215 * An internal define to indicate that this is an SMP application
216 * configuration.
217 */
218#ifdef RTEMS_SMP
219  #if !defined(CONFIGURE_DISABLE_SMP_CONFIGURATION)
220    #define _CONFIGURE_SMP_APPLICATION
221  #elif CONFIGURE_MAXIMUM_PROCESSORS > 1
222    #error "CONFIGURE_DISABLE_SMP_CONFIGURATION and CONFIGURE_MAXIMUM_PROCESSORS > 1 makes no sense"
223  #endif
224#endif
225
226#ifdef CONFIGURE_SMP_APPLICATION
227  #warning "CONFIGURE_SMP_APPLICATION is obsolete since RTEMS 4.12"
228#endif
229
230/*
231 * This sets up the resources for the FIFOs/pipes.
232 */
233
234/**
235 * This is specified to configure the maximum number of POSIX FIFOs.
236 */
237#if !defined(CONFIGURE_MAXIMUM_FIFOS)
238  #define CONFIGURE_MAXIMUM_FIFOS 0
239#endif
240
241/**
242 * This is specified to configure the maximum number of POSIX named pipes.
243 */
244#if !defined(CONFIGURE_MAXIMUM_PIPES)
245  #define CONFIGURE_MAXIMUM_PIPES 0
246#endif
247
248/*
249 * This specifies the number of barriers required for the configured
250 * number of FIFOs and named pipes.
251 */
252#if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0
253  #define _CONFIGURE_BARRIERS_FOR_FIFOS \
254    (2 * (CONFIGURE_MAXIMUM_FIFOS + CONFIGURE_MAXIMUM_PIPES))
255#else
256  #define _CONFIGURE_BARRIERS_FOR_FIFOS   0
257#endif
258
259/*
260 * This specifies the number of semaphores required for the configured
261 * number of FIFOs and named pipes.
262 */
263#if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0
264  #define _CONFIGURE_SEMAPHORES_FOR_FIFOS \
265    (1 + (CONFIGURE_MAXIMUM_FIFOS + CONFIGURE_MAXIMUM_PIPES))
266#else
267  #define _CONFIGURE_SEMAPHORES_FOR_FIFOS 0
268#endif
269
270/**
271 *  @defgroup ConfigFilesystems Filesystems and Mount Table Configuration
272 *
273 *  @ingroup Configuration
274 *
275 *  Defines to control the file system:
276 *
277 *   - CONFIGURE_APPLICATION_DISABLE_FILESYSTEM:
278 *     Disable the RTEMS filesystems. You get an empty DEVFS.
279 *
280 *   - CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM:
281 *     Use the DEVFS as the root file system. Limited functions are
282 *     provided when this is used.
283 *
284 *   - CONFIGURE_FILESYSTEM_ALL:
285 *     Add file filesystems to the default filesystem table.
286 *
287 *   List of available file systems. You can define as many as you like:
288 *     - CONFIGURE_FILESYSTEM_IMFS   - In Memory File System (IMFS)
289 *     - CONFIGURE_FILESYSTEM_DEVFS  - Device File System (DSVFS)
290 *     - CONFIGURE_FILESYSTEM_TFTPFS - TFTP File System, networking enabled
291 *     - CONFIGURE_FILESYSTEM_FTPFS  - FTP File System, networking enabled
292 *     - CONFIGURE_FILESYSTEM_NFS    - Network File System, networking enabled
293 *     - CONFIGURE_FILESYSTEM_DOSFS  - DOS File System, uses libblock
294 *     - CONFIGURE_FILESYSTEM_RFS    - RTEMS File System (RFS), uses libblock
295 *     - CONFIGURE_FILESYSTEM_JFFS2  - Journalling Flash File System, Version 2
296 *
297 *   Combinations:
298 *
299 *    - If nothing is defined the base file system is the IMFS.
300 *
301 *    - If CONFIGURE_APPLICATION_DISABLE_FILESYSTEM is defined all filesystems
302 *      are disabled by force.
303 *
304 *    - If CONFIGURE_USE_DEV_AS_BASE_FILESYSTEM is defined all filesystems
305 *      are disabled by force and DEVFS is defined.
306 */
307/**@{*/
308
309#ifdef CONFIGURE_INIT
310
311  /*
312   * Include all file systems. Do this before checking if the filesystem has
313   * been disabled.
314   */
315  #ifdef CONFIGURE_FILESYSTEM_ALL
316    #define CONFIGURE_FILESYSTEM_IMFS
317    #define CONFIGURE_FILESYSTEM_DEVFS
318    #define CONFIGURE_FILESYSTEM_TFTPFS
319    #define CONFIGURE_FILESYSTEM_FTPFS
320    #define CONFIGURE_FILESYSTEM_NFS
321    #define CONFIGURE_FILESYSTEM_DOSFS
322    #define CONFIGURE_FILESYSTEM_RFS
323    #define CONFIGURE_FILESYSTEM_JFFS2
324  #endif
325
326  /*
327   * If disabling the file system, give a compile error if the user has
328   * configured other filesystem parameters.
329   */
330  #if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
331     #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
332       #error "Filesystem disabled and a base filesystem configured."
333     #endif
334
335     #if defined(CONFIGURE_FILESYSTEM_IMFS) || \
336       defined(CONFIGURE_FILESYSTEM_DEVFS) || \
337       defined(CONFIGURE_FILESYSTEM_TFTPFS) || \
338       defined(CONFIGURE_FILESYSTEM_FTPFS) || \
339       defined(CONFIGURE_FILESYSTEM_NFS) || \
340       defined(CONFIGURE_FILESYSTEM_DOSFS) || \
341       defined(CONFIGURE_FILESYSTEM_RFS) || \
342       defined(CONFIGURE_FILESYSTEM_JFFS2)
343       #error "Filesystem disabled and a filesystem configured."
344     #endif
345  #endif
346
347  /*
348   * If the base filesystem is DEVFS define it else define IMFS.
349   * We will have either DEVFS or IMFS defined after this.
350   */
351  #if !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
352    #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
353      #define CONFIGURE_FILESYSTEM_DEVFS
354    #endif
355  #endif
356
357#endif
358
359#ifndef RTEMS_SCHEDSIM
360/**
361 * IMFS
362 */
363#include <rtems/imfs.h>
364
365/**
366 * This specifies the number of bytes per block for files within the IMFS.
367 * There are a maximum number of blocks per file so this dictates the maximum
368 * size of a file.  This has to be balanced with the unused portion of each
369 * block that might be wasted.
370 */
371#ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK
372  #define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK \
373                    IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK
374#endif
375
376/**
377 * This defines the IMFS file system table entry.
378 */
379#if !defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS) && \
380  defined(CONFIGURE_FILESYSTEM_IMFS)
381  #define CONFIGURE_FILESYSTEM_ENTRY_IMFS \
382    { RTEMS_FILESYSTEM_TYPE_IMFS, IMFS_initialize }
383#endif
384#endif
385
386#ifdef CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
387  #define CONFIGURE_IMFS_DISABLE_CHMOD
388  #define CONFIGURE_IMFS_DISABLE_CHOWN
389  #define CONFIGURE_IMFS_DISABLE_UTIME
390  #define CONFIGURE_IMFS_DISABLE_LINK
391  #define CONFIGURE_IMFS_DISABLE_SYMLINK
392  #define CONFIGURE_IMFS_DISABLE_READLINK
393  #define CONFIGURE_IMFS_DISABLE_RENAME
394  #define CONFIGURE_IMFS_DISABLE_UNMOUNT
395#endif
396
397/**
398 * DEVFS
399 */
400#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS) && \
401    defined(CONFIGURE_FILESYSTEM_DEVFS)
402#include <rtems/devfs.h>
403  #define CONFIGURE_FILESYSTEM_ENTRY_DEVFS \
404    { RTEMS_FILESYSTEM_TYPE_DEVFS, devFS_initialize }
405#endif
406
407/**
408 * FTPFS
409 */
410#if !defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS) && \
411    defined(CONFIGURE_FILESYSTEM_FTPFS)
412  #include <rtems/ftpfs.h>
413  #define CONFIGURE_FILESYSTEM_ENTRY_FTPFS \
414    { RTEMS_FILESYSTEM_TYPE_FTPFS, rtems_ftpfs_initialize }
415#endif
416
417/**
418 * TFTPFS
419 */
420#if !defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS) && \
421    defined(CONFIGURE_FILESYSTEM_TFTPFS)
422  #include <rtems/tftp.h>
423  #define CONFIGURE_FILESYSTEM_ENTRY_TFTPFS \
424    { RTEMS_FILESYSTEM_TYPE_TFTPFS, rtems_tftpfs_initialize }
425#endif
426
427/**
428 * NFS
429 */
430#if !defined(CONFIGURE_FILESYSTEM_ENTRY_NFS) && \
431    defined(CONFIGURE_FILESYSTEM_NFS)
432  #include <librtemsNfs.h>
433  #if !defined(CONFIGURE_MAXIMUM_NFS_MOUNTS)
434    #define CONFIGURE_MAXIMUM_NFS_MOUNTS 1
435  #endif
436  #define CONFIGURE_FILESYSTEM_ENTRY_NFS \
437    { RTEMS_FILESYSTEM_TYPE_NFS, rtems_nfs_initialize }
438  #define _CONFIGURE_SEMAPHORES_FOR_NFS ((CONFIGURE_MAXIMUM_NFS_MOUNTS * 2) + 1)
439#else
440  #define _CONFIGURE_SEMAPHORES_FOR_NFS 0
441#endif
442
443/**
444 * DOSFS
445 */
446#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS) && \
447    defined(CONFIGURE_FILESYSTEM_DOSFS)
448  #include <rtems/dosfs.h>
449  #if !defined(CONFIGURE_MAXIMUM_DOSFS_MOUNTS)
450    #define CONFIGURE_MAXIMUM_DOSFS_MOUNTS 1
451  #endif
452  #define CONFIGURE_FILESYSTEM_ENTRY_DOSFS \
453    { RTEMS_FILESYSTEM_TYPE_DOSFS, rtems_dosfs_initialize }
454  #define _CONFIGURE_SEMAPHORES_FOR_DOSFS CONFIGURE_MAXIMUM_DOSFS_MOUNTS
455#else
456  #define _CONFIGURE_SEMAPHORES_FOR_DOSFS 0
457#endif
458
459/**
460 * RFS
461 */
462#if !defined(CONFIGURE_FILESYSTEM_ENTRY_RFS) && \
463    defined(CONFIGURE_FILESYSTEM_RFS)
464  #include <rtems/rtems-rfs.h>
465  #if !defined(CONFIGURE_MAXIMUM_RFS_MOUNTS)
466    #define CONFIGURE_MAXIMUM_RFS_MOUNTS 1
467  #endif
468  #define CONFIGURE_FILESYSTEM_ENTRY_RFS \
469    { RTEMS_FILESYSTEM_TYPE_RFS, rtems_rfs_rtems_initialise }
470  #define _CONFIGURE_SEMAPHORES_FOR_RFS CONFIGURE_MAXIMUM_RFS_MOUNTS
471#else
472  #define _CONFIGURE_SEMAPHORES_FOR_RFS 0
473#endif
474
475/**
476 * JFFS2
477 */
478#if !defined(CONFIGURE_FILESYSTEM_ENTRY_JFFS2) && \
479    defined(CONFIGURE_FILESYSTEM_JFFS2)
480  #include <rtems/jffs2.h>
481  #if !defined(CONFIGURE_MAXIMUM_JFFS2_MOUNTS)
482    #define CONFIGURE_MAXIMUM_JFFS2_MOUNTS 1
483  #endif
484  #define CONFIGURE_FILESYSTEM_ENTRY_JFFS2 \
485    { RTEMS_FILESYSTEM_TYPE_JFFS2, rtems_jffs2_initialize }
486  #define _CONFIGURE_SEMAPHORES_FOR_JFFS2 CONFIGURE_MAXIMUM_JFFS2_MOUNTS
487#else
488  #define _CONFIGURE_SEMAPHORES_FOR_JFFS2 0
489#endif
490
491/**
492 * This computes the number of semaphores required for the various
493 * file systems including the FIFO plugin to the IMFS.
494 */
495#define _CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS \
496    (_CONFIGURE_SEMAPHORES_FOR_FIFOS + \
497     _CONFIGURE_SEMAPHORES_FOR_NFS + \
498     _CONFIGURE_SEMAPHORES_FOR_DOSFS + \
499     _CONFIGURE_SEMAPHORES_FOR_RFS + \
500     _CONFIGURE_SEMAPHORES_FOR_JFFS2)
501
502#ifdef CONFIGURE_INIT
503
504  /**
505   * DEVFS variables.
506   *
507   * The number of individual devices that may be registered
508   * in the system or the CONFIGURE_MAXIMUM_DEVICES variable
509   * is defaulted to 4 when a filesystem is enabled, unless
510   * the bsp overwrides this.  In which case the value is set
511   * to BSP_MAXIMUM_DEVICES.
512   */
513  #ifdef CONFIGURE_FILESYSTEM_DEVFS
514    #ifndef CONFIGURE_MAXIMUM_DEVICES
515      #if defined(BSP_MAXIMUM_DEVICES)
516        #define CONFIGURE_MAXIMUM_DEVICES BSP_MAXIMUM_DEVICES
517      #else
518        #define CONFIGURE_MAXIMUM_DEVICES 4
519      #endif
520    #endif
521    #include <rtems/devfs.h>
522  #endif
523
524  /**
525   * Table termination record.
526   */
527  #define CONFIGURE_FILESYSTEM_NULL { NULL, NULL }
528
529#ifndef RTEMS_SCHEDSIM
530  #if !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) && \
531    !defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
532    int imfs_rq_memfile_bytes_per_block =
533      CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
534  #endif
535
536  /**
537   * The default file system table. Must be terminated with the NULL entry if
538   * you provide your own.
539   */
540  #if !defined(CONFIGURE_HAS_OWN_FILESYSTEM_TABLE) && \
541    !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
542    const rtems_filesystem_table_t rtems_filesystem_table[] = {
543      #if !defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
544        { "/", IMFS_initialize_support },
545      #endif
546      #if defined(CONFIGURE_FILESYSTEM_IMFS) && \
547          defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS)
548        CONFIGURE_FILESYSTEM_ENTRY_IMFS,
549      #endif
550      #if defined(CONFIGURE_FILESYSTEM_DEVFS) && \
551          defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS)
552        CONFIGURE_FILESYSTEM_ENTRY_DEVFS,
553      #endif
554      #if defined(CONFIGURE_FILESYSTEM_TFTPFS) && \
555          defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS)
556        CONFIGURE_FILESYSTEM_ENTRY_TFTPFS,
557      #endif
558      #if defined(CONFIGURE_FILESYSTEM_FTPFS) && \
559          defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS)
560        CONFIGURE_FILESYSTEM_ENTRY_FTPFS,
561      #endif
562      #if defined(CONFIGURE_FILESYSTEM_NFS) && \
563          defined(CONFIGURE_FILESYSTEM_ENTRY_NFS)
564        CONFIGURE_FILESYSTEM_ENTRY_NFS,
565      #endif
566      #if defined(CONFIGURE_FILESYSTEM_DOSFS) && \
567          defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS)
568        CONFIGURE_FILESYSTEM_ENTRY_DOSFS,
569      #endif
570      #if defined(CONFIGURE_FILESYSTEM_RFS) && \
571          defined(CONFIGURE_FILESYSTEM_ENTRY_RFS)
572        CONFIGURE_FILESYSTEM_ENTRY_RFS,
573      #endif
574      #if defined(CONFIGURE_FILESYSTEM_JFFS2) && \
575          defined(CONFIGURE_FILESYSTEM_ENTRY_JFFS2)
576        CONFIGURE_FILESYSTEM_ENTRY_JFFS2,
577      #endif
578      CONFIGURE_FILESYSTEM_NULL
579    };
580  #endif
581
582  #if !defined(CONFIGURE_HAS_OWN_MOUNT_TABLE) && \
583    !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
584    #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
585      static devFS_node devFS_root_filesystem_nodes [CONFIGURE_MAXIMUM_DEVICES];
586      static const devFS_data devFS_root_filesystem_data = {
587        devFS_root_filesystem_nodes,
588        CONFIGURE_MAXIMUM_DEVICES
589      };
590    #else
591      static IMFS_fs_info_t _Configure_IMFS_fs_info;
592
593      static const rtems_filesystem_operations_table _Configure_IMFS_ops = {
594        rtems_filesystem_default_lock,
595        rtems_filesystem_default_unlock,
596        IMFS_eval_path,
597        #ifdef CONFIGURE_IMFS_DISABLE_LINK
598          rtems_filesystem_default_link,
599        #else
600          IMFS_link,
601        #endif
602        rtems_filesystem_default_are_nodes_equal,
603        #ifdef CONFIGURE_IMFS_DISABLE_MKNOD
604          rtems_filesystem_default_mknod,
605        #else
606          IMFS_mknod,
607        #endif
608        #ifdef CONFIGURE_IMFS_DISABLE_RMNOD
609          rtems_filesystem_default_rmnod,
610        #else
611          IMFS_rmnod,
612        #endif
613        #ifdef CONFIGURE_IMFS_DISABLE_CHMOD
614          rtems_filesystem_default_fchmod,
615        #else
616          IMFS_fchmod,
617        #endif
618        #ifdef CONFIGURE_IMFS_DISABLE_CHOWN
619          rtems_filesystem_default_chown,
620        #else
621          IMFS_chown,
622        #endif
623        IMFS_node_clone,
624        IMFS_node_free,
625        #ifdef CONFIGURE_IMFS_DISABLE_MOUNT
626          rtems_filesystem_default_mount,
627        #else
628          IMFS_mount,
629        #endif
630        #ifdef CONFIGURE_IMFS_DISABLE_UNMOUNT
631          rtems_filesystem_default_unmount,
632        #else
633          IMFS_unmount,
634        #endif
635        rtems_filesystem_default_fsunmount,
636        #ifdef CONFIGURE_IMFS_DISABLE_UTIME
637          rtems_filesystem_default_utime,
638        #else
639          IMFS_utime,
640        #endif
641        #ifdef CONFIGURE_IMFS_DISABLE_SYMLINK
642          rtems_filesystem_default_symlink,
643        #else
644          IMFS_symlink,
645        #endif
646        #ifdef CONFIGURE_IMFS_DISABLE_READLINK
647          rtems_filesystem_default_readlink,
648        #else
649          IMFS_readlink,
650        #endif
651        #ifdef CONFIGURE_IMFS_DISABLE_RENAME
652          rtems_filesystem_default_rename,
653        #else
654          IMFS_rename,
655        #endif
656        rtems_filesystem_default_statvfs
657      };
658
659      static const IMFS_mknod_controls _Configure_IMFS_mknod_controls = {
660        #ifdef CONFIGURE_IMFS_DISABLE_READDIR
661          &IMFS_mknod_control_dir_minimal,
662        #else
663          &IMFS_mknod_control_dir_default,
664        #endif
665        &IMFS_mknod_control_device,
666        #ifdef CONFIGURE_IMFS_DISABLE_MKNOD_FILE
667          &IMFS_mknod_control_enosys,
668        #else
669          &IMFS_mknod_control_memfile,
670        #endif
671        #if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0
672          &IMFS_mknod_control_fifo
673        #else
674          &IMFS_mknod_control_enosys
675        #endif
676      };
677
678      static const IMFS_mount_data _Configure_IMFS_mount_data = {
679        &_Configure_IMFS_fs_info,
680        &_Configure_IMFS_ops,
681        &_Configure_IMFS_mknod_controls
682      };
683    #endif
684
685    const rtems_filesystem_mount_configuration
686      rtems_filesystem_root_configuration = {
687      NULL,
688      NULL,
689      #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
690        RTEMS_FILESYSTEM_TYPE_DEVFS,
691      #else
692        "/",
693      #endif
694      RTEMS_FILESYSTEM_READ_WRITE,
695      #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
696        &devFS_root_filesystem_data
697      #else
698        &_Configure_IMFS_mount_data
699      #endif
700    };
701  #endif
702
703#endif
704#endif
705/**@}*/ /* end of file system group */
706
707/*
708 *  STACK_CHECKER_ON was still available in 4.9 so give a warning for now.
709 */
710#if defined(STACK_CHECKER_ON)
711  #define CONFIGURE_STACK_CHECKER_ENABLED
712  #warning "STACK_CHECKER_ON deprecated -- use CONFIGURE_STACK_CHECKER_ENABLED"
713#endif
714
715/**
716 * This configures the stack checker user extension.
717 */
718#ifdef CONFIGURE_STACK_CHECKER_ENABLED
719  #define _CONFIGURE_STACK_CHECKER_EXTENSION 1
720#else
721  #define _CONFIGURE_STACK_CHECKER_EXTENSION 0
722#endif
723
724/**
725 * @brief Maximum priority configuration.
726 *
727 * This configures the maximum priority value that
728 * a task may have.
729 *
730 * The following applies to the data space requirements
731 * of the Priority Scheduler.
732 *
733 * By reducing the number of priorities in a system,
734 * the amount of RAM required by RTEMS can be significantly
735 * reduced.  RTEMS allocates a Chain_Control structure per
736 * priority and this structure contains 3 pointers.  So
737 * the default is (256 * 12) = 3K on 32-bit architectures.
738 *
739 * This must be one less than a power of 2 between
740 * 4 and 256.  Valid values along with the application
741 * priority levels and memory saved when pointers are
742 * 32-bits in size are:
743 *
744 *   + 3,  2 application priorities, 3024 bytes saved
745 *   + 7, 5 application priorities, 2976 bytes saved
746 *   + 15, 13 application priorities, 2880 bytes saved
747 *   + 31, 29 application priorities, 2688 bytes saved
748 *   + 63, 61 application priorities, 2304 bytes saved
749 *   + 127, 125 application priorities, 1536 bytes saved
750 *   + 255, 253 application priorities, 0 bytes saved
751 *
752 * It is specified in terms of Classic API priority values.
753 */
754#ifndef CONFIGURE_MAXIMUM_PRIORITY
755  #define CONFIGURE_MAXIMUM_PRIORITY PRIORITY_DEFAULT_MAXIMUM
756#endif
757
758/**
759 *  @defgroup ConfigScheduler Scheduler configuration
760 *
761 *  @ingroup Configuration
762 *
763 * The scheduler configuration allows an application to select the
764 * scheduling policy to use.  The supported configurations are:
765 *
766 *  - CONFIGURE_SCHEDULER_PRIORITY - Deterministic Priority Scheduler
767 *  - CONFIGURE_SCHEDULER_PRIORITY_SMP - Deterministic Priority SMP Scheduler
768 *  - CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP - Deterministic
769 *    Priority SMP Affinity Scheduler
770 *  - CONFIGURE_SCHEDULER_STRONG_APA - Strong APA Scheduler
771 *  - CONFIGURE_SCHEDULER_SIMPLE - Light-weight Priority Scheduler
772 *  - CONFIGURE_SCHEDULER_SIMPLE_SMP - Simple SMP Priority Scheduler
773 *  - CONFIGURE_SCHEDULER_EDF - EDF Scheduler
774 *  - CONFIGURE_SCHEDULER_EDF_SMP - EDF SMP Scheduler
775 *  - CONFIGURE_SCHEDULER_CBS - CBS Scheduler
776 *  - CONFIGURE_SCHEDULER_USER  - user provided scheduler
777 *
778 * If no configuration is specified by the application in a uniprocessor
779 * configuration, then CONFIGURE_SCHEDULER_PRIORITY is the default.
780 *
781 * If no configuration is specified by the application in SMP
782 * configuration, then CONFIGURE_SCHEDULER_PRIORITY_SMP is the default.
783 *
784 * An application can define its own scheduling policy by defining
785 * CONFIGURE_SCHEDULER_USER and the following:
786 *
787 *    - CONFIGURE_SCHEDULER_CONTEXT
788 *    - CONFIGURE_SCHEDULER_CONTROLS
789 *    - CONFIGURE_SCHEDULER_USER_PER_THREAD
790 */
791
792#if !defined(CONFIGURE_SCHEDULER_USER) && \
793    !defined(CONFIGURE_SCHEDULER_PRIORITY) && \
794    !defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) && \
795    !defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) && \
796    !defined(CONFIGURE_SCHEDULER_STRONG_APA) && \
797    !defined(CONFIGURE_SCHEDULER_SIMPLE) && \
798    !defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) && \
799    !defined(CONFIGURE_SCHEDULER_EDF) && \
800    !defined(CONFIGURE_SCHEDULER_EDF_SMP) && \
801    !defined(CONFIGURE_SCHEDULER_CBS)
802  #if defined(RTEMS_SMP) && CONFIGURE_MAXIMUM_PROCESSORS > 1
803    /**
804     * If no scheduler is specified in an SMP configuration, the
805     * EDF scheduler is default.
806     */
807    #define CONFIGURE_SCHEDULER_EDF_SMP
808  #else
809    /**
810     * If no scheduler is specified in a uniprocessor configuration, the
811     * priority scheduler is default.
812     */
813    #define CONFIGURE_SCHEDULER_PRIORITY
814  #endif
815#endif
816
817#include <rtems/scheduler.h>
818
819/*
820 * If the Priority Scheduler is selected, then configure for it.
821 */
822#if defined(CONFIGURE_SCHEDULER_PRIORITY)
823  #if !defined(CONFIGURE_SCHEDULER_NAME)
824    /** Configure the name of the scheduler instance */
825    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'D', ' ')
826  #endif
827
828  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
829    /** Configure the context needed by the scheduler instance */
830    #define CONFIGURE_SCHEDULER_CONTEXT \
831      RTEMS_SCHEDULER_CONTEXT_PRIORITY( \
832        dflt, \
833        CONFIGURE_MAXIMUM_PRIORITY + 1 \
834      )
835
836    /** Configure the controls for this scheduler instance */
837    #define CONFIGURE_SCHEDULER_CONTROLS \
838      RTEMS_SCHEDULER_CONTROL_PRIORITY(dflt, CONFIGURE_SCHEDULER_NAME)
839  #endif
840#endif
841
842/*
843 * If the Deterministic Priority SMP Scheduler is selected, then configure for
844 * it.
845 */
846#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
847  #if !defined(CONFIGURE_SCHEDULER_NAME)
848    /** Configure the name of the scheduler instance */
849    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'D', ' ')
850  #endif
851
852  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
853    /** Configure the context needed by the scheduler instance */
854    #define CONFIGURE_SCHEDULER_CONTEXT \
855      RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( \
856        dflt, \
857        CONFIGURE_MAXIMUM_PRIORITY + 1 \
858      )
859
860    /** Configure the controls for this scheduler instance */
861    #define CONFIGURE_SCHEDULER_CONTROLS \
862      RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(dflt, CONFIGURE_SCHEDULER_NAME)
863  #endif
864#endif
865
866/*
867 * If the Deterministic Priority Affinity SMP Scheduler is selected, then configure for
868 * it.
869 */
870#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP)
871  #if !defined(CONFIGURE_SCHEDULER_NAME)
872    /** Configure the name of the scheduler instance */
873    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'A', ' ')
874  #endif
875
876  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
877    /** Configure the context needed by the scheduler instance */
878    #define CONFIGURE_SCHEDULER_CONTEXT \
879      RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( \
880        dflt, \
881        CONFIGURE_MAXIMUM_PRIORITY + 1 \
882      )
883
884    /** Configure the controls for this scheduler instance */
885    #define CONFIGURE_SCHEDULER_CONTROLS \
886      RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( \
887        dflt, \
888        CONFIGURE_SCHEDULER_NAME \
889      )
890  #endif
891#endif
892
893/*
894 * If the Strong APA Scheduler is selected, then configure for
895 * it.
896 */
897#if defined(CONFIGURE_SCHEDULER_STRONG_APA)
898  #if !defined(CONFIGURE_SCHEDULER_NAME)
899    /** Configure the name of the scheduler instance */
900    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'A', 'P', 'A')
901  #endif
902
903  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
904    /** Configure the context needed by the scheduler instance */
905    #define CONFIGURE_SCHEDULER_CONTEXT \
906      RTEMS_SCHEDULER_CONTEXT_STRONG_APA( \
907        dflt, \
908        CONFIGURE_MAXIMUM_PRIORITY + 1 \
909      )
910
911    /** Configure the controls for this scheduler instance */
912    #define CONFIGURE_SCHEDULER_CONTROLS \
913      RTEMS_SCHEDULER_CONTROL_STRONG_APA(dflt, CONFIGURE_SCHEDULER_NAME)
914  #endif
915#endif
916
917/*
918 * If the Simple Priority Scheduler is selected, then configure for it.
919 */
920#if defined(CONFIGURE_SCHEDULER_SIMPLE)
921  #if !defined(CONFIGURE_SCHEDULER_NAME)
922    /** Configure the name of the scheduler instance */
923    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'S', ' ')
924  #endif
925
926  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
927    /** Configure the context needed by the scheduler instance */
928    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_SIMPLE(dflt)
929
930    /** Configure the controls for this scheduler instance */
931    #define CONFIGURE_SCHEDULER_CONTROLS \
932      RTEMS_SCHEDULER_CONTROL_SIMPLE(dflt, CONFIGURE_SCHEDULER_NAME)
933  #endif
934#endif
935
936/*
937 * If the Simple SMP Priority Scheduler is selected, then configure for it.
938 */
939#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP)
940  #if !defined(CONFIGURE_SCHEDULER_NAME)
941    /** Configure the name of the scheduler instance */
942    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'S', ' ')
943  #endif
944
945  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
946    /** Configure the context needed by the scheduler instance */
947    #define CONFIGURE_SCHEDULER_CONTEXT \
948      RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(dflt)
949
950    /** Configure the controls for this scheduler instance */
951    #define CONFIGURE_SCHEDULER_CONTROLS \
952      RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(dflt, CONFIGURE_SCHEDULER_NAME)
953  #endif
954#endif
955
956/*
957 * If the EDF Scheduler is selected, then configure for it.
958 */
959#if defined(CONFIGURE_SCHEDULER_EDF)
960  #if !defined(CONFIGURE_SCHEDULER_NAME)
961    /** Configure the name of the scheduler instance */
962    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'E', 'D', 'F')
963  #endif
964
965  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
966    /** Configure the context needed by the scheduler instance */
967    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_EDF(dflt)
968
969    /** Configure the controls for this scheduler instance */
970    #define CONFIGURE_SCHEDULER_CONTROLS \
971      RTEMS_SCHEDULER_CONTROL_EDF(dflt, CONFIGURE_SCHEDULER_NAME)
972  #endif
973#endif
974
975/*
976 * If the EDF SMP Scheduler is selected, then configure for it.
977 */
978#if defined(CONFIGURE_SCHEDULER_EDF_SMP)
979  #if !defined(CONFIGURE_SCHEDULER_NAME)
980    /** Configure the name of the scheduler instance */
981    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'E', 'D', 'F')
982  #endif
983
984  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
985    /** Configure the context needed by the scheduler instance */
986    #define CONFIGURE_SCHEDULER_CONTEXT \
987      RTEMS_SCHEDULER_CONTEXT_EDF_SMP(dflt, CONFIGURE_MAXIMUM_PROCESSORS)
988
989    /** Configure the controls for this scheduler instance */
990    #define CONFIGURE_SCHEDULER_CONTROLS \
991      RTEMS_SCHEDULER_CONTROL_EDF_SMP(dflt, CONFIGURE_SCHEDULER_NAME)
992  #endif
993#endif
994
995/*
996 * If the CBS Scheduler is selected, then configure for it.
997 */
998#if defined(CONFIGURE_SCHEDULER_CBS)
999  #if !defined(CONFIGURE_SCHEDULER_NAME)
1000    /** Configure the name of the scheduler instance */
1001    #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'C', 'B', 'S')
1002  #endif
1003
1004  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
1005    /** Configure the context needed by the scheduler instance */
1006    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_CBS(dflt)
1007
1008    /** Configure the controls for this scheduler instance */
1009    #define CONFIGURE_SCHEDULER_CONTROLS \
1010      RTEMS_SCHEDULER_CONTROL_CBS(dflt, CONFIGURE_SCHEDULER_NAME)
1011  #endif
1012
1013  #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
1014    #define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS
1015  #endif
1016
1017  #ifdef CONFIGURE_INIT
1018    const uint32_t _Scheduler_CBS_Maximum_servers =
1019      CONFIGURE_CBS_MAXIMUM_SERVERS;
1020
1021    Scheduler_CBS_Server
1022      _Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ];
1023  #endif
1024#endif
1025
1026/*
1027 * Set up the scheduler entry points table.  The scheduling code uses
1028 * this code to know which scheduler is configured by the user.
1029 */
1030#ifdef CONFIGURE_INIT
1031  #if defined(CONFIGURE_SCHEDULER_CONTEXT)
1032    CONFIGURE_SCHEDULER_CONTEXT;
1033  #endif
1034
1035  const Scheduler_Control _Scheduler_Table[] = {
1036    CONFIGURE_SCHEDULER_CONTROLS
1037  };
1038
1039  #define CONFIGURE_SCHEDULER_COUNT RTEMS_ARRAY_SIZE( _Scheduler_Table )
1040
1041  #if defined(RTEMS_SMP)
1042    const size_t _Scheduler_Count = CONFIGURE_SCHEDULER_COUNT;
1043
1044    const Scheduler_Assignment _Scheduler_Initial_assignments[] = {
1045      #if defined(CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS)
1046        CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS
1047      #else
1048        #define _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT \
1049          RTEMS_SCHEDULER_ASSIGN( \
1050            0, \
1051            RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \
1052          )
1053        _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1054        #if CONFIGURE_MAXIMUM_PROCESSORS >= 2
1055          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1056        #endif
1057        #if CONFIGURE_MAXIMUM_PROCESSORS >= 3
1058          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1059        #endif
1060        #if CONFIGURE_MAXIMUM_PROCESSORS >= 4
1061          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1062        #endif
1063        #if CONFIGURE_MAXIMUM_PROCESSORS >= 5
1064          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1065        #endif
1066        #if CONFIGURE_MAXIMUM_PROCESSORS >= 6
1067          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1068        #endif
1069        #if CONFIGURE_MAXIMUM_PROCESSORS >= 7
1070          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1071        #endif
1072        #if CONFIGURE_MAXIMUM_PROCESSORS >= 8
1073          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1074        #endif
1075        #if CONFIGURE_MAXIMUM_PROCESSORS >= 9
1076          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1077        #endif
1078        #if CONFIGURE_MAXIMUM_PROCESSORS >= 10
1079          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1080        #endif
1081        #if CONFIGURE_MAXIMUM_PROCESSORS >= 11
1082          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1083        #endif
1084        #if CONFIGURE_MAXIMUM_PROCESSORS >= 12
1085          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1086        #endif
1087        #if CONFIGURE_MAXIMUM_PROCESSORS >= 13
1088          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1089        #endif
1090        #if CONFIGURE_MAXIMUM_PROCESSORS >= 14
1091          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1092        #endif
1093        #if CONFIGURE_MAXIMUM_PROCESSORS >= 15
1094          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1095        #endif
1096        #if CONFIGURE_MAXIMUM_PROCESSORS >= 16
1097          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1098        #endif
1099        #if CONFIGURE_MAXIMUM_PROCESSORS >= 17
1100          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1101        #endif
1102        #if CONFIGURE_MAXIMUM_PROCESSORS >= 18
1103          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1104        #endif
1105        #if CONFIGURE_MAXIMUM_PROCESSORS >= 19
1106          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1107        #endif
1108        #if CONFIGURE_MAXIMUM_PROCESSORS >= 20
1109          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1110        #endif
1111        #if CONFIGURE_MAXIMUM_PROCESSORS >= 21
1112          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1113        #endif
1114        #if CONFIGURE_MAXIMUM_PROCESSORS >= 22
1115          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1116        #endif
1117        #if CONFIGURE_MAXIMUM_PROCESSORS >= 23
1118          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1119        #endif
1120        #if CONFIGURE_MAXIMUM_PROCESSORS >= 24
1121          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1122        #endif
1123        #if CONFIGURE_MAXIMUM_PROCESSORS >= 25
1124          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1125        #endif
1126        #if CONFIGURE_MAXIMUM_PROCESSORS >= 26
1127          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1128        #endif
1129        #if CONFIGURE_MAXIMUM_PROCESSORS >= 27
1130          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1131        #endif
1132        #if CONFIGURE_MAXIMUM_PROCESSORS >= 28
1133          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1134        #endif
1135        #if CONFIGURE_MAXIMUM_PROCESSORS >= 29
1136          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1137        #endif
1138        #if CONFIGURE_MAXIMUM_PROCESSORS >= 30
1139          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1140        #endif
1141        #if CONFIGURE_MAXIMUM_PROCESSORS >= 31
1142          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1143        #endif
1144        #if CONFIGURE_MAXIMUM_PROCESSORS >= 32
1145          , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1146        #endif
1147        #undef _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT
1148      #endif
1149    };
1150
1151    RTEMS_STATIC_ASSERT(
1152      CONFIGURE_MAXIMUM_PROCESSORS
1153        == RTEMS_ARRAY_SIZE( _Scheduler_Initial_assignments ),
1154      _Scheduler_Initial_assignments
1155    );
1156  #endif
1157#endif
1158/**@}*/ /* end of Scheduler Configuration */
1159
1160/**
1161 * @defgroup ConfigurationIdle IDLE Thread Configuration
1162 *
1163 * @addtogroup Configuration
1164 *
1165 * This module contains configuration parameters related to the
1166 * set of IDLE threads. On a uniprocessor system, there is one
1167 * IDLE thread. On an SMP system, there is one for each core.
1168 */
1169
1170/*
1171 *  If you said the IDLE task was going to do application initialization
1172 *  and didn't override the IDLE body, then something is amiss.
1173 */
1174#if (defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
1175     !defined(CONFIGURE_IDLE_TASK_BODY))
1176  #error "CONFIGURE_ERROR: You did not override the IDLE task body."
1177#endif
1178
1179/**
1180 * @brief Idle task body configuration.
1181 *
1182 * There is a default IDLE thread body provided by RTEMS which
1183 * has the possibility of being CPU specific.  There may be a
1184 * BSP specific override of the RTEMS default body and in turn,
1185 * the application may override and provide its own.
1186 */
1187#ifndef CONFIGURE_IDLE_TASK_BODY
1188  #if defined(BSP_IDLE_TASK_BODY)
1189    #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
1190  #elif (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
1191    #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
1192  #else
1193    /* only instantiate and compile if used */
1194    #ifdef CONFIGURE_INIT
1195      void *_Thread_Idle_body(uintptr_t ignored)
1196      {
1197        for( ; ; ) ;
1198        return 0;   /* to avoid warning */
1199      }
1200    #endif
1201    #define CONFIGURE_IDLE_TASK_BODY _Thread_Idle_body
1202  #endif
1203#endif
1204/**@}*/ /* end of IDLE thread configuration */
1205
1206/**
1207 * @defgroup ConfigurationStackSize Configuration Thread Stack Size
1208 *
1209 * @addtogroup Configuration
1210 *
1211 * This module contains parameters related to thread aand interrupt stacks.
1212 */
1213
1214/**
1215 * By default, use the minimum stack size requested by this port.
1216 */
1217#ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE
1218  #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
1219#endif
1220
1221/**
1222 * This specifies the default POSIX thread stack size. By default, it is
1223 * twice that recommended for the port.
1224 */
1225#define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \
1226  (2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1227
1228/**
1229 * @brief Idle task stack size configuration.
1230 *
1231 * By default, the IDLE task will have a stack of minimum size.
1232 * The BSP or application may override this value.
1233 */
1234#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
1235  #ifdef BSP_IDLE_TASK_STACK_SIZE
1236    #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
1237  #else
1238    #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
1239  #endif
1240#endif
1241#if CONFIGURE_IDLE_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE
1242  #error "CONFIGURE_IDLE_TASK_STACK_SIZE less than CONFIGURE_MINIMUM_TASK_STACK_SIZE"
1243#endif
1244
1245/**
1246 * @brief Interrupt stack size configuration.
1247 *
1248 * By default, the interrupt stack will be of minimum size.
1249 * The BSP or application may override this value.
1250 */
1251#ifndef CONFIGURE_INTERRUPT_STACK_SIZE
1252  #ifdef BSP_INTERRUPT_STACK_SIZE
1253    #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
1254  #else
1255    #define CONFIGURE_INTERRUPT_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
1256  #endif
1257#endif
1258
1259/**
1260 * This reserves memory for the interrupt stack if it is to be allocated
1261 * by RTEMS rather than the BSP.
1262 *
1263 * @todo Try to get to the point where all BSPs support allocating the
1264 *       memory from the Workspace.
1265 */
1266#if (CPU_ALLOCATE_INTERRUPT_STACK == 0)
1267  #define _CONFIGURE_INTERRUPT_STACK_MEMORY 0
1268#else
1269  #define _CONFIGURE_INTERRUPT_STACK_MEMORY \
1270     _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE )
1271#endif
1272
1273/**
1274 * Configure the very much optional task stack allocator initialization
1275 */
1276#ifndef CONFIGURE_TASK_STACK_ALLOCATOR_INIT
1277  #define CONFIGURE_TASK_STACK_ALLOCATOR_INIT NULL
1278#endif
1279
1280/*
1281 *  Configure the very much optional task stack allocator and deallocator.
1282 */
1283#if !defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
1284  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
1285  /**
1286   * This specifies the task stack allocator method.
1287   */
1288  #define CONFIGURE_TASK_STACK_ALLOCATOR _Workspace_Allocate
1289  /**
1290   * This specifies the task stack deallocator method.
1291   */
1292  #define CONFIGURE_TASK_STACK_DEALLOCATOR _Workspace_Free
1293#elif (defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
1294  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)) \
1295    || (!defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
1296      && defined(CONFIGURE_TASK_STACK_DEALLOCATOR))
1297  #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined"
1298#endif
1299/**@}*/ /* end of thread/interrupt stack configuration */
1300
1301/**
1302 * @addtogroup Configuration
1303 */
1304/**@{*/
1305
1306/**
1307 * Should the RTEMS Workspace and C Program Heap be cleared automatically
1308 * at system start up?
1309 */
1310#ifndef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
1311  #ifdef BSP_ZERO_WORKSPACE_AUTOMATICALLY
1312    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY \
1313            BSP_ZERO_WORKSPACE_AUTOMATICALLY
1314  #else
1315    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY FALSE
1316  #endif
1317#endif
1318/**@}*/ /* end of add to group Configuration */
1319
1320/**
1321 * @defgroup ConfigurationMalloc RTEMS Malloc configuration
1322 *
1323 * This module contains parameters related to configuration of the RTEMS
1324 * Malloc implementation.
1325 */
1326/**@{*/
1327#include <rtems/malloc.h>
1328
1329#ifdef CONFIGURE_INIT
1330  /**
1331   * By default, RTEMS uses separate heaps for the RTEMS Workspace and
1332   * the C Program Heap.  The application can choose optionally to combine
1333   * these to provide one larger memory pool. This is particularly
1334   * useful in combination with the unlimited objects configuration.
1335   */
1336  #ifdef CONFIGURE_UNIFIED_WORK_AREAS
1337    Heap_Control  *RTEMS_Malloc_Heap = &_Workspace_Area;
1338  #else
1339    Heap_Control   RTEMS_Malloc_Area;
1340    Heap_Control  *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area;
1341  #endif
1342#endif
1343
1344#ifdef CONFIGURE_INIT
1345  /**
1346   * This configures the sbrk() support for the malloc family.
1347   * By default it is assumed that the BSP provides all available
1348   * RAM to the malloc family implementation so sbrk()'ing to get
1349   * more memory would always fail anyway.
1350   */
1351  const rtems_heap_extend_handler rtems_malloc_extend_handler =
1352    #ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
1353      rtems_heap_extend_via_sbrk;
1354    #else
1355      rtems_heap_null_extend;
1356    #endif
1357#endif
1358
1359#ifdef CONFIGURE_INIT
1360  /**
1361   * This configures the malloc family plugin which dirties memory
1362   * allocated.  This is helpful for finding unitialized data structure
1363   * problems.
1364   */
1365  rtems_malloc_dirtier_t rtems_malloc_dirty_helper =
1366    #if defined(CONFIGURE_MALLOC_DIRTY)
1367      rtems_malloc_dirty_memory;
1368    #else
1369      NULL;
1370    #endif
1371#endif
1372/**@}*/  /* end of Malloc Configuration */
1373
1374/**
1375 * @defgroup ConfigurationHelpers Configuration Helpers
1376 *
1377 * @ingroup Configuration
1378 *
1379 * This module contains items which are used internally to ease
1380 * the configuration calculations.
1381 */
1382/**@{*/
1383
1384/**
1385 * Zero of one returns 0 if the parameter is 0 else 1 is returned.
1386 */
1387#define _Configure_Zero_or_One(_number) ((_number) ? 1 : 0)
1388
1389/**
1390 * General helper to align up a value.
1391 */
1392#define _Configure_Align_up(_val, _align) \
1393  (((_val) + (_align) - 1) - ((_val) + (_align) - 1) % (_align))
1394
1395#define _CONFIGURE_HEAP_MIN_BLOCK_SIZE \
1396  _Configure_Align_up(sizeof(Heap_Block), CPU_HEAP_ALIGNMENT)
1397
1398/**
1399 * This is a helper macro used in calculations in this file.  It is used
1400 * to noted when an element is allocated from the RTEMS Workspace and adds
1401 * a factor to account for heap overhead plus an alignment factor that
1402 * may be applied.
1403 */
1404#define _Configure_From_workspace(_size) \
1405  (ssize_t) (_Configure_Zero_or_One(_size) * \
1406    _Configure_Align_up(_size + HEAP_BLOCK_HEADER_SIZE, \
1407      _CONFIGURE_HEAP_MIN_BLOCK_SIZE))
1408
1409/**
1410 * This is a helper macro used in stack space calculations in this file.  It
1411 * may be provided by the application in case a special task stack allocator
1412 * is used.  The default is allocation from the RTEMS Workspace.
1413 */
1414#ifdef CONFIGURE_TASK_STACK_FROM_ALLOCATOR
1415  #define _Configure_From_stackspace(_stack_size) \
1416    CONFIGURE_TASK_STACK_FROM_ALLOCATOR(_stack_size)
1417#else
1418  #define _Configure_From_stackspace(_stack_size) \
1419    _Configure_From_workspace(_stack_size)
1420#endif
1421
1422/**
1423 * Do not use the unlimited bit as part of the multiplication
1424 * for memory usage.
1425 */
1426#define _Configure_Max_Objects(_max) \
1427  (_Configure_Zero_or_One(_max) * rtems_resource_maximum_per_allocation(_max))
1428
1429/**
1430 * This macro accounts for how memory for a set of configured objects is
1431 * allocated from the Executive Workspace.
1432 *
1433 * NOTE: It does NOT attempt to address the more complex case of unlimited
1434 *       objects.
1435 */
1436#define _Configure_Object_RAM(_number, _size) ( \
1437    _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
1438    _Configure_From_workspace( \
1439      _Configure_Zero_or_One(_number) * ( \
1440        (_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *) + \
1441        _Configure_Align_up(sizeof(void *), CPU_ALIGNMENT) + \
1442        _Configure_Align_up(sizeof(uint32_t), CPU_ALIGNMENT) \
1443      ) \
1444    ) \
1445  )
1446/**@}*/
1447
1448/**
1449 * @defgroup ConfigurationInitTasksTable Initialization Tasks Configuration
1450 *
1451 * @addtogroup Configuration
1452 *
1453 * This group contains the elements needed to define the Classic API
1454 * Initialization Tasks Table.
1455 *
1456 *  Default User Initialization Task Table.  This table guarantees that
1457 *  one user initialization table is defined.
1458 */
1459#ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
1460
1461#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
1462
1463/*
1464 *  The user is defining their own table information and setting the
1465 *  appropriate variables.
1466 */
1467
1468#else
1469
1470/**
1471 * When using the default Classic API Initialization Tasks Table, this is
1472 * used to specify the name of the single Classic API task.
1473 */
1474#ifndef CONFIGURE_INIT_TASK_NAME
1475  #define CONFIGURE_INIT_TASK_NAME          rtems_build_name('U', 'I', '1', ' ')
1476#endif
1477
1478/**
1479 * When using the default Classic API Initialization Tasks Table, this is
1480 * used to specify the stack size of the single Classic API task.
1481 */
1482#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
1483  #define CONFIGURE_INIT_TASK_STACK_SIZE    CONFIGURE_MINIMUM_TASK_STACK_SIZE
1484#endif
1485
1486/**
1487 * When using the default Classic API Initialization Tasks Table, this is
1488 * used to specify the priority of the single Classic API task.
1489 */
1490#ifndef CONFIGURE_INIT_TASK_PRIORITY
1491  #define CONFIGURE_INIT_TASK_PRIORITY      1
1492#endif
1493
1494/**
1495 * When using the default Classic API Initialization Tasks Table, this is
1496 * used to specify the attributes size of the single Classic API task.
1497 */
1498#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
1499  #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_DEFAULT_ATTRIBUTES
1500#endif
1501
1502/**
1503 * When using the default Classic API Initialization Tasks Table, this is
1504 * used to specify the entry point of the single Classic API task.
1505 */
1506#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
1507  #ifdef __cplusplus
1508  extern "C" {
1509  #endif
1510    rtems_task Init (rtems_task_argument );
1511  #ifdef __cplusplus
1512  }
1513  #endif
1514  #define CONFIGURE_INIT_TASK_ENTRY_POINT   Init
1515  extern const char* bsp_boot_cmdline;
1516  #define CONFIGURE_INIT_TASK_ARGUMENTS     ((rtems_task_argument) &bsp_boot_cmdline)
1517#endif
1518
1519/**
1520 * When using the default Classic API Initialization Tasks Table, this is
1521 * used to specify the initial execution mode of the single Classic API task.
1522 */
1523#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
1524  #ifdef _CONFIGURE_SMP_APPLICATION
1525    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
1526  #else
1527    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
1528  #endif
1529#endif
1530
1531/**
1532 * When using the default Classic API Initialization Tasks Table, this is
1533 * used to specify the initial argument to the single Classic API task.
1534 */
1535#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
1536  #define CONFIGURE_INIT_TASK_ARGUMENTS     0
1537#endif
1538
1539#ifdef CONFIGURE_INIT
1540  rtems_initialization_tasks_table Initialization_tasks[] = {
1541    { CONFIGURE_INIT_TASK_NAME,
1542      CONFIGURE_INIT_TASK_STACK_SIZE,
1543      CONFIGURE_INIT_TASK_PRIORITY,
1544      CONFIGURE_INIT_TASK_ATTRIBUTES,
1545      CONFIGURE_INIT_TASK_ENTRY_POINT,
1546      CONFIGURE_INIT_TASK_INITIAL_MODES,
1547      CONFIGURE_INIT_TASK_ARGUMENTS
1548    }
1549  };
1550#endif
1551
1552/**
1553 * This is the name of the Initialization Tasks Table generated.
1554 */
1555#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
1556
1557/*
1558 * This is the size of the Initialization Tasks Table generated.
1559 */
1560#define CONFIGURE_INIT_TASK_TABLE_SIZE \
1561  RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
1562
1563#endif    /* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
1564
1565#else     /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
1566
1567/*
1568 * This is the name of the Initialization Task when none is configured.
1569 */
1570#define CONFIGURE_INIT_TASK_TABLE      NULL
1571
1572/*
1573 * This is the size of the Initialization Task when none is configured.
1574 */
1575#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
1576
1577/*
1578 * This is the stack size of the Initialization Task when none is configured.
1579 */
1580#define CONFIGURE_INIT_TASK_STACK_SIZE 0
1581
1582#endif
1583/**@}*/  /* end of Classic API Initialization Tasks Table */
1584
1585/**
1586 * @defgroup ConfigurationDriverTable Device Driver Table Configuration
1587 *
1588 * @addtogroup Configuration
1589 *
1590 * This group contains parameters related to generating a Device Driver
1591 * Table.
1592 *
1593 * Default Device Driver Table.  Each driver needed by the test is explicitly
1594 * choosen by the application.  There is always a null driver entry.
1595 */
1596/**@{*/
1597
1598/**
1599 * This is an empty device driver slot.
1600 */
1601#define NULL_DRIVER_TABLE_ENTRY \
1602 { NULL, NULL, NULL, NULL, NULL, NULL }
1603
1604#if defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1605  defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER)
1606#error "CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER and CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER are mutually exclusive"
1607#endif
1608
1609#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1610  #include <rtems/console.h>
1611#endif
1612
1613#ifdef CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
1614  #include <rtems/console.h>
1615
1616  #ifdef CONFIGURE_INIT
1617    RTEMS_SYSINIT_ITEM(
1618      _Console_simple_Initialize,
1619      RTEMS_SYSINIT_DEVICE_DRIVERS,
1620      RTEMS_SYSINIT_ORDER_SECOND
1621    );
1622  #endif
1623#endif
1624
1625#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1626  #include <rtems/clockdrv.h>
1627#endif
1628
1629#ifdef CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
1630  #include <rtems/btimer.h>
1631#endif
1632
1633#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1634  #include <rtems/rtc.h>
1635#endif
1636
1637#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1638  #include <rtems/watchdogdrv.h>
1639#endif
1640
1641#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1642  #include <rtems/framebuffer.h>
1643#endif
1644
1645#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1646  #include <rtems/devnull.h>
1647#endif
1648
1649#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1650  #include <rtems/devzero.h>
1651#endif
1652
1653#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1654  /* the ide driver needs the ATA driver */
1655  #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1656    #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1657  #endif
1658  #include <libchip/ide_ctrl.h>
1659#endif
1660
1661#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1662  #include <libchip/ata.h>
1663#endif
1664
1665#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
1666
1667/**
1668 * This specifies the maximum number of device drivers that
1669 * can be installed in the system at one time.  It must account
1670 * for both the statically and dynamically installed drivers.
1671 */
1672#ifndef CONFIGURE_MAXIMUM_DRIVERS
1673  #define CONFIGURE_MAXIMUM_DRIVERS
1674#endif
1675
1676#ifdef CONFIGURE_INIT
1677  rtems_driver_address_table
1678    _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
1679    #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
1680      CONFIGURE_BSP_PREREQUISITE_DRIVERS,
1681    #endif
1682    #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
1683      CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
1684    #endif
1685    #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1686      CONSOLE_DRIVER_TABLE_ENTRY,
1687    #endif
1688    #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1689      CLOCK_DRIVER_TABLE_ENTRY,
1690    #endif
1691    #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1692      RTC_DRIVER_TABLE_ENTRY,
1693    #endif
1694    #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1695      WATCHDOG_DRIVER_TABLE_ENTRY,
1696    #endif
1697    #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1698      DEVNULL_DRIVER_TABLE_ENTRY,
1699    #endif
1700    #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1701      DEVZERO_DRIVER_TABLE_ENTRY,
1702    #endif
1703    #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1704      IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
1705    #endif
1706    #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1707      ATA_DRIVER_TABLE_ENTRY,
1708    #endif
1709    #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1710      FRAME_BUFFER_DRIVER_TABLE_ENTRY,
1711    #endif
1712    #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
1713      CONFIGURE_APPLICATION_EXTRA_DRIVERS,
1714    #endif
1715    #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
1716      NULL_DRIVER_TABLE_ENTRY
1717    #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1718        !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
1719        !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \
1720        !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \
1721        !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) && \
1722        !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \
1723        !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \
1724        !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) && \
1725        !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
1726      NULL_DRIVER_TABLE_ENTRY
1727    #endif
1728  };
1729
1730  const size_t _IO_Number_of_drivers =
1731    RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
1732#endif
1733
1734#endif  /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
1735
1736#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1737  /*
1738   * configure the priority of the ATA driver task
1739   */
1740  #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
1741    #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
1742  #endif
1743  #ifdef CONFIGURE_INIT
1744    rtems_task_priority rtems_ata_driver_task_priority
1745      = CONFIGURE_ATA_DRIVER_TASK_PRIORITY;
1746  #endif /* CONFIGURE_INIT */
1747#endif
1748/**@}*/ /* end of Device Driver Table Configuration */
1749
1750/**
1751 * @defgroup ConfigurationLibBlock Configuration of LIBBLOCK
1752 *
1753 * @addtogroup Configuration
1754 *
1755 * This module contains parameters related to the LIBBLOCK buffering
1756 * and caching subsystem. It requires tasks to swap out data to be
1757 * written to non-volatile storage.
1758 */
1759/**@{*/
1760#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
1761  #include <rtems/bdbuf.h>
1762  /*
1763   * configure the bdbuf cache parameters
1764   */
1765  #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
1766    #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
1767                              RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
1768  #endif
1769  #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
1770    #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
1771                              RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
1772  #endif
1773  #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
1774    #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
1775                              RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
1776  #endif
1777  #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
1778    #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
1779                              RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
1780  #endif
1781  #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
1782    #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
1783                              RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
1784  #endif
1785  #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
1786    #define CONFIGURE_SWAPOUT_WORKER_TASKS \
1787                              RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
1788  #endif
1789  #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
1790    #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
1791                              RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
1792  #endif
1793  #ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE
1794    #define CONFIGURE_BDBUF_TASK_STACK_SIZE \
1795                              RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT
1796  #endif
1797  #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
1798    #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
1799                              RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
1800  #endif
1801  #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
1802    #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
1803                              RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
1804  #endif
1805  #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
1806    #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
1807                              RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
1808  #endif
1809  #ifndef CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1810    #define CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY \
1811                              RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT
1812  #endif
1813  #ifdef CONFIGURE_INIT
1814    const rtems_bdbuf_config rtems_bdbuf_configuration = {
1815      CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
1816      CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
1817      CONFIGURE_SWAPOUT_TASK_PRIORITY,
1818      CONFIGURE_SWAPOUT_SWAP_PERIOD,
1819      CONFIGURE_SWAPOUT_BLOCK_HOLD,
1820      CONFIGURE_SWAPOUT_WORKER_TASKS,
1821      CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
1822      CONFIGURE_BDBUF_TASK_STACK_SIZE,
1823      CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
1824      CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
1825      CONFIGURE_BDBUF_BUFFER_MAX_SIZE,
1826      CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1827    };
1828  #endif
1829
1830  #define _CONFIGURE_LIBBLOCK_TASKS \
1831    (1 + CONFIGURE_SWAPOUT_WORKER_TASKS + \
1832    (CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS != 0))
1833
1834  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS \
1835    (_CONFIGURE_LIBBLOCK_TASKS * \
1836    (CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \
1837    0 : CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE))
1838
1839  #ifdef RTEMS_BDBUF_USE_PTHREAD
1840    /*
1841     * Semaphores:
1842     *   o disk lock
1843     */
1844    #define _CONFIGURE_LIBBLOCK_SEMAPHORES 1
1845  #else
1846    /*
1847     * Semaphores:
1848     *   o disk lock
1849     *   o bdbuf lock
1850     *   o bdbuf sync lock
1851     *   o bdbuf access condition
1852     *   o bdbuf transfer condition
1853     *   o bdbuf buffer condition
1854     */
1855    #define _CONFIGURE_LIBBLOCK_SEMAPHORES 6
1856  #endif
1857
1858  #if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \
1859      defined(CONFIGURE_BDBUF_BUFFER_SIZE) || \
1860      defined(CONFIGURE_BDBUF_BUFFER_COUNT)
1861    #error BDBUF Cache does not use a buffer configuration table. Please remove.
1862  #endif
1863#else
1864  /** This specifies the number of libblock tasks. */
1865  #define _CONFIGURE_LIBBLOCK_TASKS 0
1866  /** This specifies the extra stack space configured for libblock tasks. */
1867  #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS 0
1868  /** This specifies the number of Classic API semaphores needed by libblock. */
1869  #define _CONFIGURE_LIBBLOCK_SEMAPHORES 0
1870#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
1871/**@}*/
1872
1873/**
1874 * @defgroup ConfigurationMultiprocessing Multiprocessing Configuration
1875 *
1876 * @addtogroup Configuration
1877 *
1878 * This module contains the parameters related to the Multiprocessing
1879 * configuration of RTEMS.
1880 *
1881 * In a single processor or SMP configuration, only two parameters are
1882 * needed and they are defaulted. The user should not have to specify
1883 * any parameters.
1884 */
1885/**@{*/
1886
1887/**
1888 * This defines the extra stack space required for the MPCI server thread.
1889 */
1890#ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
1891  #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
1892#endif
1893
1894/**
1895 * This defines the timers required for the shared memory driver in
1896 * a multiprocessing configuration.
1897 */
1898#ifndef _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER
1899  #define _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 0
1900#endif
1901
1902
1903#if defined(RTEMS_MULTIPROCESSING)
1904  /*
1905   *  Default Multiprocessing Configuration Table.  The defaults are
1906   *  appropriate for most of the RTEMS Multiprocessor Test Suite.  Each
1907   *  value may be overridden within each test to customize the environment.
1908   */
1909
1910  #ifdef CONFIGURE_MP_APPLICATION
1911    #define _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 1
1912
1913    #ifndef CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE
1914
1915      #ifndef CONFIGURE_MP_NODE_NUMBER
1916        #define CONFIGURE_MP_NODE_NUMBER                NODE_NUMBER
1917      #endif
1918
1919      #ifndef CONFIGURE_MP_MAXIMUM_NODES
1920        #define CONFIGURE_MP_MAXIMUM_NODES              2
1921      #endif
1922
1923      #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
1924        #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS     32
1925      #endif
1926      #define _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
1927        _Configure_From_workspace( \
1928          (_global_objects) * sizeof(Objects_MP_Control) \
1929        )
1930
1931      #ifndef CONFIGURE_MP_MAXIMUM_PROXIES
1932        #define CONFIGURE_MP_MAXIMUM_PROXIES            32
1933      #endif
1934      #define _CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
1935        _Configure_From_workspace((_proxies) \
1936          * (sizeof(Thread_Proxy_control) \
1937            + THREAD_QUEUE_HEADS_SIZE(CONFIGURE_SCHEDULER_COUNT)))
1938
1939      #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
1940        #include <mpci.h>
1941        #define CONFIGURE_MP_MPCI_TABLE_POINTER         &MPCI_table
1942      #endif
1943
1944      #ifdef CONFIGURE_INIT
1945        rtems_multiprocessing_table Multiprocessing_configuration = {
1946          CONFIGURE_MP_NODE_NUMBER,               /* local node number */
1947          CONFIGURE_MP_MAXIMUM_NODES,             /* maximum # nodes */
1948          CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS,    /* maximum # global objects */
1949          CONFIGURE_MP_MAXIMUM_PROXIES,           /* maximum # proxies */
1950          CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, /* MPCI stack > minimum */
1951          CONFIGURE_MP_MPCI_TABLE_POINTER         /* ptr to MPCI config table */
1952        };
1953      #endif
1954
1955      #define CONFIGURE_MULTIPROCESSING_TABLE    &Multiprocessing_configuration
1956
1957      #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 1
1958
1959    #endif /* CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE */
1960
1961  #else
1962
1963    #define CONFIGURE_MULTIPROCESSING_TABLE    NULL
1964
1965    #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0
1966
1967  #endif /* CONFIGURE_MP_APPLICATION */
1968#else
1969  #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0
1970#endif /* RTEMS_MULTIPROCESSING */
1971/**@}*/ /* end of Multiprocessing Configuration */
1972
1973/**
1974 * This macro specifies that the user wants to use unlimited objects for any
1975 * classic or posix objects that have not already been given resource limits.
1976 */
1977#if defined(CONFIGURE_UNLIMITED_OBJECTS)
1978  #if !defined(CONFIGURE_UNIFIED_WORK_AREAS) && \
1979     !defined(CONFIGURE_EXECUTIVE_RAM_SIZE) && \
1980     !defined(CONFIGURE_MEMORY_OVERHEAD)
1981     #error "CONFIGURE_UNLIMITED_OBJECTS requires a unified work area, an executive RAM size, or a defined workspace memory overhead"
1982  #endif
1983
1984  #if !defined(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1985  /**
1986   * This macro specifies a default allocation size for when auto-extending
1987   * unlimited objects if none was given by the user.
1988   */
1989    #define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 8
1990  #endif
1991  #if !defined(CONFIGURE_MAXIMUM_TASKS)
1992    #define CONFIGURE_MAXIMUM_TASKS \
1993      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1994  #endif
1995  #if !defined(CONFIGURE_MAXIMUM_TIMERS)
1996    #define CONFIGURE_MAXIMUM_TIMERS \
1997      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1998  #endif
1999  #if !defined(CONFIGURE_MAXIMUM_SEMAPHORES)
2000    #define CONFIGURE_MAXIMUM_SEMAPHORES \
2001      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2002  #endif
2003  #if !defined(CONFIGURE_MAXIMUM_MESSAGE_QUEUES)
2004    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES \
2005      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2006  #endif
2007  #if !defined(CONFIGURE_MAXIMUM_PARTITIONS)
2008    #define CONFIGURE_MAXIMUM_PARTITIONS \
2009      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2010  #endif
2011  #if !defined(CONFIGURE_MAXIMUM_REGIONS)
2012    #define CONFIGURE_MAXIMUM_REGIONS \
2013      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2014  #endif
2015  #if !defined(CONFIGURE_MAXIMUM_PORTS)
2016    #define CONFIGURE_MAXIMUM_PORTS \
2017      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2018  #endif
2019  #if !defined(CONFIGURE_MAXIMUM_PERIODS)
2020    #define CONFIGURE_MAXIMUM_PERIODS \
2021      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2022  #endif
2023  #if !defined(CONFIGURE_MAXIMUM_BARRIERS)
2024    #define CONFIGURE_MAXIMUM_BARRIERS \
2025      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2026  #endif
2027  #if !defined(CONFIGURE_MAXIMUM_POSIX_KEYS)
2028    #define CONFIGURE_MAXIMUM_POSIX_KEYS \
2029      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2030  #endif
2031  #if !defined(CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS)
2032    #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
2033      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2034  #endif
2035
2036  #ifdef RTEMS_POSIX_API
2037    #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS)
2038      #define CONFIGURE_MAXIMUM_POSIX_THREADS \
2039        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2040    #endif
2041    #if !defined(CONFIGURE_MAXIMUM_POSIX_TIMERS)
2042      #define CONFIGURE_MAXIMUM_POSIX_TIMERS \
2043        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2044    #endif
2045/*
2046    #if !defined(CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS)
2047      #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS \
2048        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2049    #endif
2050*/
2051    #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
2052      #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES \
2053        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2054    #endif
2055    #if !defined(CONFIGURE_MAXIMUM_POSIX_SEMAPHORES)
2056      #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES \
2057        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2058    #endif
2059    #if !defined(CONFIGURE_MAXIMUM_POSIX_SHMS)
2060      #define CONFIGURE_MAXIMUM_POSIX_SHMS \
2061        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
2062    #endif
2063  #endif /* RTEMS_POSIX_API */
2064#endif /* CONFIGURE_UNLIMITED_OBJECTS */
2065
2066
2067/**
2068 * @defgroup ConfigurationClassicAPI Classic API Configuration
2069 *
2070 * @ingroup Configuration
2071 *
2072 * This module contains the parameters related to configuration
2073 * of the Classic API services.
2074 */
2075/**@{*/
2076#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
2077
2078  /** This configures the maximum number of Classic API tasks. */
2079  #ifndef CONFIGURE_MAXIMUM_TASKS
2080    #define CONFIGURE_MAXIMUM_TASKS               0
2081  #endif
2082
2083  /*
2084   * This is calculated to account for the maximum number of Classic API
2085   * tasks used by the application and configured RTEMS capabilities.
2086   */
2087  #define _CONFIGURE_TASKS \
2088    (CONFIGURE_MAXIMUM_TASKS + _CONFIGURE_LIBBLOCK_TASKS)
2089
2090  #ifndef CONFIGURE_MAXIMUM_TIMERS
2091    /** This specifies the maximum number of Classic API timers. */
2092    #define CONFIGURE_MAXIMUM_TIMERS             0
2093    /*
2094     * This macro is calculated to specify the memory required for
2095     * Classic API timers.
2096     */
2097    #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0
2098  #else
2099    #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
2100      _Configure_Object_RAM(_timers, sizeof(Timer_Control) )
2101  #endif
2102
2103  #ifndef CONFIGURE_MAXIMUM_SEMAPHORES
2104    /** This specifies the maximum number of Classic API semaphores. */
2105    #define CONFIGURE_MAXIMUM_SEMAPHORES                 0
2106  #endif
2107
2108  /*
2109   * This specifies the number of Classic API semaphores required
2110   */
2111  #ifdef RTEMS_NETWORKING
2112    #define _CONFIGURE_NETWORKING_SEMAPHORES 1
2113  #else
2114    #define _CONFIGURE_NETWORKING_SEMAPHORES 0
2115  #endif
2116
2117  /*
2118   * This macro is calculated to specify the number of Classic API
2119   * semaphores required by the application and configured RTEMS
2120   * capabilities.
2121   */
2122  #define _CONFIGURE_SEMAPHORES \
2123    (CONFIGURE_MAXIMUM_SEMAPHORES + _CONFIGURE_LIBIO_SEMAPHORES + \
2124      _CONFIGURE_TERMIOS_SEMAPHORES + _CONFIGURE_LIBBLOCK_SEMAPHORES + \
2125      _CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS + \
2126      _CONFIGURE_NETWORKING_SEMAPHORES)
2127
2128  /*
2129   * This macro is calculated to specify the memory required for
2130   * Classic API Semaphores using MRSP. This is only available in
2131   * SMP configurations.
2132   */
2133  #if !defined(RTEMS_SMP) || \
2134    !defined(CONFIGURE_MAXIMUM_MRSP_SEMAPHORES)
2135    #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES 0
2136  #else
2137    #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES \
2138      CONFIGURE_MAXIMUM_MRSP_SEMAPHORES * \
2139        _Configure_From_workspace( \
2140          RTEMS_ARRAY_SIZE(_Scheduler_Table) * sizeof(Priority_Control) \
2141        )
2142  #endif
2143
2144  /*
2145   * This macro is calculated to specify the memory required for
2146   * Classic API Semaphores.
2147   *
2148   * If there are no user or support semaphores defined, then we can assume
2149   * that no memory need be allocated at all for semaphores.
2150   */
2151  #if _CONFIGURE_SEMAPHORES == 0
2152    #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0
2153  #else
2154    #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
2155      _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) ) + \
2156        _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES
2157  #endif
2158
2159  #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
2160    /**
2161     * This configuration parameter specifies the maximum number of
2162     * Classic API Message Queues.
2163     */
2164    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES             0
2165    /*
2166     * This macro is calculated to specify the RTEMS Workspace required for
2167     * the Classic API Message Queues.
2168     */
2169    #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0
2170  #else
2171    #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
2172      _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) )
2173  #endif
2174
2175  #ifndef CONFIGURE_MAXIMUM_PARTITIONS
2176    /**
2177     * This configuration parameter specifies the maximum number of
2178     * Classic API Partitions.
2179     */
2180    #define CONFIGURE_MAXIMUM_PARTITIONS                 0
2181    /*
2182     * This macro is calculated to specify the memory required for
2183     * Classic API
2184     */
2185    #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0
2186  #else
2187    #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
2188      _Configure_Object_RAM(_partitions, sizeof(Partition_Control) )
2189  #endif
2190
2191  #ifndef CONFIGURE_MAXIMUM_REGIONS
2192    /**
2193     * This configuration parameter specifies the maximum number of
2194     * Classic API Regions.
2195     */
2196    #define CONFIGURE_MAXIMUM_REGIONS              0
2197    /*
2198     * This macro is calculated to specify the memory required for
2199     * Classic API Regions.
2200     */
2201    #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0
2202  #else
2203    #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
2204      _Configure_Object_RAM(_regions, sizeof(Region_Control) )
2205  #endif
2206
2207  #ifndef CONFIGURE_MAXIMUM_PORTS
2208    /**
2209     * This configuration parameter specifies the maximum number of
2210     * Classic API Dual-Ported Memory Ports.
2211     */
2212    #define CONFIGURE_MAXIMUM_PORTS            0
2213    /**
2214     * This macro is calculated to specify the memory required for
2215     * Classic API Dual-Ported Memory Ports.
2216     */
2217    #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) 0
2218  #else
2219    #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) \
2220      _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) )
2221  #endif
2222
2223  #ifndef CONFIGURE_MAXIMUM_PERIODS
2224    /**
2225     * This configuration parameter specifies the maximum number of
2226     * Classic API Rate Monotonic Periods.
2227     */
2228    #define CONFIGURE_MAXIMUM_PERIODS              0
2229    /*
2230     * This macro is calculated to specify the memory required for
2231     * Classic API Rate Monotonic Periods.
2232     */
2233  #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0
2234#else
2235    #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
2236      _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) )
2237  #endif
2238
2239  /**
2240   * This configuration parameter specifies the maximum number of
2241   * Classic API Barriers.
2242   */
2243  #ifndef CONFIGURE_MAXIMUM_BARRIERS
2244    #define CONFIGURE_MAXIMUM_BARRIERS               0
2245  #endif
2246
2247  /*
2248   * This macro is calculated to specify the number of Classic API
2249   * Barriers required by the application and configured capabilities.
2250   */
2251  #define _CONFIGURE_BARRIERS \
2252     (CONFIGURE_MAXIMUM_BARRIERS + _CONFIGURE_BARRIERS_FOR_FIFOS)
2253
2254  /*
2255   * This macro is calculated to specify the memory required for
2256   * Classic API Barriers.
2257   */
2258  #if _CONFIGURE_BARRIERS == 0
2259    #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0
2260  #else
2261    #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \
2262      _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) )
2263  #endif
2264
2265  #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
2266    /**
2267     * This configuration parameter specifies the maximum number of
2268     * Classic API User Extensions.
2269     */
2270    #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
2271    /*
2272     * This macro is calculated to specify the memory required for
2273     * Classic API User Extensions.
2274     */
2275    #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0
2276  #else
2277    #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
2278      _Configure_Object_RAM(_extensions, sizeof(Extension_Control) )
2279  #endif
2280  /**@}*/ /* end of Classic API Configuration */
2281
2282  /**
2283   * @defgroup ConfigurationGeneral General System Configuration
2284   *
2285   * @ingroup Configuration
2286   *
2287   * This module contains configuration parameters that are independent
2288   * of any API but impact general system configuration.
2289   */
2290  /**@{*/
2291
2292  /** The configures the number of microseconds per clock tick. */
2293  #ifndef CONFIGURE_MICROSECONDS_PER_TICK
2294    #define CONFIGURE_MICROSECONDS_PER_TICK \
2295            RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
2296  #endif
2297
2298  #if 1000000 % CONFIGURE_MICROSECONDS_PER_TICK != 0
2299    #warning "The clock ticks per second is not an integer"
2300  #endif
2301
2302  #if CONFIGURE_MICROSECONDS_PER_TICK <= 0
2303    #error "The CONFIGURE_MICROSECONDS_PER_TICK must be positive"
2304  #endif
2305
2306  #define _CONFIGURE_TICKS_PER_SECOND (1000000 / CONFIGURE_MICROSECONDS_PER_TICK)
2307
2308  /** The configures the number of clock ticks per timeslice. */
2309  #ifndef CONFIGURE_TICKS_PER_TIMESLICE
2310    #define CONFIGURE_TICKS_PER_TIMESLICE        50
2311  #endif
2312
2313/**@}*/ /* end of General Configuration */
2314
2315/*
2316 *  Initial Extension Set
2317 */
2318
2319#ifdef CONFIGURE_INIT
2320#ifdef CONFIGURE_STACK_CHECKER_ENABLED
2321#include <rtems/stackchk.h>
2322#endif
2323#include <rtems/libcsupport.h>
2324
2325#if defined(BSP_INITIAL_EXTENSION) || \
2326    defined(CONFIGURE_INITIAL_EXTENSIONS) || \
2327    defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
2328    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
2329  static const rtems_extensions_table Configuration_Initial_Extensions[] = {
2330    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
2331      RTEMS_NEWLIB_EXTENSION,
2332    #endif
2333    #if defined(CONFIGURE_STACK_CHECKER_ENABLED)
2334      RTEMS_STACK_CHECKER_EXTENSION,
2335    #endif
2336    #if defined(CONFIGURE_INITIAL_EXTENSIONS)
2337      CONFIGURE_INITIAL_EXTENSIONS,
2338    #endif
2339    #if defined(BSP_INITIAL_EXTENSION)
2340      BSP_INITIAL_EXTENSION
2341    #endif
2342  };
2343
2344  #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
2345  #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
2346    RTEMS_ARRAY_SIZE(Configuration_Initial_Extensions)
2347
2348  RTEMS_SYSINIT_ITEM(
2349    _User_extensions_Handler_initialization,
2350    RTEMS_SYSINIT_INITIAL_EXTENSIONS,
2351    RTEMS_SYSINIT_ORDER_MIDDLE
2352  );
2353#else
2354  #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
2355  #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
2356#endif
2357
2358#if defined(RTEMS_NEWLIB)
2359  struct _reent *__getreent(void)
2360  {
2361    #ifdef CONFIGURE_DISABLE_NEWLIB_REENTRANCY
2362      return _GLOBAL_REENT;
2363    #else
2364      return _Thread_Get_executing()->libc_reent;
2365    #endif
2366  }
2367#endif
2368
2369#endif
2370
2371/**
2372 * @defgroup ConfigurationPOSIXAPI POSIX API Configuration Parameters
2373 *
2374 * This module contains the parameters related to configuration
2375 * of the POSIX API services.
2376 */
2377/**@{*/
2378
2379#include <rtems/posix/key.h>
2380
2381/**
2382 * This configuration parameter specifies the maximum number of
2383 * POSIX API keys.
2384 *
2385 * POSIX Keys are available whether or not the POSIX API is enabled.
2386 */
2387#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
2388  #define CONFIGURE_MAXIMUM_POSIX_KEYS 0
2389#endif
2390
2391/*
2392 * This macro is calculated to specify the memory required for
2393 * POSIX API key/value pairs.
2394 */
2395#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
2396  #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
2397    (CONFIGURE_MAXIMUM_POSIX_KEYS * \
2398     (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS))
2399#endif
2400
2401/*
2402 * This macro is calculated to specify the total number of
2403 * POSIX API keys required by the application and configured
2404 * system capabilities.
2405 */
2406#define _CONFIGURE_POSIX_KEYS \
2407  (CONFIGURE_MAXIMUM_POSIX_KEYS + _CONFIGURE_LIBIO_POSIX_KEYS)
2408
2409/*
2410 * This macro is calculated to specify the memory required for
2411 * POSIX API keys.
2412 */
2413#define _CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
2414   (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
2415    + _Configure_From_workspace( \
2416      _Configure_Max_Objects(_key_value_pairs) \
2417        * sizeof(POSIX_Keys_Key_value_pair)))
2418
2419/*
2420 *  The rest of the POSIX threads API features are only available when
2421 *  POSIX is enabled.
2422 */
2423#ifdef RTEMS_POSIX_API
2424  #include <sys/types.h>
2425  #include <signal.h>
2426  #include <limits.h>
2427  #include <mqueue.h>
2428  #include <rtems/posix/mqueue.h>
2429  #include <rtems/posix/psignal.h>
2430  #include <rtems/posix/pthread.h>
2431  #include <rtems/posix/semaphore.h>
2432  #include <rtems/posix/shm.h>
2433  #include <rtems/posix/threadsup.h>
2434  #include <rtems/posix/timer.h>
2435
2436  /*
2437   * Account for the object control structures plus the name
2438   * of the object to be duplicated.
2439   */
2440  #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
2441    (_Configure_Object_RAM(_number, _size) \
2442      + _Configure_Max_Objects(_number) \
2443        * _Configure_From_workspace(_POSIX_PATH_MAX + 1))
2444
2445  /**
2446   * This configuration parameter specifies the maximum number of
2447   * POSIX API threads.
2448   */
2449  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2450    #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
2451  #endif
2452
2453  /**
2454   * This configuration parameter specifies the maximum number of
2455   * POSIX API timers.
2456   */
2457  #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
2458    #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
2459  #endif
2460
2461  /*
2462   * This macro is calculated to specify the memory required for
2463   * POSIX API timers.
2464   */
2465  #define _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
2466    _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
2467
2468  /**
2469   * This configuration parameter specifies the maximum number of
2470   * POSIX API queued signals.
2471   */
2472  #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
2473    #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0
2474  #endif
2475
2476  /*
2477   * This macro is calculated to specify the memory required for
2478   * POSIX API queued signals.
2479   */
2480  #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
2481    _Configure_From_workspace( \
2482      (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
2483
2484  /**
2485   * This configuration parameter specifies the maximum number of
2486   * POSIX API message queues.
2487   */
2488  #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
2489    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
2490  #endif
2491
2492  /*
2493   * This macro is calculated to specify the memory required for
2494   * POSIX API message queues.
2495   */
2496  #define _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
2497    _Configure_POSIX_Named_Object_RAM( \
2498       _message_queues, sizeof(POSIX_Message_queue_Control) )
2499
2500  /**
2501   * This configuration parameter specifies the maximum number of
2502   * POSIX API semaphores.
2503   */
2504  #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
2505    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0
2506  #endif
2507
2508  /*
2509   * This macro is calculated to specify the memory required for
2510   * POSIX API semaphores.
2511   */
2512  #define _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
2513    _Configure_POSIX_Named_Object_RAM( \
2514       _semaphores, sizeof(POSIX_Semaphore_Control) )
2515
2516  /**
2517   * Configure the maximum number of POSIX shared memory objects.
2518   */
2519  #if !defined(CONFIGURE_MAXIMUM_POSIX_SHMS)
2520    #define CONFIGURE_MAXIMUM_POSIX_SHMS 0
2521  #else
2522    #ifdef CONFIGURE_INIT
2523      #if !defined(CONFIGURE_HAS_OWN_POSIX_SHM_OBJECT_OPERATIONS)
2524        const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations = {
2525          _POSIX_Shm_Object_create_from_workspace,
2526          _POSIX_Shm_Object_resize_from_workspace,
2527          _POSIX_Shm_Object_delete_from_workspace,
2528          _POSIX_Shm_Object_read_from_workspace,
2529          _POSIX_Shm_Object_mmap_from_workspace
2530        };
2531      #endif
2532    #endif
2533  #endif
2534
2535  /*
2536   * This macro is calculated to specify the memory required for
2537   * POSIX API shared memory.
2538   */
2539  #define _CONFIGURE_MEMORY_FOR_POSIX_SHMS(_shms) \
2540    _Configure_POSIX_Named_Object_RAM(_shms, sizeof(POSIX_Shm_Control) )
2541
2542
2543  #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
2544
2545    #ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
2546
2547      /*
2548       *  The user is defining their own table information and setting the
2549       *  appropriate variables for the POSIX Initialization Thread Table.
2550       */
2551
2552    #else
2553
2554      #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
2555        #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
2556      #endif
2557
2558      #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2559        #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
2560          CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
2561      #endif
2562
2563      #ifdef CONFIGURE_INIT
2564        posix_initialization_threads_table POSIX_Initialization_threads[] = {
2565          { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT, \
2566              CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
2567        };
2568      #endif
2569
2570      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
2571              POSIX_Initialization_threads
2572
2573      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
2574              RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
2575
2576    #endif    /* CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
2577
2578  #else     /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
2579
2580    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
2581    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
2582
2583  #endif
2584
2585#else
2586
2587  /**
2588   * This configuration parameter specifies the maximum number of
2589   * POSIX API threads.
2590   */
2591  #define CONFIGURE_MAXIMUM_POSIX_THREADS         0
2592
2593#endif    /* RTEMS_POSIX_API */
2594
2595/**
2596 * This configuration parameter specifies the stack size of the
2597 * POSIX API Initialization thread (if used).
2598 */
2599#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
2600  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE    0
2601#endif
2602/**@}*/  /* end of POSIX API Configuration */
2603
2604/**
2605 * @defgroup ConfigurationGNAT GNAT/RTEMS Configuration
2606 *
2607 * @addtogroup Configuration
2608 *
2609 *  This modules includes configuration parameters for applications which
2610 *  use GNAT/RTEMS. GNAT implements each Ada task as a POSIX thread.
2611 */
2612/**@{*/
2613#ifdef CONFIGURE_GNAT_RTEMS
2614  /**
2615   * This is the maximum number of Ada tasks which can be concurrently
2616   * in existence.  Twenty (20) are required to run all tests in the
2617   * ACATS (formerly ACVC).
2618   */
2619  #ifndef CONFIGURE_MAXIMUM_ADA_TASKS
2620    #define CONFIGURE_MAXIMUM_ADA_TASKS  20
2621  #endif
2622
2623  /**
2624   * This is the number of non-Ada tasks which invoked Ada code.
2625   */
2626  #ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
2627    #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2628  #endif
2629#else
2630  /** This defines he number of POSIX mutexes GNAT needs. */
2631  /** This defines he number of Ada tasks needed by the application. */
2632  #define CONFIGURE_MAXIMUM_ADA_TASKS      0
2633  /**
2634   * This defines he number of non-Ada tasks/threads that will invoke
2635   * Ada subprograms or functions.
2636   */
2637  #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2638#endif
2639/**@}*/  /* end of GNAT Configuration */
2640
2641/**
2642 * @defgroup ConfigurationGo GCC Go Configuration
2643 *
2644 * @addtogroup Configuration
2645 *
2646 *  This modules includes configuration parameters for applications which
2647 *  use GCC Go.
2648 */
2649/**@{*/
2650#ifdef CONFIGURE_ENABLE_GO
2651
2652  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2653    #define CONFIGURE_MAXIMUM_POSIX_THREADS 1
2654  #endif
2655
2656  #ifndef CONFIGURE_MAXIMUM_GOROUTINES
2657    #define CONFIGURE_MAXIMUM_GOROUTINES 400
2658  #endif
2659
2660  #ifndef CONFIGURE_MAXIMUM_GO_CHANNELS
2661    #define CONFIGURE_MAXIMUM_GO_CHANNELS 500
2662  #endif
2663
2664#else
2665  /** This specifies the maximum number of Go co-routines. */
2666  #define CONFIGURE_MAXIMUM_GOROUTINES          0
2667
2668  /** This specifies the maximum number of Go channels required. */
2669  #define CONFIGURE_MAXIMUM_GO_CHANNELS         0
2670#endif
2671/**@}*/  /* end of Go Configuration */
2672
2673/**
2674 * This is so we can account for tasks with stacks greater than minimum
2675 * size.  This is in bytes.
2676 */
2677#ifndef CONFIGURE_EXTRA_TASK_STACKS
2678  #define CONFIGURE_EXTRA_TASK_STACKS 0
2679#endif
2680
2681/**
2682 * This macro provides a summation of the various POSIX thread requirements.
2683 */
2684#define _CONFIGURE_POSIX_THREADS \
2685   (CONFIGURE_MAXIMUM_POSIX_THREADS + \
2686     CONFIGURE_MAXIMUM_ADA_TASKS + \
2687     CONFIGURE_MAXIMUM_GOROUTINES)
2688
2689#ifdef RTEMS_POSIX_API
2690  /*
2691   * This macro is calculated to specify the memory required for
2692   * the POSIX API in its entirety.
2693   */
2694  #define _CONFIGURE_MEMORY_FOR_POSIX \
2695    (_CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
2696        CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) + \
2697      _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
2698        CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
2699      _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
2700        CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \
2701      _CONFIGURE_MEMORY_FOR_POSIX_SHMS( \
2702        CONFIGURE_MAXIMUM_POSIX_SHMS) + \
2703      _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(CONFIGURE_MAXIMUM_POSIX_TIMERS))
2704#else
2705  /*
2706   * This macro is calculated to specify the memory required for
2707   * the POSIX API in its entirety.
2708   */
2709  #define _CONFIGURE_MEMORY_FOR_POSIX 0
2710#endif
2711
2712/*
2713 * We must be able to split the free block used for the second last allocation
2714 * into two parts so that we have a free block for the last allocation.  See
2715 * _Heap_Block_split().
2716 */
2717#define _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2718  _Configure_Align_up( HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT )
2719
2720/*
2721 *  Calculate the RAM size based on the maximum number of objects configured.
2722 */
2723#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
2724
2725/*
2726 * Account for allocating the following per object
2727 *   + array of object control structures
2728 *   + local pointer table -- pointer per object plus a zero'th
2729 *     entry in the local pointer table.
2730 */
2731#define _CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \
2732  ( \
2733    _Configure_Object_RAM(_tasks, sizeof(Configuration_Thread_control)) \
2734      + _Configure_From_workspace(_Configure_Max_Objects(_tasks) \
2735        * THREAD_QUEUE_HEADS_SIZE(CONFIGURE_SCHEDULER_COUNT)) \
2736      + _Configure_Max_Objects(_number_FP_tasks) \
2737        * _Configure_From_workspace(CONTEXT_FP_SIZE) \
2738  )
2739
2740/*
2741 * This defines the amount of memory configured for the multiprocessing
2742 * support required by this application.
2743 */
2744#ifdef CONFIGURE_MP_APPLICATION
2745  #define _CONFIGURE_MEMORY_FOR_MP \
2746    (_CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
2747     _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS))
2748#else
2749  #define _CONFIGURE_MEMORY_FOR_MP  0
2750#endif
2751
2752/**
2753 * The following macro is used to calculate the memory allocated by RTEMS
2754 * for the message buffers associated with a particular message queue.
2755 * There is a fixed amount of overhead per message.
2756 */
2757#define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
2758    _Configure_From_workspace( \
2759      (_messages) * (_Configure_Align_up(_size, sizeof(uintptr_t)) \
2760        + sizeof(CORE_message_queue_Buffer_control)))
2761
2762/*
2763 * This macro is set to the amount of memory required for pending message
2764 * buffers in bytes.  It should be constructed by adding together a
2765 * set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
2766 */
2767#ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
2768  #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
2769#endif
2770
2771/**
2772 * This macro is available just in case the confdefs.h file underallocates
2773 * memory for a particular application.  This lets the user add some extra
2774 * memory in case something broken and underestimates.
2775 *
2776 * It is also possible for cases where confdefs.h overallocates memory,
2777 * you could substract memory from the allocated.  The estimate is just
2778 * that, an estimate, and assumes worst case alignment and padding on
2779 * each allocated element.  So in some cases it could be too conservative.
2780 *
2781 * NOTE: Historically this was used for message buffers.
2782 */
2783#ifndef CONFIGURE_MEMORY_OVERHEAD
2784  #define CONFIGURE_MEMORY_OVERHEAD 0
2785#endif
2786
2787/**
2788 * This calculates the amount of memory reserved for the IDLE tasks.
2789 * In an SMP system, each CPU core has its own idle task.
2790 */
2791#define _CONFIGURE_IDLE_TASKS_COUNT CONFIGURE_MAXIMUM_PROCESSORS
2792
2793/**
2794 * This defines the formula used to compute the amount of memory
2795 * reserved for internal task control structures.
2796 */
2797#if CPU_IDLE_TASK_IS_FP == TRUE
2798  #define _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS \
2799    _CONFIGURE_MEMORY_FOR_TASKS( \
2800      _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT, \
2801      _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT \
2802    )
2803#else
2804  #define _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS \
2805    _CONFIGURE_MEMORY_FOR_TASKS( \
2806      _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT, \
2807      _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT \
2808    )
2809#endif
2810
2811/**
2812 * This macro accounts for general RTEMS system overhead.
2813 */
2814#define _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
2815  ( _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS + \
2816    _CONFIGURE_INTERRUPT_STACK_MEMORY \
2817  )
2818
2819/**
2820 * This macro reserves the memory required by the statically configured
2821 * user extensions.
2822 */
2823#define _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \
2824  (_CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS == 0 ? 0 : \
2825    _Configure_From_workspace( \
2826      _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
2827        * sizeof(User_extensions_Switch_control) \
2828    ))
2829
2830/**
2831 * This macro provides a summation of the memory required by the
2832 * Classic API as configured.
2833 */
2834#define _CONFIGURE_MEMORY_FOR_CLASSIC \
2835   (_CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \
2836    _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \
2837   _CONFIGURE_MEMORY_FOR_SEMAPHORES(_CONFIGURE_SEMAPHORES) + \
2838   _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
2839   _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
2840   _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \
2841   _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
2842   _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
2843   _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS) + \
2844   _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \
2845  )
2846
2847/*
2848 * This macro provides a summation of the memory required by SMP as configured.
2849 */
2850#if defined(RTEMS_SMP)
2851  #define _CONFIGURE_MEMORY_FOR_SMP \
2852     (CONFIGURE_MAXIMUM_PROCESSORS * \
2853      _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE ) \
2854     )
2855#else
2856  #define _CONFIGURE_MEMORY_FOR_SMP 0
2857#endif
2858
2859/**
2860 * This calculates the memory required for the executive workspace.
2861 *
2862 * This is an internal parameter.
2863 */
2864#define CONFIGURE_EXECUTIVE_RAM_SIZE \
2865( \
2866   _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD + \
2867   _CONFIGURE_MEMORY_FOR_TASKS( \
2868     _CONFIGURE_TASKS, _CONFIGURE_TASKS) + \
2869   _CONFIGURE_MEMORY_FOR_TASKS( \
2870     _CONFIGURE_POSIX_THREADS, _CONFIGURE_POSIX_THREADS) + \
2871   _CONFIGURE_MEMORY_FOR_CLASSIC + \
2872   _CONFIGURE_MEMORY_FOR_POSIX_KEYS( \
2873      _CONFIGURE_POSIX_KEYS, \
2874      CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \
2875   _CONFIGURE_MEMORY_FOR_POSIX + \
2876   _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
2877   _CONFIGURE_MEMORY_FOR_MP + \
2878   _CONFIGURE_MEMORY_FOR_SMP + \
2879   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
2880   (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
2881   _CONFIGURE_HEAP_HANDLER_OVERHEAD \
2882)
2883
2884/*
2885 *  Now account for any extra memory that initialization tasks or threads
2886 *  may have requested.
2887 */
2888
2889/*
2890 * This accounts for any extra memory required by the Classic API
2891 * Initialization Task.
2892 */
2893#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2894  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
2895      (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2896#else
2897  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
2898#endif
2899
2900/*
2901 * This accounts for any extra memory required by the POSIX API
2902 * Initialization Thread.
2903 */
2904#if defined(RTEMS_POSIX_API) && \
2905    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \
2906      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2907  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
2908    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - \
2909      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2910#else
2911  #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
2912#endif
2913
2914/*
2915 * This macro provides a summation of the various initialization task
2916 * and thread stack requirements.
2917 */
2918#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS \
2919    (_CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
2920    _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART)
2921
2922/*
2923 * This macro is calculated to specify the memory required for
2924 * the Idle tasks(s) stack.
2925 */
2926#define _CONFIGURE_IDLE_TASKS_STACK \
2927  (_CONFIGURE_IDLE_TASKS_COUNT * \
2928    _Configure_From_stackspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) )
2929
2930/*
2931 * This macro is calculated to specify the stack memory required for the MPCI
2932 * task.
2933 */
2934#define _CONFIGURE_MPCI_RECEIVE_SERVER_STACK \
2935  (_CONFIGURE_MPCI_RECEIVE_SERVER_COUNT * \
2936    _Configure_From_stackspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE))
2937
2938/*
2939 * This macro is calculated to specify the memory required for
2940 * the stacks of all tasks.
2941 */
2942#define _CONFIGURE_TASKS_STACK \
2943  (_Configure_Max_Objects( _CONFIGURE_TASKS ) * \
2944    _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
2945
2946/*
2947 * This macro is calculated to specify the memory required for
2948 * the stacks of all POSIX threads.
2949 */
2950#define _CONFIGURE_POSIX_THREADS_STACK \
2951  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \
2952    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2953
2954/*
2955 * This macro is calculated to specify the memory required for
2956 * the stacks of all Ada tasks.
2957 */
2958#define _CONFIGURE_ADA_TASKS_STACK \
2959  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_ADA_TASKS ) * \
2960    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2961
2962/*
2963 * This macro is calculated to specify the memory required for
2964 * the stacks of all Go routines.
2965 */
2966#define _CONFIGURE_GOROUTINES_STACK \
2967  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_GOROUTINES ) * \
2968    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2969
2970#else /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2971
2972#define _CONFIGURE_IDLE_TASKS_STACK 0
2973#define _CONFIGURE_MPCI_RECEIVE_SERVER_STACK 0
2974#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS 0
2975#define _CONFIGURE_TASKS_STACK 0
2976#define _CONFIGURE_POSIX_THREADS_STACK 0
2977#define _CONFIGURE_GOROUTINES_STACK 0
2978#define _CONFIGURE_ADA_TASKS_STACK 0
2979
2980#if CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK != 0
2981  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK"
2982#endif
2983
2984#if CONFIGURE_EXTRA_TASK_STACKS != 0
2985  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_TASK_STACKS"
2986#endif
2987
2988#endif /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2989
2990/*
2991 * This macro is calculated to specify the memory required for
2992 * all tasks and threads of all varieties.
2993 */
2994#define _CONFIGURE_STACK_SPACE_SIZE \
2995  ( \
2996    _CONFIGURE_IDLE_TASKS_STACK + \
2997    _CONFIGURE_MPCI_RECEIVE_SERVER_STACK + \
2998    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \
2999    _CONFIGURE_TASKS_STACK + \
3000    _CONFIGURE_POSIX_THREADS_STACK + \
3001    _CONFIGURE_GOROUTINES_STACK + \
3002    _CONFIGURE_ADA_TASKS_STACK + \
3003    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK + \
3004    _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS + \
3005    CONFIGURE_EXTRA_TASK_STACKS + \
3006    _CONFIGURE_HEAP_HANDLER_OVERHEAD \
3007  )
3008
3009#ifndef CONFIGURE_MAXIMUM_THREAD_NAME_SIZE
3010  #define CONFIGURE_MAXIMUM_THREAD_NAME_SIZE 16
3011#endif
3012
3013#ifdef CONFIGURE_INIT
3014  typedef union {
3015    Scheduler_Node Base;
3016    #ifdef CONFIGURE_SCHEDULER_CBS
3017      Scheduler_CBS_Node CBS;
3018    #endif
3019    #ifdef CONFIGURE_SCHEDULER_EDF
3020      Scheduler_EDF_Node EDF;
3021    #endif
3022    #ifdef CONFIGURE_SCHEDULER_EDF_SMP
3023      Scheduler_EDF_SMP_Node EDF_SMP;
3024    #endif
3025    #ifdef CONFIGURE_SCHEDULER_PRIORITY
3026      Scheduler_priority_Node Priority;
3027    #endif
3028    #ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
3029      Scheduler_SMP_Node Simple_SMP;
3030    #endif
3031    #ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
3032      Scheduler_priority_SMP_Node Priority_SMP;
3033    #endif
3034    #ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
3035      Scheduler_priority_affinity_SMP_Node Priority_affinity_SMP;
3036    #endif
3037    #ifdef CONFIGURE_SCHEDULER_STRONG_APA
3038      Scheduler_strong_APA_Node Strong_APA;
3039    #endif
3040    #ifdef CONFIGURE_SCHEDULER_USER_PER_THREAD
3041      CONFIGURE_SCHEDULER_USER_PER_THREAD User;
3042    #endif
3043  } Configuration_Scheduler_node;
3044
3045  #ifdef RTEMS_SMP
3046    const size_t _Scheduler_Node_size = sizeof( Configuration_Scheduler_node );
3047  #endif
3048
3049  const size_t _Thread_Maximum_name_size = CONFIGURE_MAXIMUM_THREAD_NAME_SIZE;
3050
3051  typedef struct {
3052    Thread_Control Control;
3053    #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
3054      void *extensions[ CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1 ];
3055    #endif
3056    Configuration_Scheduler_node Scheduler_nodes[ CONFIGURE_SCHEDULER_COUNT ];
3057    RTEMS_API_Control API_RTEMS;
3058    #ifdef RTEMS_POSIX_API
3059      POSIX_API_Control API_POSIX;
3060    #endif
3061    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
3062      char name[ CONFIGURE_MAXIMUM_THREAD_NAME_SIZE ];
3063    #endif
3064    #if !defined(RTEMS_SCHEDSIM) \
3065      && defined(RTEMS_NEWLIB) \
3066      && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
3067      struct _reent Newlib;
3068    #else
3069      struct { /* Empty */ } Newlib;
3070    #endif
3071  } Configuration_Thread_control;
3072
3073  const size_t _Thread_Control_size = sizeof( Configuration_Thread_control );
3074
3075  const Thread_Control_add_on _Thread_Control_add_ons[] = {
3076    {
3077      offsetof( Configuration_Thread_control, Control.Scheduler.nodes ),
3078      offsetof( Configuration_Thread_control, Scheduler_nodes )
3079    }, {
3080      offsetof(
3081        Configuration_Thread_control,
3082        Control.API_Extensions[ THREAD_API_RTEMS ]
3083      ),
3084      offsetof( Configuration_Thread_control, API_RTEMS )
3085    }, {
3086      offsetof(
3087        Configuration_Thread_control,
3088        Control.libc_reent
3089      ),
3090      offsetof( Configuration_Thread_control, Newlib )
3091    }
3092    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
3093      , {
3094        offsetof(
3095          Configuration_Thread_control,
3096          Control.Join_queue.Queue.name
3097        ),
3098        offsetof( Configuration_Thread_control, name )
3099      }
3100    #endif
3101    #ifdef RTEMS_POSIX_API
3102      , {
3103        offsetof(
3104          Configuration_Thread_control,
3105          Control.API_Extensions[ THREAD_API_POSIX ]
3106        ),
3107        offsetof( Configuration_Thread_control, API_POSIX )
3108      }
3109    #endif
3110  };
3111
3112  const size_t _Thread_Control_add_on_count =
3113    RTEMS_ARRAY_SIZE( _Thread_Control_add_ons );
3114
3115  const uint32_t _Watchdog_Nanoseconds_per_tick =
3116    1000 * CONFIGURE_MICROSECONDS_PER_TICK;
3117
3118  const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND;
3119
3120  const uint64_t _Watchdog_Monotonic_max_seconds =
3121    UINT64_MAX / _CONFIGURE_TICKS_PER_SECOND;
3122
3123  /**
3124   * This is the Classic API Configuration Table.
3125   */
3126  rtems_api_configuration_table Configuration_RTEMS_API = {
3127    _CONFIGURE_TASKS,
3128    CONFIGURE_MAXIMUM_TIMERS + _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER,
3129    _CONFIGURE_SEMAPHORES,
3130    CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
3131    CONFIGURE_MAXIMUM_PARTITIONS,
3132    CONFIGURE_MAXIMUM_REGIONS,
3133    CONFIGURE_MAXIMUM_PORTS,
3134    CONFIGURE_MAXIMUM_PERIODS,
3135    _CONFIGURE_BARRIERS,
3136    CONFIGURE_INIT_TASK_TABLE_SIZE,
3137    CONFIGURE_INIT_TASK_TABLE
3138  };
3139
3140  #ifdef RTEMS_POSIX_API
3141    /**
3142     * This is the POSIX API Configuration Table.
3143     */
3144    posix_api_configuration_table Configuration_POSIX_API = {
3145      _CONFIGURE_POSIX_THREADS,
3146      CONFIGURE_MAXIMUM_POSIX_TIMERS,
3147      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
3148      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
3149      CONFIGURE_MAXIMUM_POSIX_SEMAPHORES,
3150      CONFIGURE_MAXIMUM_POSIX_SHMS,
3151      CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
3152      CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
3153    };
3154  #endif
3155
3156  /**
3157   * This variable specifies the minimum stack size for tasks in an RTEMS
3158   * application.
3159   *
3160   * NOTE: This is left as a simple uint32_t so it can be externed as
3161   *       needed without requring being high enough logical to
3162   *       include the full configuration table.
3163   */
3164  uint32_t rtems_minimum_stack_size =
3165    CONFIGURE_MINIMUM_TASK_STACK_SIZE;
3166
3167  /**
3168   * This is the primary Configuration Table for this application.
3169   */
3170  const rtems_configuration_table Configuration = {
3171    CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
3172    _CONFIGURE_STACK_SPACE_SIZE,               /* required stack space */
3173    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
3174    _CONFIGURE_POSIX_KEYS,                     /* POSIX keys are always */
3175    CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS,  /*   enabled */
3176    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
3177    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
3178    CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
3179    CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
3180    CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
3181    CONFIGURE_TASK_STACK_ALLOCATOR_INIT,      /* stack allocator init */
3182    CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
3183    CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
3184    CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */
3185    #ifdef CONFIGURE_UNIFIED_WORK_AREAS       /* true for unified work areas */
3186      true,
3187    #else
3188      false,
3189    #endif
3190    #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE /* true to avoid
3191                                                 work space for thread stack
3192                                                 allocation */
3193      true,
3194    #else
3195      false,
3196    #endif
3197    #ifdef RTEMS_SMP
3198      #ifdef _CONFIGURE_SMP_APPLICATION
3199        true,
3200      #else
3201        false,
3202      #endif
3203    #endif
3204    _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
3205    CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
3206    #if defined(RTEMS_MULTIPROCESSING)
3207      CONFIGURE_MULTIPROCESSING_TABLE,        /* pointer to MP config table */
3208    #endif
3209    #ifdef RTEMS_SMP
3210      CONFIGURE_MAXIMUM_PROCESSORS,
3211    #endif
3212  };
3213#endif
3214
3215#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
3216
3217#if defined(RTEMS_SMP)
3218 /*
3219  * Instantiate the Per CPU information based upon the user configuration.
3220  */
3221 #if defined(CONFIGURE_INIT)
3222   Per_CPU_Control_envelope _Per_CPU_Information[CONFIGURE_MAXIMUM_PROCESSORS];
3223 #endif
3224
3225#endif
3226
3227/*
3228 *  If the user has configured a set of Classic API Initialization Tasks,
3229 *  then we need to install the code that runs that loop.
3230 */
3231#ifdef CONFIGURE_INIT
3232  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
3233      defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
3234    RTEMS_SYSINIT_ITEM(
3235      _RTEMS_tasks_Initialize_user_tasks_body,
3236      RTEMS_SYSINIT_CLASSIC_USER_TASKS,
3237      RTEMS_SYSINIT_ORDER_MIDDLE
3238    );
3239  #endif
3240#endif
3241
3242/*
3243 *  If the user has configured a set of POSIX Initialization Threads,
3244 *  then we need to install the code that runs that loop.
3245 */
3246#ifdef RTEMS_POSIX_API
3247  #ifdef CONFIGURE_INIT
3248    #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
3249        defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
3250      RTEMS_SYSINIT_ITEM(
3251        _POSIX_Threads_Initialize_user_threads_body,
3252        RTEMS_SYSINIT_POSIX_USER_THREADS,
3253        RTEMS_SYSINIT_ORDER_MIDDLE
3254      );
3255    #endif
3256  #endif
3257#endif
3258
3259/*
3260 *  Select PCI Configuration Library
3261 */
3262#ifdef RTEMS_PCI_CONFIG_LIB
3263  #ifdef CONFIGURE_INIT
3264    #define PCI_LIB_NONE 0
3265    #define PCI_LIB_AUTO 1
3266    #define PCI_LIB_STATIC 2
3267    #define PCI_LIB_READ 3
3268    #define PCI_LIB_PERIPHERAL 4
3269    #if CONFIGURE_PCI_LIB == PCI_LIB_AUTO
3270      #define PCI_CFG_AUTO_LIB
3271      #include <pci/cfg.h>
3272      struct pci_bus pci_hb;
3273      #define PCI_LIB_INIT pci_config_auto
3274      #define PCI_LIB_CONFIG pci_config_auto_register
3275    #elif CONFIGURE_PCI_LIB == PCI_LIB_STATIC
3276      #define PCI_CFG_STATIC_LIB
3277      #include <pci/cfg.h>
3278      #define PCI_LIB_INIT pci_config_static
3279      #define PCI_LIB_CONFIG NULL
3280      /* Let user define PCI configuration (struct pci_bus pci_hb) */
3281    #elif CONFIGURE_PCI_LIB == PCI_LIB_READ
3282      #define PCI_CFG_READ_LIB
3283      #include <pci/cfg.h>
3284      #define PCI_LIB_INIT pci_config_read
3285      #define PCI_LIB_CONFIG NULL
3286      struct pci_bus pci_hb;
3287    #elif CONFIGURE_PCI_LIB == PCI_LIB_PERIPHERAL
3288      #define PCI_LIB_INIT pci_config_peripheral
3289      #define PCI_LIB_CONFIG NULL
3290      /* Let user define PCI configuration (struct pci_bus pci_hb) */
3291    #elif CONFIGURE_PCI_LIB == PCI_LIB_NONE
3292      #define PCI_LIB_INIT NULL
3293      #define PCI_LIB_CONFIG NULL
3294      /* No PCI Configuration at all, user can use/debug access routines */
3295    #else
3296      #error NO PCI LIBRARY DEFINED
3297    #endif
3298
3299    const int pci_config_lib_type = CONFIGURE_PCI_LIB;
3300    int (*pci_config_lib_init)(void) = PCI_LIB_INIT;
3301    void (*pci_config_lib_register)(void *config) = PCI_LIB_CONFIG;
3302  #endif
3303#endif
3304
3305#ifdef __cplusplus
3306}
3307#endif
3308
3309/******************************************************************
3310 ******************************************************************
3311 ******************************************************************
3312 *         CONFIGURATION WARNINGS AND ERROR CHECKING              *
3313 ******************************************************************
3314 ******************************************************************
3315 ******************************************************************
3316 */
3317
3318#if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
3319  /**
3320   * This is a debug mechanism, so if you need to, the executable will
3321   * have a structure with various partial values.  Add to this as you
3322   * need to.  Viewing this structure in gdb combined with dumping
3323   * the Configuration structures generated should help a lot in tracing
3324   * down errors and analyzing where over and under allocations are.
3325   */
3326  typedef struct {
3327    uint32_t SYSTEM_OVERHEAD;
3328    uint32_t STATIC_EXTENSIONS;
3329    uint32_t INITIALIZATION_THREADS_STACKS;
3330
3331    uint32_t PER_INTEGER_TASK;
3332    uint32_t FP_OVERHEAD;
3333    uint32_t CLASSIC;
3334    uint32_t POSIX;
3335
3336    /* System overhead pieces */
3337    uint32_t INTERRUPT_STACK_MEMORY;
3338    uint32_t MEMORY_FOR_IDLE_TASK;
3339
3340    /* Classic API Pieces */
3341    uint32_t CLASSIC_TASKS;
3342    uint32_t TIMERS;
3343    uint32_t SEMAPHORES;
3344    uint32_t MESSAGE_QUEUES;
3345    uint32_t PARTITIONS;
3346    uint32_t REGIONS;
3347    uint32_t PORTS;
3348    uint32_t PERIODS;
3349    uint32_t BARRIERS;
3350    uint32_t USER_EXTENSIONS;
3351
3352    /* POSIX API managers that are always enabled */
3353    uint32_t POSIX_KEYS;
3354
3355#ifdef RTEMS_POSIX_API
3356    /* POSIX API Pieces */
3357    uint32_t POSIX_TIMERS;
3358    uint32_t POSIX_QUEUED_SIGNALS;
3359    uint32_t POSIX_MESSAGE_QUEUES;
3360    uint32_t POSIX_SEMAPHORES;
3361    uint32_t POSIX_SHMS;
3362#endif
3363
3364    /* Stack space sizes */
3365    uint32_t IDLE_TASKS_STACK;
3366    uint32_t INITIALIZATION_THREADS_EXTRA_STACKS;
3367    uint32_t TASKS_STACK;
3368    uint32_t POSIX_THREADS_STACK;
3369    uint32_t GOROUTINES_STACK;
3370    uint32_t ADA_TASKS_STACK;
3371    uint32_t EXTRA_MPCI_RECEIVE_SERVER_STACK;
3372    uint32_t EXTRA_TASK_STACKS;
3373  } Configuration_Debug_t;
3374
3375  Configuration_Debug_t Configuration_Memory_Debug = {
3376    /* General Information */
3377    _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD,
3378    _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS,
3379    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
3380    _CONFIGURE_MEMORY_FOR_TASKS(1, 0),
3381    _CONFIGURE_MEMORY_FOR_TASKS(0, 1),
3382    _CONFIGURE_MEMORY_FOR_CLASSIC,
3383    _CONFIGURE_MEMORY_FOR_POSIX,
3384
3385    /* System overhead pieces */
3386    _CONFIGURE_INTERRUPT_STACK_MEMORY,
3387    _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS,
3388
3389    /* Classic API Pieces */
3390    _CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
3391    _CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
3392    _CONFIGURE_MEMORY_FOR_SEMAPHORES(_CONFIGURE_SEMAPHORES),
3393    _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES),
3394    _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS),
3395    _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ),
3396    _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS),
3397    _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS),
3398    _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS),
3399    _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
3400    _CONFIGURE_MEMORY_FOR_POSIX_KEYS( _CONFIGURE_POSIX_KEYS, \
3401                                     CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ),
3402
3403#ifdef RTEMS_POSIX_API
3404    /* POSIX API Pieces */
3405    _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
3406      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
3407    _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
3408      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
3409    _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
3410    _CONFIGURE_MEMORY_FOR_POSIX_SHMS( CONFIGURE_MAXIMUM_POSIX_SHMS ),
3411    _CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
3412#endif
3413
3414    /* Stack space sizes */
3415    _CONFIGURE_IDLE_TASKS_STACK,
3416    _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
3417    _CONFIGURE_TASKS_STACK,
3418    _CONFIGURE_POSIX_THREADS_STACK,
3419    _CONFIGURE_GOROUTINES_STACK,
3420    _CONFIGURE_ADA_TASKS_STACK,
3421    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK,
3422    CONFIGURE_EXTRA_TASK_STACKS
3423  };
3424#endif
3425
3426/*
3427 *  Make sure a task/thread of some sort is configured.
3428 *
3429 *  When analyzing RTEMS to find the smallest possible of memory
3430 *  that must be allocated, you probably do want to configure 0
3431 *  tasks/threads so there is a smaller set of calls to _Workspace_Allocate
3432 *  to analyze.
3433 */
3434#if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
3435  #if (CONFIGURE_MAXIMUM_TASKS == 0) && \
3436      (CONFIGURE_MAXIMUM_POSIX_THREADS == 0) && \
3437      (CONFIGURE_MAXIMUM_ADA_TASKS == 0) && \
3438      (CONFIGURE_MAXIMUM_GOROUTINES == 0)
3439    #error "CONFIGURATION ERROR: No tasks or threads configured!!"
3440  #endif
3441#endif
3442
3443#ifndef RTEMS_SCHEDSIM
3444/*
3445 *  Make sure at least one of the initialization task/thread
3446 *  tables was defined.
3447 */
3448#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
3449    !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \
3450    !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
3451#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
3452#endif
3453#endif
3454
3455/*
3456 *  If the user is trying to configure a multiprocessing application and
3457 *  RTEMS was not configured and built multiprocessing, then error out.
3458 */
3459#if defined(CONFIGURE_MP_APPLICATION) && \
3460    !defined(RTEMS_MULTIPROCESSING)
3461#error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!"
3462#endif
3463
3464/*
3465 *  If an attempt was made to configure POSIX objects and
3466 *  the POSIX API was not configured into RTEMS, error out.
3467 *
3468 *  @note POSIX Keys are always available so the parameters
3469 *        CONFIGURE_MAXIMUM_POSIX_KEYS and
3470 *        CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS  are not in this list.
3471 */
3472#if !defined(RTEMS_POSIX_API)
3473  #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
3474       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
3475       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
3476       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
3477       (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \
3478       (CONFIGURE_MAXIMUM_POSIX_SHMS != 0) || \
3479      defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
3480  #error "CONFIGURATION ERROR: POSIX API support not configured!!"
3481  #endif
3482#endif
3483
3484#if !defined(RTEMS_SCHEDSIM)
3485  #if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE)
3486    /*
3487     *  You must either explicity include or exclude the clock driver.
3488     *  It is such a common newbie error to leave it out.  Maybe this
3489     *  will put an end to it.
3490     *
3491     *  NOTE: If you are using the timer driver, it is considered
3492     *        mutually exclusive with the clock driver because the
3493     *        drivers are assumed to use the same "timer" hardware
3494     *        on many boards.
3495     */
3496    #if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
3497        !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \
3498        !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER)
3499      #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?"
3500     #endif
3501
3502    /*
3503     * Only one of the following three configuration parameters should be
3504     * defined at a time.
3505     */
3506    #if ((defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) + \
3507          defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER) + \
3508          defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER)) > 1)
3509       #error "CONFIGURATION ERROR: More than one clock/timer driver configuration parameter specified?!?"
3510    #endif
3511  #endif /* !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE) */
3512#endif   /* !defined(RTEMS_SCHEDSIM) */
3513
3514/*
3515 *  These names have been obsoleted so make the user application stop compiling
3516 */
3517#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
3518    defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
3519    defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
3520    defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
3521    defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
3522#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
3523#endif
3524
3525/*
3526 *  Validate the configured maximum priority
3527 */
3528#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \
3529     (CONFIGURE_MAXIMUM_PRIORITY != 7) && \
3530     (CONFIGURE_MAXIMUM_PRIORITY != 15) && \
3531     (CONFIGURE_MAXIMUM_PRIORITY != 31) && \
3532     (CONFIGURE_MAXIMUM_PRIORITY != 63) && \
3533     (CONFIGURE_MAXIMUM_PRIORITY != 127) && \
3534     (CONFIGURE_MAXIMUM_PRIORITY != 255))
3535  #error "Maximum priority is not 1 less than a power of 2 between 4 and 256"
3536#endif
3537
3538#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM)
3539  #error "Maximum priority configured higher than supported by target."
3540#endif
3541
3542#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
3543  #warning "The CONFIGURE_MAXIMUM_POSIX_BARRIERS configuration option is obsolete since RTEMS 4.12"
3544#endif
3545
3546#ifdef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
3547  #warning "The CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES configuration option is obsolete since RTEMS 4.12"
3548#endif
3549
3550#ifdef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
3551  #warning "The CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS configuration option is obsolete since RTEMS 4.12"
3552#endif
3553
3554#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
3555  #warning "The CONFIGURE_MAXIMUM_POSIX_MUTEXES configuration option is obsolete since RTEMS 4.12"
3556#endif
3557
3558#ifdef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
3559  #warning "The CONFIGURE_MAXIMUM_POSIX_RWLOCKS configuration option is obsolete since RTEMS 4.12"
3560#endif
3561
3562#ifdef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
3563  #warning "The CONFIGURE_MAXIMUM_POSIX_SPINLOCKS configuration option is obsolete since RTEMS 4.12"
3564#endif
3565
3566/*
3567 * POSIX Key pair shouldn't be less than POSIX Key, which is highly
3568 * likely to be error.
3569 */
3570#if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \
3571    (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0)
3572  #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < CONFIGURE_MAXIMUM_POSIX_KEYS)
3573    #error "Fewer POSIX Key pairs than POSIX Key!"
3574  #endif
3575#endif
3576
3577/*
3578 * IMFS block size for in memory files (memfiles) must be a power of
3579 * two between 16 and 512 inclusive.
3580 */
3581#if ((CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 16) && \
3582     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 32) && \
3583     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 64) && \
3584     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 128) && \
3585     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 256) && \
3586     (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 512))
3587  #error "IMFS Memfile block size must be a power of 2 between 16 and 512"
3588#endif
3589
3590
3591#endif
3592/* end of include file */
Note: See TracBrowser for help on using the repository browser.