1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** ThreadX Component                                                     */
16 /**                                                                       */
17 /**   User Specific                                                       */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  PORT SPECIFIC C INFORMATION                            RELEASE        */
26 /*                                                                        */
27 /*    tx_user.h                                           PORTABLE C      */
28 /*                                                           6.0.1        */
29 /*                                                                        */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    William E. Lamie, Microsoft Corporation                             */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file contains user defines for configuring ThreadX in specific */
37 /*    ways. This file will have an effect only if the application and     */
38 /*    ThreadX library are built with TX_INCLUDE_USER_DEFINE_FILE defined. */
39 /*    Note that all the defines in this file may also be made on the      */
40 /*    command line when building ThreadX library and application objects. */
41 /*                                                                        */
42 /*  RELEASE HISTORY                                                       */
43 /*                                                                        */
44 /*    DATE              NAME                      DESCRIPTION             */
45 /*                                                                        */
46 /*  06-30-2020     William E. Lamie         Initial Version 6.0.1         */
47 /*                                                                        */
48 /**************************************************************************/
49 
50 #ifndef TX_USER_H
51 #define TX_USER_H
52 
53 
54 /* Define various build options for the ThreadX port.  The application should either make changes
55    here by commenting or un-commenting the conditional compilation defined OR supply the defines
56    though the compiler's equivalent of the -D option.
57 
58    For maximum speed, the following should be defined:
59 
60         TX_MAX_PRIORITIES                       32
61         TX_DISABLE_PREEMPTION_THRESHOLD
62         TX_DISABLE_REDUNDANT_CLEARING
63         TX_DISABLE_NOTIFY_CALLBACKS
64         TX_NOT_INTERRUPTABLE
65         TX_TIMER_PROCESS_IN_ISR
66         TX_REACTIVATE_INLINE
67         TX_DISABLE_STACK_FILLING
68         TX_INLINE_THREAD_RESUME_SUSPEND
69 
70    For minimum size, the following should be defined:
71 
72         TX_MAX_PRIORITIES                       32
73         TX_DISABLE_PREEMPTION_THRESHOLD
74         TX_DISABLE_REDUNDANT_CLEARING
75         TX_DISABLE_NOTIFY_CALLBACKS
76         TX_NOT_INTERRUPTABLE
77         TX_TIMER_PROCESS_IN_ISR
78 
79    Of course, many of these defines reduce functionality and/or change the behavior of the
80    system in ways that may not be worth the trade-off. For example, the TX_TIMER_PROCESS_IN_ISR
81    results in faster and smaller code, however, it increases the amount of processing in the ISR.
82    In addition, some services that are available in timers are not available from ISRs and will
83    therefore return an error if this option is used. This may or may not be desirable for a
84    given application.  */
85 
86 
87 /* Override various options with default values already assigned in tx_port.h. Please also refer
88    to tx_port.h for descriptions on each of these options.  */
89 
90 /*
91 #define TX_MAX_PRIORITIES                       32
92 #define TX_MINIMUM_STACK                        ????
93 #define TX_THREAD_USER_EXTENSION                ????
94 #define TX_TIMER_THREAD_STACK_SIZE              ????
95 #define TX_TIMER_THREAD_PRIORITY                ????
96 */
97 
98 /* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls
99    should be processed within the a system timer thread or directly in the timer ISR.
100    By default, the timer thread is used. When the following is defined, the timer expiration
101    processing is done directly from the timer ISR, thereby eliminating the timer thread control
102    block, stack, and context switching to activate it.  */
103 
104 /*
105 #define TX_TIMER_PROCESS_IN_ISR
106 */
107 
108 /* Determine if in-line timer reactivation should be used within the timer expiration processing.
109    By default, this is disabled and a function call is used. When the following is defined,
110    reactivating is performed in-line resulting in faster timer processing but slightly larger
111    code size.  */
112 
113 /*
114 #define TX_REACTIVATE_INLINE
115 */
116 
117 /* Determine is stack filling is enabled. By default, ThreadX stack filling is enabled,
118    which places an 0xEF pattern in each byte of each thread's stack.  This is used by
119    debuggers with ThreadX-awareness and by the ThreadX run-time stack checking feature.  */
120 
121 /*
122 #define TX_DISABLE_STACK_FILLING
123 */
124 
125 /* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is
126    disabled. When the following is defined, ThreadX thread stack checking is enabled.  If stack
127    checking is enabled (TX_ENABLE_STACK_CHECKING is defined), the TX_DISABLE_STACK_FILLING
128    define is negated, thereby forcing the stack fill which is necessary for the stack checking
129    logic.  */
130 
131 /*
132 #define TX_ENABLE_STACK_CHECKING
133 */
134 
135 /* Determine if preemption-threshold should be disabled. By default, preemption-threshold is
136    enabled. If the application does not use preemption-threshold, it may be disabled to reduce
137    code size and improve performance.  */
138 
139 /*
140 #define TX_DISABLE_PREEMPTION_THRESHOLD
141 */
142 
143 /* Determine if global ThreadX variables should be cleared. If the compiler startup code clears
144    the .bss section prior to ThreadX running, the define can be used to eliminate unnecessary
145    clearing of ThreadX global variables.  */
146 
147 /*
148 #define TX_DISABLE_REDUNDANT_CLEARING
149 */
150 
151 /* Determine if no timer processing is required. This option will help eliminate the timer
152    processing when not needed. The user will also have to comment out the call to
153    tx_timer_interrupt, which is typically made from assembly language in
154    tx_initialize_low_level. Note: if TX_NO_TIMER is used, the define TX_TIMER_PROCESS_IN_ISR
155    must also be used.  */
156 
157 /*
158 #define TX_NO_TIMER
159 #ifndef TX_TIMER_PROCESS_IN_ISR
160 #define TX_TIMER_PROCESS_IN_ISR
161 #endif
162 */
163 
164 /* Determine if the notify callback option should be disabled. By default, notify callbacks are
165    enabled. If the application does not use notify callbacks, they may be disabled to reduce
166    code size and improve performance.  */
167 
168 /*
169 #define TX_DISABLE_NOTIFY_CALLBACKS
170 */
171 
172 
173 /* Determine if the tx_thread_resume and tx_thread_suspend services should have their internal
174    code in-line. This results in a larger image, but improves the performance of the thread
175    resume and suspend services.  */
176 
177 /*
178 #define TX_INLINE_THREAD_RESUME_SUSPEND
179 */
180 
181 
182 /* Determine if the internal ThreadX code is non-interruptable. This results in smaller code
183    size and less processing overhead, but increases the interrupt lockout time.  */
184 
185 /*
186 #define TX_NOT_INTERRUPTABLE
187 */
188 
189 
190 /* Determine if the trace event logging code should be enabled. This causes slight increases in
191    code size and overhead, but provides the ability to generate system trace information which
192    is available for viewing in TraceX.  */
193 
194 /*
195 #define TX_ENABLE_EVENT_TRACE
196 */
197 
198 
199 /* Determine if block pool performance gathering is required by the application. When the following is
200    defined, ThreadX gathers various block pool performance information. */
201 
202 /*
203 #define TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
204 */
205 
206 /* Determine if byte pool performance gathering is required by the application. When the following is
207    defined, ThreadX gathers various byte pool performance information. */
208 
209 /*
210 #define TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
211 */
212 
213 /* Determine if event flags performance gathering is required by the application. When the following is
214    defined, ThreadX gathers various event flags performance information. */
215 
216 /*
217 #define TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
218 */
219 
220 /* Determine if mutex performance gathering is required by the application. When the following is
221    defined, ThreadX gathers various mutex performance information. */
222 
223 /*
224 #define TX_MUTEX_ENABLE_PERFORMANCE_INFO
225 */
226 
227 /* Determine if queue performance gathering is required by the application. When the following is
228    defined, ThreadX gathers various queue performance information. */
229 
230 /*
231 #define TX_QUEUE_ENABLE_PERFORMANCE_INFO
232 */
233 
234 /* Determine if semaphore performance gathering is required by the application. When the following is
235    defined, ThreadX gathers various semaphore performance information. */
236 
237 /*
238 #define TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
239 */
240 
241 /* Determine if thread performance gathering is required by the application. When the following is
242    defined, ThreadX gathers various thread performance information. */
243 
244 /*
245 #define TX_THREAD_ENABLE_PERFORMANCE_INFO
246 */
247 
248 /* Determine if timer performance gathering is required by the application. When the following is
249    defined, ThreadX gathers various timer performance information. */
250 
251 /*
252 #define TX_TIMER_ENABLE_PERFORMANCE_INFO
253 */
254 
255 #endif
256 
257