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

4.115
Last change on this file since c236082 was c236082, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 30, 2013 at 1:54:53 PM

smp: Provide cache optimized Per_CPU_Control

Delete _Per_CPU_Information_p.

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