source: rtems/cpukit/sapi/include/confdefs.h @ 49f6309b

4.115
Last change on this file since 49f6309b was 49f6309b, checked in by Joel Sherrill <joel.sherrill@…>, on 05/23/11 at 14:55:58

2011-05-23 Joel Sherrill <joel.sherrilL@…>

PR 1804/cpukit

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