source: rtems/cpukit/include/rtems/confdefs.h @ cadd8d1

5
Last change on this file since cadd8d1 was cadd8d1, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 14, 2020 at 3:50:18 PM

config: Add <rtems/confdefs/obsolete.h>

Unify handling of obsolete configuration options. Remove comments and
copyrightable content from the moved content. Use BSD-2-Clause license
for new file.

Update #3053.
Update #3875.

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