[rtems commit] Optional Extensions initialization

Sebastian Huber sebh at rtems.org
Wed Feb 3 09:30:08 UTC 2016


Module:    rtems
Branch:    master
Commit:    92bb345374ea3982b40b10e7d50ecfc1cb4d2ed3
Changeset: http://git.rtems.org/rtems/commit/?id=92bb345374ea3982b40b10e7d50ecfc1cb4d2ed3

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Dec 10 11:40:26 2015 +0100

Optional Extensions initialization

Update #2408.

---

 cpukit/sapi/Makefile.am                   |  2 +-
 cpukit/sapi/include/rtems/extensionimpl.h | 13 +------------
 cpukit/sapi/src/exinit.c                  |  2 --
 cpukit/sapi/src/extension.c               | 16 +++++++++++-----
 cpukit/sapi/src/extensiondata.c           | 25 -------------------------
 cpukit/score/include/rtems/sysinit.h      |  1 +
 doc/user/init.t                           |  4 ++++
 testsuites/sptests/spsysinit01/init.c     | 17 +++++++++++++++++
 8 files changed, 35 insertions(+), 45 deletions(-)

diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am
index ca7b421..e930a4c 100644
--- a/cpukit/sapi/Makefile.am
+++ b/cpukit/sapi/Makefile.am
@@ -31,7 +31,7 @@ libsapi_a_SOURCES = src/extension.c src/extensioncreate.c \
     src/exshutdown.c src/io.c src/ioclose.c src/iocontrol.c src/iodata.c \
     src/ioinitialize.c src/ioopen.c src/ioread.c src/ioregisterdriver.c \
     src/iounregisterdriver.c src/iowrite.c src/posixapi.c  \
-    src/rtemsapi.c src/extensiondata.c src/getversionstring.c \
+    src/rtemsapi.c src/getversionstring.c \
     src/chainappendnotify.c src/chaingetnotify.c src/chaingetwait.c \
     src/chainprependnotify.c src/rbheap.c src/interrtext.c \
     src/fatal2.c src/fatalsrctext.c
