source: rtems/cpukit/sapi/include/confdefs.h @ 8fed642

4.104.115
Last change on this file since 8fed642 was 8fed642, checked in by Joel Sherrill <joel.sherrill@…>, on 08/04/09 at 17:06:26

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

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