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