Changeset a78495ed in rtems


Ignore:
Timestamp:
Feb 21, 2020, 7:08:57 AM (7 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
470dfa1f
Parents:
1fb1cf1
git-author:
Sebastian Huber <sebastian.huber@…> (02/21/20 07:08:57)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/25/20 06:18:38)
Message:

config: Add <rtems/confdefs/wkspace.h>

Remove all comments and copyrightable content from the moved content.
Use BSD-2-Clause license for new file.

Change licence of <rtems/confdefs.h> to BSD-2-Clause according to file
history.

Update #3053.
Close #3875.

Location:
cpukit
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/headers.am

    r1fb1cf1 ra78495ed  
    204204include_rtems_confdefs_HEADERS += include/rtems/confdefs/threads.h
    205205include_rtems_confdefs_HEADERS += include/rtems/confdefs/unlimited.h
     206include_rtems_confdefs_HEADERS += include/rtems/confdefs/wkspace.h
    206207include_rtems_confdefs_HEADERS += include/rtems/confdefs/wkspacesupport.h
    207208include_rtems_debugger_HEADERS += include/rtems/debugger/rtems-debugger-bsp.h
  • cpukit/include/rtems/confdefs.h

    r1fb1cf1 ra78495ed  
     1/* SPDX-License-Identifier: BSD-2-Clause */
     2
    13/**
    24 * @file
    35 *
    4  * @brief Configuration Table Template that will be Instantiated
    5  * by an Application
     6 * @ingroup RTEMSApplicationConfiguration
    67 *
    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
     8 * @brief Evaluate Configuration Options
     9 *
     10 * This header file includes a couple of header files which evaluate the
     11 * configuration options specified by the application.  The macros and defines
     12 * used to configure the system are documented in the Configuring a System
     13 * chapter of the Classic API User's Guide.
    1114 */
    1215
    1316/*
    14  *  COPYRIGHT (c) 1989-2015.
    15  *  On-Line Applications Research Corporation (OAR).
     17 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
     18 * Copyright (C) 1989, 2000 On-Line Applications Research Corporation (OAR)
    1619 *
    17  *  The license and distribution terms for this file may be
    18  *  found in the file LICENSE in this distribution or at
    19  *  http://www.rtems.org/license/LICENSE.
     20 * Redistribution and use in source and binary forms, with or without
     21 * modification, are permitted provided that the following conditions
     22 * are met:
     23 * 1. Redistributions of source code must retain the above copyright
     24 *    notice, this list of conditions and the following disclaimer.
     25 * 2. Redistributions in binary form must reproduce the above copyright
     26 *    notice, this list of conditions and the following disclaimer in the
     27 *    documentation and/or other materials provided with the distribution.
     28 *
     29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     30 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     32 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     33 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     34 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     35 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     36 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     37 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     39 * POSSIBILITY OF SUCH DAMAGE.
    2040 */
    2141
     
    2343#define __CONFIGURATION_TEMPLATE_h
    2444
     45/**
     46 * @defgroup RTEMSApplicationConfiguration Application Configuration
     47 *
     48 * @ingroup RTEMSInternal
     49 *
     50 * @brief Evaluation of Application Configuration Options
     51 *
     52 * This group contains header files which evaluate the configuration options
     53 * specified by the application.
     54 *
     55 * @{
     56 */
     57
    2558/*
    26  * Include the executive's configuration
     59 * This header file must be included first.  For example, configuration options
     60 * which have been renamed are mapped to the new define.
    2761 */
    28 #include <rtems.h>
    29 #include <rtems/sysinit.h>
    30 #include <rtems/score/apimutex.h>
    31 #include <rtems/score/context.h>
    32 #include <rtems/score/wkspace.h>
    3362#include <rtems/confdefs/obsolete.h>
     63
    3464#include <rtems/confdefs/bdbuf.h>
    3565#include <rtems/confdefs/clock.h>
     
    4979#include <rtems/confdefs/scheduler.h>
    5080#include <rtems/confdefs/threads.h>
    51 #include <rtems/confdefs/wkspacesupport.h>
     81#include <rtems/confdefs/wkspace.h>
    5282
    53 #include <limits.h>
    54 
    55 #ifdef __cplusplus
    56 extern "C" {
    57 #endif
    58 
    59 /*
    60  * Internal defines must be prefixed with _CONFIGURE to distinguish them from
    61  * user-provided options which use a CONFIGURE prefix.
    62  */
    63 
    64 /**
    65  * @defgroup Configuration RTEMS Configuration
    66  *
    67  * This module contains all RTEMS Configuration parameters.
    68  *
    69  * The model is to estimate the memory required for each configured item
    70  * and sum those estimates.  The estimate can be too high or too low for
    71  * a variety of reasons:
    72  *
    73  * Reasons estimate is too high:
    74  *   + FP contexts (not all tasks are FP)
    75  *
    76  * Reasons estimate is too low:
    77  *   + stacks greater than minimum size
    78  *   + messages
    79  *   + application must account for device driver resources
    80  *   + application must account for add-on library resource requirements
    81  *
    82  * NOTE:  Eventually this may be able to take into account some of
    83  *        the above.  This procedure has evolved from just enough to
    84  *        support the RTEMS Test Suites into something that can be
    85  *        used remarkably reliably by most applications.
    86  */
    87 
    88 /**
    89  * @defgroup ConfigurationHelpers Configuration Helpers
    90  *
    91  * @ingroup Configuration
    92  *
    93  * This module contains items which are used internally to ease
    94  * the configuration calculations.
    95  */
    96 /**@{*/
    97 
    98 /**
    99  * This is a helper macro used in stack space calculations in this file.  It
    100  * may be provided by the application in case a special task stack allocator
    101  * is used.  The default is allocation from the RTEMS Workspace.
    102  */
    103 #ifdef CONFIGURE_TASK_STACK_FROM_ALLOCATOR
    104   #define _Configure_From_stackspace(_stack_size) \
    105     CONFIGURE_TASK_STACK_FROM_ALLOCATOR(_stack_size + CONTEXT_FP_SIZE)
    106 #else
    107   #define _Configure_From_stackspace(_stack_size) \
    108     _Configure_From_workspace(_stack_size + CONTEXT_FP_SIZE)
    109 #endif
    110 /**@}*/
    111 
    112 /**
    113  * This is so we can account for tasks with stacks greater than minimum
    114  * size.  This is in bytes.
    115  */
    116 #ifndef CONFIGURE_EXTRA_TASK_STACKS
    117   #define CONFIGURE_EXTRA_TASK_STACKS 0
    118 #endif
    119 
    120 /*
    121  * We must be able to split the free block used for the second last allocation
    122  * into two parts so that we have a free block for the last allocation.  See
    123  * _Heap_Block_split().
    124  */
    125 #define _CONFIGURE_HEAP_HANDLER_OVERHEAD \
    126   _Configure_Align_up( HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT )
    127 
    128 /*
    129  *  Calculate the RAM size based on the maximum number of objects configured.
    130  */
    131 #ifndef CONFIGURE_EXECUTIVE_RAM_SIZE
    132 
    133 /**
    134  * The following macro is used to calculate the memory allocated by RTEMS
    135  * for the message buffers associated with a particular message queue.
    136  * There is a fixed amount of overhead per message.
    137  */
    138 #define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \
    139     _Configure_From_workspace( \
    140       (_messages) * (_Configure_Align_up(_size, sizeof(uintptr_t)) \
    141         + sizeof(CORE_message_queue_Buffer_control)))
    142 
    143 /*
    144  * This macro is set to the amount of memory required for pending message
    145  * buffers in bytes.  It should be constructed by adding together a
    146  * set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE.
    147  */
    148 #ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY
    149   #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0
    150 #endif
    151 
    152 /**
    153  * This macro is available just in case the confdefs.h file underallocates
    154  * memory for a particular application.  This lets the user add some extra
    155  * memory in case something broken and underestimates.
    156  *
    157  * It is also possible for cases where confdefs.h overallocates memory,
    158  * you could substract memory from the allocated.  The estimate is just
    159  * that, an estimate, and assumes worst case alignment and padding on
    160  * each allocated element.  So in some cases it could be too conservative.
    161  *
    162  * NOTE: Historically this was used for message buffers.
    163  */
    164 #ifndef CONFIGURE_MEMORY_OVERHEAD
    165   #define CONFIGURE_MEMORY_OVERHEAD 0
    166 #endif
    167 
    168 /**
    169  * This calculates the memory required for the executive workspace.
    170  *
    171  * This is an internal parameter.
    172  */
    173 #define CONFIGURE_EXECUTIVE_RAM_SIZE \
    174 ( \
    175    _CONFIGURE_MEMORY_FOR_POSIX_OBJECTS + \
    176    CONFIGURE_MESSAGE_BUFFER_MEMORY + \
    177    (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
    178    _CONFIGURE_HEAP_HANDLER_OVERHEAD \
    179 )
    180 
    181 /*
    182  * This macro provides a summation of the various initialization task
    183  * and thread stack requirements.
    184  */
    185 #define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS \
    186     (_CONFIGURE_INIT_TASK_STACK_EXTRA + \
    187     _CONFIGURE_POSIX_INIT_THREAD_STACK_EXTRA)
    188 
    189 /*
    190  * This macro is calculated to specify the memory required for
    191  * the stacks of all tasks.
    192  */
    193 #define _CONFIGURE_TASKS_STACK \
    194   (rtems_resource_maximum_per_allocation( _CONFIGURE_TASKS ) * \
    195     _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
    196 
    197 /*
    198  * This macro is calculated to specify the memory required for
    199  * the stacks of all POSIX threads.
    200  */
    201 #define _CONFIGURE_POSIX_THREADS_STACK \
    202   (rtems_resource_maximum_per_allocation( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \
    203     _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
    204 
    205 #else /* CONFIGURE_EXECUTIVE_RAM_SIZE */
    206 
    207 #define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS 0
    208 #define _CONFIGURE_TASKS_STACK 0
    209 #define _CONFIGURE_POSIX_THREADS_STACK 0
    210 
    211 #if CONFIGURE_EXTRA_TASK_STACKS != 0
    212   #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_TASK_STACKS"
    213 #endif
    214 
    215 #endif /* CONFIGURE_EXECUTIVE_RAM_SIZE */
    216 
    217 /*
    218  * This macro is calculated to specify the memory required for
    219  * all tasks and threads of all varieties.
    220  */
    221 #define _CONFIGURE_STACK_SPACE_SIZE \
    222   ( \
    223     _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \
    224     _CONFIGURE_TASKS_STACK + \
    225     _CONFIGURE_POSIX_THREADS_STACK + \
    226     _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA + \
    227     CONFIGURE_EXTRA_TASK_STACKS + \
    228     _CONFIGURE_HEAP_HANDLER_OVERHEAD \
    229   )
    230 
    231 #ifdef CONFIGURE_INIT
    232   /**
    233    * This variable specifies the minimum stack size for tasks in an RTEMS
    234    * application.
    235    *
    236    * NOTE: This is left as a simple uint32_t so it can be externed as
    237    *       needed without requring being high enough logical to
    238    *       include the full configuration table.
    239    */
    240   uint32_t rtems_minimum_stack_size =
    241     CONFIGURE_MINIMUM_TASK_STACK_SIZE;
    242 
    243   const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
    244 
    245   #if defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
    246     && defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
    247     #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE
    248       const bool _Stack_Allocator_avoids_workspace = true;
    249     #else
    250       const bool _Stack_Allocator_avoids_workspace = false;
    251     #endif
    252 
    253     #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_INIT
    254       const Stack_Allocator_initialize _Stack_Allocator_initialize =
    255         CONFIGURE_TASK_STACK_ALLOCATOR_INIT;
    256     #else
    257       const Stack_Allocator_initialize _Stack_Allocator_initialize = NULL;
    258     #endif
    259 
    260     const Stack_Allocator_allocate _Stack_Allocator_allocate =
    261       CONFIGURE_TASK_STACK_ALLOCATOR;
    262 
    263     const Stack_Allocator_free _Stack_Allocator_free =
    264       CONFIGURE_TASK_STACK_DEALLOCATOR;
    265   #elif defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
    266     || defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
    267     #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined"
    268   #endif
    269 
    270   const uintptr_t _Workspace_Size = CONFIGURE_EXECUTIVE_RAM_SIZE;
    271 
    272   #ifdef CONFIGURE_UNIFIED_WORK_AREAS
    273     const bool _Workspace_Is_unified = true;
    274   #endif
    275 
    276   #ifdef CONFIGURE_DIRTY_MEMORY
    277     RTEMS_SYSINIT_ITEM(
    278       _Memory_Dirty_free_areas,
    279       RTEMS_SYSINIT_DIRTY_MEMORY,
    280       RTEMS_SYSINIT_ORDER_MIDDLE
    281     );
    282   #endif
    283 
    284   #ifdef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY
    285     const bool _Memory_Zero_before_use = true;
    286 
    287     RTEMS_SYSINIT_ITEM(
    288       _Memory_Zero_free_areas,
    289       RTEMS_SYSINIT_ZERO_MEMORY,
    290       RTEMS_SYSINIT_ORDER_MIDDLE
    291     );
    292   #endif
    293 #endif
    294 
    295 #ifdef __cplusplus
    296 }
    297 #endif
     83/** @} */
    29884
    29985#endif
Note: See TracChangeset for help on using the changeset viewer.