source: rtems/cpukit/sapi/include/confdefs.h @ bc5b56a

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

libio: Use API mutex

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