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

4.104.115
Last change on this file since dfce6724 was dfce6724, checked in by Chris Johns <chrisj@…>, on 06/02/10 at 00:43:13

2010-06-01 Chris Johns <chrisj@…>

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