[PATCH v2 34/44] config: Add <rtems/confdefs/extensions.h>

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Feb 21 10:52:46 UTC 2020


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

Update #3053.
Update #3875.
---
 cpukit/headers.am                          |   1 +
 cpukit/include/rtems/confdefs.h            | 104 +------------------
 cpukit/include/rtems/confdefs/extensions.h | 158 +++++++++++++++++++++++++++++
 3 files changed, 160 insertions(+), 103 deletions(-)
 create mode 100644 cpukit/include/rtems/confdefs/extensions.h

diff --git a/cpukit/headers.am b/cpukit/headers.am
index 1a23ce5608..7bcc7be6ca 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -186,6 +186,7 @@ include_rtems_HEADERS += include/rtems/watchdogdrv.h
 include_rtems_confdefs_HEADERS += include/rtems/confdefs/bdbuf.h
 include_rtems_confdefs_HEADERS += include/rtems/confdefs/bsp.h
 include_rtems_confdefs_HEADERS += include/rtems/confdefs/clock.h
+include_rtems_confdefs_HEADERS += include/rtems/confdefs/extensions.h
 include_rtems_confdefs_HEADERS += include/rtems/confdefs/libio.h
 include_rtems_confdefs_HEADERS += include/rtems/confdefs/libpci.h
 include_rtems_confdefs_HEADERS += include/rtems/confdefs/malloc.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 0e5038cf92..b0783ae225 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -26,12 +26,10 @@
  * Include the executive's configuration
  */
 #include <rtems.h>
-#include <rtems/extensiondata.h>
 #include <rtems/ioimpl.h>
 #include <rtems/sysinit.h>
 #include <rtems/score/apimutex.h>
 #include <rtems/score/context.h>
-#include <rtems/score/userextimpl.h>
 #include <rtems/score/wkspace.h>
 #include <rtems/rtems/barrierdata.h>
 #include <rtems/rtems/dpmemdata.h>
@@ -52,6 +50,7 @@
 #include <rtems/confdefs/obsolete.h>
 #include <rtems/confdefs/bdbuf.h>
 #include <rtems/confdefs/clock.h>
+#include <rtems/confdefs/extensions.h>
 #include <rtems/confdefs/libio.h>
 #include <rtems/confdefs/libpci.h>
 #include <rtems/confdefs/malloc.h>
