Optional Extensions initialization

Update #2408.
This commit is contained in:
Sebastian Huber
2015-12-10 11:40:26 +01:00
parent a853c8518d
commit 92bb345374
8 changed files with 35 additions and 45 deletions

View File

@@ -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/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/ioinitialize.c src/ioopen.c src/ioread.c src/ioregisterdriver.c \
src/iounregisterdriver.c src/iowrite.c src/posixapi.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/chainappendnotify.c src/chaingetnotify.c src/chaingetwait.c \
src/chainprependnotify.c src/rbheap.c src/interrtext.c \ src/chainprependnotify.c src/rbheap.c src/interrtext.c \
src/fatal2.c src/fatalsrctext.c src/fatal2.c src/fatalsrctext.c

View File

@@ -25,18 +25,7 @@
extern "C" { extern "C" {
#endif #endif
#ifndef SAPI_EXT_EXTERN extern Objects_Information _Extension_Information;
#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);
RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Allocate( void ) RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Allocate( void )
{ {

View File

@@ -137,8 +137,6 @@ static void rtems_initialize_data_structures(void)
_RTEMS_API_Initialize(); _RTEMS_API_Initialize();
_Extension_Manager_initialization();
_POSIX_API_Initialize(); _POSIX_API_Initialize();
} }

View File

@@ -21,13 +21,13 @@
#include "config.h" #include "config.h"
#endif #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/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( _Objects_Initialize_information(
&_Extension_Information, &_Extension_Information,
@@ -44,3 +44,9 @@ void _Extension_Manager_initialization(void)
#endif #endif
); );
} }
RTEMS_SYSINIT_ITEM(
_Extension_Manager_initialization,
RTEMS_SYSINIT_USER_EXTENSIONS,
RTEMS_SYSINIT_ORDER_MIDDLE
);

View File

@@ -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>

View File

@@ -30,6 +30,7 @@ extern "C" {
#define RTEMS_SYSINIT_BSP_START 000200 #define RTEMS_SYSINIT_BSP_START 000200
#define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000300 #define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000300
#define RTEMS_SYSINIT_DATA_STRUCTURES 000301 #define RTEMS_SYSINIT_DATA_STRUCTURES 000301
#define RTEMS_SYSINIT_USER_EXTENSIONS 000320
#define RTEMS_SYSINIT_IDLE_THREADS 000380 #define RTEMS_SYSINIT_IDLE_THREADS 000380
#define RTEMS_SYSINIT_BSP_LIBC 000400 #define RTEMS_SYSINIT_BSP_LIBC 000400
#define RTEMS_SYSINIT_BEFORE_DRIVERS 000500 #define RTEMS_SYSINIT_BEFORE_DRIVERS 000500

View File

@@ -168,6 +168,10 @@ upon the information in the Configuration Table, User Initialization Tasks
Table, Device Driver Table, Multiprocessor Configuration Table, and the Table, Device Driver Table, Multiprocessor Configuration Table, and the
Multiprocessor Communications Interface (MPCI) Table. Multiprocessor Communications Interface (MPCI) Table.
@item RTEMS_SYSINIT_USER_EXTENSIONS
Initializes the @ref{User Extensions Manager} in case it is used by the
application.
@item RTEMS_SYSINIT_BSP_LIBC @item RTEMS_SYSINIT_BSP_LIBC
Depending on the application configuration the IO library and root filesystem Depending on the application configuration the IO library and root filesystem
is initialized. This step is mandatory. is initialized. This step is mandatory.

View File

@@ -24,6 +24,7 @@
#include <rtems/sysinit.h> #include <rtems/sysinit.h>
#include <rtems/test.h> #include <rtems/test.h>
#include <rtems/extensionimpl.h>
#include <rtems/score/apimutex.h> #include <rtems/score/apimutex.h>
#include <rtems/score/sysstate.h> #include <rtems/score/sysstate.h>
#include <rtems/score/userextimpl.h> #include <rtems/score/userextimpl.h>
@@ -40,6 +41,8 @@ typedef enum {
INITIAL_EXTENSIONS_POST, INITIAL_EXTENSIONS_POST,
DATA_STRUCTURES_PRE, DATA_STRUCTURES_PRE,
DATA_STRUCTURES_POST, DATA_STRUCTURES_POST,
USER_EXTENSIONS_PRE,
USER_EXTENSIONS_POST,
IDLE_THREADS_PRE, IDLE_THREADS_PRE,
IDLE_THREADS_POST, IDLE_THREADS_POST,
BSP_LIBC_PRE, BSP_LIBC_PRE,
@@ -133,6 +136,18 @@ LAST(RTEMS_SYSINIT_DATA_STRUCTURES)
next_step(DATA_STRUCTURES_POST); 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) FIRST(RTEMS_SYSINIT_IDLE_THREADS)
{ {
assert(_System_state_Is_before_initialization(_System_state_Get())); 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_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE #define CONFIGURE_RTEMS_INIT_TASKS_TABLE