source: rtems/cpukit/sapi/include/confdefs.h @ 93f7ea15

4.104.115
Last change on this file since 93f7ea15 was 93f7ea15, checked in by Joel Sherrill <joel.sherrill@…>, on 08/19/09 at 16:40:03

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

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