@@ -573,69 +572,8 @@ extern "C" {
   #define CONFIGURE_MAXIMUM_BARRIERS               0
 #endif
 
-#ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
-  /**
-   * This configuration parameter specifies the maximum number of
-   * Classic API User Extensions.
-   */
-  #define CONFIGURE_MAXIMUM_USER_EXTENSIONS                 0
-#endif
-
 /**@}*/ /* end of Classic API Configuration */
 
-/*
- *  Initial Extension Set
- */
-
-#ifdef CONFIGURE_INIT
-#if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
-#include <rtems/record.h>
-#endif
-#ifdef CONFIGURE_STACK_CHECKER_ENABLED
-#include <rtems/stackchk.h>
-#endif
-
-#include <rtems/libcsupport.h>
-
-#if defined(BSP_INITIAL_EXTENSION) || \
-    defined(CONFIGURE_INITIAL_EXTENSIONS) || \
-    defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
-    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
-  const User_extensions_Table _User_extensions_Initial_extensions[] = {
-    #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0 && \
-      defined(CONFIGURE_RECORD_EXTENSIONS_ENABLED)
-      RECORD_EXTENSION,
-    #endif
-    #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
-      RTEMS_NEWLIB_EXTENSION,
-    #endif
-    #if defined(CONFIGURE_STACK_CHECKER_ENABLED)
-      RTEMS_STACK_CHECKER_EXTENSION,
-    #endif
-    #if defined(CONFIGURE_INITIAL_EXTENSIONS)
-      CONFIGURE_INITIAL_EXTENSIONS,
-    #endif
-    #if defined(BSP_INITIAL_EXTENSION)
-      BSP_INITIAL_EXTENSION
-    #endif
-  };
-
-  const size_t _User_extensions_Initial_count =
-    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions );
-
-  User_extensions_Switch_control _User_extensions_Initial_switch_controls[
-    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions )
-  ];
-
-  RTEMS_SYSINIT_ITEM(
-    _User_extensions_Handler_initialization,
-    RTEMS_SYSINIT_INITIAL_EXTENSIONS,
-    RTEMS_SYSINIT_ORDER_MIDDLE
-  );
-#endif
-
-#endif
-
 /**
  * @defgroup ConfigurationPOSIXAPI POSIX API Configuration Parameters
  *
@@ -1099,10 +1037,6 @@ extern "C" {
     );
   #endif
 
-  #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
-    EXTENSION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_USER_EXTENSIONS );
-  #endif
-
   #if CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS > 0
     POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[
       rtems_resource_maximum_per_allocation(
@@ -1220,42 +1154,6 @@ extern "C" {
       RTEMS_SYSINIT_ORDER_MIDDLE
     );
   #endif
-
-  #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
-    #if (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS & (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS - 1)) != 0
-      #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be a power of two"
-    #endif
-
-    #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS < 16
-      #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be at least 16"
-    #endif
-
-    typedef struct {
-      Record_Control    Control;
-      rtems_record_item Items[ CONFIGURE_RECORD_PER_PROCESSOR_ITEMS ];
-    } Record_Configured_control;
-
-    static Record_Configured_control _Record_Controls[ _CONFIGURE_MAXIMUM_PROCESSORS ];
-
-    const Record_Configuration _Record_Configuration = {
-      CONFIGURE_RECORD_PER_PROCESSOR_ITEMS,
-      &_Record_Controls[ 0 ].Control
-    };
-
-    RTEMS_SYSINIT_ITEM(
-      _Record_Initialize,
-      RTEMS_SYSINIT_RECORD,
-      RTEMS_SYSINIT_ORDER_MIDDLE
-    );
-  #endif
-
-  #ifdef CONFIGURE_VERBOSE_SYSTEM_INITIALIZATION
-    RTEMS_SYSINIT_ITEM(
-      _Sysinit_Verbose,
-      RTEMS_SYSINIT_RECORD,
-      RTEMS_SYSINIT_ORDER_LAST
-    );
-  #endif
 #endif
 
 /*
diff --git a/cpukit/include/rtems/confdefs/extensions.h b/cpukit/include/rtems/confdefs/extensions.h
new file mode 100644
index 0000000000..7b868e44a8
--- /dev/null
+++ b/cpukit/include/rtems/confdefs/extensions.h
@@ -0,0 +1,158 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSApplicationConfiguration
+ *
+ * @brief Evaluate User Extensions Configuration Options
+ */
+
+#ifndef _RTEMS_CONFDEFS_EXTENSIONS_H
+#define _RTEMS_CONFDEFS_EXTENSIONS_H
+
+#ifndef __CONFIGURATION_TEMPLATE_h
+#error "Do not include this file directly, use <rtems/confdefs.h> instead"
+#endif
+
+#ifdef CONFIGURE_INIT
+
+#include <rtems/confdefs/bsp.h>
+#include <rtems/confdefs/newlib.h>
+#include <rtems/score/userextimpl.h>
+#include <rtems/sysinit.h>
+
+#ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS
+  #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
+#endif
+
+#if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
+  #include <rtems/extensiondata.h>
+#endif
+
+#ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY
+  #include <rtems/libcsupport.h>
+#endif
+
+#if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
+  #include <rtems/confdefs/percpu.h>
+  #include <rtems/record.h>
+#endif
+
+#ifdef CONFIGURE_STACK_CHECKER_ENABLED
+  #include <rtems/stackchk.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(BSP_INITIAL_EXTENSION) \
+ || defined(CONFIGURE_INITIAL_EXTENSIONS) \
+ || defined(CONFIGURE_STACK_CHECKER_ENABLED) \
+ || defined(_CONFIGURE_ENABLE_NEWLIB_REENTRANCY)
+  const User_extensions_Table _User_extensions_Initial_extensions[] = {
+    #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0 \
+      && defined(CONFIGURE_RECORD_EXTENSIONS_ENABLED)
+      RECORD_EXTENSION,
+    #endif
+    #ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY
+      RTEMS_NEWLIB_EXTENSION,
+    #endif
+    #ifdef CONFIGURE_STACK_CHECKER_ENABLED
+      RTEMS_STACK_CHECKER_EXTENSION,
+    #endif
+    #ifdef CONFIGURE_INITIAL_EXTENSIONS
+      CONFIGURE_INITIAL_EXTENSIONS,
+    #endif
+    #ifdef BSP_INITIAL_EXTENSION
+      BSP_INITIAL_EXTENSION
+    #endif
+  };
+
+  const size_t _User_extensions_Initial_count =
+    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions );
+
+  User_extensions_Switch_control _User_extensions_Initial_switch_controls[
+    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions )
+  ];
+
+  RTEMS_SYSINIT_ITEM(
+    _User_extensions_Handler_initialization,
+    RTEMS_SYSINIT_INITIAL_EXTENSIONS,
+    RTEMS_SYSINIT_ORDER_MIDDLE
+  );
+#endif
+
+#if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0
+  EXTENSION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_USER_EXTENSIONS );
+#endif
+
+#if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0
+  #if (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS & (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS - 1)) != 0
+    #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be a power of two"
+  #endif
+
+  #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS < 16
+    #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be at least 16"
+  #endif
+
+  typedef struct {
+    Record_Control    Control;
+    rtems_record_item Items[ CONFIGURE_RECORD_PER_PROCESSOR_ITEMS ];
+  } Record_Configured_control;
+
+  static Record_Configured_control _Record_Controls[ _CONFIGURE_MAXIMUM_PROCESSORS ];
+
+  const Record_Configuration _Record_Configuration = {
+    CONFIGURE_RECORD_PER_PROCESSOR_ITEMS,
+    &_Record_Controls[ 0 ].Control
+  };
+
+  RTEMS_SYSINIT_ITEM(
+    _Record_Initialize,
+    RTEMS_SYSINIT_RECORD,
+    RTEMS_SYSINIT_ORDER_MIDDLE
+  );
+#endif
+
+#ifdef CONFIGURE_VERBOSE_SYSTEM_INITIALIZATION
+  RTEMS_SYSINIT_ITEM(
+    _Sysinit_Verbose,
+    RTEMS_SYSINIT_RECORD,
+    RTEMS_SYSINIT_ORDER_LAST
+  );
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CONFIGURE_INIT */
+
+#endif /* _RTEMS_CONFDEFS_EXTENSIONS_H */
-- 
2.16.4



More information about the devel mailing list