Optional Initial Extensions initialization

Update #2408.
This commit is contained in:
Sebastian Huber
2015-12-10 15:44:02 +01:00
parent 36b86d7eb5
commit a853c8518d
7 changed files with 42 additions and 19 deletions

View File

@@ -26,8 +26,10 @@
* Include the executive's configuration
*/
#include <rtems.h>
#include <rtems/sysinit.h>
#include <rtems/score/apimutex.h>
#include <rtems/score/percpu.h>
#include <rtems/score/userextimpl.h>
#include <rtems/score/wkspace.h>
#ifdef CONFIGURE_DISABLE_BSP_SETTINGS
@@ -2394,6 +2396,12 @@ const rtems_libio_helper rtems_fs_init_helper =
#define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
#define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
RTEMS_ARRAY_SIZE(Configuration_Initial_Extensions)
RTEMS_SYSINIT_ITEM(
_User_extensions_Handler_initialization,
RTEMS_SYSINIT_INITIAL_EXTENSIONS,
RTEMS_SYSINIT_ORDER_MIDDLE
);
#else
#define CONFIGURE_INITIAL_EXTENSION_TABLE NULL
#define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0

View File

@@ -47,7 +47,6 @@
#include <rtems/score/timecounter.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/todimpl.h>
#include <rtems/score/userextimpl.h>
#include <rtems/score/watchdogimpl.h>
#include <rtems/score/wkspace.h>
@@ -113,7 +112,6 @@ static void rtems_initialize_data_structures(void)
_Thread_Dispatch_initialization();
_User_extensions_Handler_initialization();
_ISR_Handler_initialization();
_API_Mutex_Initialization( 2 );

View File

@@ -28,7 +28,8 @@ extern "C" {
*/
#define RTEMS_SYSINIT_BSP_WORK_AREAS 000100
#define RTEMS_SYSINIT_BSP_START 000200
#define RTEMS_SYSINIT_DATA_STRUCTURES 000300
#define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000300
#define RTEMS_SYSINIT_DATA_STRUCTURES 000301
#define RTEMS_SYSINIT_IDLE_THREADS 000380
#define RTEMS_SYSINIT_BSP_LIBC 000400
#define RTEMS_SYSINIT_BEFORE_DRIVERS 000500

View File

@@ -30,6 +30,8 @@
#include <rtems/score/wkspace.h>
#include <rtems/config.h>
CHAIN_DEFINE_EMPTY( _User_extensions_Switches_list );
static Thread_Action *_Thread_Get_post_switch_action(
Thread_Control *executing
)

View File

@@ -23,8 +23,6 @@
#include <rtems/score/userextimpl.h>
#include <rtems/score/wkspace.h>
CHAIN_DEFINE_EMPTY( _User_extensions_Switches_list );
typedef struct {
User_extensions_Switch_control *switch_control;
} User_extensions_Switch_context;
@@ -50,17 +48,12 @@ static void _User_extensions_Switch_visitor(
void _User_extensions_Handler_initialization(void)
{
uint32_t number_of_initial_extensions =
rtems_configuration_get_number_of_initial_extensions();
User_extensions_Switch_control *initial_extension_switch_controls =
_Workspace_Allocate_or_fatal_error(
rtems_configuration_get_number_of_initial_extensions()
* sizeof( *initial_extension_switch_controls )
);
User_extensions_Switch_context ctx = { initial_extension_switch_controls };
if ( number_of_initial_extensions > 0 ) {
User_extensions_Switch_control *initial_extension_switch_controls =
_Workspace_Allocate_or_fatal_error(
number_of_initial_extensions
* sizeof( *initial_extension_switch_controls )
);
User_extensions_Switch_context ctx = { initial_extension_switch_controls };
_User_extensions_Iterate( &ctx, _User_extensions_Switch_visitor );
}
_User_extensions_Iterate( &ctx, _User_extensions_Switch_visitor );
}

View File

@@ -157,12 +157,16 @@ initialized by the Board Support Package. This step is mandatory.
Basic initialization step provided by the Board Support Package. This step is
mandatory.
@item RTEMS_SYSINIT_INITIAL_EXTENSIONS
Initializes the initial extensions if at least one is configured by the Board
Support Package or application.
@item RTEMS_SYSINIT_DATA_STRUCTURES
This directive is called when the Board Support Package has completed its basic
initialization and allows RTEMS to initialize the application environment based
upon the information in the Configuration Table, User Initialization Tasks
Table, Device Driver Table, User Extension Table, Multiprocessor Configuration
Table, and the Multiprocessor Communications Interface (MPCI) Table.
Table, Device Driver Table, Multiprocessor Configuration Table, and the
Multiprocessor Communications Interface (MPCI) Table.
@item RTEMS_SYSINIT_BSP_LIBC
Depending on the application configuration the IO library and root filesystem

View File

@@ -26,6 +26,7 @@
#include <rtems/score/apimutex.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/userextimpl.h>
#include <rtems/score/wkspace.h>
const char rtems_test_name[] = "SPSYSINIT 1";
@@ -35,6 +36,8 @@ typedef enum {
BSP_WORK_AREAS_POST,
BSP_START_PRE,
BSP_START_POST,
INITIAL_EXTENSIONS_PRE,
INITIAL_EXTENSIONS_POST,
DATA_STRUCTURES_PRE,
DATA_STRUCTURES_POST,
IDLE_THREADS_PRE,
@@ -106,6 +109,18 @@ LAST(RTEMS_SYSINIT_BSP_START)
next_step(BSP_START_POST);
}
FIRST(RTEMS_SYSINIT_INITIAL_EXTENSIONS)
{
assert(_Chain_Is_empty(&_User_extensions_Switches_list));
next_step(INITIAL_EXTENSIONS_PRE);
}
LAST(RTEMS_SYSINIT_INITIAL_EXTENSIONS)
{
assert(!_Chain_Is_empty(&_User_extensions_Switches_list));
next_step(INITIAL_EXTENSIONS_POST);
}
FIRST(RTEMS_SYSINIT_DATA_STRUCTURES)
{
assert(_RTEMS_Allocator_Mutex == NULL);
@@ -205,6 +220,8 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_STACK_CHECKER_ENABLED
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_INIT