source: rtems/cpukit/sapi/include/confdefs.h @ 739329f

4.115
Last change on this file since 739329f was 739329f, checked in by Joel Sherrill <joel.sherrill@…>, on 06/17/10 at 18:38:00

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

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