source: rtems/cpukit/sapi/include/confdefs.h @ 06dcaf0

4.115
Last change on this file since 06dcaf0 was 06dcaf0, checked in by Joel Sherrill <joel.sherrill@…>, on 03/16/11 at 20:05:06

2011-03-16 Jennifer Averett <jennifer.averett@…>

PR 1729/cpukit

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