source: rtems/cpukit/include/rtems/confdefs.h @ 0f8e139e

5
Last change on this file since 0f8e139e was 0f8e139e, checked in by Sebastian Huber <sebastian.huber@…>, on 02/15/20 at 13:00:08

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

Remove comments and copyrightable content from the moved content. Use
BSD-2-Clause for new file according to file history of
<rtems/confdefs.h>.

Update #3053.
Update #3875.

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