summaryrefslogtreecommitdiffstats
path: root/schedsim/rtems/rtems_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'schedsim/rtems/rtems_init.c')
-rw-r--r--schedsim/rtems/rtems_init.c76
1 files changed, 53 insertions, 23 deletions
diff --git a/schedsim/rtems/rtems_init.c b/schedsim/rtems/rtems_init.c
index 26343bc..2d44fba 100644
--- a/schedsim/rtems/rtems_init.c
+++ b/schedsim/rtems/rtems_init.c
@@ -1,7 +1,9 @@
/*
* BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
- *
- * COPYRIGHT (c) 1989-2013.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -12,18 +14,43 @@
#define SAPI_INIT
#define SCORE_INIT
#define RTEMS_API_INIT
+#define POSIX_API_INIT
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/debug.h>
+#include <rtems/extensionimpl.h>
+#include <rtems/fatal.h>
+#include <rtems/init.h>
+#include <rtems/io.h>
+#include <rtems/score/sysstate.h>
-#include <rtems.h>
#include <rtems/score/apiext.h>
-#include <rtems/score/bitfield.h>
#include <rtems/score/apimutex.h>
+#include <rtems/score/cpusetimpl.h>
#include <rtems/score/userextimpl.h>
+#include <rtems/score/schedulerimpl.h>
+#include <rtems/score/smpimpl.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/todimpl.h>
+#include <rtems/score/watchdogimpl.h>
#include <rtems/score/wkspace.h>
+#include <rtems/rtems/tasksimpl.h>
+#include <rtems/rtems/semimpl.h>
+
+#include <rtems/posix/keyimpl.h>
+
+/*
+ * Declare Object Information tables directly here instead of API
+ * specific initialization files as in cpukit/sapi/src.
+ */
Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ];
+Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];
+
extern void check_heir_and_executing(void);
void rtems_initialize_data_structures(void)
@@ -40,18 +67,7 @@ void rtems_initialize_data_structures(void)
_Thread_Dispatch_initialization();
- /*
- * Before this is called, we are not allowed to allocate memory
- * from the Workspace because it is not initialized.
- */
- _Workspace_Handler_initialization(NULL, 0, NULL);
-
- #if defined(RTEMS_SMP)
- _SMP_Handler_initialize();
- #endif
-
_User_extensions_Handler_initialization();
-
_ISR_Handler_initialization();
/*
@@ -59,10 +75,10 @@ void rtems_initialize_data_structures(void)
*/
_Objects_Information_table[OBJECTS_INTERNAL_API] = _Internal_Objects;
- _API_Mutex_Initialization( 1 );
+ _API_Mutex_Initialization( 2 );
_API_Mutex_Allocate( &_RTEMS_Allocator_Mutex );
+ _API_Mutex_Allocate( &_Once_Mutex );
- _Priority_bit_map_Handler_initialization();
_Watchdog_Handler_initialization();
_TOD_Handler_initialization();
@@ -70,6 +86,9 @@ void rtems_initialize_data_structures(void)
_Scheduler_Handler_initialization();
+ _SMP_Handler_initialize();
+
+ _CPU_set_Handler_initialization();
/* MANAGERS */
/*
@@ -82,12 +101,17 @@ void rtems_initialize_data_structures(void)
_Semaphore_Manager_initialization();
/*
+ * Install our API Object Management Table and initialize the
+ * various managers.
+ */
+ _Objects_Information_table[OBJECTS_POSIX_API] = _POSIX_Objects;
+
+ _POSIX_Key_Manager_initialization();
+
+ /*
* Discover and initialize the secondary cores in an SMP system.
*/
- #if defined(RTEMS_SMP)
- _SMP_Processor_count =
- bsp_smp_initialize( rtems_configuration_smp_maximum_processors );
- #endif
+ _SMP_Handler_initialize();
_System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
@@ -104,14 +128,20 @@ void rtems_initialize_data_structures(void)
* Scheduling can properly occur now as long as we avoid dispatching.
*/
- _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
+ _System_state_Set( SYSTEM_STATE_UP );
+
+ _SMP_Request_start_multitasking();
_Thread_Start_multitasking();
/*
* Now we are back in a non-dispatching critical section
*/
- _Thread_Dispatch_set_disable_level(0);
+ #if defined(RTEMS_SMP)
+ #error "NOT IMPLEMENTED"
+ #else
+ _Thread_Enable_dispatch();
+ #endif
/*
* Print an initial message