source: rtems/cpukit/sapi/include/confdefs.h @ 22c28282

4.11
Last change on this file since 22c28282 was 22c28282, checked in by Joel Sherrill <joel.sherrill@…>, on Feb 21, 2011 at 5:00:51 PM

2011-02-21 Joel Sherrill <joel.sherrill@…>

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