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 /**   User Specific                                                       */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  PORT SPECIFIC C INFORMATION                            RELEASE        */
27 /*                                                                        */
28 /*    tx_user.h                                           PORTABLE C      */
29 /*                                                           6.1.11       */
30 /*                                                                        */
31 /*  AUTHOR                                                                */
32 /*                                                                        */
33 /*    William E. Lamie, Microsoft Corporation                             */
34 /*                                                                        */
35 /*  DESCRIPTION                                                           */
36 /*                                                                        */
37 /*    This file contains user defines for configuring ThreadX in specific */
38 /*    ways. This file will have an effect only if the application and     */
39 /*    ThreadX library are built with TX_INCLUDE_USER_DEFINE_FILE defined. */
40 /*    Note that all the defines in this file may also be made on the      */
41 /*    command line when building ThreadX library and application objects. */
42 /*                                                                        */
43 /*  RELEASE HISTORY                                                       */
44 /*                                                                        */
45 /*    DATE              NAME                      DESCRIPTION             */
46 /*                                                                        */
47 /*  05-19-2020      William E. Lamie        Initial Version 6.0           */
48 /*  09-30-2020      Yuxin Zhou              Modified comment(s),          */
49 /*                                            resulting in version 6.1    */
50 /*  03-02-2021      Scott Larson            Modified comment(s),          */
51 /*                                            added option to remove      */
52 /*                                            FileX pointer,              */
53 /*                                            resulting in version 6.1.5  */
54 /*  06-02-2021      Scott Larson            Added options for multiple    */
55 /*                                            block pool search & delay,  */
56 /*                                            resulting in version 6.1.7  */
57 /*  10-15-2021      Yuxin Zhou              Modified comment(s), added    */
58 /*                                            user-configurable symbol    */
59 /*                                            TX_TIMER_TICKS_PER_SECOND   */
60 /*                                            resulting in version 6.1.9  */
61 /*  04-25-2022      Wenhui Xie              Modified comment(s),          */
62 /*                                            optimized the definition of */
63 /*                                            TX_TIMER_TICKS_PER_SECOND,  */
64 /*                                            resulting in version 6.1.11 */
65 /*                                                                        */
66 /**************************************************************************/
67 
68 #ifndef TX_USER_H
69 #define TX_USER_H
70 
71 
72 /* Define various build options for the ThreadX port.  The application should either make changes
73    here by commenting or un-commenting the conditional compilation defined OR supply the defines
74    though the compiler's equivalent of the -D option.
75 
76    For maximum speed, the following should be defined:
77 
78         TX_MAX_PRIORITIES                       32
79         TX_DISABLE_PREEMPTION_THRESHOLD
80         TX_DISABLE_REDUNDANT_CLEARING
81         TX_DISABLE_NOTIFY_CALLBACKS
82         TX_NOT_INTERRUPTABLE
83         TX_TIMER_PROCESS_IN_ISR
84         TX_REACTIVATE_INLINE
85         TX_DISABLE_STACK_FILLING
86         TX_INLINE_THREAD_RESUME_SUSPEND
87 
88    For minimum size, the following should be defined:
89 
90         TX_MAX_PRIORITIES                       32
91         TX_DISABLE_PREEMPTION_THRESHOLD
92         TX_DISABLE_REDUNDANT_CLEARING
93         TX_DISABLE_NOTIFY_CALLBACKS
94         TX_NO_FILEX_POINTER
95         TX_NOT_INTERRUPTABLE
96         TX_TIMER_PROCESS_IN_ISR
97 
98    Of course, many of these defines reduce functionality and/or change the behavior of the
99    system in ways that may not be worth the trade-off. For example, the TX_TIMER_PROCESS_IN_ISR
100    results in faster and smaller code, however, it increases the amount of processing in the ISR.
101    In addition, some services that are available in timers are not available from ISRs and will
102    therefore return an error if this option is used. This may or may not be desirable for a
103    given application.  */
104 
105 
106 /* Override various options with default values already assigned in tx_port.h. Please also refer
107    to tx_port.h for descriptions on each of these options.  */
108 
109 /*
110 #define TX_MAX_PRIORITIES                       32
111 #define TX_MINIMUM_STACK                        ????
112 #define TX_THREAD_USER_EXTENSION                ????
113 #define TX_TIMER_THREAD_STACK_SIZE              ????
114 #define TX_TIMER_THREAD_PRIORITY                ????
115 */
116 
117 /* Define the common timer tick reference for use by other middleware components. The default
118    value is 10ms (i.e. 100 ticks, defined in tx_api.h), but may be replaced by a port-specific
119    version in tx_port.h or here.
120    Note: the actual hardware timer value may need to be changed (usually in tx_initialize_low_level).  */
121 
122 /*
123 #define TX_TIMER_TICKS_PER_SECOND       (100UL)
124 */
125 
126 /* Determine if there is a FileX pointer in the thread control block.
127    By default, the pointer is there for legacy/backwards compatibility.
128    The pointer must also be there for applications using FileX.
129    Define this to save space in the thread control block.
130 */
131 
132 /*
133 #define TX_NO_FILEX_POINTER
134 */
135 
136 /* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls
137    should be processed within the a system timer thread or directly in the timer ISR.
138    By default, the timer thread is used. When the following is defined, the timer expiration
139    processing is done directly from the timer ISR, thereby eliminating the timer thread control
140    block, stack, and context switching to activate it.  */
141 
142 /*
143 #define TX_TIMER_PROCESS_IN_ISR
144 */
145 
146 /* Determine if in-line timer reactivation should be used within the timer expiration processing.
147    By default, this is disabled and a function call is used. When the following is defined,
148    reactivating is performed in-line resulting in faster timer processing but slightly larger
149    code size.  */
150 
151 /*
152 #define TX_REACTIVATE_INLINE
153 */
154 
155 /* Determine is stack filling is enabled. By default, ThreadX stack filling is enabled,
156    which places an 0xEF pattern in each byte of each thread's stack.  This is used by
157    debuggers with ThreadX-awareness and by the ThreadX run-time stack checking feature.  */
158 
159 /*
160 #define TX_DISABLE_STACK_FILLING
161 */
162 
163 /* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is
164    disabled. When the following is defined, ThreadX thread stack checking is enabled.  If stack
165    checking is enabled (TX_ENABLE_STACK_CHECKING is defined), the TX_DISABLE_STACK_FILLING
166    define is negated, thereby forcing the stack fill which is necessary for the stack checking
167    logic.  */
168 
169 /*
170 #define TX_ENABLE_STACK_CHECKING
171 */
172 
173 /* Determine if preemption-threshold should be disabled. By default, preemption-threshold is
174    enabled. If the application does not use preemption-threshold, it may be disabled to reduce
175    code size and improve performance.  */
176 
177 /*
178 #define TX_DISABLE_PREEMPTION_THRESHOLD
179 */
180 
181 /* Determine if global ThreadX variables should be cleared. If the compiler startup code clears
182    the .bss section prior to ThreadX running, the define can be used to eliminate unnecessary
183    clearing of ThreadX global variables.  */
184 
185 /*
186 #define TX_DISABLE_REDUNDANT_CLEARING
187 */
188 
189 /* Determine if no timer processing is required. This option will help eliminate the timer
190    processing when not needed. The user will also have to comment out the call to
191    tx_timer_interrupt, which is typically made from assembly language in
192    tx_initialize_low_level. Note: if TX_NO_TIMER is used, the define TX_TIMER_PROCESS_IN_ISR
193    must also be used and tx_timer_initialize must be removed from ThreadX library.  */
194 
195 /*
196 #define TX_NO_TIMER
197 #ifndef TX_TIMER_PROCESS_IN_ISR
198 #define TX_TIMER_PROCESS_IN_ISR
199 #endif
200 */
201 
202 /* Determine if the notify callback option should be disabled. By default, notify callbacks are
203    enabled. If the application does not use notify callbacks, they may be disabled to reduce
204    code size and improve performance.  */
205 
206 /*
207 #define TX_DISABLE_NOTIFY_CALLBACKS
208 */
209 
210 
211 /* Determine if the tx_thread_resume and tx_thread_suspend services should have their internal
212    code in-line. This results in a larger image, but improves the performance of the thread
213    resume and suspend services.  */
214 
215 /*
216 #define TX_INLINE_THREAD_RESUME_SUSPEND
217 */
218 
219 
220 /* Determine if the internal ThreadX code is non-interruptable. This results in smaller code
221    size and less processing overhead, but increases the interrupt lockout time.  */
222 
223 /*
224 #define TX_NOT_INTERRUPTABLE
225 */
226 
227 
228 /* Determine if the trace event logging code should be enabled. This causes slight increases in
229    code size and overhead, but provides the ability to generate system trace information which
230    is available for viewing in TraceX.  */
231 
232 /*
233 #define TX_ENABLE_EVENT_TRACE
234 */
235 
236 
237 /* Determine if block pool performance gathering is required by the application. When the following is
238    defined, ThreadX gathers various block pool performance information. */
239 
240 /*
241 #define TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
242 */
243 
244 /* Determine if byte pool performance gathering is required by the application. When the following is
245    defined, ThreadX gathers various byte pool performance information. */
246 
247 /*
248 #define TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
249 */
250 
251 /* Determine if event flags performance gathering is required by the application. When the following is
252    defined, ThreadX gathers various event flags performance information. */
253 
254 /*
255 #define TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
256 */
257 
258 /* Determine if mutex performance gathering is required by the application. When the following is
259    defined, ThreadX gathers various mutex performance information. */
260 
261 /*
262 #define TX_MUTEX_ENABLE_PERFORMANCE_INFO
263 */
264 
265 /* Determine if queue performance gathering is required by the application. When the following is
266    defined, ThreadX gathers various queue performance information. */
267 
268 /*
269 #define TX_QUEUE_ENABLE_PERFORMANCE_INFO
270 */
271 
272 /* Determine if semaphore performance gathering is required by the application. When the following is
273    defined, ThreadX gathers various semaphore performance information. */
274 
275 /*
276 #define TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
277 */
278 
279 /* Determine if thread performance gathering is required by the application. When the following is
280    defined, ThreadX gathers various thread performance information. */
281 
282 /*
283 #define TX_THREAD_ENABLE_PERFORMANCE_INFO
284 */
285 
286 /* Determine if timer performance gathering is required by the application. When the following is
287    defined, ThreadX gathers various timer performance information. */
288 
289 /*
290 #define TX_TIMER_ENABLE_PERFORMANCE_INFO
291 */
292 
293 /*  Override options for byte pool searches of multiple blocks. */
294 
295 /*
296 #define TX_BYTE_POOL_MULTIPLE_BLOCK_SEARCH    20
297 */
298 
299 /*  Override options for byte pool search delay to avoid thrashing. */
300 
301 /*
302 #define TX_BYTE_POOL_DELAY_VALUE              3
303 */
304 
305 #endif
306 
307