source: rtems/cpukit/sapi/include/confdefs.h @ 5af951f

4.115
Last change on this file since 5af951f was 5af951f, checked in by Sebastian Huber <sebastian.huber@…>, on 05/13/11 at 13:49:16

2011-05-13 Sebastian Huber <sebastian.huber@…>

  • sapi/include/confdefs.h: Added "/dev/zero" driver.
  • Property mode set to 100644
File size: 76.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 *
576 * If no configuration is specified by the application, then
577 * CONFIGURE_SCHEDULER_PRIORITY is assumed to be the default.
578 *
579 * An application can define its own scheduling policy by defining
580 * CONFIGURE_SCHEDULER_USER and the following:
581 *    - CONFIGURE_SCHEDULER_ENTRY_POINTS
582 *    - CONFIGURE_MEMORY_FOR_SCHEDULER - base memory
583 *    - CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER - per task memory
584 */
585#include <rtems/score/scheduler.h>
586
587#if defined(CONFIGURE_SCHEDULER_USER) && \
588    !defined(CONFIGURE_SCHEDULER_USER_ENTRY_POINTS)
589  #error "CONFIGURE_ERROR: CONFIGURE_SCHEDULER_USER requires CONFIGURE_SCHEDULER_USER_ENTRY_POINTS"
590#endif
591
592/* If no scheduler is specified, the priority scheduler is default. */
593#if !defined(CONFIGURE_SCHEDULER_USER) && \
594    !defined(CONFIGURE_SCHEDULER_PRIORITY) && \
595    !defined(CONFIGURE_SCHEDULER_SIMPLE)
596  #define CONFIGURE_SCHEDULER_PRIORITY
597#endif
598
599/*
600 * If the Priority Scheduler is selected, then configure for it.
601 */
602#if defined(CONFIGURE_SCHEDULER_PRIORITY)
603  #include <rtems/score/schedulerpriority.h>
604  #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_ENTRY_POINTS
605
606  /**
607   * This defines the memory used by the priority scheduler.
608   */
609  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
610    _Configure_From_workspace( \
611      ((CONFIGURE_MAXIMUM_PRIORITY+1) * sizeof(Chain_Control)) ) \
612  )
613  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
614    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
615#endif
616
617/*
618 * If the Simple Priority Scheduler is selected, then configure for it.
619 */
620#if defined(CONFIGURE_SCHEDULER_SIMPLE)
621  #include <rtems/score/schedulersimple.h>
622  #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_ENTRY_POINTS
623
624  /**
625   * define the memory used by the simple scheduler
626   */
627  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
628    _Configure_From_workspace( sizeof(Chain_Control) ) \
629  )
630  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
631#endif
632
633#if defined(CONFIGURE_SCHEDULER_USER)
634  #define CONFIGURE_SCHEDULER_ENTRY_POINTS \
635          CONFIGURE_SCHEDULER_USER_ENTRY_POINTS
636#endif
637
638/*
639 * Set up the scheduler entry points table.  The scheduling code uses
640 * this code to know which scheduler is configured by the user.
641 */
642#ifdef CONFIGURE_INIT
643  Scheduler_Control  _Scheduler = {
644    NULL,                             /* Scheduler Specific Data Pointer */
645    CONFIGURE_SCHEDULER_ENTRY_POINTS  /* Scheduler Operations */
646  };
647#endif
648
649/*
650 *  If you said the IDLE task was going to do application initialization
651 *  and didn't override the IDLE body, then something is amiss.
652 */
653#if (defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
654     !defined(CONFIGURE_IDLE_TASK_BODY))
655  #error "CONFIGURE_ERROR: You did not override the IDLE task body."
656#endif
657
658/**
659 *  @brief Idle task body configuration
660 *
661 *  There is a default IDLE thread body provided by RTEMS which
662 *  has the possibility of being CPU specific.  There may be a
663 *  BSP specific override of the RTEMS default body and in turn,
664 *  the application may override and provide its own.
665 */
666#ifndef CONFIGURE_IDLE_TASK_BODY
667  #if defined(BSP_IDLE_TASK_BODY)
668    #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
669  #elif (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
670    #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
671  #else
672    /* only instantiate and compile if used */
673    #ifdef CONFIGURE_INIT
674      void *_Thread_Idle_body(uintptr_t ignored)
675      {
676        for( ; ; ) ;
677        return 0;   /* to avoid warning */
678      }
679    #endif
680    #define CONFIGURE_IDLE_TASK_BODY _Thread_Idle_body
681  #endif
682#endif
683
684/**
685 *  By default, use the minimum stack size requested by this port.
686 */
687#ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE
688  #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
689#endif
690
691/**
692 *  @brief Idle task stack size configuration
693 *
694 *  By default, the IDLE task will have a stack of minimum size.
695 *  The BSP or application may override this value.
696 */
697#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
698  #ifdef BSP_IDLE_TASK_STACK_SIZE
699    #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
700  #else
701    #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
702  #endif
703#endif
704
705/**
706 *  @brief Interrupt stack size configuration
707 *
708 *  By default, the interrupt stack will be of minimum size.
709 *  The BSP or application may override this value.
710 */
711#ifndef CONFIGURE_INTERRUPT_STACK_SIZE
712  #ifdef BSP_INTERRUPT_STACK_SIZE
713    #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
714  #else
715    #define CONFIGURE_INTERRUPT_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
716  #endif
717#endif
718
719/**
720 *  This reserves memory for the interrupt stack if it is to be allocated
721 *  by RTEMS rather than the BSP.
722 *
723 *  @todo Try to get to the point where all BSPs support allocating the
724 *        memory from the Workspace.
725 */
726#if (CPU_ALLOCATE_INTERRUPT_STACK == 0)
727  #define CONFIGURE_INTERRUPT_STACK_MEMORY 0
728#else
729  #define CONFIGURE_INTERRUPT_STACK_MEMORY \
730     _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE )
731#endif
732
733/**
734 *  Configure the very much optional task stack allocator
735 */
736#ifndef CONFIGURE_TASK_STACK_ALLOCATOR
737  #define CONFIGURE_TASK_STACK_ALLOCATOR NULL
738#endif
739
740/**
741 *  Configure the very much optional task stack deallocator
742 */
743#ifndef CONFIGURE_TASK_STACK_DEALLOCATOR
744  #define CONFIGURE_TASK_STACK_DEALLOCATOR NULL
745#endif
746
747/**
748 *  Should the RTEMS Workspace and C Program Heap be cleared automatically
749 *  at system start up?
750 */
751#ifndef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
752  #ifdef BSP_ZERO_WORKSPACE_AUTOMATICALLY
753    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY \
754            BSP_ZERO_WORKSPACE_AUTOMATICALLY
755  #else
756    #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY FALSE
757  #endif
758#endif
759
760/*
761 *  RTEMS Malloc configuration
762 */
763
764#include <rtems/malloc.h>
765
766#ifdef CONFIGURE_INIT
767  /**
768   *  By default, RTEMS uses separate heaps for the RTEMS Workspace and
769   *  the C Program Heap.  On many BSPs, these can be optionally
770   *  combined provided one larger memory pool. This is particularly
771   *  useful in combination with the unlimited objects configuration.
772   */
773  #ifdef CONFIGURE_UNIFIED_WORK_AREAS
774    #include <rtems/score/wkspace.h>
775    Heap_Control  *RTEMS_Malloc_Heap = &_Workspace_Area;
776    bool           rtems_unified_work_area = true;
777  #else
778    Heap_Control   RTEMS_Malloc_Area;
779    Heap_Control  *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area;
780    bool           rtems_unified_work_area = false;
781  #endif
782#endif
783
784#ifdef CONFIGURE_INIT
785  /**
786   *  This configures the malloc family statistics to be available.
787   *  By default only function call counts are kept.
788   */
789  rtems_malloc_statistics_functions_t *rtems_malloc_statistics_helpers =
790    #ifndef CONFIGURE_MALLOC_STATISTICS
791      NULL;
792    #else
793      &rtems_malloc_statistics_helpers_table;
794    #endif
795#endif
796
797#ifdef CONFIGURE_INIT
798  /**
799   *  This configures the sbrk() support for the malloc family.
800   *  By default it is assumed that the BSP provides all available
801   *  RAM to the malloc family implementation so sbrk()'ing to get
802   *  more memory would always fail anyway.
803   */
804  rtems_malloc_sbrk_functions_t *rtems_malloc_sbrk_helpers =
805    #ifndef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
806      NULL;
807    #else
808      &rtems_malloc_sbrk_helpers_table;
809    #endif
810#endif
811
812#ifdef CONFIGURE_INIT
813  /**
814   *  This configures the malloc family plugin which dirties memory
815   *  allocated.  This is helpful for finding unitialized data structure
816   *  problems.
817   */
818  rtems_malloc_dirtier_t rtems_malloc_dirty_helper =
819    #if defined(CONFIGURE_MALLOC_DIRTY)
820      rtems_malloc_dirty_memory;
821    #else
822      NULL;
823    #endif
824#endif
825
826/**
827 *  This is a helper macro used in calculations in this file.  It is used
828 *  to noted when an element is allocated from the RTEMS Workspace and adds
829 *  a factor to account for heap overhead plus an alignment factor that
830 *  may be applied.
831 */
832#define _Configure_From_workspace(_size) \
833  (ssize_t)((_size) + (2 * sizeof(uint32_t)) + CPU_ALIGNMENT)
834
835/**
836 *  Do not use the unlimited bit as part of the multiplication
837 *  for memory usage.
838 */
839#define _Configure_Max_Objects(_max) \
840  ((_max) & ~RTEMS_UNLIMITED_OBJECTS)
841
842/**
843 *  This macro accounts for how memory for a set of configured objects is
844 *  allocated from the Executive Workspace.
845 *
846 *  NOTE: It does NOT attempt to address the more complex case of unlimited
847 *        objects.
848 */
849#define _Configure_Object_RAM(_number, _size) \
850  ( _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
851    _Configure_From_workspace( \
852      ((_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *)) + \
853      (sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *)) \
854    ) \
855  )
856
857/*
858 *  Default User Initialization Task Table.  This table guarantees that
859 *  one user initialization table is defined.
860 */
861
862#ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
863
864#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
865
866/*
867 *  The user is defining their own table information and setting the
868 *  appropriate variables.
869 */
870
871#else
872
873#ifndef CONFIGURE_INIT_TASK_NAME
874  #define CONFIGURE_INIT_TASK_NAME          rtems_build_name('U', 'I', '1', ' ')
875#endif
876
877#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
878  #define CONFIGURE_INIT_TASK_STACK_SIZE    CONFIGURE_MINIMUM_TASK_STACK_SIZE
879#endif
880
881#ifndef CONFIGURE_INIT_TASK_PRIORITY
882  #define CONFIGURE_INIT_TASK_PRIORITY      1
883#endif
884
885#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
886  #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_DEFAULT_ATTRIBUTES
887#endif
888
889#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
890  #ifdef __cplusplus
891  extern "C" {
892  #endif
893    rtems_task Init (rtems_task_argument );
894  #ifdef __cplusplus
895  }
896  #endif
897  #define CONFIGURE_INIT_TASK_ENTRY_POINT   Init
898  extern const char* bsp_boot_cmdline;
899  #define CONFIGURE_INIT_TASK_ARGUMENTS     ((rtems_task_argument) &bsp_boot_cmdline)
900#endif
901
902#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
903  #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
904#endif
905
906#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
907  #define CONFIGURE_INIT_TASK_ARGUMENTS     0
908#endif
909
910#ifdef CONFIGURE_INIT
911  rtems_initialization_tasks_table Initialization_tasks[] = {
912    { CONFIGURE_INIT_TASK_NAME,
913      CONFIGURE_INIT_TASK_STACK_SIZE,
914      CONFIGURE_INIT_TASK_PRIORITY,
915      CONFIGURE_INIT_TASK_ATTRIBUTES,
916      CONFIGURE_INIT_TASK_ENTRY_POINT,
917      CONFIGURE_INIT_TASK_INITIAL_MODES,
918      CONFIGURE_INIT_TASK_ARGUMENTS
919    }
920  };
921#endif
922
923#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
924
925#define CONFIGURE_INIT_TASK_TABLE_SIZE \
926  sizeof(CONFIGURE_INIT_TASK_TABLE) / sizeof(rtems_initialization_tasks_table)
927
928#endif    /* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
929
930#else     /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
931
932#define CONFIGURE_INIT_TASK_TABLE      NULL
933#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
934#define CONFIGURE_INIT_TASK_STACK_SIZE 0
935
936#endif
937
938/*
939 *  Default Device Driver Table.  Each driver needed by the test is explicitly
940 *  choosen by that test.  There is always a null driver entry.
941 */
942
943#define NULL_DRIVER_TABLE_ENTRY \
944 { NULL, NULL, NULL, NULL, NULL, NULL }
945
946#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
947  #include <rtems/console.h>
948#endif
949
950#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
951  #include <rtems/clockdrv.h>
952#endif
953
954#ifdef CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
955  #include <rtems/timerdrv.h>
956#endif
957
958#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
959  #include <rtems/rtc.h>
960#endif
961
962#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
963  #include <rtems/watchdogdrv.h>
964#endif
965
966#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
967  #include <rtems/framebuffer.h>
968#endif
969
970#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
971  #include <rtems/devnull.h>
972#endif
973
974#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
975  #include <rtems/devzero.h>
976#endif
977
978#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
979  /* the ide driver needs the ATA driver */
980  #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
981    #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
982  #endif
983  #include <libchip/ide_ctrl.h>
984#endif
985
986#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
987  #include <libchip/ata.h>
988#endif
989
990#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
991
992#ifdef CONFIGURE_INIT
993  rtems_driver_address_table Device_drivers[] = {
994    #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
995      CONFIGURE_BSP_PREREQUISITE_DRIVERS,
996    #endif
997    #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
998      CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
999    #endif
1000    #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
1001      CONSOLE_DRIVER_TABLE_ENTRY,
1002    #endif
1003    #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
1004      CLOCK_DRIVER_TABLE_ENTRY,
1005    #endif
1006    #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
1007      RTC_DRIVER_TABLE_ENTRY,
1008    #endif
1009    #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
1010      WATCHDOG_DRIVER_TABLE_ENTRY,
1011    #endif
1012    #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
1013      DEVNULL_DRIVER_TABLE_ENTRY,
1014    #endif
1015    #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
1016      DEVZERO_DRIVER_TABLE_ENTRY,
1017    #endif
1018    #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
1019      IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
1020    #endif
1021    #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1022      ATA_DRIVER_TABLE_ENTRY,
1023    #endif
1024    #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
1025      FRAME_BUFFER_DRIVER_TABLE_ENTRY,
1026    #endif
1027    #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
1028      CONFIGURE_APPLICATION_EXTRA_DRIVERS,
1029    #endif
1030    #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
1031      NULL_DRIVER_TABLE_ENTRY
1032    #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
1033        !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
1034        !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \
1035        !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \
1036        !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) && \
1037        !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \
1038        !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \
1039        !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) && \
1040        !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
1041      NULL_DRIVER_TABLE_ENTRY
1042    #endif
1043  };
1044#endif
1045
1046#endif  /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
1047
1048/*
1049 *  Default the number of drivers per node.  This value may be
1050 *  overridden by the user.
1051 */
1052
1053#define CONFIGURE_NUMBER_OF_DRIVERS \
1054  ((sizeof(Device_drivers) / sizeof(rtems_driver_address_table)))
1055
1056/**
1057 *  This specifies the maximum number of device drivers that
1058 *  can be installed in the system at one time.  It must account
1059 *  for both the statically and dynamically installed drivers.
1060 */
1061#ifndef CONFIGURE_MAXIMUM_DRIVERS
1062  #define CONFIGURE_MAXIMUM_DRIVERS CONFIGURE_NUMBER_OF_DRIVERS
1063#endif
1064
1065
1066#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
1067  /*
1068   * configure the priority of the ATA driver task
1069   */
1070  #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
1071    #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
1072  #endif
1073  #ifdef CONFIGURE_INIT
1074    rtems_task_priority rtems_ata_driver_task_priority
1075      = CONFIGURE_ATA_DRIVER_TASK_PRIORITY;
1076  #endif /* CONFIGURE_INIT */
1077#endif
1078
1079/*
1080 * add bdbuf configuration and values for swapout task priority
1081 */
1082#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
1083  #include <rtems/bdbuf.h>
1084  /*
1085   * configure the bdbuf cache parameters
1086   */
1087  #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
1088    #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
1089                              RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
1090  #endif
1091  #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
1092    #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
1093                              RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
1094  #endif
1095  #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
1096    #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
1097                              RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
1098  #endif
1099  #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
1100    #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
1101                              RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
1102  #endif
1103  #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
1104    #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
1105                              RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
1106  #endif
1107  #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
1108    #define CONFIGURE_SWAPOUT_WORKER_TASKS \
1109                              RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
1110  #endif
1111  #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
1112    #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
1113                              RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
1114  #endif
1115  #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
1116    #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
1117                              RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
1118  #endif
1119  #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
1120    #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
1121                              RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
1122  #endif
1123  #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
1124    #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
1125                              RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
1126  #endif
1127  #ifdef CONFIGURE_INIT
1128    const rtems_bdbuf_config rtems_bdbuf_configuration = {
1129      CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
1130      CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
1131      CONFIGURE_SWAPOUT_TASK_PRIORITY,
1132      CONFIGURE_SWAPOUT_SWAP_PERIOD,
1133      CONFIGURE_SWAPOUT_BLOCK_HOLD,
1134      CONFIGURE_SWAPOUT_WORKER_TASKS,
1135      CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
1136      CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
1137      CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
1138      CONFIGURE_BDBUF_BUFFER_MAX_SIZE
1139    };
1140  #endif
1141
1142  /*
1143   *  Semaphores:
1144   *    o disk lock
1145   *    o bdbuf lock
1146   *    o bdbuf sync lock
1147   *    o bdbuf access condition
1148   *    o bdbuf transfer condition
1149   *    o bdbuf buffer condition
1150   */
1151  #define CONFIGURE_LIBBLOCK_SEMAPHORES 6
1152
1153  #if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \
1154      defined(CONFIGURE_BDBUF_BUFFER_SIZE) || \
1155      defined(CONFIGURE_BDBUF_BUFFER_COUNT)
1156    #error BDBUF Cache does not use a buffer configuration table. Please remove.
1157  #endif
1158#else
1159  #define CONFIGURE_LIBBLOCK_SEMAPHORES 0
1160#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
1161
1162#if defined(RTEMS_MULTIPROCESSING)
1163  /*
1164   *  Default Multiprocessing Configuration Table.  The defaults are
1165   *  appropriate for most of the RTEMS Multiprocessor Test Suite.  Each
1166   *  value may be overridden within each test to customize the environment.
1167   */
1168
1169  #ifdef CONFIGURE_MP_APPLICATION
1170    #define CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 1
1171
1172    #ifndef CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE
1173
1174      #ifndef CONFIGURE_MP_NODE_NUMBER
1175        #define CONFIGURE_MP_NODE_NUMBER                NODE_NUMBER
1176      #endif
1177
1178      #ifndef CONFIGURE_MP_MAXIMUM_NODES
1179        #define CONFIGURE_MP_MAXIMUM_NODES              2
1180      #endif
1181
1182      #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS
1183        #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS     32
1184      #endif
1185      #define CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \
1186        _Configure_Object_RAM((_global_objects), sizeof(Objects_MP_Control))
1187
1188      #ifndef CONFIGURE_MP_MAXIMUM_PROXIES
1189        #define CONFIGURE_MP_MAXIMUM_PROXIES            32
1190      #endif
1191      #define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
1192        _Configure_Object_RAM((_proxies) + 1, sizeof(Thread_Proxy_control) )
1193
1194      #ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
1195        #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
1196      #endif
1197
1198      #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
1199        #include <mpci.h>
1200        #define CONFIGURE_MP_MPCI_TABLE_POINTER         &MPCI_table
1201      #endif
1202
1203      #ifdef CONFIGURE_INIT
1204        rtems_multiprocessing_table Multiprocessing_configuration = {
1205          CONFIGURE_MP_NODE_NUMBER,               /* local node number */
1206          CONFIGURE_MP_MAXIMUM_NODES,             /* maximum # nodes */
1207          CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS,    /* maximum # global objects */
1208          CONFIGURE_MP_MAXIMUM_PROXIES,           /* maximum # proxies */
1209          CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, /* MPCI stack > minimum */
1210          CONFIGURE_MP_MPCI_TABLE_POINTER         /* ptr to MPCI config table */
1211        };
1212      #endif
1213
1214      #define CONFIGURE_MULTIPROCESSING_TABLE    &Multiprocessing_configuration
1215
1216    #endif /* CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE */
1217
1218  #else
1219
1220    #define CONFIGURE_MULTIPROCESSING_TABLE    NULL
1221
1222  #endif /* CONFIGURE_MP_APPLICATION */
1223#endif /* RTEMS_MULTIPROCESSING */
1224
1225#ifndef CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER
1226  #define CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 0
1227#endif
1228
1229
1230/*
1231 *  Default Configuration Table.
1232 */
1233
1234#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE
1235
1236  #ifndef CONFIGURE_MAXIMUM_TASKS
1237    #define CONFIGURE_MAXIMUM_TASKS               0
1238  #endif
1239
1240  #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
1241    #define CONFIGURE_NOTEPADS_ENABLED           TRUE
1242  #else
1243    #define CONFIGURE_NOTEPADS_ENABLED           FALSE
1244  #endif
1245
1246  #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
1247    #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
1248      _Configure_From_workspace( sizeof(RTEMS_API_Control) )
1249  #else
1250    #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \
1251      _Configure_From_workspace( sizeof(RTEMS_API_Control) - \
1252        (RTEMS_NUMBER_NOTEPADS * sizeof(uint32_t)))
1253  #endif
1254
1255  /**
1256   *  This macro calculates the memory required for task variables.
1257   *
1258   *  @note Each task variable is individually allocated from the Workspace.
1259   *        Hence, we do the multiplication on the configured size.
1260   */
1261  #ifndef CONFIGURE_MAXIMUM_TASK_VARIABLES
1262    #define CONFIGURE_MAXIMUM_TASK_VARIABLES                     0
1263    #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) 0
1264  #else
1265    #define CONFIGURE_MEMORY_FOR_TASK_VARIABLES(_task_variables) \
1266      (_task_variables) * \
1267         _Configure_From_workspace(sizeof(rtems_task_variable_t))
1268  #endif
1269
1270  #ifndef CONFIGURE_MAXIMUM_TIMERS
1271    #define CONFIGURE_MAXIMUM_TIMERS             0
1272    #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0
1273  #else
1274    #define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
1275      _Configure_Object_RAM(_timers, sizeof(Timer_Control) )
1276  #endif
1277
1278  #ifndef CONFIGURE_MAXIMUM_SEMAPHORES
1279    #define CONFIGURE_MAXIMUM_SEMAPHORES                 0
1280  #endif
1281
1282  #define CONFIGURE_SEMAPHORES \
1283    (CONFIGURE_MAXIMUM_SEMAPHORES + CONFIGURE_LIBIO_SEMAPHORES + \
1284      CONFIGURE_TERMIOS_SEMAPHORES + CONFIGURE_LIBBLOCK_SEMAPHORES + \
1285      CONFIGURE_SEMAPHORES_FOR_FIFOS)
1286
1287  /*
1288   * If there are no user or support semaphores defined, then we can assume
1289   * that no memory need be allocated at all for semaphores.
1290   */
1291  #if CONFIGURE_SEMAPHORES == 0
1292    #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0
1293  #else
1294    #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \
1295      _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) )
1296  #endif
1297
1298  #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
1299    #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES             0
1300    #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0
1301  #else
1302    #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \
1303      _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) )
1304  #endif
1305
1306  #ifndef CONFIGURE_MAXIMUM_PARTITIONS
1307    #define CONFIGURE_MAXIMUM_PARTITIONS                 0
1308    #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0
1309  #else
1310    #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \
1311      _Configure_Object_RAM(_partitions, sizeof(Partition_Control) )
1312  #endif
1313
1314  #ifndef CONFIGURE_MAXIMUM_REGIONS
1315    #define CONFIGURE_MAXIMUM_REGIONS              0
1316    #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0
1317  #else
1318    #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \
1319      _Configure_Object_RAM(_regions, sizeof(Region_Control) )
1320  #endif
1321
1322  #ifndef CONFIGURE_MAXIMUM_PORTS
1323    #define CONFIGURE_MAXIMUM_PORTS            0
1324    #define CONFIGURE_MEMORY_FOR_PORTS(_ports) 0
1325  #else
1326    #define CONFIGURE_MEMORY_FOR_PORTS(_ports) \
1327      _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) )
1328  #endif
1329
1330  #ifndef CONFIGURE_MAXIMUM_PERIODS
1331    #define CONFIGURE_MAXIMUM_PERIODS              0
1332    #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0
1333  #else
1334    #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \
1335      _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) )
1336  #endif
1337
1338  #ifndef CONFIGURE_MAXIMUM_BARRIERS
1339    #define CONFIGURE_MAXIMUM_BARRIERS               0
1340  #endif
1341
1342  #define CONFIGURE_BARRIERS \
1343     (CONFIGURE_MAXIMUM_BARRIERS + CONFIGURE_BARRIERS_FOR_FIFOS)
1344
1345  #if CONFIGURE_BARRIERS == 0
1346    #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0
1347  #else
1348    #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \
1349      _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) )
1350  #endif
1351
1352  #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
1353    #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
1354    #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0
1355  #else
1356    #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \
1357      _Configure_Object_RAM(_extensions, sizeof(Extension_Control) )
1358  #endif
1359
1360  #ifndef CONFIGURE_MICROSECONDS_PER_TICK
1361    #define CONFIGURE_MICROSECONDS_PER_TICK \
1362            RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
1363  #endif
1364
1365  #ifndef CONFIGURE_TICKS_PER_TIMESLICE
1366    #define CONFIGURE_TICKS_PER_TIMESLICE        50
1367  #endif
1368
1369/*
1370 *  Initial Extension Set
1371 */
1372
1373#ifdef CONFIGURE_INIT
1374#ifdef CONFIGURE_STACK_CHECKER_ENABLED
1375#include <rtems/stackchk.h>
1376#endif
1377#include <rtems/libcsupport.h>
1378
1379#if defined(CONFIGURE_INITIAL_EXTENSIONS) || \
1380    defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
1381    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
1382  rtems_extensions_table Configuration_Initial_Extensions[] = {
1383    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
1384      RTEMS_NEWLIB_EXTENSION,
1385    #endif
1386    #if defined(CONFIGURE_STACK_CHECKER_ENABLED)
1387      RTEMS_STACK_CHECKER_EXTENSION,
1388    #endif
1389    #if defined(CONFIGURE_INITIAL_EXTENSIONS)
1390      CONFIGURE_INITIAL_EXTENSIONS,
1391    #endif
1392  };
1393
1394  #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
1395  #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
1396    ((sizeof(Configuration_Initial_Extensions) / \
1397      sizeof(rtems_extensions_table)))
1398#else
1399  #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
1400  #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
1401#endif
1402
1403
1404#endif
1405
1406/*
1407 *  POSIX API Configuration Parameters
1408 */
1409
1410#ifdef RTEMS_POSIX_API
1411
1412  #include <sys/types.h>
1413  #include <signal.h>
1414  #include <limits.h>
1415  #include <mqueue.h>
1416  #include <rtems/posix/barrier.h>
1417  #include <rtems/posix/cond.h>
1418  #include <rtems/posix/mqueue.h>
1419  #include <rtems/posix/mutex.h>
1420  #include <rtems/posix/key.h>
1421  #include <rtems/posix/psignal.h>
1422  #include <rtems/posix/rwlock.h>
1423  #include <rtems/posix/semaphore.h>
1424  #include <rtems/posix/spinlock.h>
1425  #include <rtems/posix/threadsup.h>
1426  #include <rtems/posix/timer.h>
1427
1428  /**
1429   *  Account for the object control structures plus the name
1430   *  of the object to be duplicated.
1431   */
1432  #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
1433    _Configure_Object_RAM( (_number), _size ) + \
1434    ((_number) + _Configure_From_workspace(NAME_MAX) )
1435
1436  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
1437    #define CONFIGURE_MAXIMUM_POSIX_THREADS      0
1438  #endif
1439
1440  #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \
1441    _Configure_From_workspace( \
1442      CONFIGURE_MINIMUM_TASK_STACK_SIZE + \
1443      sizeof (POSIX_API_Control) + \
1444     (sizeof (void *) * (CONFIGURE_MAXIMUM_POSIX_KEYS)) \
1445    )
1446
1447  #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
1448    #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              0
1449    #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) 0
1450  #else
1451    #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
1452      _Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
1453  #endif
1454
1455  #ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
1456    #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES               0
1457    #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) 0
1458  #else
1459    #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) \
1460        _Configure_Object_RAM(_condvars, \
1461                            sizeof(POSIX_Condition_variables_Control) )
1462  #endif
1463
1464  #ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
1465    #define CONFIGURE_MAXIMUM_POSIX_KEYS           0
1466    #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys) 0
1467  #else
1468    #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys) \
1469      _Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) )
1470  #endif
1471
1472  #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
1473    #define CONFIGURE_MAXIMUM_POSIX_TIMERS             0
1474    #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) 0
1475  #else
1476    #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
1477      _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
1478  #endif
1479
1480  #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
1481    #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS                     0
1482    #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) 0
1483  #else
1484    #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
1485      _Configure_From_workspace( \
1486        (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
1487  #endif
1488
1489  #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
1490    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
1491    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) 0
1492    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS          0
1493    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_fds) 0
1494  #else
1495    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
1496      _Configure_POSIX_Named_Object_RAM( \
1497         _message_queues, sizeof(POSIX_Message_queue_Control) )
1498
1499    /* default to same number */
1500    #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
1501       #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
1502               CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
1503    #endif
1504
1505    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_mqueue_fds) \
1506      _Configure_POSIX_Named_Object_RAM( \
1507         _mqueue_fds, sizeof(POSIX_Message_queue_Control_fd) )
1508  #endif
1509
1510  #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
1511    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES                 0
1512    #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) 0
1513  #else
1514    #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
1515      _Configure_POSIX_Named_Object_RAM( \
1516         _semaphores, sizeof(POSIX_Semaphore_Control) )
1517  #endif
1518
1519  #ifndef CONFIGURE_MAXIMUM_POSIX_BARRIERS
1520    #define CONFIGURE_MAXIMUM_POSIX_BARRIERS               0
1521    #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) 0
1522  #else
1523    #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \
1524      _Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) )
1525  #endif
1526
1527  #ifndef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
1528    #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS                0
1529    #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) 0
1530  #else
1531    #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \
1532      _Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) )
1533  #endif
1534
1535  #ifndef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
1536    #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS              0
1537    #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) 0
1538  #else
1539    #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) \
1540      _Configure_Object_RAM(_rwlocks, sizeof(POSIX_RWLock_Control) )
1541  #endif
1542
1543  #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
1544
1545    #ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
1546
1547      /*
1548       *  The user is defining their own table information and setting the
1549       *  appropriate variables for the POSIX Initialization Thread Table.
1550       */
1551
1552    #else
1553
1554      #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
1555        #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
1556      #endif
1557
1558      #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
1559        #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
1560                (CONFIGURE_MINIMUM_TASK_STACK_SIZE * 2)
1561      #endif
1562
1563      #ifdef CONFIGURE_INIT
1564        posix_initialization_threads_table POSIX_Initialization_threads[] = {
1565          { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT, \
1566              CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
1567        };
1568      #endif
1569
1570      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
1571              POSIX_Initialization_threads
1572
1573      #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
1574        sizeof(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME) / \
1575            sizeof(posix_initialization_threads_table)
1576
1577    #endif    /* CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
1578
1579  #else     /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
1580
1581    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
1582    #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
1583
1584  #endif
1585
1586  #define CONFIGURE_MEMORY_FOR_POSIX \
1587    ( CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES + \
1588          CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES) + \
1589      CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES( \
1590          CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES + \
1591          CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES) + \
1592      CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS ) + \
1593      CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
1594          CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ) + \
1595      CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
1596          CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ) + \
1597      CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS( \
1598          CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS ) + \
1599      CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
1600          CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ) + \
1601      CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(CONFIGURE_MAXIMUM_POSIX_BARRIERS) + \
1602      CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( \
1603          CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ) + \
1604      CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( \
1605          CONFIGURE_MAXIMUM_POSIX_RWLOCKS ) + \
1606      CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ) + \
1607      (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE) \
1608     )
1609#else
1610
1611  #define CONFIGURE_MAXIMUM_POSIX_THREADS         0
1612  #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API 0
1613  #define CONFIGURE_MEMORY_FOR_POSIX              0
1614
1615#endif    /* RTEMS_POSIX_API */
1616
1617#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
1618  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE    0
1619#endif
1620
1621/*
1622 *  This block of defines are for applications which use GNAT/RTEMS.
1623 *  GNAT implements each Ada task as a POSIX thread.
1624 */
1625#ifdef CONFIGURE_GNAT_RTEMS
1626
1627  /**
1628   *  The GNAT run-time needs something less than (10) POSIX mutexes.
1629   *  We may be able to get by with less but why bother.
1630   */
1631  #define CONFIGURE_GNAT_MUTEXES 10
1632
1633  /**
1634   *  This is the maximum number of Ada tasks which can be concurrently
1635   *  in existence.  Twenty (20) are required to run all tests in the
1636   *  ACATS (formerly ACVC).
1637   */
1638  #ifndef CONFIGURE_MAXIMUM_ADA_TASKS
1639    #define CONFIGURE_MAXIMUM_ADA_TASKS  20
1640  #endif
1641
1642  /**
1643   * This is the number of non-Ada tasks which invoked Ada code.
1644   */
1645  #ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
1646    #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
1647  #endif
1648
1649  /**
1650   * Ada tasks are allocated twice the minimum stack space.
1651   */
1652  #define CONFIGURE_ADA_TASKS_STACK \
1653    (CONFIGURE_MAXIMUM_ADA_TASKS * \
1654      (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (6 * 1024)))
1655
1656#else
1657  #define CONFIGURE_GNAT_MUTEXES           0
1658  #define CONFIGURE_MAXIMUM_ADA_TASKS      0
1659  #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
1660  #define CONFIGURE_ADA_TASKS_STACK        0
1661#endif
1662
1663#ifdef CONFIGURE_ENABLE_GO
1664
1665  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
1666    #define CONFIGURE_MAXIMUM_POSIX_THREADS 1
1667  #endif
1668  #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
1669    #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
1670  #endif
1671  #ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
1672    #define CONFIGURE_MAXIMUM_CONDITION_VARIABLES 1
1673  #endif
1674
1675  #define CONFIGURE_GO_INIT_MUTEXES 77
1676  #define CONFIGURE_GO_INIT_CONDITION_VARIABLES 4
1677
1678  #ifndef CONFIGURE_MAXIMUM_GOROUTINES
1679    #define CONFIGURE_MAXIMUM_GOROUTINES 400
1680  #endif
1681
1682  #define CONFIGURE_GOROUTINES_TASK_VARIABLES \
1683    (2 * CONFIGURE_MAXIMUM_GOROUTINES)
1684
1685  #ifndef CONFIGURE_MAXIMUM_GO_CHANNELS
1686    #define CONFIGURE_MAXIMUM_GO_CHANNELS 500
1687  #endif
1688
1689#else
1690  #define CONFIGURE_GO_INIT_MUTEXES             0
1691  #define CONFIGURE_GO_INIT_CONDITION_VARIABLES 0
1692  #define CONFIGURE_MAXIMUM_GOROUTINES          0
1693  #define CONFIGURE_GOROUTINES_TASK_VARIABLES   0
1694  #define CONFIGURE_MAXIMUM_GO_CHANNELS         0
1695#endif
1696
1697#ifndef RTEMS_SCHEDSIM
1698/**
1699 *  This macro specifies the amount of memory to be reserved for the
1700 *  Newlib C Library reentrancy structure -- if we are using newlib.
1701 */
1702
1703#if (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
1704  #include <reent.h>
1705
1706  #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB \
1707    _Configure_From_workspace(sizeof(struct _reent))
1708#else
1709  #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB 0
1710#endif
1711
1712#else
1713  #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB 0
1714#endif
1715
1716
1717/*
1718 *  Calculate the RAM size based on the maximum number of objects configured.
1719 */
1720
1721#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
1722
1723/**
1724 *  Account for allocating the following per object
1725 *    + array of object control structures
1726 *    + local pointer table -- pointer per object plus a zero'th
1727 *      entry in the local pointer table.
1728 */
1729
1730#define CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \
1731 ( \
1732  _Configure_Object_RAM(_tasks, sizeof(Thread_Control)) + \
1733  (_Configure_Max_Objects(_tasks) * \
1734   (_Configure_From_workspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \
1735    CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API + \
1736    CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB + \
1737    CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \
1738    CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER))  + \
1739  _Configure_From_workspace( \
1740    _Configure_Max_Objects(_number_FP_tasks) * CONTEXT_FP_SIZE) + \
1741  _Configure_From_workspace( \
1742          (CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1) * sizeof(void *)) \
1743 )
1744
1745/**
1746 *  This defines the amount of memory configured for the multiprocessing
1747 *  support required by this application.
1748 */
1749#ifdef CONFIGURE_MP_APPLICATION
1750  #define CONFIGURE_MEMORY_FOR_MP \
1751    (CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
1752     CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS( \
1753             CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) + \
1754     CONFIGURE_MEMORY_FOR_TASKS(1, 1) + \
1755     CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK \
1756  )
1757#else
1758  #define CONFIGURE_MEMORY_FOR_MP  0
1759#endif
1760
1761/**
1762 *  This is so we can account for tasks with stacks greater than minimum
1763 *  size.  This is in bytes.
1764 */
1765#ifndef CONFIGURE_EXTRA_TASK_STACKS
1766  #define CONFIGURE_EXTRA_TASK_STACKS 0
1767#endif
1768
1769/**
1770 *  The following macro is used to calculate the memory allocated by RTEMS
1771 *  for the message buffers associated with a particular message queue.
1772 *  There is a fixed amount of overhead per message.
1773 */
1774#define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
1775    _Configure_From_workspace( \
1776      (_messages) * ((_size) + sizeof(CORE_message_queue_Buffer_control)))
1777
1778/**
1779 *  This macros is set to the amount of memory required for pending message
1780 *  buffers in bytes.  It should be constructed by adding together a
1781 *  set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
1782 */
1783#ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
1784  #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
1785#endif
1786
1787/**
1788 *  This macro is available just in case the confdefs.h file underallocates
1789 *  memory for a particular application.  This lets the user add some extra
1790 *  memory in case something broken and underestimates.
1791 *
1792 *  It is also possible for cases where confdefs.h overallocates memory,
1793 *  you could substract memory from the allocated.  The estimate is just
1794 *  that, an estimate, and assumes worst case alignment and padding on
1795 *  each allocated element.  So in some cases it could be too conservative.
1796 *
1797 *  @note Historically this was used for message buffers.
1798 */
1799#ifndef CONFIGURE_MEMORY_OVERHEAD
1800  #define CONFIGURE_MEMORY_OVERHEAD 0
1801#endif
1802
1803/**
1804 *  On architectures that use Simple Vectored Interrupts, it is RTEMS
1805 *  responsibility to allocate the vector table.  This avoids reserving
1806 *  the memory on architectures that use the Programmable Interrupt
1807 *  Controller Vectored Interrupts.
1808 */
1809#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
1810  /*
1811   *  This is a (hopefully) temporary hack.  On the mips, the number of
1812   *  vectors is NOT statically defined.  But it has to be statically
1813   *  defined for this to work.  This is an issue looking for a nice
1814   *  solution.
1815   */
1816  #if defined(__mips__)
1817    #define CONFIGURE_INTERRUPT_VECTOR_TABLE \
1818      _Configure_From_workspace( (sizeof(ISR_Handler_entry) * 256))
1819  #else
1820    #define CONFIGURE_INTERRUPT_VECTOR_TABLE \
1821      _Configure_From_workspace( \
1822        (sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS))
1823  #endif
1824#else
1825  #define CONFIGURE_INTERRUPT_VECTOR_TABLE 0
1826#endif
1827
1828/**
1829 *  RTEMS uses one instance of an internal mutex class.  This accounts
1830 *  for that mutex
1831 */
1832#define CONFIGURE_API_MUTEX_MEMORY \
1833  _Configure_Object_RAM(1, sizeof(API_Mutex_Control))
1834
1835/**
1836 *  This defines the formula used to compute the amount of memory
1837 *  reserved for IDLE task control structures and stacks.
1838 */
1839#define CONFIGURE_IDLE_TASKS(_count) \
1840    (CONFIGURE_MEMORY_FOR_TASKS(_count, 0) + \
1841      _count * _Configure_From_workspace( \
1842       (CONFIGURE_IDLE_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)))
1843
1844/**
1845 *  This calculates the amount of memory reserved for the IDLE tasks.
1846 *  In an SMP system, each CPU core has its own idle task.
1847 */
1848#if defined(RTEMS_SMP)
1849  #define CONFIGURE_MEMORY_FOR_IDLE_TASK \
1850          CONFIGURE_IDLE_TASKS(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
1851#else
1852  #define CONFIGURE_MEMORY_FOR_IDLE_TASK \
1853          CONFIGURE_IDLE_TASKS(1)
1854#endif
1855
1856/**
1857 *  This macro accounts for general RTEMS system overhead.
1858 */
1859#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
1860  ( CONFIGURE_MEMORY_FOR_IDLE_TASK +                /* IDLE and stack */ \
1861    CONFIGURE_MEMORY_FOR_SCHEDULER +                /* Scheduler */ \
1862    CONFIGURE_INTERRUPT_VECTOR_TABLE +             /* interrupt vectors */ \
1863    CONFIGURE_INTERRUPT_STACK_MEMORY +             /* interrupt stack */ \
1864    CONFIGURE_API_MUTEX_MEMORY                     /* allocation mutex */ \
1865  )
1866
1867/*
1868 *  Now account for any extra memory that initialization tasks or threads
1869 *  may have requested.
1870 */
1871
1872/**
1873 *  This accounts for any extra memory required by the Classic API
1874 *  Initialization Task.
1875 */
1876#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1877  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
1878      (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1879#else
1880  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
1881#endif
1882
1883/**
1884 *  This accounts for any extra memory required by the POSIX API
1885 *  Initialization Thread.
1886 */
1887#if defined(RTEMS_POSIX_API) && \
1888    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1889  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
1890    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
1891#else
1892  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
1893#endif
1894
1895/**
1896 *  This macro provides a summation of the various initialization task
1897 *  and thread stack requirements.
1898 */
1899#define CONFIGURE_INITIALIZATION_THREADS_STACKS \
1900    (CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
1901    CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART)
1902
1903/**
1904 *  This macro provides a summation of the various task and thread
1905 *  requirements.
1906 */
1907#define CONFIGURE_TOTAL_TASKS_AND_THREADS \
1908   (CONFIGURE_MAXIMUM_TASKS + \
1909    CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS + \
1910    CONFIGURE_MAXIMUM_GOROUTINES)
1911
1912/**
1913 *  This macro reserves the memory required by the statically configured
1914 *  user extensions.
1915 */
1916#define CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \
1917     ((CONFIGURE_NEWLIB_EXTENSION * \
1918        _Configure_From_workspace( sizeof(User_extensions_Control))) + \
1919      (CONFIGURE_STACK_CHECKER_EXTENSION * \
1920        _Configure_From_workspace( sizeof(User_extensions_Control))) \
1921     )
1922
1923/**
1924 *  This macro provides a summation of the memory required by the
1925 *  Classic API as configured.
1926 */
1927#define CONFIGURE_MEMORY_FOR_CLASSIC \
1928  (CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES + \
1929    CONFIGURE_GOROUTINES_TASK_VARIABLES) + \
1930   CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \
1931    CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \
1932   CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES) + \
1933   CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \
1934   CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \
1935   CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \
1936   CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \
1937   CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \
1938   CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_BARRIERS) + \
1939   CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \
1940  )
1941
1942#if defined(RTEMS_SMP)
1943  #define CONFIGURE_MEMORY_FOR_SMP \
1944     (CONFIGURE_SMP_MAXIMUM_PROCESSORS * \
1945      _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE ) \
1946     )
1947#else
1948  #define CONFIGURE_MEMORY_FOR_SMP 0
1949#endif
1950
1951#if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
1952  /**
1953   *  This is a debug mechanism, so if you need to, the executable will
1954   *  have a structure with various partial values.  Add to this as you
1955   *  need to.  Viewing this structure in gdb combined with dumping
1956   *  the Configuration structures generated should help a lot in tracing
1957   *  down errors and analyzing where over and under allocations are.
1958   */
1959  typedef struct {
1960    uint32_t SYSTEM_OVERHEAD;
1961    uint32_t STATIC_EXTENSIONS;
1962    uint32_t INITIALIZATION_THREADS_STACKS;
1963
1964    uint32_t PER_INTEGER_TASK;
1965    uint32_t FP_OVERHEAD;
1966    uint32_t CLASSIC;
1967    uint32_t POSIX;
1968
1969    /* System overhead pieces */
1970    uint32_t INTERRUPT_VECTOR_TABLE;
1971    uint32_t INTERRUPT_STACK_MEMORY;
1972    uint32_t THREAD_READY_CHAINS;
1973    uint32_t MEMORY_FOR_IDLE_TASK;
1974
1975    /* Classic API Pieces */
1976    uint32_t CLASSIC_TASKS;
1977    uint32_t TASK_VARIABLES;
1978    uint32_t TIMERS;
1979    uint32_t SEMAPHORES;
1980    uint32_t MESSAGE_QUEUES;
1981    uint32_t PARTITIONS;
1982    uint32_t REGIONS;
1983    uint32_t PORTS;
1984    uint32_t PERIODS;
1985    uint32_t BARRIERS;
1986    uint32_t USER_EXTENSIONS;
1987#ifdef RTEMS_POSIX_API
1988    /* POSIX API Pieces */
1989    uint32_t POSIX_MUTEXES;
1990    uint32_t POSIX_CONDITION_VARIABLES;
1991    uint32_t POSIX_KEYS;
1992    uint32_t POSIX_TIMERS;
1993    uint32_t POSIX_QUEUED_SIGNALS;
1994    uint32_t POSIX_MESSAGE_QUEUES;
1995    uint32_t POSIX_SEMAPHORES;
1996    uint32_t POSIX_BARRIERS;
1997    uint32_t POSIX_SPINLOCKS;
1998    uint32_t POSIX_RWLOCKS;
1999#endif
2000  } Configuration_Debug_t;
2001
2002  Configuration_Debug_t Configuration_Memory_Debug = {
2003    /* General Information */
2004    CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD,
2005    CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS,
2006    CONFIGURE_INITIALIZATION_THREADS_STACKS,
2007    CONFIGURE_MEMORY_FOR_TASKS(1, 0),
2008    CONFIGURE_MEMORY_FOR_TASKS(0, 1),
2009    CONFIGURE_MEMORY_FOR_CLASSIC,
2010    CONFIGURE_MEMORY_FOR_POSIX,
2011
2012    /* System overhead pieces */
2013    CONFIGURE_INTERRUPT_VECTOR_TABLE,
2014    CONFIGURE_INTERRUPT_STACK_MEMORY,
2015    CONFIGURE_MEMORY_FOR_THREAD_READY_CHAINS,
2016    CONFIGURE_MEMORY_FOR_IDLE_TASK,
2017
2018    /* Classic API Pieces */
2019    CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
2020    CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES +
2021      CONFIGURE_GOROUTINES_TASK_VARIABLES),
2022    CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
2023    CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES),
2024    CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES),
2025    CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS),
2026    CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ),
2027    CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS),
2028    CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS),
2029    CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_BARRIERS),
2030    CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
2031
2032#ifdef RTEMS_POSIX_API
2033    /* POSIX API Pieces */
2034    CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES +
2035      CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES),
2036    CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(
2037      CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
2038      CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES),
2039    CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS ),
2040    CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
2041      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
2042    CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
2043      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
2044    CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
2045    CONFIGURE_MEMORY_FOR_POSIX_BARRIERS( CONFIGURE_MAXIMUM_POSIX_BARRIERS ),
2046    CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ),
2047    CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( CONFIGURE_MAXIMUM_POSIX_RWLOCKS ),
2048    CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
2049#endif
2050  };
2051#endif
2052
2053/**
2054 *  This calculates the memory required for the executive workspace.
2055 */
2056#define CONFIGURE_EXECUTIVE_RAM_SIZE \
2057(( \
2058   CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD + \
2059   CONFIGURE_MEMORY_FOR_DEVFS + \
2060   CONFIGURE_MEMORY_FOR_TASKS( \
2061     CONFIGURE_TOTAL_TASKS_AND_THREADS, CONFIGURE_TOTAL_TASKS_AND_THREADS) + \
2062   CONFIGURE_MEMORY_FOR_CLASSIC + \
2063   CONFIGURE_MEMORY_FOR_POSIX + \
2064   (CONFIGURE_MAXIMUM_POSIX_THREADS * CONFIGURE_MINIMUM_TASK_STACK_SIZE ) + \
2065   (CONFIGURE_MAXIMUM_GOROUTINES * CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \
2066   CONFIGURE_INITIALIZATION_THREADS_STACKS + \
2067   CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
2068   CONFIGURE_MEMORY_FOR_MP + \
2069   CONFIGURE_MEMORY_FOR_SMP + \
2070   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
2071   (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
2072   (CONFIGURE_EXTRA_TASK_STACKS) + (CONFIGURE_ADA_TASKS_STACK) \
2073) & ~0x7)
2074#endif
2075
2076#ifdef CONFIGURE_INIT
2077  /**
2078   *  This is the Classic API Configuration Table.
2079   */
2080  rtems_api_configuration_table Configuration_RTEMS_API = {
2081    CONFIGURE_MAXIMUM_TASKS,
2082    CONFIGURE_NOTEPADS_ENABLED,
2083    CONFIGURE_MAXIMUM_TIMERS + CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER,
2084    CONFIGURE_SEMAPHORES,
2085    CONFIGURE_MAXIMUM_MESSAGE_QUEUES,
2086    CONFIGURE_MAXIMUM_PARTITIONS,
2087    CONFIGURE_MAXIMUM_REGIONS,
2088    CONFIGURE_MAXIMUM_PORTS,
2089    CONFIGURE_MAXIMUM_PERIODS,
2090    CONFIGURE_BARRIERS,
2091    CONFIGURE_INIT_TASK_TABLE_SIZE,
2092    CONFIGURE_INIT_TASK_TABLE
2093  };
2094
2095  #ifdef RTEMS_POSIX_API
2096    /**
2097     *  This is the POSIX API Configuration Table.
2098     */
2099    posix_api_configuration_table Configuration_POSIX_API = {
2100      CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS +
2101        CONFIGURE_MAXIMUM_GOROUTINES,
2102      CONFIGURE_MAXIMUM_POSIX_MUTEXES + CONFIGURE_GNAT_MUTEXES +
2103        CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS +
2104        CONFIGURE_GO_INIT_MUTEXES + CONFIGURE_MAXIMUM_GO_CHANNELS,
2105      CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
2106        CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS +
2107        CONFIGURE_GO_INIT_CONDITION_VARIABLES + CONFIGURE_MAXIMUM_GO_CHANNELS,
2108      CONFIGURE_MAXIMUM_POSIX_KEYS,
2109      CONFIGURE_MAXIMUM_POSIX_TIMERS,
2110      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
2111      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
2112      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS,
2113      CONFIGURE_MAXIMUM_POSIX_SEMAPHORES,
2114      CONFIGURE_MAXIMUM_POSIX_BARRIERS,
2115      CONFIGURE_MAXIMUM_POSIX_RWLOCKS,
2116      CONFIGURE_MAXIMUM_POSIX_SPINLOCKS,
2117      CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
2118      CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
2119    };
2120  #endif
2121
2122  /** This variable specifies the minimum stack size for tasks in an RTEMS
2123   *  application.
2124   *
2125   *  @note This is left as a simple uint32_t so it can be externed as
2126   *        needed without requring being high enough logical to
2127   *        include the full configuration table.
2128   */
2129  uint32_t rtems_minimum_stack_size =
2130    CONFIGURE_MINIMUM_TASK_STACK_SIZE;
2131
2132  /** This variable specifies the maximum priority value that
2133   *  a task may have.  This must be a power of 2 between 4
2134   *  and 256 and is specified in terms of Classic API
2135   *  priority values.
2136   *
2137   *  @note This is left as a simple uint8_t so it can be externed as
2138   *        needed without requring being high enough logical to
2139   *        include the full configuration table.
2140   */
2141  uint8_t rtems_maximum_priority = CONFIGURE_MAXIMUM_PRIORITY;
2142
2143  /**
2144   *  This is the primary Configuration Table for this application.
2145   */
2146  rtems_configuration_table Configuration = {
2147    NULL,                                     /* filled in by BSP */
2148    CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
2149    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
2150    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
2151    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
2152    CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
2153    CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
2154    CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
2155    CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
2156    CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
2157    CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */
2158    CONFIGURE_MAXIMUM_DRIVERS,                /* maximum device drivers */
2159    CONFIGURE_NUMBER_OF_DRIVERS,              /* static device drivers */
2160    Device_drivers,                           /* pointer to driver table */
2161    CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
2162    CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
2163    #if defined(RTEMS_MULTIPROCESSING)
2164      CONFIGURE_MULTIPROCESSING_TABLE,        /* pointer to MP config table */
2165    #endif
2166  };
2167#endif
2168
2169#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
2170
2171#if defined(RTEMS_SMP)
2172  /**
2173   *  Instantiate the variable which specifies the number of CPUs
2174   *  in an SMP configuration.
2175   */
2176  #if defined(CONFIGURE_INIT)
2177    uint32_t rtems_configuration_smp_maximum_processors = \
2178        CONFIGURE_SMP_MAXIMUM_PROCESSORS;
2179  #else
2180    extern uint32_t rtems_configuration_smp_maximum_processors;
2181  #endif
2182 /*
2183  * Instantiate the Per CPU information based upon the user configuration.
2184  */
2185 #if defined(CONFIGURE_INIT)
2186   Per_CPU_Control _Per_CPU_Information[CONFIGURE_SMP_MAXIMUM_PROCESSORS];
2187   Per_CPU_Control *_Per_CPU_Information_p[CONFIGURE_SMP_MAXIMUM_PROCESSORS];
2188 #endif
2189
2190#endif
2191
2192/*
2193 *  If the user has configured a set of Classic API Initialization Tasks,
2194 *  then we need to install the code that runs that loop.
2195 */
2196#ifdef CONFIGURE_INIT
2197  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
2198      defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
2199    void (_RTEMS_tasks_Initialize_user_tasks_body)(void);
2200    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) =
2201              _RTEMS_tasks_Initialize_user_tasks_body;
2202  #else
2203    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) = NULL;
2204  #endif
2205#endif
2206
2207/*
2208 *  If the user has configured a set of POSIX Initialization Threads,
2209 *  then we need to install the code that runs that loop.
2210 */
2211#ifdef RTEMS_POSIX_API
2212  #ifdef CONFIGURE_INIT
2213    #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
2214        defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
2215      void _POSIX_Threads_Initialize_user_threads_body(void);
2216      void (*_POSIX_Threads_Initialize_user_threads_p)(void) =
2217                _POSIX_Threads_Initialize_user_threads_body;
2218    #else
2219      void (*_POSIX_Threads_Initialize_user_threads_p)(void) = NULL;
2220    #endif
2221  #endif
2222#endif
2223
2224#ifdef __cplusplus
2225}
2226#endif
2227
2228/******************************************************************
2229 ******************************************************************
2230 ******************************************************************
2231 *         CONFIGURATION WARNINGS AND ERROR CHECKING              *
2232 ******************************************************************
2233 ******************************************************************
2234 ******************************************************************
2235 */
2236
2237/*
2238 *  Make sure a task/thread of some sort is configured.
2239 *
2240 *  When analyzing RTEMS to find the smallest possible of memory
2241 *  that must be allocated, you probably do want to configure 0
2242 *  tasks/threads so there is a smaller set of calls to _Workspace_Allocate
2243 *  to analyze.
2244 */
2245#if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
2246  #if (CONFIGURE_MAXIMUM_TASKS == 0) && \
2247      (CONFIGURE_MAXIMUM_POSIX_THREADS == 0) && \
2248      (CONFIGURE_MAXIMUM_ADA_TASKS == 0) && \
2249      (CONFIGURE_MAXIMUM_GOROUTINES == 0)
2250    #error "CONFIGURATION ERROR: No tasks or threads configured!!"
2251  #endif
2252#endif
2253
2254#ifndef RTEMS_SCHEDSIM
2255/*
2256 *  Make sure at least one of the initialization task/thread
2257 *  tables was defined.
2258 */
2259#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
2260    !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \
2261    !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION)
2262#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
2263#endif
2264#endif
2265
2266/*
2267 *  If the user is trying to configure a multiprocessing application and
2268 *  RTEMS was not configured and built multiprocessing, then error out.
2269 */
2270#if defined(CONFIGURE_MP_APPLICATION) && \
2271    !defined(RTEMS_MULTIPROCESSING)
2272#error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!"
2273#endif
2274
2275/*
2276 *  If an attempt was made to configure POSIX objects and
2277 *  the POSIX API was not configured into RTEMS, error out.
2278 */
2279#if !defined(RTEMS_POSIX_API)
2280  #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
2281       (CONFIGURE_MAXIMUM_POSIX_MUTEXES != 0) || \
2282       (CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES != 0) || \
2283       (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) || \
2284       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
2285       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
2286       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
2287       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS != 0) || \
2288       (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \
2289       (CONFIGURE_MAXIMUM_POSIX_BARRIERS != 0) || \
2290       (CONFIGURE_MAXIMUM_POSIX_SPINLOCKS != 0) || \
2291       (CONFIGURE_MAXIMUM_POSIX_RWLOCKS != 0) || \
2292      defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
2293  #error "CONFIGURATION ERROR: POSIX API support not configured!!"
2294  #endif
2295#endif
2296
2297#ifndef RTEMS_SCHEDSIM
2298/*
2299 *  You must either explicity include or exclude the clock driver.
2300 *  It is such a common newbie error to leave it out.  Maybe this
2301 *  will put an end to it.
2302 *
2303 *  NOTE: If you are using the timer driver, it is considered
2304 *        mutually exclusive with the clock driver because the
2305 *        drivers are assumed to use the same "timer" hardware
2306 *        on many boards.
2307 */
2308#if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE)
2309  #if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
2310      !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \
2311      !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER)
2312    #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?"
2313   #endif
2314#endif
2315#endif
2316
2317/*
2318 *  These names have been obsoleted so make the user application stop compiling
2319 */
2320#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
2321    defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
2322    defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
2323    defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
2324    defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
2325#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
2326#endif
2327
2328/*
2329 *  Validate the configured maximum priority
2330 */
2331#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \
2332     (CONFIGURE_MAXIMUM_PRIORITY != 7) && \
2333     (CONFIGURE_MAXIMUM_PRIORITY != 15) && \
2334     (CONFIGURE_MAXIMUM_PRIORITY != 31) && \
2335     (CONFIGURE_MAXIMUM_PRIORITY != 63) && \
2336     (CONFIGURE_MAXIMUM_PRIORITY != 127) && \
2337     (CONFIGURE_MAXIMUM_PRIORITY != 255))
2338  #error "Maximum priority is not 1 less than a power of 2 between 4 and 256"
2339#endif
2340
2341#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM)
2342  #error "Maximum priority configured higher than supported by target."
2343#endif
2344
2345/*
2346 *  If you have fewer POSIX Message Queue Descriptors than actual
2347 *  POSIX Message Queues, then you will not be able to open all the
2348 *  queues.
2349 */
2350#if (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS < \
2351     CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
2352  #error "Fewer POSIX Message Queue descriptors than Queues!"
2353#endif
2354
2355#endif
2356/* end of include file */
Note: See TracBrowser for help on using the repository browser.