source: rtems/cpukit/sapi/include/confdefs.h @ 659019e

4.115
Last change on this file since 659019e was 659019e, checked in by Joel Sherrill <joel.sherrill@…>, on 06/19/10 at 23:39:56

2010-06-19 Joel Sherrill <joel.sherrilL@…>

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