1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** ThreadX Component */
17 /** */
18 /** Initialize */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define TX_SOURCE_CODE
24 #define TX_THREAD_SMP_SOURCE_CODE
25
26
27 /* Include necessary system files. */
28
29 #include "tx_api.h"
30 #include "tx_initialize.h"
31 #include "tx_thread.h"
32
33
34 /**************************************************************************/
35 /* */
36 /* FUNCTION RELEASE */
37 /* */
38 /* _tx_initialize_kernel_setup PORTABLE SMP */
39 /* 6.1 */
40 /* AUTHOR */
41 /* */
42 /* William E. Lamie, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function is called by the compiler's startup code to make */
47 /* ThreadX objects accessible to the compiler's library. If this */
48 /* function is not called by the compiler, all ThreadX initialization */
49 /* takes place from the kernel enter function defined previously. */
50 /* */
51 /* INPUT */
52 /* */
53 /* None */
54 /* */
55 /* OUTPUT */
56 /* */
57 /* None */
58 /* */
59 /* CALLS */
60 /* */
61 /* _tx_thread_smp_high_level_initialize SMP initialization */
62 /* _tx_thread_smp_current_state_set Set system state for all cores */
63 /* _tx_initialize_low_level Low-level initialization */
64 /* _tx_initialize_high_level High-level initialization */
65 /* */
66 /* CALLED BY */
67 /* */
68 /* startup code Compiler startup code */
69 /* */
70 /* RELEASE HISTORY */
71 /* */
72 /* DATE NAME DESCRIPTION */
73 /* */
74 /* 09-30-2020 William E. Lamie Initial Version 6.1 */
75 /* */
76 /**************************************************************************/
_tx_initialize_kernel_setup(VOID)77 VOID _tx_initialize_kernel_setup(VOID)
78 {
79
80 /* Ensure that the system state variable is set to indicate
81 initialization is in progress. Note that this variable is
82 later used to represent interrupt nesting. */
83 _tx_thread_smp_current_state_set(TX_INITIALIZE_IN_PROGRESS);
84
85 /* Call any port specific preprocessing. */
86 TX_PORT_SPECIFIC_PRE_INITIALIZATION
87
88 /* Invoke the low-level initialization to handle all processor specific
89 initialization issues. */
90 _tx_initialize_low_level();
91
92 /* Call the high-level SMP Initialization. */
93 _tx_thread_smp_high_level_initialize();
94
95 /* Invoke the high-level initialization to exercise all of the
96 ThreadX components and the application's initialization
97 function. */
98 _tx_initialize_high_level();
99
100 /* Call any port specific post-processing. */
101 TX_PORT_SPECIFIC_POST_INITIALIZATION
102
103 /* Set the system state to indicate initialization is almost done. */
104 _tx_thread_system_state[0] = TX_INITIALIZE_ALMOST_DONE;
105 }
106
107