source: rtems/cpukit/sapi/include/confdefs.h @ 38ec8af

4.115
Last change on this file since 38ec8af was 6e4c01e, checked in by Chris Johns <chrisj@…>, on 08/23/13 at 04:56:36

posix: Update to the pthread_once changes.

Implement the reeview changes.
Add a POSIX Fatal error domain.
Fix confdefs.h to correctly handle the internal POSIX mutexes.

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