source: rtems/cpukit/sapi/include/confdefs.h @ 263f4bec

4.115
Last change on this file since 263f4bec was 263f4bec, checked in by Sebastian Huber <sebastian.huber@…>, on 04/07/14 at 12:50:37

score: Statically initialize IO manager

This simplifies the RTEMS initialization and helps to avoid a memory
overhead. The workspace demands of the IO manager were not included in
the <rtems/confdefs.h> workspace size estimate. This is also fixed as a
side-effect.

Update documentation and move "Specifying Application Defined Device
Driver Table" to the section end. This sub-section is not that
important for the user. Mentioning this at the beginning may lead to
confusion.

  • Property mode set to 100644
File size: 91.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 * The model is to estimate the memory required for each configured item
13 * and sum those estimates.  The estimate can be too high or too low for
14 * a variety of reasons:
15 *
16 * Reasons estimate is too high:
17 *   + FP contexts (not all tasks are FP)
18 *
19 * Reasons estimate is too low:
20 *   + stacks greater than minimum size
21 *   + messages
22 *   + application must account for device driver resources
23 *   + application must account for add-on library resource requirements
24 *
25 * NOTE:  Eventually this may be able to take into account some of
26 *        the above.  This procedure has evolved from just enough to
27 *        support the RTEMS Test Suites into something that can be
28 *        used remarkably reliably by most applications.
29 */
30
31/*
32 *  COPYRIGHT (c) 1989-2014.
33 *  On-Line Applications Research Corporation (OAR).
34 *
35 *  The license and distribution terms for this file may be
36 *  found in the file LICENSE in this distribution or at
37 *  http://www.rtems.org/license/LICENSE.
38 */
39
40#ifndef __CONFIGURATION_TEMPLATE_h
41#define __CONFIGURATION_TEMPLATE_h
42
43/*
44 * Include the executive's configuration
45 */
46#include <rtems.h>
47#include <rtems/score/apimutex.h>
48#include <rtems/score/wkspace.h>
49
50#ifdef CONFIGURE_DISABLE_BSP_SETTINGS
51  #undef BSP_DEFAULT_UNIFIED_WORK_AREAS
52  #undef BSP_IDLE_TASK_BODY
53  #undef BSP_IDLE_TASK_STACK_SIZE
54  #undef BSP_INITIAL_EXTENSION
55  #undef BSP_INTERRUPT_STACK_SIZE
56  #undef BSP_MAXIMUM_DEVICES
57  #undef BSP_ZERO_WORKSPACE_AUTOMATICALLY
58  #undef CONFIGURE_BSP_PREREQUISITE_DRIVERS
59  #undef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
60#else
61  #include <bsp.h>
62#endif
63
64#ifdef RTEMS_NEWLIB
65  #include <sys/reent.h>
66#endif
67
68#ifdef __cplusplus
69extern "C" {
70#endif
71
72extern rtems_initialization_tasks_table Initialization_tasks[];
73#if defined(RTEMS_MULTIPROCESSING)
74  extern rtems_multiprocessing_table      Multiprocessing_configuration;
75#endif
76#ifdef RTEMS_POSIX_API
77  extern posix_api_configuration_table    Configuration_POSIX_API;
78#endif
79
80/**
81 * This macro determines whether the RTEMS reentrancy support for
82 * the Newlib C Library is enabled.
83 */
84#ifdef RTEMS_SCHEDSIM
85  #undef RTEMS_NEWLIB
86#endif
87
88#if (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
89  #define CONFIGURE_NEWLIB_EXTENSION 1
90#else
91  #define CONFIGURE_NEWLIB_EXTENSION 0
92#endif
93
94#ifndef RTEMS_SCHEDSIM
95#include <rtems/libio.h>
96
97#ifdef CONFIGURE_INIT
98const rtems_libio_helper rtems_libio_init_helper =
99  #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
100    rtems_libio_helper_null;
101  #else
102    rtems_libio_init;
103  #endif
104
105const rtems_libio_helper rtems_libio_post_driver_helper =
106  #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
107    rtems_libio_helper_null;
108  #else
109    rtems_libio_post_driver;
110  #endif
111
112const rtems_libio_helper rtems_libio_exit_helper =
113  #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
114    rtems_libio_helper_null;
115  #else
116    rtems_libio_exit;
117  #endif
118
119const rtems_libio_helper rtems_fs_init_helper =
120  #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
121    rtems_libio_helper_null;
122  #else
123    rtems_filesystem_initialize;
124  #endif
125#endif
126#endif
127
128/*
129 *  If the application disables the filesystem, they will not need
130 *  a mount table, so do not produce one.
131 */
132#ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
133  #define CONFIGURE_HAS_OWN_MOUNT_TABLE
134#endif
135
136/**
137 * This macro defines the number of POSIX file descriptors allocated
138 * and managed by libio.  These are the "integer" file descriptors that
139 * are used by calls like open(2) and read(2).
140 */
141#ifndef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
142  #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 3
143#endif
144
145/**
146 * Semaphore count used by the IO library.
147 */
148#define CONFIGURE_LIBIO_SEMAPHORES 1
149
150/**
151 * POSIX key count used by the IO library.
152 */
153#define CONFIGURE_LIBIO_POSIX_KEYS 1
154
155#ifdef CONFIGURE_INIT
156  /**
157   * When instantiating the configuration tables, this variable is
158   * initialized to specify the maximum number of file descriptors.
159   */
160  uint32_t rtems_libio_number_iops = CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS;
161#endif
162
163/**
164 * This macro determines if termios is disabled by this application.
165 * This only means that resources will not be reserved.  If you end
166 * up using termios, it will fail.
167 */
168#ifdef CONFIGURE_TERMIOS_DISABLED
169  #define CONFIGURE_TERMIOS_SEMAPHORES 0
170#else
171  /**
172   * This macro specifies the number of serial or PTY ports that will
173   * use termios.
174   */
175  #ifndef CONFIGURE_NUMBER_OF_TERMIOS_PORTS
176  #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1
177  #endif
178
179  /**
180   * This macro reserves the number of semaphores required by termios
181   * based upon the number of communication ports that will use it.
182   */
183  #define CONFIGURE_TERMIOS_SEMAPHORES \
184    ((CONFIGURE_NUMBER_OF_TERMIOS_PORTS * 4) + 1)
185#endif
186
187/**
188 * This macro specifies the number of PTYs that can be concurrently
189 * active.
190 */
191#ifndef CONFIGURE_MAXIMUM_PTYS
192  #define CONFIGURE_MAXIMUM_PTYS 0
193#endif
194
195/**
196 * This variable contains the maximum number of PTYs that can be
197 * concurrently active.
198 */
199#ifdef CONFIGURE_INIT
200  int rtems_telnetd_maximum_ptys = CONFIGURE_MAXIMUM_PTYS;
201#else
202  extern int rtems_telnetd_maximum_ptys;
203#endif
204
205#if defined(RTEMS_SMP)
206  /*
207   *  If configured for SMP, then we need to know the maximum CPU cores.
208   */
209  #if !defined(CONFIGURE_SMP_APPLICATION)
210    #if !defined(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
211      #define CONFIGURE_SMP_MAXIMUM_PROCESSORS 1
212    #endif
213  #else
214    #if !defined(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
215      #error "CONFIGURE_SMP_MAXIMUM_PROCESSORS not specified for SMP Application"
216    #endif
217  #endif
218#endif
219
220/*
221 *  Filesystems and Mount Table Configuration.
222 *
223 *  Defines to control the file system:
224 *
225 *   CONFIGURE_APPLICATION_DISABLE_FILESYSTEM:
226 *     Disable the RTEMS filesystems. You get an empty DEVFS.
227 *
228 *   CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM:
229 *     Use the DEVFS as the root file system. Limited functions are
230 *     provided when this is used.
231 *
232 *   CONFIGURE_FILESYSTEM_ALL:
233 *     Add file filesystems to the default filesystem table.
234 *
235 *   List of available file systems. You can define as many as you like:
236 *     CONFIGURE_FILESYSTEM_MINIIMFS - MiniIMFS, use DEVFS now
237 *     CONFIGURE_FILESYSTEM_IMFS     - In Memory File System (IMFS)
238 *     CONFIGURE_FILESYSTEM_DEVFS    - Device File System (DSVFS)
239 *     CONFIGURE_FILESYSTEM_TFTPFS   - TFTP File System, networking enabled
240 *     CONFIGURE_FILESYSTEM_FTPFS    - FTP File System, networking enabled
241 *     CONFIGURE_FILESYSTEM_NFS      - Network File System, networking enabled
242 *     CONFIGURE_FILESYSTEM_DOSFS    - DOS File System, uses libblock
243 *     CONFIGURE_FILESYSTEM_RFS      - RTEMS File System (RFS), uses libblock
244 *     CONFIGURE_FILESYSTEM_JFFS2    - Journalling Flash File System, Version 2
245 *
246 *   Combinations:
247 *
248 *    - If nothing is defined the base file system is the IMFS.
249 *
250 *    - If CONFIGURE_APPLICATION_DISABLE_FILESYSTEM is defined all filesystem
251 *      are disabled by force and an empty DEVFS is created.
252 *
253 *    - If CONFIGURE_USE_DEV_AS_BASE_FILESYSTEM is defined all filesystem
254 *      are disabled by force and DEVFS is defined.
255 */
256
257#ifdef CONFIGURE_INIT
258
259  /*
260   * Include all file systems. Do this before checking if the filesystem has
261   * been disabled.
262   */
263  #ifdef CONFIGURE_FILESYSTEM_ALL
264    #define CONFIGURE_FILESYSTEM_MINIIMFS
265    #define CONFIGURE_FILESYSTEM_IMFS
266    #define CONFIGURE_FILESYSTEM_DEVFS
267    #define CONFIGURE_FILESYSTEM_TFTPFS
268    #define CONFIGURE_FILESYSTEM_FTPFS
269    #define CONFIGURE_FILESYSTEM_NFS
270    #define CONFIGURE_FILESYSTEM_DOSFS
271    #define CONFIGURE_FILESYSTEM_RFS
272    #define CONFIGURE_FILESYSTEM_JFFS2
273  #endif
274
275  /*
276   * If disabling the file system, give a compile error if the user has
277   * configured other filesystem parameters.
278   */
279  #if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
280     #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) || \
281         defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
282       #error "Filesystem disabled but a base filesystem configured."
283     #endif
284
285    #if defined(CONFIGURE_FILESYSTEM_MINIIMFS) || \
286        defined(CONFIGURE_FILESYSTEM_IMFS) || \
287        defined(CONFIGURE_FILESYSTEM_DEVFS) || \
288        defined(CONFIGURE_FILESYSTEM_TFTPFS) || \
289        defined(CONFIGURE_FILESYSTEM_FTPFS) || \
290        defined(CONFIGURE_FILESYSTEM_NFS) || \
291        defined(CONFIGURE_FILESYSTEM_DOSFS) || \
292        defined(CONFIGURE_FILESYSTEM_RFS) || \
293        defined(CONFIGURE_FILESYSTEM_JFFS2)
294        #error "Configured filesystems but root filesystem was not IMFS!"
295        #error "Filesystems could be disabled, DEVFS is root, or"
296        #error "  miniIMFS is root!"
297     #endif
298  #endif
299
300  /*
301   * If the base filesystem is DEVFS define it else define IMFS.
302   * We will have either DEVFS or IMFS defined after this.
303   */
304  #if !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
305    #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
306      #define CONFIGURE_FILESYSTEM_DEVFS
307    #elif defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
308      #define CONFIGURE_FILESYSTEM_MINIIMFS
309    #elif !defined(CONFIGURE_FILESYSTEM_IMFS)
310      #define CONFIGURE_FILESYSTEM_IMFS
311    #endif
312  #endif
313
314#endif
315
316#ifndef RTEMS_SCHEDSIM
317/**
318 * IMFS
319 */
320#include <rtems/imfs.h>
321
322/**
323 * This specifies the number of bytes per block for files within the IMFS.
324 * There are a maximum number of blocks per file so this dictates the maximum
325 * size of a file.  This has to be balanced with the unused portion of each
326 * block that might be wasted.
327 */
328#ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK
329  #define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK \
330                    IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK
331#endif
332
333/**
334 * This defines the miniIMFS file system table entry.
335 */
336#if !defined(CONFIGURE_FILESYSTEM_ENTRY_miniIMFS) && \
337    defined(CONFIGURE_FILESYSTEM_MINIIMFS)
338  #define CONFIGURE_FILESYSTEM_ENTRY_miniIMFS \
339    { RTEMS_FILESYSTEM_TYPE_MINIIMFS, miniIMFS_initialize }
340#endif
341#endif
342
343/**
344 * Internall it is called FIFOs not pipes
345 */
346#if defined(CONFIGURE_PIPES_ENABLED)
347  #define CONFIGURE_FIFOS_ENABLED
348#endif
349
350#ifndef RTEMS_SCHEDSIM
351/**
352 * This defines the IMFS file system table entry.
353 */
354#if !defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS) && \
355    defined(CONFIGURE_FILESYSTEM_IMFS)
356  #if defined(CONFIGURE_FIFOS_ENABLED)
357    #define CONFIGURE_FILESYSTEM_ENTRY_IMFS \
358      { RTEMS_FILESYSTEM_TYPE_IMFS, fifoIMFS_initialize }
359  #else
360    #define CONFIGURE_FILESYSTEM_ENTRY_IMFS \
361      { RTEMS_FILESYSTEM_TYPE_IMFS, IMFS_initialize }
362  #endif
363#endif
364#endif
365
366/**
367 * This sets up the resources for the PIPES/FIFOs
368 */
369#if defined(CONFIGURE_FIFOS_ENABLED)
370  #if !defined(CONFIGURE_MAXIMUM_FIFOS) && !defined(CONFIGURE_MAXIMUM_PIPES)
371     #error "No FIFOs or PIPES configured"
372  #endif
373  #if !defined(CONFIGURE_MAXIMUM_FIFOS)
374    #define CONFIGURE_MAXIMUM_FIFOS 0
375  #endif
376  #if !defined(CONFIGURE_MAXIMUM_PIPES)
377    #define CONFIGURE_MAXIMUM_PIPES 0
378  #endif
379  #define CONFIGURE_BARRIERS_FOR_FIFOS \
380    (2 * (CONFIGURE_MAXIMUM_FIFOS + CONFIGURE_MAXIMUM_PIPES))
381  #define CONFIGURE_SEMAPHORES_FOR_FIFOS \
382    (1 + (CONFIGURE_MAXIMUM_FIFOS + CONFIGURE_MAXIMUM_PIPES))
383#else
384  #define CONFIGURE_BARRIERS_FOR_FIFOS   0
385  #define CONFIGURE_SEMAPHORES_FOR_FIFOS 0
386#endif
387
388/**
389 * DEVFS
390 */
391#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS) && \
392    defined(CONFIGURE_FILESYSTEM_DEVFS)
393#include <rtems/devfs.h>
394  #define CONFIGURE_FILESYSTEM_ENTRY_DEVFS \
395    { RTEMS_FILESYSTEM_TYPE_DEVFS, devFS_initialize }
396#endif
397
398#ifdef RTEMS_NETWORKING
399  /**
400   * FTPFS
401   */
402  #if !defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS) && \
403      defined(CONFIGURE_FILESYSTEM_FTPFS)
404    #include <rtems/ftpfs.h>
405    #define CONFIGURE_FILESYSTEM_ENTRY_FTPFS \
406      { RTEMS_FILESYSTEM_TYPE_FTPFS, rtems_ftpfs_initialize }
407  #endif
408
409  /**
410   * TFTPFS
411   */
412  #if !defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS) && \
413      defined(CONFIGURE_FILESYSTEM_TFTPFS)
414    #include <rtems/tftp.h>
415    #define CONFIGURE_FILESYSTEM_ENTRY_TFTPFS \
416      { RTEMS_FILESYSTEM_TYPE_TFTPFS, rtems_tftpfs_initialize }
417  #endif
418
419  /**
420   * NFS
421   */
422  #if !defined(CONFIGURE_FILESYSTEM_ENTRY_NFS) && \
423      defined(CONFIGURE_FILESYSTEM_NFS)
424    #include <librtemsNfs.h>
425    #define CONFIGURE_FILESYSTEM_ENTRY_NFS \
426      { RTEMS_FILESYSTEM_TYPE_NFS, rtems_nfs_initialize }
427  #endif
428#endif
429
430/**
431 * DOSFS
432 */
433#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS) && \
434    defined(CONFIGURE_FILESYSTEM_DOSFS)
435  #include <rtems/dosfs.h>
436  #define CONFIGURE_FILESYSTEM_ENTRY_DOSFS \
437    { RTEMS_FILESYSTEM_TYPE_DOSFS, rtems_dosfs_initialize }
438#endif
439
440/**
441 * RFS
442 */
443#if !defined(CONFIGURE_FILESYSTEM_ENTRY_RFS) && \
444    defined(CONFIGURE_FILESYSTEM_RFS)
445  #include <rtems/rtems-rfs.h>
446  #define CONFIGURE_FILESYSTEM_ENTRY_RFS \
447    { RTEMS_FILESYSTEM_TYPE_RFS, rtems_rfs_rtems_initialise }
448#endif
449
450/**
451 * JFFS2
452 */
453#if !defined(CONFIGURE_FILESYSTEM_ENTRY_JFFS2) && \
454    defined(CONFIGURE_FILESYSTEM_JFFS2)
455  #include <rtems/jffs2.h>
456  #define CONFIGURE_FILESYSTEM_ENTRY_JFFS2 \
457    { RTEMS_FILESYSTEM_TYPE_JFFS2, rtems_jffs2_initialize }
458#endif
459
460#ifdef CONFIGURE_INIT
461
462  /**
463   * DEVFS variables.
464   *
465   * The number of individual devices that may be registered
466   * in the system or the CONFIGURE_MAXIMUM_DEVICES variable
467   * is defaulted to 4 when a filesystem is enabled, unless
468   * the bsp overwrides this.  In which case the value is set
469   * to BSP_MAXIMUM_DEVICES.
470   */
471  #ifdef CONFIGURE_FILESYSTEM_DEVFS
472    #ifndef CONFIGURE_MAXIMUM_DEVICES
473      #if defined(BSP_MAXIMUM_DEVICES)
474        #define CONFIGURE_MAXIMUM_DEVICES BSP_MAXIMUM_DEVICES
475      #else
476        #define CONFIGURE_MAXIMUM_DEVICES 4
477      #endif
478    #endif
479    #include <rtems/devfs.h>
480  #endif
481
482#ifndef RTEMS_SCHEDSIM
483  #if defined(CONFIGURE_FILESYSTEM_IMFS) || \
484      defined(CONFIGURE_FILESYSTEM_MINIIMFS)
485    int imfs_rq_memfile_bytes_per_block = CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
486  #endif
487#endif
488
489  /**
490   * Table termination record.
491   */
492  #define CONFIGURE_FILESYSTEM_NULL { NULL, NULL }
493
494#ifndef RTEMS_SCHEDSIM
495  /**
496   * The default file system table. Must be terminated with the NULL entry if
497   * you provide your own.
498   */
499  #ifndef CONFIGURE_HAS_OWN_FILESYSTEM_TABLE
500    const rtems_filesystem_table_t rtems_filesystem_table[] = {
501      #if defined(CONFIGURE_FILESYSTEM_MINIIMFS) && \
502          defined(CONFIGURE_FILESYSTEM_ENTRY_miniIMFS)
503        CONFIGURE_FILESYSTEM_ENTRY_miniIMFS,
504      #endif
505      #if defined(CONFIGURE_FILESYSTEM_IMFS) && \
506          defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS)
507        CONFIGURE_FILESYSTEM_ENTRY_IMFS,
508      #endif
509      #if defined(CONFIGURE_FILESYSTEM_DEVFS) && \
510          defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS)
511        CONFIGURE_FILESYSTEM_ENTRY_DEVFS,
512      #endif
513      #if defined(CONFIGURE_FILESYSTEM_TFTPFS) && \
514          defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS)
515        CONFIGURE_FILESYSTEM_ENTRY_TFTPFS,
516      #endif
517      #if defined(CONFIGURE_FILESYSTEM_FTPFS) && \
518          defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS)
519        CONFIGURE_FILESYSTEM_ENTRY_FTPFS,
520      #endif
521      #if defined(CONFIGURE_FILESYSTEM_NFS) && \
522          defined(CONFIGURE_FILESYSTEM_ENTRY_NFS)
523        CONFIGURE_FILESYSTEM_ENTRY_NFS,
524      #endif
525      #if defined(CONFIGURE_FILESYSTEM_DOSFS) && \
526          defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS)
527        CONFIGURE_FILESYSTEM_ENTRY_DOSFS,
528      #endif
529      #if defined(CONFIGURE_FILESYSTEM_RFS) && \
530          defined(CONFIGURE_FILESYSTEM_ENTRY_RFS)
531        CONFIGURE_FILESYSTEM_ENTRY_RFS,
532      #endif
533      #if defined(CONFIGURE_FILESYSTEM_JFFS2) && \
534          defined(CONFIGURE_FILESYSTEM_ENTRY_JFFS2)
535        CONFIGURE_FILESYSTEM_ENTRY_JFFS2,
536      #endif
537      CONFIGURE_FILESYSTEM_NULL
538    };
539  #endif
540
541  #ifndef CONFIGURE_HAS_OWN_MOUNT_TABLE
542    #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
543      static devFS_node devFS_root_filesystem_nodes [CONFIGURE_MAXIMUM_DEVICES];
544      static const devFS_data devFS_root_filesystem_data = {
545        devFS_root_filesystem_nodes,
546        CONFIGURE_MAXIMUM_DEVICES
547      };
548    #endif
549    const rtems_filesystem_mount_configuration
550      rtems_filesystem_root_configuration = {
551      NULL,
552      NULL,
553      #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
554        RTEMS_FILESYSTEM_TYPE_DEVFS,
555      #elif defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
556        RTEMS_FILESYSTEM_TYPE_MINIIMFS,
557      #else
558        RTEMS_FILESYSTEM_TYPE_IMFS,
559      #endif
560      RTEMS_FILESYSTEM_READ_WRITE,
561      #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
562        &devFS_root_filesystem_data
563      #else
564        NULL
565      #endif
566    };
567  #endif
568
569#endif
570#endif
571
572/*
573 *  STACK_CHECKER_ON was still available in 4.9 so give a warning for now.
574 */
575#if defined(STACK_CHECKER_ON)
576  #define CONFIGURE_STACK_CHECKER_ENABLED
577  #warning "STACK_CHECKER_ON deprecated -- use CONFIGURE_STACK_CHECKER_ENABLED"
578#endif
579
580/**
581 * This configures the stack checker user extension.
582 */
583#ifdef CONFIGURE_STACK_CHECKER_ENABLED
584  #define CONFIGURE_STACK_CHECKER_EXTENSION 1
585#else
586  #define CONFIGURE_STACK_CHECKER_EXTENSION 0
587#endif
588
589/**
590 * @brief Maximum priority configuration.
591 *
592 * This configures the maximum priority value that
593 * a task may have.
594 *
595 * The following applies to the data space requirements
596 * of the Priority Scheduler.
597 *
598 * By reducing the number of priorities in a system,
599 * the amount of RAM required by RTEMS can be significantly
600 * reduced.  RTEMS allocates a Chain_Control structure per
601 * priority and this structure contains 3 pointers.  So
602 * the default is (256 * 12) = 3K on 32-bit architectures.
603 *
604 * This must be one less than a power of 2 between
605 * 4 and 256.  Valid values along with the application
606 * priority levels and memory saved when pointers are
607 * 32-bits in size are:
608 *
609 *   + 3,  2 application priorities, 3024 bytes saved
610 *   + 7, 5 application priorities, 2976 bytes saved
611 *   + 15, 13 application priorities, 2880 bytes saved
612 *   + 31, 29 application priorities, 2688 bytes saved
613 *   + 63, 61 application priorities, 2304 bytes saved
614 *   + 127, 125 application priorities, 1536 bytes saved
615 *   + 255, 253 application priorities, 0 bytes saved
616 *
617 * It is specified in terms of Classic API priority values.
618 */
619#ifndef CONFIGURE_MAXIMUM_PRIORITY
620  #define CONFIGURE_MAXIMUM_PRIORITY PRIORITY_DEFAULT_MAXIMUM
621#endif
622
623/*
624 * Scheduler configuration.
625 *
626 * The scheduler configuration allows an application to select the
627 * scheduling policy to use.  The supported configurations are:
628 *  CONFIGURE_SCHEDULER_USER       - user provided scheduler
629 *  CONFIGURE_SCHEDULER_PRIORITY   - Deterministic Priority Scheduler
630 *  CONFIGURE_SCHEDULER_PRIORITY_SMP - Deterministic Priority SMP Scheduler
631 *  CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP - Deterministic Priority SMP Affinity Scheduler
632 *  CONFIGURE_SCHEDULER_SIMPLE     - Light-weight Priority Scheduler
633 *  CONFIGURE_SCHEDULER_SIMPLE_SMP - Simple SMP Priority Scheduler
634 *  CONFIGURE_SCHEDULER_EDF        - EDF Scheduler
635 *  CONFIGURE_SCHEDULER_CBS        - CBS Scheduler
636 *
637 * If no configuration is specified by the application, then
638 * CONFIGURE_SCHEDULER_PRIORITY is assumed to be the default.
639 *
640 * An application can define its own scheduling policy by defining
641 * CONFIGURE_SCHEDULER_USER and the following:
642 *    - CONFIGURE_SCHEDULER_ENTRY_POINTS
643 *    - CONFIGURE_MEMORY_FOR_SCHEDULER - base memory
644 *    - CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER - per task memory
645 */
646#include <rtems/score/scheduler.h>
647
648#if !defined(RTEMS_SMP)
649  #undef CONFIGURE_SCHEDULER_SIMPLE_SMP
650#endif
651
652/* If no scheduler is specified, the priority scheduler is default. */
653#if !defined(CONFIGURE_SCHEDULER_USER) && \
654    !defined(CONFIGURE_SCHEDULER_PRIORITY) && \
655    !defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) && \
656    !defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) && \
657    !defined(CONFIGURE_SCHEDULER_SIMPLE) && \
658    !defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) && \
659    !defined(CONFIGURE_SCHEDULER_EDF) && \
660    !defined(CONFIGURE_SCHEDULER_CBS)
661  #if defined(RTEMS_SMP) && defined(CONFIGURE_SMP_APPLICATION)
662    #define CONFIGURE_SCHEDULER_PRIORITY_SMP
663  #else
664    #define CONFIGURE_SCHEDULER_PRIORITY
665  #endif
666#endif
667
668/*
669 * If the Priority Scheduler is selected, then configure for it.
670 */
671#if defined(CONFIGURE_SCHEDULER_PRIORITY)
672  #include <rtems/score/schedulerpriority.h>
673  #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_ENTRY_POINTS
674
675  /**
676   * This defines the memory used by the priority scheduler.
677   */
678  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
679    _Configure_From_workspace( \
680      sizeof(Scheduler_priority_Control) +  \
681      ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
682  )
683  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
684    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
685#endif
686
687/*
688 * If the Deterministic Priority SMP Scheduler is selected, then configure for
689 * it.
690 */
691#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
692  #include <rtems/score/schedulerprioritysmp.h>
693  #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_SMP_ENTRY_POINTS
694
695  /**
696   * This defines the memory used by the priority scheduler.
697   */
698  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
699    _Configure_From_workspace( \
700      sizeof(Scheduler_priority_SMP_Control) +  \
701      ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
702  )
703  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
704    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
705#endif
706
707/*
708 * If the Deterministic Priority Affinity SMP Scheduler is selected, then configure for
709 * it.
710 */
711#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP)
712  #include <rtems/score/schedulerpriorityaffinitysmp.h>
713  #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS
714
715  /**
716   * This defines the memory used by the priority scheduler.
717   */
718  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
719    _Configure_From_workspace( \
720      sizeof(Scheduler_SMP_Control) +  \
721      ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
722  )
723  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
724    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
725#endif
726
727/*
728 * If the Simple Priority Scheduler is selected, then configure for it.
729 */
730#if defined(CONFIGURE_SCHEDULER_SIMPLE)
731  #include <rtems/score/schedulersimple.h>
732  #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_ENTRY_POINTS
733
734  /**
735   * define the memory used by the simple scheduler
736   */
737  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
738    _Configure_From_workspace( sizeof( Scheduler_simple_Control ) ) \
739  )
740  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
741#endif
742
743/*
744 * If the Simple SMP Priority Scheduler is selected, then configure for it.
745 */
746#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP)
747  #include <rtems/score/schedulersimplesmp.h>
748  #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_SMP_ENTRY_POINTS
749
750  /**
751   * Define the memory used by the Simple SMP Scheduler
752   *
753   * NOTE: This is the same as the Simple Scheduler
754   */
755  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
756    _Configure_From_workspace( sizeof( Scheduler_simple_SMP_Control ) ) \
757  )
758  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
759#endif
760
761/*
762 * If the EDF Scheduler is selected, then configure for it.
763 */
764#if defined(CONFIGURE_SCHEDULER_EDF)
765  #include <rtems/score/scheduleredf.h>
766  #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_EDF_ENTRY_POINTS
767
768  /**
769   * define the memory used by the EDF scheduler
770   */
771  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
772    _Configure_From_workspace(sizeof(Scheduler_EDF_Control)))
773  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
774    _Configure_From_workspace(sizeof(Scheduler_EDF_Per_thread)))
775#endif
776
777/*
778 * If the CBS Scheduler is selected, then configure for it.
779 */
780#if defined(CONFIGURE_SCHEDULER_CBS)
781  #include <rtems/score/schedulercbs.h>
782  #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_CBS_ENTRY_POINTS
783
784  #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
785    #define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS
786  #endif
787
788  #ifdef CONFIGURE_INIT
789    uint32_t _Scheduler_CBS_Maximum_servers = CONFIGURE_CBS_MAXIMUM_SERVERS;
790  #endif
791
792  /**
793   * define the memory used by the CBS scheduler
794   */
795  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
796    _Configure_From_workspace(sizeof(Scheduler_EDF_Control)) + \
797      _Configure_From_workspace(CONFIGURE_CBS_MAXIMUM_SERVERS * \
798        sizeof(Scheduler_CBS_Server *)) + \
799      CONFIGURE_CBS_MAXIMUM_SERVERS * \
800        _Configure_From_workspace(sizeof(Scheduler_CBS_Server)))
801  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
802    _Configure_From_workspace(sizeof(Scheduler_CBS_Per_thread)))
803#endif
804
805/*
806 * Set up the scheduler entry points table.  The scheduling code uses
807 * this code to know which scheduler is configured by the user.
808 */
809#ifdef CONFIGURE_INIT
810  Scheduler_Control  _Scheduler = {
811    NULL,                             /* Scheduler Specific Data Pointer */
812    CONFIGURE_SCHEDULER_ENTRY_POINTS  /* Scheduler Operations */
813  };
814
815  #if defined(CONFIGURE_SCHEDULER_EDF)
816    const bool _Scheduler_FIXME_thread_priority_queues_are_broken = true;
817  #else
818    const bool _Scheduler_FIXME_thread_priority_queues_are_broken = false;
819  #endif
820#endif
821
822/*
823 *  If you said the IDLE task was going to do application initialization
824 *  and didn't override the IDLE body, then something is amiss.
825 */
826#if (defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
827     !defined(CONFIGURE_IDLE_TASK_BODY))
828  #error "CONFIGURE_ERROR: You did not override the IDLE task body."
829#endif
830
831/**
832 * @brief Idle task body configuration.
833 *
834 * There is a default IDLE thread body provided by RTEMS which
835 * has the possibility of being CPU specific.  There may be a
836 * BSP specific override of the RTEMS default body and in turn,
837 * the application may override and provide its own.
838 */
839#ifndef CONFIGURE_IDLE_TASK_BODY
840  #if defined(BSP_IDLE_TASK_BODY)
841    #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
842  #elif (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
843    #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
844  #else
845    /* only instantiate and compile if used */
846    #ifdef CONFIGURE_INIT
847      void *_Thread_Idle_body(uintptr_t ignored)
848      {
849        for( ; ; ) ;
850        return 0;   /* to avoid warning */
851      }
852    #endif
853    #define CONFIGURE_IDLE_TASK_BODY _Thread_Idle_body
854  #endif
855#endif
856
857/**
858 * By default, use the minimum stack size requested by this port.
859 */
860#ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE
861  #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
862#endif
863
864#define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \
865  (2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
866
867/**
868 * @brief Idle task stack size configuration.
869 *
870 * By default, the IDLE task will have a stack of minimum size.
871 * The BSP or application may override this value.
872 */
873#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
874  #ifdef BSP_IDLE_TASK_STACK_SIZE
875    #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
876  #else
877    #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
878  #endif
879#endif
880#if CONFIGURE_IDLE_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE
881  #error "CONFIGURE_IDLE_TASK_STACK_SIZE less than CONFIGURE_MINIMUM_TASK_STACK_SIZE"
882#endif
883
884/**
885 * @brief Interrupt stack size configuration.
886 *
887 * By default, the interrupt stack will be of minimum size.
888 * The BSP or application may override this value.
889 */
890#ifndef CONFIGURE_INTERRUPT_STACK_SIZE
891  #ifdef BSP_INTERRUPT_STACK_SIZE
892    #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
893  #else
894    #define CONFIGURE_INTERRUPT_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
895  #endif
896#endif
897
898/**
899 * This reserves memory for the interrupt stack if it is to be allocated
900 * by RTEMS rather than the BSP.
901 *
902 * @todo Try to get to the point where all BSPs support allocating the
903 *       memory from the Workspace.
904 */
905#if (CPU_ALLOCATE_INTERRUPT_STACK == 0)
906  #define CONFIGURE_INTERRUPT_STACK_MEMORY 0
907#else
908  #define CONFIGURE_INTERRUPT_STACK_MEMORY \
909     _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE )
910#endif
911
912/**
913 * Configure the very much optional task stack allocator initialization
914 */
915#ifndef CONFIGURE_TASK_STACK_ALLOCATOR_INIT
916  #define CONFIGURE_TASK_STACK_ALLOCATOR_INIT NULL
917#endif
918
919/*
920 *  Configure the very much optional task stack allocator and deallocator.
921 */
922#if !defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
923  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
924  #define CONFIGURE_TASK_STACK_ALLOCATOR _Workspace_Allocate
925  #define CONFIGURE_TASK_STACK_DEALLOCATOR _Workspace_Free
926#elif (defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
927  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)) \
928    || (!defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
929      && defined(CONFIGURE_TASK_STACK_DEALLOCATOR))
930  #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined"
931#endif
932
933/**
934 * Should the RTEMS Workspace and C Program Heap be cleared automatically
935 * at system start up?
936 */
937#ifndef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
938  #ifdef BSP_ZERO_WORKSPACE_AUTOMATICALLY
939    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY \
940            BSP_ZERO_WORKSPACE_AUTOMATICALLY
941  #else
942    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY FALSE
943  #endif
944#endif
945
946/*
947 *  RTEMS Malloc configuration
948 */
949
950#include <rtems/malloc.h>
951
952#ifdef CONFIGURE_INIT
953  /**
954   * By default, RTEMS uses separate heaps for the RTEMS Workspace and
955   * the C Program Heap.  The application can choose optionally to combine
956   * these to provide one larger memory pool. This is particularly
957   * useful in combination with the unlimited objects configuration.
958   */
959  #ifdef CONFIGURE_UNIFIED_WORK_AREAS
960    Heap_Control  *RTEMS_Malloc_Heap = &_Workspace_Area;
961  #else
962    Heap_Control   RTEMS_Malloc_Area;
963    Heap_Control  *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area;
964  #endif
965#endif
966
967#ifdef CONFIGURE_INIT
968  /**
969   * This configures the malloc family statistics to be available.
970   * By default only function call counts are kept.
971   */
972  rtems_malloc_statistics_functions_t *rtems_malloc_statistics_helpers =
973    #ifndef CONFIGURE_MALLOC_STATISTICS
974      NULL;
975    #else
976      &rtems_malloc_statistics_helpers_table;
977    #endif
978#endif
979
980#ifdef CONFIGURE_INIT
981  /**
982   * This configures the sbrk() support for the malloc family.
983   * By default it is assumed that the BSP provides all available
984   * RAM to the malloc family implementation so sbrk()'ing to get
985   * more memory would always fail anyway.
986   */
987  const rtems_heap_extend_handler rtems_malloc_extend_handler =
988    #ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
989      rtems_heap_extend_via_sbrk;
990    #else
991      rtems_heap_null_extend;
992    #endif
993#endif
994
995#ifdef CONFIGURE_INIT
996  /**
997   * This configures the malloc family plugin which dirties memory
998   * allocated.  This is helpful for finding unitialized data structure
999   * problems.
1000   */
1001  rtems_malloc_dirtier_t rtems_malloc_dirty_helper =
1002    #if defined(CONFIGURE_MALLOC_DIRTY)
1003      rtems_malloc_dirty_memory;
1004    #else
1005      NULL;
1006    #endif
1007#endif
1008
1009/**
1010 * Zero of one returns 0 if the parameter is 0 else 1 is returned.
1011 */
1012#define _Configure_Zero_or_One(_number) ((_number) ? 1 : 0)
1013
1014#define _Configure_Align_up(_val, _align) \
1015  (((_val) + (_align) - 1) & ~((_align) - 1))
1016
1017/**
1018 * This is a helper macro used in calculations in this file.  It is used
1019 * to noted when an element is allocated from the RTEMS Workspace and adds
1020 * a factor to account for heap overhead plus an alignment factor that
1021 * may be applied.
1022 */
1023#define _Configure_From_workspace(_size) \
1024   (ssize_t) (_Configure_Zero_or_One(_size) * \
1025     _Configure_Align_up((_size) + HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT))
1026
1027/**
1028 * This is a helper macro used in stack space calculations in this file.  It
1029 * may be provided by the application in case a special task stack allocator
1030 * is used.  The default is allocation from the RTEMS Workspace.
1031 */
1032#ifdef CONFIGURE_TASK_STACK_FROM_ALLOCATOR
1033  #define _Configure_From_stackspace(_stack_size) \
1034    CONFIGURE_TASK_STACK_FROM_ALLOCATOR(_stack_size)
1035#else
1036  #define _Configure_From_stackspace(_stack_size) \
1037    _Configure_From_workspace(_stack_size)
1038#endif
1039
1040/**
1041 * Do not use the unlimited bit as part of the multiplication
1042 * for memory usage.
1043 */
1044#define _Configure_Max_Objects(_max) \
1045  (_Configure_Zero_or_One(_max) * rtems_resource_maximum_per_allocation(_max))
1046
1047/**
1048 * This macro accounts for how memory for a set of configured objects is
1049 * allocated from the Executive Workspace.
1050 *
1051 * NOTE: It does NOT attempt to address the more complex case of unlimited
1052 *       objects.
1053 */
1054#define _Configure_Object_RAM(_number, _size) ( \
1055    _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
1056    _Configure_From_workspace( \
1057      _Configure_Zero_or_One(_number) * ( \
1058        (_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *) + \
1059        _Configure_Align_up(sizeof(void *), CPU_ALIGNMENT) + \
1060        _Configure_Align_up(sizeof(uint32_t), CPU_ALIGNMENT) \
1061      ) \
1062    ) \
1063  )
1064
1065/*
1066 *  Default User Initialization Task Table.  This table guarantees that
1067 *  one user initialization table is defined.
1068 */
1069
1070#ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
1071
1072#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
1073
1074/*
1075 *  The user is defining their own table information and setting the
1076 *  appropriate variables.
1077 */
1078
1079#else
1080
1081#ifndef CONFIGURE_INIT_TASK_NAME
1082  #define CONFIGURE_INIT_TASK_NAME          rtems_build_name('U', 'I', '1', ' ')
1083#endif
1084
1085#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
1086  #define CONFIGURE_INIT_TASK_STACK_SIZE    CONFIGURE_MINIMUM_TASK_STACK_SIZE
1087#endif
1088
1089#ifndef CONFIGURE_INIT_TASK_PRIORITY
1090  #define CONFIGURE_INIT_TASK_PRIORITY      1
1091#endif
1092
1093#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
1094  #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_DEFAULT_ATTRIBUTES
1095#endif
1096
1097#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
1098  #ifdef __cplusplus
1099  extern "C" {
1100  #endif
1101    rtems_task Init (rtems_task_argument );
1102  #ifdef __cplusplus
1103  }
1104  #endif
1105  #define CONFIGURE_INIT_TASK_ENTRY_POINT   Init
1106  extern const char* bsp_boot_cmdline;
1107  #define CONFIGURE_INIT_TASK_ARGUMENTS     ((rtems_task_argument) &bsp_boot_cmdline)
1108#endif
1109
1110#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
1111  #if defined(RTEMS_SMP) && defined(CONFIGURE_SMP_APPLICATION)
1112    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
1113  #else
1114    #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
1115  #endif
1116#endif
1117
1118#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
1119  #define CONFIGURE_INIT_TASK_ARGUMENTS     0
1120#endif
1121
1122#ifdef CONFIGURE_INIT
1123  rtems_initialization_tasks_table Initialization_tasks[] = {
1124    { CONFIGURE_INIT_TASK_NAME,
1125      CONFIGURE_INIT_TASK_STACK_SIZE,
1126      CONFIGURE_INIT_TASK_PRIORITY,
1127      CONFIGURE_INIT_TASK_ATTRIBUTES,
1128      CONFIGURE_INIT_TASK_ENTRY_POINT,
1129      CONFIGURE_INIT_TASK_INITIAL_MODES,
1130      CONFIGURE_INIT_TASK_ARGUMENTS
1131    }
1132  };
1133#endif
1134
1135#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
1136
1137#define CONFIGURE_INIT_TASK_TABLE_SIZE \
1138  RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
1139
1140#endif    /* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
1141
1142#else     /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
1143
1144#define CONFIGURE_INIT_TASK_TABLE      NULL
1145#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
1146#define CONFIGURE_INIT_TASK_STACK_SIZE 0
1147
1148#endif
1149
1150/*
1151 *  Default Device Driver Table.  Each driver needed by the test is explicitly
1152 *  choosen by that test.  There is always a null driver entry.
1153 */
1154
1155#define NULL_DRIVER_TABLE_ENTRY \
1156 { NULL, NULL, NULL, NULL, NULL, NULL }
1157
1158#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1159  #include <rtems/console.h>
1160#endif
1161
1162#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1163  #include <rtems/clockdrv.h>
1164#endif
1165
1166#ifdef CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
1167  #include <rtems/timerdrv.h>
1168#endif
1169
1170#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1171  #include <rtems/rtc.h>
1172#endif
1173
1174#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1175  #include <rtems/watchdogdrv.h>
1176#endif
1177
1178#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1179  #include <rtems/framebuffer.h>
1180#endif
1181
1182#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1183  #include <rtems/devnull.h>
1184#endif
1185
1186#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1187  #include <rtems/devzero.h>
1188#endif
1189
1190#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1191  /* the ide driver needs the ATA driver */
1192  #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1193    #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1194  #endif
1195  #include <libchip/ide_ctrl.h>
1196#endif
1197
1198#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1199  #include <libchip/ata.h>
1200#endif
1201
1202#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
1203
1204/**
1205 * This specifies the maximum number of device drivers that
1206 * can be installed in the system at one time.  It must account
1207 * for both the statically and dynamically installed drivers.
1208 */
1209#ifndef CONFIGURE_MAXIMUM_DRIVERS
1210  #define CONFIGURE_MAXIMUM_DRIVERS
1211#endif
1212
1213#ifdef CONFIGURE_INIT
1214  rtems_driver_address_table
1215    _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
1216    #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
1217      CONFIGURE_BSP_PREREQUISITE_DRIVERS,
1218    #endif
1219    #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
1220      CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
1221    #endif
1222    #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1223      CONSOLE_DRIVER_TABLE_ENTRY,
1224    #endif
1225    #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1226      CLOCK_DRIVER_TABLE_ENTRY,
1227    #endif
1228    #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1229      RTC_DRIVER_TABLE_ENTRY,
1230    #endif
1231    #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1232      WATCHDOG_DRIVER_TABLE_ENTRY,
1233    #endif
1234    #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1235      DEVNULL_DRIVER_TABLE_ENTRY,
1236    #endif
1237    #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1238      DEVZERO_DRIVER_TABLE_ENTRY,
1239    #endif
1240    #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1241      IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
1242    #endif
1243    #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1244      ATA_DRIVER_TABLE_ENTRY,
1245    #endif
1246    #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1247      FRAME_BUFFER_DRIVER_TABLE_ENTRY,
1248    #endif
1249    #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
1250      CONFIGURE_APPLICATION_EXTRA_DRIVERS,
1251    #endif
1252    #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
1253      NULL_DRIVER_TABLE_ENTRY
1254    #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1255        !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
1256        !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \
1257        !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \
1258        !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) && \
1259        !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \
1260        !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \
1261        !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) && \
1262        !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
1263      NULL_DRIVER_TABLE_ENTRY
1264    #endif
1265  };
1266
1267  const size_t _IO_Number_of_drivers =
1268    RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
1269#endif
1270
1271#endif  /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
1272
1273#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1274  /*
1275   * configure the priority of the ATA driver task
1276   */
1277  #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
1278    #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
1279  #endif
1280  #ifdef CONFIGURE_INIT
1281    rtems_task_priority rtems_ata_driver_task_priority
1282      = CONFIGURE_ATA_DRIVER_TASK_PRIORITY;
1283  #endif /* CONFIGURE_INIT */
1284#endif
1285
1286/*
1287 * add bdbuf configuration and values for swapout task priority
1288 */
1289#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
1290  #include <rtems/bdbuf.h>
1291  /*
1292   * configure the bdbuf cache parameters
1293   */
1294  #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
1295    #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
1296                              RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
1297  #endif
1298  #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
1299    #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
1300                              RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
1301  #endif
1302  #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
1303    #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
1304                              RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
1305  #endif
1306  #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
1307    #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
1308                              RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
1309  #endif
1310  #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
1311    #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
1312                              RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
1313  #endif
1314  #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
1315    #define CONFIGURE_SWAPOUT_WORKER_TASKS \
1316                              RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
1317  #endif
1318  #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
1319    #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
1320                              RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
1321  #endif
1322  #ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE
1323    #define CONFIGURE_BDBUF_TASK_STACK_SIZE \
1324                              RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT
1325  #endif
1326  #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
1327    #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
1328                              RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
1329  #endif
1330  #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
1331    #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
1332                              RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
1333  #endif
1334  #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
1335    #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
1336                              RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
1337  #endif
1338  #ifndef CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1339    #define CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY \
1340                              RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT
1341  #endif
1342  #ifdef CONFIGURE_INIT
1343    const rtems_bdbuf_config rtems_bdbuf_configuration = {
1344      CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
1345      CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
1346      CONFIGURE_SWAPOUT_TASK_PRIORITY,
1347      CONFIGURE_SWAPOUT_SWAP_PERIOD,
1348      CONFIGURE_SWAPOUT_BLOCK_HOLD,
1349      CONFIGURE_SWAPOUT_WORKER_TASKS,
1350      CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
1351      CONFIGURE_BDBUF_TASK_STACK_SIZE,
1352      CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
1353      CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
1354      CONFIGURE_BDBUF_BUFFER_MAX_SIZE,
1355      CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
1356    };
1357  #endif
1358
1359  #define CONFIGURE_LIBBLOCK_TASKS \
1360    (1 + CONFIGURE_SWAPOUT_WORKER_TASKS + \
1361    (CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS != 0))
1362
1363  #define CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS \
1364    (CONFIGURE_LIBBLOCK_TASKS * \
1365    (CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \
1366    0 : CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE))
1367
1368  /*
1369   *  Semaphores:
1370   *    o disk lock
1371   *    o bdbuf lock
1372   *    o bdbuf sync lock
1373   *    o bdbuf access condition
1374   *    o bdbuf transfer condition
1375   *    o bdbuf buffer condition
1376   */
1377  #define CONFIGURE_LIBBLOCK_SEMAPHORES 6
1378
1379  #if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \
1380      defined(CONFIGURE_BDBUF_BUFFER_SIZE) || \
1381      defined(CONFIGURE_BDBUF_BUFFER_COUNT)
1382    #error BDBUF Cache does not use a buffer configuration table. Please remove.
1383  #endif
1384#else
1385  #define CONFIGURE_LIBBLOCK_TASKS 0
1386  #define CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS 0
1387  #define CONFIGURE_LIBBLOCK_SEMAPHORES 0
1388#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
1389
1390#ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
1391  #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
1392#endif
1393
1394#if defined(RTEMS_MULTIPROCESSING)
1395  /*
1396   *  Default Multiprocessing Configuration Table.  The defaults are
1397   *  appropriate for most of the RTEMS Multiprocessor Test Suite.  Each
1398   *  value may be overridden within each test to customize the environment.
1399   */
1400
1401  #ifdef CONFIGURE_MP_APPLICATION
1402    #define CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 1
1403
1404    #ifndef CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE
1405
1406      #ifndef CONFIGURE_MP_NODE_NUMBER
1407        #define CONFIGURE_MP_NODE_NUMBER                NODE_NUMBER
1408      #endif
1409
1410      #ifndef CONFIGURE_MP_MAXIMUM_NODES
1411        #define CONFIGURE_MP_MAXIMUM_NODES              2
1412      #endif
1413
1414      #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
1415        #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS     32
1416      #endif
1417      #define CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
1418        _Configure_Object_RAM((_global_objects), sizeof(Objects_MP_Control))
1419
1420      #ifndef CONFIGURE_MP_MAXIMUM_PROXIES
1421        #define CONFIGURE_MP_MAXIMUM_PROXIES            32
1422      #endif
1423      #define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
1424        _Configure_Object_RAM((_proxies) + 1, sizeof(Thread_Proxy_control) )
1425
1426      #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
1427        #include <mpci.h>
1428        #define CONFIGURE_MP_MPCI_TABLE_POINTER         &MPCI_table
1429      #endif
1430
1431      #ifdef CONFIGURE_INIT
1432        rtems_multiprocessing_table Multiprocessing_configuration = {
1433          CONFIGURE_MP_NODE_NUMBER,               /* local node number */
1434          CONFIGURE_MP_MAXIMUM_NODES,             /* maximum # nodes */
1435          CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS,    /* maximum # global objects */
1436          CONFIGURE_MP_MAXIMUM_PROXIES,           /* maximum # proxies */
1437          CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, /* MPCI stack > minimum */
1438          CONFIGURE_MP_MPCI_TABLE_POINTER         /* ptr to MPCI config table */
1439        };
1440      #endif
1441
1442      #define CONFIGURE_MULTIPROCESSING_TABLE    &Multiprocessing_configuration
1443
1444    #endif /* CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE */
1445
1446  #else
1447
1448    #define CONFIGURE_MULTIPROCESSING_TABLE    NULL
1449
1450  #endif /* CONFIGURE_MP_APPLICATION */
1451#endif /* RTEMS_MULTIPROCESSING */
1452
1453#ifndef CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER
1454  #define CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 0
1455#endif
1456
1457
1458/**
1459 * This macro specifies that the user wants to use unlimited objects for any
1460 * classic or posix objects that have not already been given resource limits.
1461 */
1462#if defined(CONFIGURE_UNLIMITED_OBJECTS)
1463  #if !defined(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1464  /**
1465   * This macro specifies a default allocation size for when auto-extending
1466   * unlimited objects if none was given by the user.
1467   */
1468    #define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 8
1469  #endif
1470  #if !defined(CONFIGURE_MAXIMUM_TASKS)
1471    #define CONFIGURE_MAXIMUM_TASKS \
1472      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1473  #endif
1474  #if !defined(CONFIGURE_MAXIMUM_TIMERS)
1475    #define CONFIGURE_MAXIMUM_TIMERS \
1476      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1477  #endif
1478  #if !defined(CONFIGURE_MAXIMUM_SEMAPHORES)
1479    #define CONFIGURE_MAXIMUM_SEMAPHORES \
1480      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1481  #endif
1482  #if !defined(CONFIGURE_MAXIMUM_MESSAGE_QUEUES)
1483    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES \
1484      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1485  #endif
1486  #if !defined(CONFIGURE_MAXIMUM_PARTITIONS)
1487    #define CONFIGURE_MAXIMUM_PARTITIONS \
1488      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1489  #endif
1490  #if !defined(CONFIGURE_MAXIMUM_REGIONS)
1491    #define CONFIGURE_MAXIMUM_REGIONS \
1492      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1493  #endif
1494  #if !defined(CONFIGURE_MAXIMUM_PORTS)
1495    #define CONFIGURE_MAXIMUM_PORTS \
1496      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1497  #endif
1498  #if !defined(CONFIGURE_MAXIMUM_PERIODS)
1499    #define CONFIGURE_MAXIMUM_PERIODS \
1500      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1501  #endif
1502  #if !defined(CONFIGURE_MAXIMUM_BARRIERS)
1503    #define CONFIGURE_MAXIMUM_BARRIERS \
1504      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1505  #endif
1506
1507  #ifdef RTEMS_POSIX_API
1508    #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS)
1509      #define CONFIGURE_MAXIMUM_POSIX_THREADS \
1510        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1511    #endif
1512    #if !defined(CONFIGURE_MAXIMUM_POSIX_MUTEXES)
1513      #define CONFIGURE_MAXIMUM_POSIX_MUTEXES \
1514        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1515    #endif
1516    #if !defined(CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES)
1517      #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES \
1518        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1519    #endif
1520/*
1521    #if !defined(CONFIGURE_MAXIMUM_POSIX_KEYS)
1522      #define CONFIGURE_MAXIMUM_POSIX_KEYS \
1523        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1524    #endif
1525*/
1526    #if !defined(CONFIGURE_MAXIMUM_POSIX_TIMERS)
1527      #define CONFIGURE_MAXIMUM_POSIX_TIMERS \
1528        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1529    #endif
1530/*
1531    #if !defined(CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS)
1532      #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS \
1533        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1534    #endif
1535*/
1536    #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
1537      #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES \
1538        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1539    #endif
1540    #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS)
1541      #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
1542        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1543    #endif
1544    #if !defined(CONFIGURE_MAXIMUM_POSIX_SEMAPHORES)
1545      #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES \
1546        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1547    #endif
1548    #if !defined(CONFIGURE_MAXIMUM_POSIX_BARRIERS)
1549      #define CONFIGURE_MAXIMUM_POSIX_BARRIERS \
1550        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1551    #endif
1552    #if !defined(CONFIGURE_MAXIMUM_POSIX_RWLOCKS)
1553      #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS \
1554        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1555    #endif
1556    #if !defined(CONFIGURE_MAXIMUM_POSIX_SPINLOCKS)
1557      #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS \
1558        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
1559    #endif
1560  #endif /* RTEMS_POSIX_API */
1561#endif /* CONFIGURE_UNLIMITED_OBJECTS */
1562
1563
1564/*
1565 *  Default Configuration Table.
1566 */
1567
1568#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
1569
1570  #ifndef CONFIGURE_MAXIMUM_TASKS
1571    #define CONFIGURE_MAXIMUM_TASKS               0
1572  #endif
1573
1574  #define CONFIGURE_TASKS \
1575    (CONFIGURE_MAXIMUM_TASKS + CONFIGURE_LIBBLOCK_TASKS)
1576
1577  #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
1578    #define CONFIGURE_NOTEPADS_ENABLED           TRUE
1579  #else
1580    #define CONFIGURE_NOTEPADS_ENABLED           FALSE
1581  #endif
1582
1583  #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
1584    #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
1585      _Configure_From_workspace( sizeof(RTEMS_API_Control) )
1586  #else
1587    #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
1588      _Configure_From_workspace( sizeof(RTEMS_API_Control) - \
1589        (RTEMS_NUMBER_NOTEPADS * sizeof(uint32_t)))
1590  #endif
1591
1592/**
1593 * This macro calculates the memory required for task variables.
1594 *
1595 * Each task variable is individually allocated from the Workspace.
1596 * Hence, we do the multiplication on the configured size.
1597 *
1598 * @note Per-task variables are disabled for SMP configurations.
1599 */
1600#if defined(RTEMS_SMP)
1601  #ifdef CONFIGURE_MAXIMUM_TASK_VARIABLES
1602    #error "Per-Task Variables are not safe for SMP systems and disabled"
1603  #endif
1604  #define CONFIGURE_MAXIMUM_TASK_VARIABLES                     0
1605  #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) 0
1606#else
1607  #ifndef CONFIGURE_MAXIMUM_TASK_VARIABLES
1608    #define CONFIGURE_MAXIMUM_TASK_VARIABLES                     0
1609    #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) 0
1610  #else
1611    #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) \
1612      (_task_variables) * \
1613         _Configure_From_workspace(sizeof(rtems_task_variable_t))
1614  #endif
1615#endif
1616
1617  #ifndef CONFIGURE_MAXIMUM_TIMERS
1618    #define CONFIGURE_MAXIMUM_TIMERS             0
1619    #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0
1620  #else
1621    #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
1622      _Configure_Object_RAM(_timers, sizeof(Timer_Control) )
1623  #endif
1624
1625  #ifndef CONFIGURE_MAXIMUM_SEMAPHORES
1626    #define CONFIGURE_MAXIMUM_SEMAPHORES                 0
1627  #endif
1628
1629  #define CONFIGURE_SEMAPHORES \
1630    (CONFIGURE_MAXIMUM_SEMAPHORES + CONFIGURE_LIBIO_SEMAPHORES + \
1631      CONFIGURE_TERMIOS_SEMAPHORES + CONFIGURE_LIBBLOCK_SEMAPHORES + \
1632      CONFIGURE_SEMAPHORES_FOR_FIFOS)
1633
1634  /*
1635   * If there are no user or support semaphores defined, then we can assume
1636   * that no memory need be allocated at all for semaphores.
1637   */
1638  #if CONFIGURE_SEMAPHORES == 0
1639    #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0
1640  #else
1641    #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
1642      _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) )
1643  #endif
1644
1645  #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
1646    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES             0
1647    #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0
1648  #else
1649    #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
1650      _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) )
1651  #endif
1652
1653  #ifndef CONFIGURE_MAXIMUM_PARTITIONS
1654    #define CONFIGURE_MAXIMUM_PARTITIONS                 0
1655    #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0
1656  #else
1657    #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
1658      _Configure_Object_RAM(_partitions, sizeof(Partition_Control) )
1659  #endif
1660
1661  #ifndef CONFIGURE_MAXIMUM_REGIONS
1662    #define CONFIGURE_MAXIMUM_REGIONS              0
1663    #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0
1664  #else
1665    #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
1666      _Configure_Object_RAM(_regions, sizeof(Region_Control) )
1667  #endif
1668
1669  #ifndef CONFIGURE_MAXIMUM_PORTS
1670    #define CONFIGURE_MAXIMUM_PORTS            0
1671    #define CONFIGURE_MEMORY_FOR_PORTS(_ports) 0
1672  #else
1673    #define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
1674      _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) )
1675  #endif
1676
1677  #ifndef CONFIGURE_MAXIMUM_PERIODS
1678    #define CONFIGURE_MAXIMUM_PERIODS              0
1679    #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0
1680  #else
1681    #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
1682      _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) )
1683  #endif
1684
1685  #ifndef CONFIGURE_MAXIMUM_BARRIERS
1686    #define CONFIGURE_MAXIMUM_BARRIERS               0
1687  #endif
1688
1689  #define CONFIGURE_BARRIERS \
1690     (CONFIGURE_MAXIMUM_BARRIERS + CONFIGURE_BARRIERS_FOR_FIFOS)
1691
1692  #if CONFIGURE_BARRIERS == 0
1693    #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0
1694  #else
1695    #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \
1696      _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) )
1697  #endif
1698
1699  #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
1700    #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
1701    #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0
1702  #else
1703    #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
1704      _Configure_Object_RAM(_extensions, sizeof(Extension_Control) )
1705  #endif
1706
1707  #ifndef CONFIGURE_MICROSECONDS_PER_TICK
1708    #define CONFIGURE_MICROSECONDS_PER_TICK \
1709            RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
1710  #endif
1711
1712  #ifndef CONFIGURE_TICKS_PER_TIMESLICE
1713    #define CONFIGURE_TICKS_PER_TIMESLICE        50
1714  #endif
1715
1716/*
1717 *  Initial Extension Set
1718 */
1719
1720#ifdef CONFIGURE_INIT
1721#ifdef CONFIGURE_STACK_CHECKER_ENABLED
1722#include <rtems/stackchk.h>
1723#endif
1724#include <rtems/libcsupport.h>
1725
1726#if defined(BSP_INITIAL_EXTENSION) || \
1727    defined(CONFIGURE_INITIAL_EXTENSIONS) || \
1728    defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
1729    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
1730  static const rtems_extensions_table Configuration_Initial_Extensions[] = {
1731    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
1732      RTEMS_NEWLIB_EXTENSION,
1733    #endif
1734    #if defined(CONFIGURE_STACK_CHECKER_ENABLED)
1735      RTEMS_STACK_CHECKER_EXTENSION,
1736    #endif
1737    #if defined(CONFIGURE_INITIAL_EXTENSIONS)
1738      CONFIGURE_INITIAL_EXTENSIONS,
1739    #endif
1740    #if defined(BSP_INITIAL_EXTENSION)
1741      BSP_INITIAL_EXTENSION
1742    #endif
1743  };
1744
1745  #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
1746  #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
1747    RTEMS_ARRAY_SIZE(Configuration_Initial_Extensions)
1748#else
1749  #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
1750  #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
1751#endif
1752
1753#if defined(RTEMS_NEWLIB) && defined(__DYNAMIC_REENT__)
1754  struct _reent *__getreent(void)
1755  {
1756    #ifdef CONFIGURE_DISABLE_NEWLIB_REENTRANCY
1757      return _GLOBAL_REENT;
1758    #else
1759      return _Thread_Get_executing()->libc_reent;
1760    #endif
1761  }
1762#endif
1763
1764#endif
1765
1766/*
1767 *  POSIX API Configuration Parameters
1768 */
1769
1770/*
1771 *  POSIX Keys are available whether or not the POSIX API is enabled.
1772 */
1773#include <rtems/posix/key.h>
1774
1775#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
1776  #define CONFIGURE_MAXIMUM_POSIX_KEYS 0
1777#endif
1778
1779#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
1780  #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
1781    (CONFIGURE_MAXIMUM_POSIX_KEYS * \
1782     (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS))
1783#endif
1784
1785#define CONFIGURE_POSIX_KEYS \
1786  (CONFIGURE_MAXIMUM_POSIX_KEYS + CONFIGURE_LIBIO_POSIX_KEYS)
1787
1788#define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
1789   (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
1790    + _Configure_From_workspace( \
1791        _key_value_pairs * sizeof(POSIX_Keys_Key_value_pair)))
1792
1793/*
1794 *  The rest of the POSIX threads API features are only available when
1795 *  POSIX is enabled.
1796 */
1797
1798#ifdef RTEMS_POSIX_API
1799  #include <sys/types.h>
1800  #include <signal.h>
1801  #include <limits.h>
1802  #include <mqueue.h>
1803  #include <rtems/posix/barrier.h>
1804  #include <rtems/posix/cond.h>
1805  #include <rtems/posix/mqueue.h>
1806  #include <rtems/posix/mutex.h>
1807  #include <rtems/posix/psignal.h>
1808  #include <rtems/posix/pthread.h>
1809  #include <rtems/posix/rwlock.h>
1810  #include <rtems/posix/semaphore.h>
1811  #include <rtems/posix/spinlock.h>
1812  #include <rtems/posix/threadsup.h>
1813  #include <rtems/posix/timer.h>
1814
1815  /**
1816   * Account for the object control structures plus the name
1817   * of the object to be duplicated.
1818   */
1819  #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
1820    _Configure_Object_RAM( (_number), _size ) + \
1821    (_Configure_Max_Objects(_number) * _Configure_From_workspace(NAME_MAX) )
1822
1823  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
1824    #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
1825  #endif
1826
1827  #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \
1828    _Configure_From_workspace(sizeof(POSIX_API_Control))
1829
1830  #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
1831    #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 0
1832  #endif
1833  #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
1834    _Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
1835
1836  #ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
1837    #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 0
1838  #endif
1839  #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) \
1840      _Configure_Object_RAM(_condvars, \
1841                          sizeof(POSIX_Condition_variables_Control) )
1842
1843  #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
1844    #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
1845  #endif
1846  #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
1847    _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
1848
1849  #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
1850    #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0
1851  #endif
1852  #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
1853    _Configure_From_workspace( \
1854      (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
1855
1856  #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
1857    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
1858    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS          0
1859  #else
1860    /* default to same number */
1861    #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
1862       #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
1863               CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
1864    #endif
1865  #endif
1866
1867  #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
1868    _Configure_POSIX_Named_Object_RAM( \
1869       _message_queues, sizeof(POSIX_Message_queue_Control) )
1870
1871  #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_mqueue_fds) \
1872    _Configure_Object_RAM( \
1873       _mqueue_fds, sizeof(POSIX_Message_queue_Control_fd) )
1874
1875  #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
1876    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0
1877  #endif
1878  #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
1879    _Configure_POSIX_Named_Object_RAM( \
1880       _semaphores, sizeof(POSIX_Semaphore_Control) )
1881
1882  #ifndef CONFIGURE_MAXIMUM_POSIX_BARRIERS
1883    #define CONFIGURE_MAXIMUM_POSIX_BARRIERS 0
1884  #endif
1885  #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \
1886    _Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) )
1887
1888  #ifndef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
1889    #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 0
1890  #endif
1891  #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \
1892    _Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) )
1893
1894  #ifndef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
1895    #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS 0
1896  #endif
1897  #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) \
1898    _Configure_Object_RAM(_rwlocks, sizeof(POSIX_RWLock_Control) )
1899
1900  #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
1901
1902    #ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
1903
1904      /*
1905       *  The user is defining their own table information and setting the
1906       *  appropriate variables for the POSIX Initialization Thread Table.
1907       */
1908
1909    #else
1910
1911      #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
1912        #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
1913      #endif
1914
1915      #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
1916        #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
1917          CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
1918      #endif
1919
1920      #ifdef CONFIGURE_INIT
1921        posix_initialization_threads_table POSIX_Initialization_threads[] = {
1922          { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT, \
1923              CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
1924        };
1925      #endif
1926
1927      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
1928              POSIX_Initialization_threads
1929
1930      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
1931              RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
1932
1933    #endif    /* CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
1934
1935  #else     /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
1936
1937    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
1938    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
1939
1940  #endif
1941
1942  #define CONFIGURE_MEMORY_FOR_POSIX \
1943    ( CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES + \
1944          CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES) + \
1945      CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES( \
1946          CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES + \
1947          CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES) + \
1948      CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
1949          CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ) + \
1950      CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
1951          CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ) + \
1952      CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS( \
1953          CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS ) + \
1954      CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
1955          CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ) + \
1956      CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(CONFIGURE_MAXIMUM_POSIX_BARRIERS) + \
1957      CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( \
1958          CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ) + \
1959      CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( \
1960          CONFIGURE_MAXIMUM_POSIX_RWLOCKS ) + \
1961      CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ) \
1962     )
1963#else
1964
1965  #define CONFIGURE_MAXIMUM_POSIX_THREADS         0
1966  #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API 0
1967  #define CONFIGURE_MEMORY_FOR_POSIX              0
1968
1969#endif    /* RTEMS_POSIX_API */
1970
1971#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
1972  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE    0
1973#endif
1974
1975/*
1976 *  This block of defines are for applications which use GNAT/RTEMS.
1977 *  GNAT implements each Ada task as a POSIX thread.
1978 */
1979#ifdef CONFIGURE_GNAT_RTEMS
1980
1981  /**
1982   * The GNAT run-time needs something less than (10) POSIX mutexes.
1983   * We may be able to get by with less but why bother.
1984   */
1985  #define CONFIGURE_GNAT_MUTEXES 10
1986
1987  /**
1988   * This is the maximum number of Ada tasks which can be concurrently
1989   * in existence.  Twenty (20) are required to run all tests in the
1990   * ACATS (formerly ACVC).
1991   */
1992  #ifndef CONFIGURE_MAXIMUM_ADA_TASKS
1993    #define CONFIGURE_MAXIMUM_ADA_TASKS  20
1994  #endif
1995
1996  /**
1997   * This is the number of non-Ada tasks which invoked Ada code.
1998   */
1999  #ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
2000    #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2001  #endif
2002
2003#else
2004  #define CONFIGURE_GNAT_MUTEXES           0
2005  #define CONFIGURE_MAXIMUM_ADA_TASKS      0
2006  #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
2007#endif
2008
2009#ifdef CONFIGURE_ENABLE_GO
2010
2011  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
2012    #define CONFIGURE_MAXIMUM_POSIX_THREADS 1
2013  #endif
2014  #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
2015    #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
2016  #endif
2017  #ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
2018    #define CONFIGURE_MAXIMUM_CONDITION_VARIABLES 1
2019  #endif
2020
2021  #define CONFIGURE_GO_INIT_MUTEXES 77
2022  #define CONFIGURE_GO_INIT_CONDITION_VARIABLES 4
2023
2024  #ifndef CONFIGURE_MAXIMUM_GOROUTINES
2025    #define CONFIGURE_MAXIMUM_GOROUTINES 400
2026  #endif
2027
2028  #define CONFIGURE_GOROUTINES_TASK_VARIABLES \
2029    (2 * CONFIGURE_MAXIMUM_GOROUTINES)
2030
2031  #ifndef CONFIGURE_MAXIMUM_GO_CHANNELS
2032    #define CONFIGURE_MAXIMUM_GO_CHANNELS 500
2033  #endif
2034
2035#else
2036  #define CONFIGURE_GO_INIT_MUTEXES             0
2037  #define CONFIGURE_GO_INIT_CONDITION_VARIABLES 0
2038  #define CONFIGURE_MAXIMUM_GOROUTINES          0
2039  #define CONFIGURE_GOROUTINES_TASK_VARIABLES   0
2040  #define CONFIGURE_MAXIMUM_GO_CHANNELS         0
2041#endif
2042
2043#ifndef RTEMS_SCHEDSIM
2044/**
2045 * This macro specifies the amount of memory to be reserved for the
2046 * Newlib C Library reentrancy structure -- if we are using newlib.
2047 */
2048
2049#if (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
2050  #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB \
2051    _Configure_From_workspace(sizeof(struct _reent))
2052#else
2053  #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB 0
2054#endif
2055
2056#else
2057  #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB 0
2058#endif
2059
2060/**
2061 * This is so we can account for tasks with stacks greater than minimum
2062 * size.  This is in bytes.
2063 */
2064#ifndef CONFIGURE_EXTRA_TASK_STACKS
2065  #define CONFIGURE_EXTRA_TASK_STACKS 0
2066#endif
2067
2068/**
2069 * This macro provides a summation of the various POSIX thread requirements.
2070 */
2071#define CONFIGURE_POSIX_THREADS \
2072   (CONFIGURE_MAXIMUM_POSIX_THREADS + \
2073     CONFIGURE_MAXIMUM_ADA_TASKS + \
2074     CONFIGURE_MAXIMUM_GOROUTINES)
2075
2076/*
2077 *  Calculate the RAM size based on the maximum number of objects configured.
2078 */
2079
2080#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
2081
2082/**
2083 * Account for allocating the following per object
2084 *   + array of object control structures
2085 *   + local pointer table -- pointer per object plus a zero'th
2086 *     entry in the local pointer table.
2087 */
2088
2089#define CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \
2090  ( \
2091    _Configure_Object_RAM(_tasks, sizeof(Thread_Control)) \
2092      + _Configure_Max_Objects(_tasks) \
2093        * ( \
2094            CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
2095              + CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB \
2096              + CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \
2097              + CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER \
2098              + _Configure_From_workspace( \
2099                (CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1) * sizeof(void *) \
2100              ) \
2101          ) \
2102      + _Configure_Max_Objects(_number_FP_tasks) \
2103        * _Configure_From_workspace(CONTEXT_FP_SIZE) \
2104        * (CONTEXT_FP_SIZE != 0) \
2105  )
2106
2107/**
2108 * This defines the amount of memory configured for the multiprocessing
2109 * support required by this application.
2110 */
2111#ifdef CONFIGURE_MP_APPLICATION
2112  #define CONFIGURE_MEMORY_FOR_MP \
2113    (CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
2114     CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS( \
2115             CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) + \
2116     CONFIGURE_MEMORY_FOR_TASKS(1, 1) \
2117  )
2118#else
2119  #define CONFIGURE_MEMORY_FOR_MP  0
2120#endif
2121
2122/**
2123 * The following macro is used to calculate the memory allocated by RTEMS
2124 * for the message buffers associated with a particular message queue.
2125 * There is a fixed amount of overhead per message.
2126 */
2127#define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
2128    _Configure_From_workspace( \
2129      (_messages) * ((_size) + sizeof(CORE_message_queue_Buffer_control)))
2130
2131/**
2132 * This macros is set to the amount of memory required for pending message
2133 * buffers in bytes.  It should be constructed by adding together a
2134 * set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
2135 */
2136#ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
2137  #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
2138#endif
2139
2140/**
2141 * This macro is available just in case the confdefs.h file underallocates
2142 * memory for a particular application.  This lets the user add some extra
2143 * memory in case something broken and underestimates.
2144 *
2145 * It is also possible for cases where confdefs.h overallocates memory,
2146 * you could substract memory from the allocated.  The estimate is just
2147 * that, an estimate, and assumes worst case alignment and padding on
2148 * each allocated element.  So in some cases it could be too conservative.
2149 *
2150 * NOTE: Historically this was used for message buffers.
2151 */
2152#ifndef CONFIGURE_MEMORY_OVERHEAD
2153  #define CONFIGURE_MEMORY_OVERHEAD 0
2154#endif
2155
2156/**
2157 * On architectures that use Simple Vectored Interrupts, it is RTEMS
2158 * responsibility to allocate the vector table.  This avoids reserving
2159 * the memory on architectures that use the Programmable Interrupt
2160 * Controller Vectored Interrupts.
2161 */
2162#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
2163  /*
2164   *  This is a (hopefully) temporary hack.  On the mips, the number of
2165   *  vectors is NOT statically defined.  But it has to be statically
2166   *  defined for this to work.  This is an issue looking for a nice
2167   *  solution.
2168   */
2169  #if defined(__mips__)
2170    #define CONFIGURE_INTERRUPT_VECTOR_TABLE \
2171      _Configure_From_workspace( (sizeof(ISR_Handler_entry) * 256))
2172  #else
2173    #define CONFIGURE_INTERRUPT_VECTOR_TABLE \
2174      _Configure_From_workspace( \
2175        (sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS))
2176  #endif
2177#else
2178  #define CONFIGURE_INTERRUPT_VECTOR_TABLE 0
2179#endif
2180
2181/**
2182 * RTEMS uses two instance of an internal mutex class.  This accounts
2183 * for these mutexes.
2184 */
2185#define CONFIGURE_API_MUTEX_MEMORY \
2186  _Configure_Object_RAM(2, sizeof(API_Mutex_Control))
2187
2188/**
2189 * This calculates the amount of memory reserved for the IDLE tasks.
2190 * In an SMP system, each CPU core has its own idle task.
2191 */
2192#if defined(RTEMS_SMP)
2193  #define CONFIGURE_IDLE_TASKS_COUNT CONFIGURE_SMP_MAXIMUM_PROCESSORS
2194#else
2195  #define CONFIGURE_IDLE_TASKS_COUNT 1
2196#endif
2197
2198/**
2199 * This defines the formula used to compute the amount of memory
2200 * reserved for IDLE task control structures.
2201 */
2202#define CONFIGURE_MEMORY_FOR_IDLE_TASK \
2203  CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_IDLE_TASKS_COUNT, 0)
2204
2205/**
2206 * This macro accounts for general RTEMS system overhead.
2207 */
2208#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
2209  ( CONFIGURE_MEMORY_FOR_IDLE_TASK +                /* IDLE and stack */ \
2210    CONFIGURE_MEMORY_FOR_SCHEDULER +                /* Scheduler */ \
2211    CONFIGURE_INTERRUPT_VECTOR_TABLE +             /* interrupt vectors */ \
2212    CONFIGURE_INTERRUPT_STACK_MEMORY +             /* interrupt stack */ \
2213    CONFIGURE_API_MUTEX_MEMORY                     /* allocation mutex */ \
2214  )
2215
2216/**
2217 * This macro reserves the memory required by the statically configured
2218 * user extensions.
2219 */
2220#define CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \
2221  (CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS == 0 ? 0 : \
2222    _Configure_From_workspace( \
2223      CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
2224        * sizeof(User_extensions_Switch_control) \
2225    ))
2226
2227/**
2228 * This macro provides a summation of the memory required by the
2229 * Classic API as configured.
2230 */
2231#define CONFIGURE_MEMORY_FOR_CLASSIC \
2232  (CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES + \
2233    CONFIGURE_GOROUTINES_TASK_VARIABLES) + \
2234   CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \
2235    CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \
2236   CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES) + \
2237   CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
2238   CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
2239   CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \
2240   CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
2241   CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
2242   CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_BARRIERS) + \
2243   CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \
2244  )
2245
2246#if defined(RTEMS_SMP)
2247  #define CONFIGURE_MEMORY_FOR_SMP \
2248     (CONFIGURE_SMP_MAXIMUM_PROCESSORS * \
2249      _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE ) \
2250     )
2251#else
2252  #define CONFIGURE_MEMORY_FOR_SMP 0
2253#endif
2254
2255/**
2256 * This calculates the memory required for the executive workspace.
2257 */
2258#define CONFIGURE_EXECUTIVE_RAM_SIZE \
2259(( \
2260   CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD + \
2261   CONFIGURE_MEMORY_FOR_TASKS( \
2262     CONFIGURE_TASKS, CONFIGURE_TASKS) + \
2263   CONFIGURE_MEMORY_FOR_TASKS( \
2264     CONFIGURE_POSIX_THREADS, CONFIGURE_POSIX_THREADS) + \
2265   CONFIGURE_MEMORY_FOR_CLASSIC + \
2266   CONFIGURE_MEMORY_FOR_POSIX_KEYS( \
2267      CONFIGURE_POSIX_KEYS, \
2268      CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \
2269   CONFIGURE_MEMORY_FOR_POSIX + \
2270   CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
2271   CONFIGURE_MEMORY_FOR_MP + \
2272   CONFIGURE_MEMORY_FOR_SMP + \
2273   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
2274   (CONFIGURE_MEMORY_OVERHEAD * 1024) \
2275) & ~0x7)
2276
2277/*
2278 *  Now account for any extra memory that initialization tasks or threads
2279 *  may have requested.
2280 */
2281
2282/**
2283 * This accounts for any extra memory required by the Classic API
2284 * Initialization Task.
2285 */
2286#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2287  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
2288      (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
2289#else
2290  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
2291#endif
2292
2293/**
2294 * This accounts for any extra memory required by the POSIX API
2295 * Initialization Thread.
2296 */
2297#if defined(RTEMS_POSIX_API) && \
2298    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \
2299      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2300  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
2301    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - \
2302      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
2303#else
2304  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
2305#endif
2306
2307/**
2308 * This macro provides a summation of the various initialization task
2309 * and thread stack requirements.
2310 */
2311#define CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS \
2312    (CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
2313    CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART)
2314
2315#define CONFIGURE_IDLE_TASKS_STACK \
2316  (CONFIGURE_IDLE_TASKS_COUNT * \
2317    _Configure_From_stackspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) )
2318
2319#define CONFIGURE_TASKS_STACK \
2320  (_Configure_Max_Objects( CONFIGURE_TASKS ) * \
2321    _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
2322
2323#define CONFIGURE_POSIX_THREADS_STACK \
2324  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \
2325    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2326
2327#define CONFIGURE_GOROUTINES_STACK \
2328  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_GOROUTINES ) * \
2329    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2330
2331#define CONFIGURE_ADA_TASKS_STACK \
2332  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_ADA_TASKS ) * \
2333    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
2334
2335#else /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2336
2337#define CONFIGURE_IDLE_TASKS_STACK 0
2338#define CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS 0
2339#define CONFIGURE_TASKS_STACK 0
2340#define CONFIGURE_POSIX_THREADS_STACK 0
2341#define CONFIGURE_GOROUTINES_STACK 0
2342#define CONFIGURE_ADA_TASKS_STACK 0
2343
2344#if CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK != 0
2345  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK"
2346#endif
2347
2348#if CONFIGURE_EXTRA_TASK_STACKS != 0
2349  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_TASK_STACKS"
2350#endif
2351
2352#endif /* CONFIGURE_EXECUTIVE_RAM_SIZE */
2353
2354#define CONFIGURE_STACK_SPACE_SIZE \
2355  ( \
2356    CONFIGURE_IDLE_TASKS_STACK + \
2357    CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \
2358    CONFIGURE_TASKS_STACK + \
2359    CONFIGURE_POSIX_THREADS_STACK + \
2360    CONFIGURE_GOROUTINES_STACK + \
2361    CONFIGURE_ADA_TASKS_STACK + \
2362    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK + \
2363    CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS + \
2364    CONFIGURE_EXTRA_TASK_STACKS \
2365  )
2366
2367#ifdef CONFIGURE_INIT
2368  /**
2369   * This is the Classic API Configuration Table.
2370   */
2371  rtems_api_configuration_table Configuration_RTEMS_API = {
2372    CONFIGURE_TASKS,
2373    CONFIGURE_NOTEPADS_ENABLED,
2374    CONFIGURE_MAXIMUM_TIMERS + CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER,
2375    CONFIGURE_SEMAPHORES,
2376    CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
2377    CONFIGURE_MAXIMUM_PARTITIONS,
2378    CONFIGURE_MAXIMUM_REGIONS,
2379    CONFIGURE_MAXIMUM_PORTS,
2380    CONFIGURE_MAXIMUM_PERIODS,
2381    CONFIGURE_BARRIERS,
2382    CONFIGURE_INIT_TASK_TABLE_SIZE,
2383    CONFIGURE_INIT_TASK_TABLE
2384  };
2385
2386  #ifdef RTEMS_POSIX_API
2387    /**
2388     * This is the POSIX API Configuration Table.
2389     */
2390    posix_api_configuration_table Configuration_POSIX_API = {
2391      CONFIGURE_POSIX_THREADS,
2392      CONFIGURE_MAXIMUM_POSIX_MUTEXES + CONFIGURE_GNAT_MUTEXES +
2393        CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS +
2394        CONFIGURE_GO_INIT_MUTEXES + CONFIGURE_MAXIMUM_GO_CHANNELS,
2395      CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
2396        CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS +
2397        CONFIGURE_GO_INIT_CONDITION_VARIABLES + CONFIGURE_MAXIMUM_GO_CHANNELS,
2398      CONFIGURE_MAXIMUM_POSIX_TIMERS,
2399      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
2400      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
2401      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS,
2402      CONFIGURE_MAXIMUM_POSIX_SEMAPHORES,
2403      CONFIGURE_MAXIMUM_POSIX_BARRIERS,
2404      CONFIGURE_MAXIMUM_POSIX_RWLOCKS,
2405      CONFIGURE_MAXIMUM_POSIX_SPINLOCKS,
2406      CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
2407      CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
2408    };
2409  #endif
2410
2411  /**
2412   * This variable specifies the minimum stack size for tasks in an RTEMS
2413   * application.
2414   *
2415   * NOTE: This is left as a simple uint32_t so it can be externed as
2416   *       needed without requring being high enough logical to
2417   *       include the full configuration table.
2418   */
2419  uint32_t rtems_minimum_stack_size =
2420    CONFIGURE_MINIMUM_TASK_STACK_SIZE;
2421
2422  /**
2423   * This variable specifies the maximum priority value that
2424   * a task may have.  This must be a power of 2 between 4
2425   * and 256 and is specified in terms of Classic API
2426   * priority values.
2427   *
2428   * NOTE: This is left as a simple uint8_t so it can be externed as
2429   *       needed without requring being high enough logical to
2430   *       include the full configuration table.
2431   */
2432  uint8_t rtems_maximum_priority = CONFIGURE_MAXIMUM_PRIORITY;
2433
2434  /**
2435   * This is the primary Configuration Table for this application.
2436   */
2437  const rtems_configuration_table Configuration = {
2438    CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
2439    CONFIGURE_STACK_SPACE_SIZE,               /* required stack space */
2440    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
2441    CONFIGURE_POSIX_KEYS,                     /* POSIX keys are always */
2442    CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS,  /*   enabled */
2443    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
2444    1000 * CONFIGURE_MICROSECONDS_PER_TICK,   /* nanoseconds per clock tick */
2445    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
2446    CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
2447    CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
2448    CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
2449    CONFIGURE_TASK_STACK_ALLOCATOR_INIT,      /* stack allocator init */
2450    CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
2451    CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
2452    CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */
2453    #ifdef CONFIGURE_UNIFIED_WORK_AREAS       /* true for unified work areas */
2454      true,
2455    #else
2456      false,
2457    #endif
2458    #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE /* true to avoid
2459                                                 work space for thread stack
2460                                                 allocation */
2461      true,
2462    #else
2463      false,
2464    #endif
2465    #ifdef RTEMS_SMP
2466      #ifdef CONFIGURE_SMP_APPLICATION
2467        true,
2468      #else
2469        false,
2470      #endif
2471    #endif
2472    CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
2473    CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
2474    #if defined(RTEMS_MULTIPROCESSING)
2475      CONFIGURE_MULTIPROCESSING_TABLE,        /* pointer to MP config table */
2476    #endif
2477    #ifdef RTEMS_SMP
2478      CONFIGURE_SMP_MAXIMUM_PROCESSORS
2479    #endif
2480  };
2481#endif
2482
2483#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
2484
2485#if defined(RTEMS_SMP)
2486 /*
2487  * Instantiate the Per CPU information based upon the user configuration.
2488  */
2489 #if defined(CONFIGURE_INIT)
2490   Per_CPU_Control_envelope _Per_CPU_Information[CONFIGURE_SMP_MAXIMUM_PROCESSORS];
2491 #endif
2492
2493#endif
2494
2495/*
2496 *  If the user has configured a set of Classic API Initialization Tasks,
2497 *  then we need to install the code that runs that loop.
2498 */
2499#ifdef CONFIGURE_INIT
2500  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
2501      defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
2502    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) =
2503              _RTEMS_tasks_Initialize_user_tasks_body;
2504  #else
2505    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) = NULL;
2506  #endif
2507#endif
2508
2509/*
2510 *  If the user has configured a set of POSIX Initialization Threads,
2511 *  then we need to install the code that runs that loop.
2512 */
2513#ifdef RTEMS_POSIX_API
2514  #ifdef CONFIGURE_INIT
2515    #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
2516        defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
2517      void (*_POSIX_Threads_Initialize_user_threads_p)(void) =
2518                _POSIX_Threads_Initialize_user_threads_body;
2519    #else
2520      void (*_POSIX_Threads_Initialize_user_threads_p)(void) = NULL;
2521    #endif
2522  #endif
2523#endif
2524
2525#ifdef __cplusplus
2526}
2527#endif
2528
2529/******************************************************************
2530 ******************************************************************
2531 ******************************************************************
2532 *         CONFIGURATION WARNINGS AND ERROR CHECKING              *
2533 ******************************************************************
2534 ******************************************************************
2535 ******************************************************************
2536 */
2537
2538#if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
2539  /**
2540   * This is a debug mechanism, so if you need to, the executable will
2541   * have a structure with various partial values.  Add to this as you
2542   * need to.  Viewing this structure in gdb combined with dumping
2543   * the Configuration structures generated should help a lot in tracing
2544   * down errors and analyzing where over and under allocations are.
2545   */
2546  typedef struct {
2547    uint32_t SYSTEM_OVERHEAD;
2548    uint32_t STATIC_EXTENSIONS;
2549    uint32_t INITIALIZATION_THREADS_STACKS;
2550
2551    uint32_t PER_INTEGER_TASK;
2552    uint32_t FP_OVERHEAD;
2553    uint32_t CLASSIC;
2554    uint32_t POSIX;
2555
2556    /* System overhead pieces */
2557    uint32_t INTERRUPT_VECTOR_TABLE;
2558    uint32_t INTERRUPT_STACK_MEMORY;
2559    uint32_t MEMORY_FOR_IDLE_TASK;
2560    uint32_t MEMORY_FOR_SCHEDULER;
2561    uint32_t MEMORY_PER_TASK_FOR_SCHEDULER;
2562
2563    /* Classic API Pieces */
2564    uint32_t CLASSIC_TASKS;
2565    uint32_t TASK_VARIABLES;
2566    uint32_t TIMERS;
2567    uint32_t SEMAPHORES;
2568    uint32_t MESSAGE_QUEUES;
2569    uint32_t PARTITIONS;
2570    uint32_t REGIONS;
2571    uint32_t PORTS;
2572    uint32_t PERIODS;
2573    uint32_t BARRIERS;
2574    uint32_t USER_EXTENSIONS;
2575
2576    /* POSIX API managers that are always enabled */
2577    uint32_t POSIX_KEYS;
2578
2579#ifdef RTEMS_POSIX_API
2580    /* POSIX API Pieces */
2581    uint32_t POSIX_MUTEXES;
2582    uint32_t POSIX_CONDITION_VARIABLES;
2583    uint32_t POSIX_TIMERS;
2584    uint32_t POSIX_QUEUED_SIGNALS;
2585    uint32_t POSIX_MESSAGE_QUEUES;
2586    uint32_t POSIX_SEMAPHORES;
2587    uint32_t POSIX_BARRIERS;
2588    uint32_t POSIX_SPINLOCKS;
2589    uint32_t POSIX_RWLOCKS;
2590#endif
2591
2592    /* Stack space sizes */
2593    uint32_t IDLE_TASKS_STACK;
2594    uint32_t INITIALIZATION_THREADS_EXTRA_STACKS;
2595    uint32_t TASKS_STACK;
2596    uint32_t POSIX_THREADS_STACK;
2597    uint32_t GOROUTINES_STACK;
2598    uint32_t ADA_TASKS_STACK;
2599    uint32_t EXTRA_MPCI_RECEIVE_SERVER_STACK;
2600    uint32_t EXTRA_TASK_STACKS;
2601  } Configuration_Debug_t;
2602
2603  Configuration_Debug_t Configuration_Memory_Debug = {
2604    /* General Information */
2605    CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD,
2606    CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS,
2607    CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
2608    CONFIGURE_MEMORY_FOR_TASKS(1, 0),
2609    CONFIGURE_MEMORY_FOR_TASKS(0, 1),
2610    CONFIGURE_MEMORY_FOR_CLASSIC,
2611    CONFIGURE_MEMORY_FOR_POSIX,
2612
2613    /* System overhead pieces */
2614    CONFIGURE_INTERRUPT_VECTOR_TABLE,
2615    CONFIGURE_INTERRUPT_STACK_MEMORY,
2616    CONFIGURE_MEMORY_FOR_IDLE_TASK,
2617    CONFIGURE_MEMORY_FOR_SCHEDULER,
2618    CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER,
2619
2620    /* Classic API Pieces */
2621    CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
2622    CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES +
2623      CONFIGURE_GOROUTINES_TASK_VARIABLES),
2624    CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
2625    CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES),
2626    CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES),
2627    CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS),
2628    CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ),
2629    CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS),
2630    CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS),
2631    CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_BARRIERS),
2632    CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
2633    CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_POSIX_KEYS, \
2634                                     CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ),
2635
2636#ifdef RTEMS_POSIX_API
2637    /* POSIX API Pieces */
2638    CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES +
2639      CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES),
2640    CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(
2641      CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
2642      CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES),
2643    CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
2644      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
2645    CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
2646      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
2647    CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
2648    CONFIGURE_MEMORY_FOR_POSIX_BARRIERS( CONFIGURE_MAXIMUM_POSIX_BARRIERS ),
2649    CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ),
2650    CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( CONFIGURE_MAXIMUM_POSIX_RWLOCKS ),
2651    CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
2652#endif
2653
2654    /* Stack space sizes */
2655    CONFIGURE_IDLE_TASKS_STACK,
2656    CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
2657    CONFIGURE_TASKS_STACK,
2658    CONFIGURE_POSIX_THREADS_STACK,
2659    CONFIGURE_GOROUTINES_STACK,
2660    CONFIGURE_ADA_TASKS_STACK,
2661    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK,
2662    CONFIGURE_EXTRA_TASK_STACKS
2663  };
2664#endif
2665
2666/*
2667 *  Make sure a task/thread of some sort is configured.
2668 *
2669 *  When analyzing RTEMS to find the smallest possible of memory
2670 *  that must be allocated, you probably do want to configure 0
2671 *  tasks/threads so there is a smaller set of calls to _Workspace_Allocate
2672 *  to analyze.
2673 */
2674#if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
2675  #if (CONFIGURE_MAXIMUM_TASKS == 0) && \
2676      (CONFIGURE_MAXIMUM_POSIX_THREADS == 0) && \
2677      (CONFIGURE_MAXIMUM_ADA_TASKS == 0) && \
2678      (CONFIGURE_MAXIMUM_GOROUTINES == 0)
2679    #error "CONFIGURATION ERROR: No tasks or threads configured!!"
2680  #endif
2681#endif
2682
2683#ifndef RTEMS_SCHEDSIM
2684/*
2685 *  Make sure at least one of the initialization task/thread
2686 *  tables was defined.
2687 */
2688#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
2689    !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \
2690    !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
2691#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
2692#endif
2693#endif
2694
2695/*
2696 *  If the user is trying to configure a multiprocessing application and
2697 *  RTEMS was not configured and built multiprocessing, then error out.
2698 */
2699#if defined(CONFIGURE_MP_APPLICATION) && \
2700    !defined(RTEMS_MULTIPROCESSING)
2701#error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!"
2702#endif
2703
2704/*
2705 *  If an attempt was made to configure POSIX objects and
2706 *  the POSIX API was not configured into RTEMS, error out.
2707 *
2708 *  @note POSIX Keys are always available so the parameters
2709 *        CONFIGURE_MAXIMUM_POSIX_KEYS and
2710 *        CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS  are not in this list.
2711 */
2712#if !defined(RTEMS_POSIX_API)
2713  #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
2714       (CONFIGURE_MAXIMUM_POSIX_MUTEXES != 0) || \
2715       (CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES != 0) || \
2716       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
2717       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
2718       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
2719       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS != 0) || \
2720       (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \
2721       (CONFIGURE_MAXIMUM_POSIX_BARRIERS != 0) || \
2722       (CONFIGURE_MAXIMUM_POSIX_SPINLOCKS != 0) || \
2723       (CONFIGURE_MAXIMUM_POSIX_RWLOCKS != 0) || \
2724      defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
2725  #error "CONFIGURATION ERROR: POSIX API support not configured!!"
2726  #endif
2727#endif
2728
2729#if !defined(RTEMS_SCHEDSIM)
2730  #if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE)
2731    /*
2732     *  You must either explicity include or exclude the clock driver.
2733     *  It is such a common newbie error to leave it out.  Maybe this
2734     *  will put an end to it.
2735     *
2736     *  NOTE: If you are using the timer driver, it is considered
2737     *        mutually exclusive with the clock driver because the
2738     *        drivers are assumed to use the same "timer" hardware
2739     *        on many boards.
2740     */
2741    #if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
2742        !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \
2743        !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER)
2744      #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?"
2745     #endif
2746
2747    /*
2748     * Only one of the following three configuration parameters should be
2749     * defined at a time.
2750     */
2751    #if ((defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) + \
2752          defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER) + \
2753          defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER)) > 1)
2754       #error "CONFIGURATION ERROR: More than one clock/timer driver configuration parameter specified?!?"
2755    #endif
2756  #endif /* !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE) */
2757#endif   /* !defined(RTEMS_SCHEDSIM) */
2758
2759/*
2760 *  These names have been obsoleted so make the user application stop compiling
2761 */
2762#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
2763    defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
2764    defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
2765    defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
2766    defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
2767#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
2768#endif
2769
2770/*
2771 *  Validate the configured maximum priority
2772 */
2773#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \
2774     (CONFIGURE_MAXIMUM_PRIORITY != 7) && \
2775     (CONFIGURE_MAXIMUM_PRIORITY != 15) && \
2776     (CONFIGURE_MAXIMUM_PRIORITY != 31) && \
2777     (CONFIGURE_MAXIMUM_PRIORITY != 63) && \
2778     (CONFIGURE_MAXIMUM_PRIORITY != 127) && \
2779     (CONFIGURE_MAXIMUM_PRIORITY != 255))
2780  #error "Maximum priority is not 1 less than a power of 2 between 4 and 256"
2781#endif
2782
2783#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM)
2784  #error "Maximum priority configured higher than supported by target."
2785#endif
2786
2787/*
2788 *  If you have fewer POSIX Message Queue Descriptors than actual
2789 *  POSIX Message Queues, then you will not be able to open all the
2790 *  queues.
2791 */
2792#if (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS < \
2793     CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
2794  #error "Fewer POSIX Message Queue descriptors than Queues!"
2795#endif
2796
2797/*
2798 * POSIX Key pair shouldn't be less than POSIX Key, which is highly
2799 * likely to be error.
2800 */
2801#if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \
2802    (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0)
2803  #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < CONFIGURE_MAXIMUM_POSIX_KEYS)
2804    #error "Fewer POSIX Key pairs than POSIX Key!"
2805  #endif
2806#endif
2807
2808#endif
2809/* end of include file */
Note: See TracBrowser for help on using the repository browser.