tx_user.h 14 KB

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