source: rtems/cpukit/sapi/include/confdefs.h @ 717391f5

4.104.115
Last change on this file since 717391f5 was 717391f5, checked in by Joel Sherrill <joel.sherrill@…>, on 08/12/09 at 20:53:33

2009-08-12 Joel Sherrill <joel.sherrill@…>

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