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