diff --git a/cpukit/sapi/include/rtems/extensionimpl.h b/cpukit/sapi/include/rtems/extensionimpl.h
index 487bdb4..e26731c 100644
--- a/cpukit/sapi/include/rtems/extensionimpl.h
+++ b/cpukit/sapi/include/rtems/extensionimpl.h
@@ -25,18 +25,7 @@
 extern "C" {
 #endif
 
-#ifndef SAPI_EXT_EXTERN
-#define SAPI_EXT_EXTERN extern
-#endif
-
-SAPI_EXT_EXTERN Objects_Information  _Extension_Information;
-
-/**
- *  @brief Initialize extension manager.
- *
- *  This routine initializes all extension manager related data structures.
- */
-void _Extension_Manager_initialization(void);
+extern Objects_Information  _Extension_Information;
 
 RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Allocate( void )
 {
diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
index 685197d..4b04b5f 100644
--- a/cpukit/sapi/src/exinit.c
+++ b/cpukit/sapi/src/exinit.c
@@ -137,8 +137,6 @@ static void rtems_initialize_data_structures(void)
 
   _RTEMS_API_Initialize();
 
-  _Extension_Manager_initialization();
-
   _POSIX_API_Initialize();
 }
 
diff --git a/cpukit/sapi/src/extension.c b/cpukit/sapi/src/extension.c
index 100f194..3378850 100644
--- a/cpukit/sapi/src/extension.c
+++ b/cpukit/sapi/src/extension.c
@@ -21,13 +21,13 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/rtems/support.h>
-#include <rtems/score/thread.h>
 #include <rtems/extensionimpl.h>
+#include <rtems/config.h>
+#include <rtems/sysinit.h>
 
-void _Extension_Manager_initialization(void)
+Objects_Information _Extension_Information;
+
+static void _Extension_Manager_initialization(void)
 {
   _Objects_Initialize_information(
     &_Extension_Information,
@@ -44,3 +44,9 @@ void _Extension_Manager_initialization(void)
 #endif
   );
 }
+
+RTEMS_SYSINIT_ITEM(
+  _Extension_Manager_initialization,
+  RTEMS_SYSINIT_USER_EXTENSIONS,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/sapi/src/extensiondata.c b/cpukit/sapi/src/extensiondata.c
deleted file mode 100644
index 0d7e481..0000000
--- a/cpukit/sapi/src/extensiondata.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @file
- *
- * @brief Extension Data
- *
- * @ingroup ClassicUserExtensions
- */
-
-/*
- *  COPYRIGHT (c) 1989-2007.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* instantiate extension data */
-#define SAPI_EXT_EXTERN
-
-#include <rtems/extensionimpl.h>
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 49c465b..ab7dfc4 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -30,6 +30,7 @@ extern "C" {
 #define RTEMS_SYSINIT_BSP_START                  000200
 #define RTEMS_SYSINIT_INITIAL_EXTENSIONS         000300
 #define RTEMS_SYSINIT_DATA_STRUCTURES            000301
+#define RTEMS_SYSINIT_USER_EXTENSIONS            000320
 #define RTEMS_SYSINIT_IDLE_THREADS               000380
 #define RTEMS_SYSINIT_BSP_LIBC                   000400
 #define RTEMS_SYSINIT_BEFORE_DRIVERS             000500
diff --git a/doc/user/init.t b/doc/user/init.t
index 5ab011e..a373b4a 100644
--- a/doc/user/init.t
+++ b/doc/user/init.t
@@ -168,6 +168,10 @@ upon the information in the Configuration Table, User Initialization Tasks
 Table, Device Driver Table, Multiprocessor Configuration Table, and the
 Multiprocessor Communications Interface (MPCI) Table.
 
+ at item RTEMS_SYSINIT_USER_EXTENSIONS
+Initializes the @ref{User Extensions Manager} in case it is used by the
+application.
+
 @item RTEMS_SYSINIT_BSP_LIBC
 Depending on the application configuration the IO library and root filesystem
 is initialized.  This step is mandatory.
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index 2bc859b..e5e72f8 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -24,6 +24,7 @@
 #include <rtems/sysinit.h>
 #include <rtems/test.h>
 
+#include <rtems/extensionimpl.h>
 #include <rtems/score/apimutex.h>
 #include <rtems/score/sysstate.h>
 #include <rtems/score/userextimpl.h>
@@ -40,6 +41,8 @@ typedef enum {
   INITIAL_EXTENSIONS_POST,
   DATA_STRUCTURES_PRE,
   DATA_STRUCTURES_POST,
+  USER_EXTENSIONS_PRE,
+  USER_EXTENSIONS_POST,
   IDLE_THREADS_PRE,
   IDLE_THREADS_POST,
   BSP_LIBC_PRE,
@@ -133,6 +136,18 @@ LAST(RTEMS_SYSINIT_DATA_STRUCTURES)
   next_step(DATA_STRUCTURES_POST);
 }
 
+FIRST(RTEMS_SYSINIT_USER_EXTENSIONS)
+{
+  assert(_Extension_Information.maximum == 0);
+  next_step(USER_EXTENSIONS_PRE);
+}
+
+LAST(RTEMS_SYSINIT_USER_EXTENSIONS)
+{
+  assert(_Extension_Information.maximum != 0);
+  next_step(USER_EXTENSIONS_POST);
+}
+
 FIRST(RTEMS_SYSINIT_IDLE_THREADS)
 {
   assert(_System_state_Is_before_initialization(_System_state_Get()));
@@ -216,6 +231,8 @@ static void Init(rtems_task_argument arg)
 #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+
 #define CONFIGURE_MAXIMUM_TASKS 1
 
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE




More information about the vc mailing list