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

4.115
Last change on this file since c1545f0 was c1545f0, checked in by Joel Sherrill <joel.sherrill@…>, on May 23, 2011 at 4:06:23 PM

2011-05-23 Marta Rybczynska <marta.rybczynska@…>

PR 1805/cpukit

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