source: rtems/cpukit/include/rtems/confdefs.h @ 9520ec3

5
Last change on this file since 9520ec3 was 9520ec3, checked in by Sebastian Huber <sebastian.huber@…>, on 02/14/20 at 08:31:44

config: Simplify initialization task config

With the removal of the CONFIGURE_HAS_OWN_INIT_TASK_TABLE configuration
option at most one Classic API user initialization task can be
configured.

Provide an RTEMS API configuration table for backward compatibility.

Update #3873.

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