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

4.115
Last change on this file since a936aa49 was a936aa49, checked in by Sebastian Huber <sebastian.huber@…>, on 06/06/13 at 13:41:00

scheduler: New simple SMP scheduler implementation

The new Simple SMP Scheduler allocates a processor for the processor
count highest priority ready threads. The thread priority and position
in the ready chain are the only information to determine the scheduling
decision. Threads with an allocated processor are in the scheduled
chain. After initialization the scheduled chain has exactly processor
count nodes. Each processor has exactly one allocated thread after
initialization. All enqueue and extract operations may exchange threads
with the scheduled chain. One thread will be added and another will be
removed. The scheduled and ready chain is ordered according to the
thread priority order. The chain insert operations are O(count of ready
threads), thus this scheduler is unsuitable for most real-time
applications.

The thread preempt mode will be ignored.

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