source: rtems/cpukit/sapi/include/confdefs.h @ 6de36ed

4.115
Last change on this file since 6de36ed was 6de36ed, checked in by Sebastian Huber <sebastian.huber@…>, on Aug 16, 2011 at 11:40:53 AM

2011-08-16 Sebastian Huber <sebastian.huber@…>

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