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 
25 
26 /* Include necessary system files.  */
27 
28 #include "tx_api.h"
29 #include "tx_trace.h"
30 
31 /* Determine if in-line initialization is required.  */
32 #ifdef TX_INLINE_INITIALIZATION
33 #define TX_INVOKE_INLINE_INITIALIZATION
34 #endif
35 
36 #include "tx_initialize.h"
37 #include "tx_thread.h"
38 #include "tx_timer.h"
39 #include "tx_semaphore.h"
40 #include "tx_queue.h"
41 #include "tx_event_flags.h"
42 #include "tx_mutex.h"
43 #include "tx_block_pool.h"
44 #include "tx_byte_pool.h"
45 
46 
47 /* Define the unused memory pointer.  The value of the first available
48    memory address is placed in this variable in the low-level
49    initialization function.  The content of this variable is passed
50    to the application's system definition function.  */
51 
52 VOID     *_tx_initialize_unused_memory;
53 
54 
55 /**************************************************************************/
56 /*                                                                        */
57 /*  FUNCTION                                               RELEASE        */
58 /*                                                                        */
59 /*    _tx_initialize_high_level                           PORTABLE C      */
60 /*                                                           6.1          */
61 /*  AUTHOR                                                                */
62 /*                                                                        */
63 /*    William E. Lamie, Microsoft Corporation                             */
64 /*                                                                        */
65 /*  DESCRIPTION                                                           */
66 /*                                                                        */
67 /*    This function is responsible for initializing all of the other      */
68 /*    components in the ThreadX real-time kernel.                         */
69 /*                                                                        */
70 /*  INPUT                                                                 */
71 /*                                                                        */
72 /*    None                                                                */
73 /*                                                                        */
74 /*  OUTPUT                                                                */
75 /*                                                                        */
76 /*    None                                                                */
77 /*                                                                        */
78 /*  CALLS                                                                 */
79 /*                                                                        */
80 /*    _tx_thread_initialize             Initialize the thread control     */
81 /*                                        component                       */
82 /*    _tx_timer_initialize              Initialize the timer control      */
83 /*                                        component                       */
84 /*    _tx_semaphore_initialize          Initialize the semaphore control  */
85 /*                                        component                       */
86 /*    _tx_queue_initialize              Initialize the queue control      */
87 /*                                        component                       */
88 /*    _tx_event_flags_initialize        Initialize the event flags control*/
89 /*                                        component                       */
90 /*    _tx_block_pool_initialize         Initialize the block pool control */
91 /*                                        component                       */
92 /*    _tx_byte_pool_initialize          Initialize the byte pool control  */
93 /*                                        component                       */
94 /*    _tx_mutex_initialize              Initialize the mutex control      */
95 /*                                        component                       */
96 /*                                                                        */
97 /*  CALLED BY                                                             */
98 /*                                                                        */
99 /*    _tx_initialize_kernel_enter       Kernel entry function             */
100 /*    _tx_initialize_kernel_setup       Early kernel setup function that  */
101 /*                                        is optionally called by         */
102 /*                                        compiler's startup code.        */
103 /*                                                                        */
104 /*  RELEASE HISTORY                                                       */
105 /*                                                                        */
106 /*    DATE              NAME                      DESCRIPTION             */
107 /*                                                                        */
108 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
109 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
110 /*                                            resulting in version 6.1    */
111 /*                                                                        */
112 /**************************************************************************/
_tx_initialize_high_level(VOID)113 VOID    _tx_initialize_high_level(VOID)
114 {
115 
116     /* Initialize event tracing, if enabled.  */
117     TX_TRACE_INITIALIZE
118 
119     /* Initialize the event log, if enabled.  */
120     TX_EL_INITIALIZE
121 
122     /* Call the thread control initialization function.  */
123     _tx_thread_initialize();
124 
125 #ifndef TX_NO_TIMER
126 
127     /* Call the timer control initialization function.  */
128     _tx_timer_initialize();
129 #endif
130 
131 #ifndef TX_DISABLE_REDUNDANT_CLEARING
132 
133     /* Call the semaphore initialization function.  */
134     _tx_semaphore_initialize();
135 
136     /* Call the queue initialization function.  */
137     _tx_queue_initialize();
138 
139     /* Call the event flag initialization function.  */
140     _tx_event_flags_initialize();
141 
142     /* Call the block pool initialization function.  */
143     _tx_block_pool_initialize();
144 
145     /* Call the byte pool initialization function.  */
146     _tx_byte_pool_initialize();
147 
148     /* Call the mutex initialization function.  */
149     _tx_mutex_initialize();
150 #endif
151 }
152 
153