blob: 4e7ab0d353c3d6f741922eeadcdbbc7be1183acb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
* BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
*
* COPYRIGHT (c) 1989-2010.
* 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.com/license/LICENSE.
*
* $Id$
*/
#define SAPI_INIT
#define SCORE_INIT
#define RTEMS_API_INIT
#include <rtems.h>
#include <rtems/score/apiext.h>
#include <rtems/score/bitfield.h>
#include <rtems/score/apimutex.h>
#include <rtems/score/wkspace.h>
Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ];
extern void check_heir_and_executing(void);
void rtems_initialize_data_structures(void)
{
_System_state_Handler_initialization( FALSE );
/*
* Do this as early as possible to ensure no debugging output
* is even attempted to be printed.
*/
_Debug_Manager_initialization();
_API_extensions_Initialization();
_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();
_User_extensions_Handler_initialization();
// _ISR_Handler_initialization();
/*
* Initialize the internal support API and allocator Mutex
*/
_Objects_Information_table[OBJECTS_INTERNAL_API] = _Internal_Objects;
_API_Mutex_Initialization( 1 );
_API_Mutex_Allocate( &_RTEMS_Allocator_Mutex );
_Priority_bit_map_Handler_initialization();
_Watchdog_Handler_initialization();
_TOD_Handler_initialization();
_Thread_Handler_initialization();
_Scheduler_Handler_initialization();
/* MANAGERS */
/*
* Install our API Object Management Table and initialize the
* various managers.
*/
_Objects_Information_table[OBJECTS_CLASSIC_API] = _RTEMS_Objects;
_RTEMS_tasks_Manager_initialization();
_Semaphore_Manager_initialization();
_System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
/*
* No threads should be created before this point!!!
* _Thread_Executing and _Thread_Heir are not set.
*
* At this point all API extensions are in place. After the call to
* _Thread_Create_idle() _Thread_Executing and _Thread_Heir will be set.
*/
_Thread_Create_idle();
/*
* Scheduling can properly occur now as long as we avoid dispatching.
*/
_System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
_Thread_Start_multitasking();
/*
* Now we are back in a non-dispatching critical section
*/
_Thread_Dispatch_set_disable_level(0);
/*
* Print an initial message
*/
check_heir_and_executing();
}
|