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 /**   Application Interface (API)                                         */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
27 /*                                                                        */
28 /*    tx_api.h                                            PORTABLE C      */
29 /*                                                           6.2.1        */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    William E. Lamie, Microsoft Corporation                             */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file defines the basic Application Interface (API) to the      */
37 /*    high-performance ThreadX real-time kernel.  All service prototypes  */
38 /*    and data structure definitions are defined in this file.            */
39 /*    Please note that basic data type definitions and other architecture-*/
40 /*    specific information is contained in the file tx_port.h.            */
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      William E. Lamie        Modified comment(s), and      */
48 /*                                            updated product constants,  */
49 /*                                            added new thread execution  */
50 /*                                            state TX_PRIORITY_CHANGE,   */
51 /*                                            added macros for casting    */
52 /*                                            pointers to ALIGN_TYPE,     */
53 /*                                            resulting in version 6.1    */
54 /*  10-16-2020      William E. Lamie        Modified comment(s), and      */
55 /*                                            increased patch version,    */
56 /*                                            resulting in version 6.1.1  */
57 /*  11-09-2020      Yuxin Zhou              Modified comment(s), and      */
58 /*                                            moved TX_THREAD_GET_SYSTEM_ */
59 /*                                            STATE to tx_api.h,          */
60 /*                                            resulting in version 6.1.2  */
61 /*  12-31-2020      William E. Lamie        Modified comment(s), and      */
62 /*                                            increased patch version,    */
63 /*                                            resulting in version 6.1.3  */
64 /*  03-02-2021      Scott Larson            Modified comment(s), and      */
65 /*                                            order defines numerically,  */
66 /*                                            add option to remove FileX  */
67 /*                                            pointer,                    */
68 /*                                            resulting in version 6.1.5  */
69 /*  04-02-2021      Scott Larson            Modified comment(s), and      */
70 /*                                            update patch number,        */
71 /*                                            resulting in version 6.1.6  */
72 /*  06-02-2021      Yuxin Zhou              Modified comment(s), added    */
73 /*                                            Execution Profile support,  */
74 /*                                            resulting in version 6.1.7  */
75 /*  08-02-2021      Scott Larson            Modified comment(s), and      */
76 /*                                            update patch number,        */
77 /*                                            resulting in version 6.1.8  */
78 /*  10-15-2021      Yuxin Zhou              Modified comment(s),          */
79 /*                                            update patch number,        */
80 /*                                            resulting in version 6.1.9  */
81 /*  01-31-2022      Scott Larson            Modified comment(s),          */
82 /*                                            add unused parameter macro, */
83 /*                                            update patch number,        */
84 /*                                            resulting in version 6.1.10 */
85 /*  04-25-2022      Wenhui Xie              Modified comment(s),          */
86 /*                                            optimized the definition of */
87 /*                                            TX_TIMER_TICKS_PER_SECOND,  */
88 /*                                            resulting in version 6.1.11 */
89 /*  07-29-2022      Scott Larson            Modified comment(s),          */
90 /*                                            update patch number,        */
91 /*                                            resulting in version 6.1.12 */
92 /*  10-31-2022      Scott Larson            Modified comment(s),          */
93 /*                                            add extension macros,       */
94 /*                                            update EPK typedef,         */
95 /*                                            update version numbers,     */
96 /*                                            resulting in version 6.2.0  */
97 /*  03-08-2023      Tiejun Zhou             Modified comment(s),          */
98 /*                                            update patch number,        */
99 /*                                            resulting in version 6.2.1  */
100 /*                                                                        */
101 /**************************************************************************/
102 
103 #ifndef TX_API_H
104 #define TX_API_H
105 
106 
107 /* Determine if a C++ compiler is being used.  If so, ensure that standard
108    C is used to process the API information.  */
109 
110 #ifdef __cplusplus
111 
112 /* Yes, C++ compiler is present.  Use standard C.  */
113 extern   "C" {
114 
115 #endif
116 
117 /* Disable warning of parameter not used. */
118 #ifndef TX_PARAMETER_NOT_USED
119 #define TX_PARAMETER_NOT_USED(p) ((void)(p))
120 #endif /* TX_PARAMETER_NOT_USED */
121 
122 /* Include the port-specific data type file.  */
123 
124 #include "tx_port.h"
125 
126 #if (defined(TX_EXECUTION_PROFILE_ENABLE) && !defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY))
127 #include "tx_execution_profile.h"
128 #endif
129 
130 /* Define basic constants for the ThreadX kernel.  */
131 
132 
133 /* Define the major/minor version information that can be used by the application
134    and the ThreadX source as well.  */
135 
136 #define AZURE_RTOS_THREADX
137 #define THREADX_MAJOR_VERSION           6
138 #define THREADX_MINOR_VERSION           2
139 #define THREADX_PATCH_VERSION           1
140 
141 /* Define the following symbol for backward compatibility */
142 #define EL_PRODUCT_THREADX
143 
144 
145 /* API input parameters and general constants.  */
146 
147 #define TX_NO_WAIT                      ((ULONG)  0)
148 #define TX_WAIT_FOREVER                 ((ULONG)  0xFFFFFFFFUL)
149 #define TX_AND                          ((UINT)   2)
150 #define TX_AND_CLEAR                    ((UINT)   3)
151 #define TX_OR                           ((UINT)   0)
152 #define TX_OR_CLEAR                     ((UINT)   1)
153 #define TX_1_ULONG                      ((UINT)   1)
154 #define TX_2_ULONG                      ((UINT)   2)
155 #define TX_4_ULONG                      ((UINT)   4)
156 #define TX_8_ULONG                      ((UINT)   8)
157 #define TX_16_ULONG                     ((UINT)   16)
158 #define TX_NO_TIME_SLICE                ((ULONG)  0)
159 #define TX_AUTO_START                   ((UINT)   1)
160 #define TX_DONT_START                   ((UINT)   0)
161 #define TX_AUTO_ACTIVATE                ((UINT)   1)
162 #define TX_NO_ACTIVATE                  ((UINT)   0)
163 #define TX_TRUE                         ((UINT)   1)
164 #define TX_FALSE                        ((UINT)   0)
165 #define TX_NULL                         ((void *) 0)
166 #define TX_INHERIT                      ((UINT)   1)
167 #define TX_NO_INHERIT                   ((UINT)   0)
168 #define TX_THREAD_ENTRY                 ((UINT)   0)
169 #define TX_THREAD_EXIT                  ((UINT)   1)
170 #define TX_NO_SUSPENSIONS               ((UINT)   0)
171 #define TX_NO_MESSAGES                  ((UINT)   0)
172 #define TX_EMPTY                        ((ULONG)  0)
173 #define TX_CLEAR_ID                     ((ULONG)  0)
174 #define TX_STACK_FILL                   ((ULONG)  0xEFEFEFEFUL)
175 
176 
177 /* Thread execution state values.  */
178 
179 #define TX_READY                        ((UINT) 0)
180 #define TX_COMPLETED                    ((UINT) 1)
181 #define TX_TERMINATED                   ((UINT) 2)
182 #define TX_SUSPENDED                    ((UINT) 3)
183 #define TX_SLEEP                        ((UINT) 4)
184 #define TX_QUEUE_SUSP                   ((UINT) 5)
185 #define TX_SEMAPHORE_SUSP               ((UINT) 6)
186 #define TX_EVENT_FLAG                   ((UINT) 7)
187 #define TX_BLOCK_MEMORY                 ((UINT) 8)
188 #define TX_BYTE_MEMORY                  ((UINT) 9)
189 #define TX_IO_DRIVER                    ((UINT) 10)
190 #define TX_FILE                         ((UINT) 11)
191 #define TX_TCP_IP                       ((UINT) 12)
192 #define TX_MUTEX_SUSP                   ((UINT) 13)
193 #define TX_PRIORITY_CHANGE              ((UINT) 14)
194 
195 
196 /* API return values.  */
197 
198 #define TX_SUCCESS                      ((UINT) 0x00)
199 #define TX_DELETED                      ((UINT) 0x01)
200 #define TX_POOL_ERROR                   ((UINT) 0x02)
201 #define TX_PTR_ERROR                    ((UINT) 0x03)
202 #define TX_WAIT_ERROR                   ((UINT) 0x04)
203 #define TX_SIZE_ERROR                   ((UINT) 0x05)
204 #define TX_GROUP_ERROR                  ((UINT) 0x06)
205 #define TX_NO_EVENTS                    ((UINT) 0x07)
206 #define TX_OPTION_ERROR                 ((UINT) 0x08)
207 #define TX_QUEUE_ERROR                  ((UINT) 0x09)
208 #define TX_QUEUE_EMPTY                  ((UINT) 0x0A)
209 #define TX_QUEUE_FULL                   ((UINT) 0x0B)
210 #define TX_SEMAPHORE_ERROR              ((UINT) 0x0C)
211 #define TX_NO_INSTANCE                  ((UINT) 0x0D)
212 #define TX_THREAD_ERROR                 ((UINT) 0x0E)
213 #define TX_PRIORITY_ERROR               ((UINT) 0x0F)
214 #define TX_NO_MEMORY                    ((UINT) 0x10)
215 #define TX_START_ERROR                  ((UINT) 0x10)
216 #define TX_DELETE_ERROR                 ((UINT) 0x11)
217 #define TX_RESUME_ERROR                 ((UINT) 0x12)
218 #define TX_CALLER_ERROR                 ((UINT) 0x13)
219 #define TX_SUSPEND_ERROR                ((UINT) 0x14)
220 #define TX_TIMER_ERROR                  ((UINT) 0x15)
221 #define TX_TICK_ERROR                   ((UINT) 0x16)
222 #define TX_ACTIVATE_ERROR               ((UINT) 0x17)
223 #define TX_THRESH_ERROR                 ((UINT) 0x18)
224 #define TX_SUSPEND_LIFTED               ((UINT) 0x19)
225 #define TX_WAIT_ABORTED                 ((UINT) 0x1A)
226 #define TX_WAIT_ABORT_ERROR             ((UINT) 0x1B)
227 #define TX_MUTEX_ERROR                  ((UINT) 0x1C)
228 #define TX_NOT_AVAILABLE                ((UINT) 0x1D)
229 #define TX_NOT_OWNED                    ((UINT) 0x1E)
230 #define TX_INHERIT_ERROR                ((UINT) 0x1F)
231 #define TX_NOT_DONE                     ((UINT) 0x20)
232 #define TX_CEILING_EXCEEDED             ((UINT) 0x21)
233 #define TX_INVALID_CEILING              ((UINT) 0x22)
234 #define TX_FEATURE_NOT_ENABLED          ((UINT) 0xFF)
235 
236 
237 #ifdef TX_64_BIT
238 
239 #ifndef TX_THREAD_EXTENSION_PTR_SET
240 #define TX_THREAD_EXTENSION_PTR_SET(a, b)                   { \
241                                                                 TX_THREAD *thread_ptr; \
242                                                                 thread_ptr = (TX_THREAD *) (a); \
243                                                                 (thread_ptr -> tx_thread_extension_ptr) = (VOID *)(b); \
244                                                             }
245 #endif /* TX_THREAD_EXTENSION_PTR_SET  */
246 
247 #ifndef TX_THREAD_EXTENSION_PTR_GET
248 #define TX_THREAD_EXTENSION_PTR_GET(a, b, c)                { \
249                                                                 TX_PARAMETER_NOT_USED(c); \
250                                                                 TX_THREAD *thread_ptr; \
251                                                                 thread_ptr = tx_thread_identify(); \
252                                                                 while(1)\
253                                                                 { \
254                                                                     if (thread_ptr -> tx_thread_extension_ptr) \
255                                                                     { \
256                                                                         (a) = (b *)(thread_ptr -> tx_thread_extension_ptr); \
257                                                                         break; \
258                                                                     } \
259                                                                     tx_thread_sleep(1); \
260                                                                 } \
261                                                             }
262 #endif /* TX_THREAD_EXTENSION_PTR_GET  */
263 
264 #ifndef TX_TIMER_EXTENSION_PTR_SET
265 #define TX_TIMER_EXTENSION_PTR_SET(a, b)                    { \
266                                                                 TX_TIMER *timer_ptr; \
267                                                                 timer_ptr = (TX_TIMER *) (a);   \
268                                                                 (timer_ptr -> tx_timer_internal.tx_timer_internal_extension_ptr) = (VOID *)(b); \
269                                                             }
270 #endif /* TX_TIMER_EXTENSION_PTR_SET  */
271 
272 #ifndef TX_TIMER_EXTENSION_PTR_GET
273 #define TX_TIMER_EXTENSION_PTR_GET(a, b, c)                 { \
274                                                                 TX_PARAMETER_NOT_USED(c); \
275                                                                 if (!_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr) \
276                                                                     return; \
277                                                                 (a) = (b *)(_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr); \
278                                                             }
279 #endif /* TX_TIMER_EXTENSION_PTR_GET  */
280 
281 #else   /* not 64 bit */
282 
283 #ifndef TX_THREAD_EXTENSION_PTR_SET
284 #define TX_THREAD_EXTENSION_PTR_SET(a, b)
285 #endif /* TX_THREAD_EXTENSION_PTR_SET  */
286 
287 #ifndef TX_THREAD_EXTENSION_PTR_GET
288 #define TX_THREAD_EXTENSION_PTR_GET(a, b, c)                { \
289                                                                 (a) = (b *)(c); \
290                                                             }
291 #endif /* TX_THREAD_EXTENSION_PTR_GET  */
292 
293 #ifndef TX_TIMER_EXTENSION_PTR_SET
294 #define TX_TIMER_EXTENSION_PTR_SET(a, b)
295 #endif /* TX_TIMER_EXTENSION_PTR_SET  */
296 
297 #ifndef TX_TIMER_EXTENSION_PTR_GET
298 #define TX_TIMER_EXTENSION_PTR_GET(a, b, c)                 { \
299                                                                 (a) = (b *)(c); \
300                                                             }
301 #endif /* TX_TIMER_EXTENSION_PTR_GET  */
302 
303 #endif  /* TX_64_BIT */
304 
305 
306 
307 /* Define the common timer tick reference for use by other middleware components. The default
308    value is 10ms, but may be replaced by a port specific version in tx_port.h or by the user
309    as a compilation option.  */
310 
311 #ifndef TX_TIMER_TICKS_PER_SECOND
312 #define TX_TIMER_TICKS_PER_SECOND       (100UL)
313 #endif
314 
315 
316 /* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are:
317 
318                                 ThreadX events:     1-199
319                                 FileX events:       200-299
320                                 NetX events:        300-599
321                                 USBX events:        600-999
322                                 GUIX events:        1000-1500
323 
324    User-defined event numbers start at 4096 and continue through 65535, as defined by the constants
325    TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based
326    on these constants in case the user event number assignment is changed in future releases.  */
327 
328 #define TX_TRACE_USER_EVENT_START           4096            /* I1, I2, I3, I4 are user defined           */
329 #define TX_TRACE_USER_EVENT_END             65535           /* I1, I2, I3, I4 are user defined           */
330 
331 
332 /* Define event filters that can be used to selectively disable certain events or groups of events.  */
333 
334 #define TX_TRACE_ALL_EVENTS                 0x000007FF      /* All ThreadX events                        */
335 #define TX_TRACE_INTERNAL_EVENTS            0x00000001      /* ThreadX internal events                   */
336 #define TX_TRACE_BLOCK_POOL_EVENTS          0x00000002      /* ThreadX Block Pool events                 */
337 #define TX_TRACE_BYTE_POOL_EVENTS           0x00000004      /* ThreadX Byte Pool events                  */
338 #define TX_TRACE_EVENT_FLAGS_EVENTS         0x00000008      /* ThreadX Event Flags events                */
339 #define TX_TRACE_INTERRUPT_CONTROL_EVENT    0x00000010      /* ThreadX Interrupt Control events          */
340 #define TX_TRACE_MUTEX_EVENTS               0x00000020      /* ThreadX Mutex events                      */
341 #define TX_TRACE_QUEUE_EVENTS               0x00000040      /* ThreadX Queue events                      */
342 #define TX_TRACE_SEMAPHORE_EVENTS           0x00000080      /* ThreadX Semaphore events                  */
343 #define TX_TRACE_THREAD_EVENTS              0x00000100      /* ThreadX Thread events                     */
344 #define TX_TRACE_TIME_EVENTS                0x00000200      /* ThreadX Time events                       */
345 #define TX_TRACE_TIMER_EVENTS               0x00000400      /* ThreadX Timer events                      */
346 #define TX_TRACE_USER_EVENTS                0x80000000UL    /* ThreadX User Events                       */
347 
348 
349 /* Define basic alignment type used in block and byte pool operations. This data type must
350    be at least 32-bits in size and also be large enough to hold a pointer type.  */
351 
352 #ifndef ALIGN_TYPE_DEFINED
353 #define ALIGN_TYPE      ULONG
354 #endif
355 
356 
357 /* Define the control block definitions for all system objects.  */
358 
359 
360 /* Define the basic timer management structures.  These are the structures
361    used to manage thread sleep, timeout, and user timer requests.  */
362 
363 /* Determine if the internal timer control block has an extension defined. If not,
364    define the extension to whitespace.  */
365 
366 #ifndef TX_TIMER_INTERNAL_EXTENSION
367 #define TX_TIMER_INTERNAL_EXTENSION
368 #endif
369 
370 
371 /* Define the common internal timer control block.  */
372 
373 typedef struct TX_TIMER_INTERNAL_STRUCT
374 {
375 
376     /* Define the remaining ticks and re-initialization tick values.  */
377     ULONG               tx_timer_internal_remaining_ticks;
378     ULONG               tx_timer_internal_re_initialize_ticks;
379 
380     /* Define the timeout function and timeout function parameter.  */
381     VOID                (*tx_timer_internal_timeout_function)(ULONG id);
382     ULONG               tx_timer_internal_timeout_param;
383 
384 
385     /* Define the next and previous internal link pointers for active
386        internal timers.  */
387     struct TX_TIMER_INTERNAL_STRUCT
388                         *tx_timer_internal_active_next,
389                         *tx_timer_internal_active_previous;
390 
391     /* Keep track of the pointer to the head of this list as well.  */
392     struct TX_TIMER_INTERNAL_STRUCT
393                         **tx_timer_internal_list_head;
394 
395     /* Define optional extension to internal timer control block.  */
396     TX_TIMER_INTERNAL_EXTENSION
397 
398 } TX_TIMER_INTERNAL;
399 
400 
401 /* Determine if the timer control block has an extension defined. If not,
402    define the extension to whitespace.  */
403 
404 #ifndef TX_TIMER_EXTENSION
405 #define TX_TIMER_EXTENSION
406 #endif
407 
408 
409 /* Define the timer structure utilized by the application.  */
410 
411 typedef struct TX_TIMER_STRUCT
412 {
413 
414     /* Define the timer ID used for error checking.  */
415     ULONG               tx_timer_id;
416 
417     /* Define the timer's name.  */
418     CHAR                *tx_timer_name;
419 
420     /* Define the actual contents of the timer.  This is the block that
421        is used in the actual timer expiration processing.  */
422     TX_TIMER_INTERNAL   tx_timer_internal;
423 
424     /* Define the pointers for the created list.  */
425     struct TX_TIMER_STRUCT
426                         *tx_timer_created_next,
427                         *tx_timer_created_previous;
428 
429     /* Define optional extension to timer control block.  */
430     TX_TIMER_EXTENSION
431 
432 #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO
433 
434     /* Define the number of timer activations.  */
435     ULONG               tx_timer_performance_activate_count;
436 
437     /* Define the number of timer reactivations.  */
438     ULONG               tx_timer_performance_reactivate_count;
439 
440     /* Define the number of timer deactivations.  */
441     ULONG               tx_timer_performance_deactivate_count;
442 
443     /* Define the number of timer expirations.  */
444     ULONG               tx_timer_performance_expiration_count;
445 
446     /* Define the total number of timer expiration adjustments.  */
447     ULONG               tx_timer_performance__expiration_adjust_count;
448 #endif
449 
450 } TX_TIMER;
451 
452 
453 /* ThreadX thread control block structure follows.  Additional fields
454    can be added providing they are added after the information that is
455    referenced in the port-specific assembly code.  */
456 
457 typedef struct TX_THREAD_STRUCT
458 {
459     /* The first section of the control block contains critical
460        information that is referenced by the port-specific
461        assembly language code.  Any changes in this section could
462        necessitate changes in the assembly language.  */
463 
464     ULONG               tx_thread_id;                   /* Control block ID         */
465     ULONG               tx_thread_run_count;            /* Thread's run counter     */
466     VOID                *tx_thread_stack_ptr;           /* Thread's stack pointer   */
467     VOID                *tx_thread_stack_start;         /* Stack starting address   */
468     VOID                *tx_thread_stack_end;           /* Stack ending address     */
469     ULONG               tx_thread_stack_size;           /* Stack size               */
470     ULONG               tx_thread_time_slice;           /* Current time-slice       */
471     ULONG               tx_thread_new_time_slice;       /* New time-slice           */
472 
473     /* Define pointers to the next and previous ready threads.  */
474     struct TX_THREAD_STRUCT
475                         *tx_thread_ready_next,
476                         *tx_thread_ready_previous;
477 
478     /***************************************************************/
479 
480     /* Define the first port extension in the thread control block. This
481        is typically defined to whitespace or a pointer type in tx_port.h.  */
482     TX_THREAD_EXTENSION_0
483 
484     CHAR                *tx_thread_name;                /* Pointer to thread's name     */
485     UINT                tx_thread_priority;             /* Priority of thread (0-1023)  */
486     UINT                tx_thread_state;                /* Thread's execution state     */
487     UINT                tx_thread_delayed_suspend;      /* Delayed suspend flag         */
488     UINT                tx_thread_suspending;           /* Thread suspending flag       */
489     UINT                tx_thread_preempt_threshold;    /* Preemption threshold         */
490 
491     /* Define the thread schedule hook. The usage of this is port/application specific,
492        but when used, the function pointer designated is called whenever the thread is
493        scheduled and unscheduled.  */
494     VOID                (*tx_thread_schedule_hook)(struct TX_THREAD_STRUCT *thread_ptr, ULONG id);
495 
496     /* Nothing after this point is referenced by the target-specific
497        assembly language.  Hence, information after this point can
498        be added to the control block providing the complete system
499        is recompiled.  */
500 
501     /* Define the thread's entry point and input parameter.  */
502     VOID                (*tx_thread_entry)(ULONG id);
503     ULONG               tx_thread_entry_parameter;
504 
505     /* Define the thread's timer block.   This is used for thread
506        sleep and timeout requests.  */
507     TX_TIMER_INTERNAL   tx_thread_timer;
508 
509     /* Define the thread's cleanup function and associated data.  This
510        is used to cleanup various data structures when a thread
511        suspension is lifted or terminated either by the user or
512        a timeout.  */
513     VOID                (*tx_thread_suspend_cleanup)(struct TX_THREAD_STRUCT *thread_ptr, ULONG suspension_sequence);
514     VOID                *tx_thread_suspend_control_block;
515     struct TX_THREAD_STRUCT
516                         *tx_thread_suspended_next,
517                         *tx_thread_suspended_previous;
518     ULONG               tx_thread_suspend_info;
519     VOID                *tx_thread_additional_suspend_info;
520     UINT                tx_thread_suspend_option;
521     UINT                tx_thread_suspend_status;
522 
523     /* Define the second port extension in the thread control block. This
524        is typically defined to whitespace or a pointer type in tx_port.h.  */
525     TX_THREAD_EXTENSION_1
526 
527     /* Define pointers to the next and previous threads in the
528        created list.  */
529     struct TX_THREAD_STRUCT
530                         *tx_thread_created_next,
531                         *tx_thread_created_previous;
532 
533     /* Define the third port extension in the thread control block. This
534        is typically defined to whitespace in tx_port.h.  */
535     TX_THREAD_EXTENSION_2
536 
537     /* Define a pointer type for FileX extensions.  */
538 #ifndef TX_NO_FILEX_POINTER
539     VOID                *tx_thread_filex_ptr;
540 #endif
541 
542     /* Define the priority inheritance variables. These will be used
543        to manage priority inheritance changes applied to this thread
544        as a result of mutex get operations.  */
545     UINT                tx_thread_user_priority;
546     UINT                tx_thread_user_preempt_threshold;
547     UINT                tx_thread_inherit_priority;
548 
549     /* Define the owned mutex count and list head pointer.  */
550     UINT                tx_thread_owned_mutex_count;
551     struct TX_MUTEX_STRUCT
552                         *tx_thread_owned_mutex_list;
553 
554 #ifdef TX_THREAD_ENABLE_PERFORMANCE_INFO
555 
556     /* Define the number of times this thread is resumed.  */
557     ULONG               tx_thread_performance_resume_count;
558 
559     /* Define the number of times this thread suspends.  */
560     ULONG               tx_thread_performance_suspend_count;
561 
562     /* Define the number of times this thread is preempted by calling
563        a ThreadX API service.  */
564     ULONG               tx_thread_performance_solicited_preemption_count;
565 
566     /* Define the number of times this thread is preempted by an
567        ISR calling a ThreadX API service.  */
568     ULONG               tx_thread_performance_interrupt_preemption_count;
569 
570     /* Define the number of priority inversions for this thread.  */
571     ULONG               tx_thread_performance_priority_inversion_count;
572 
573     /* Define the last thread pointer to preempt this thread.  */
574     struct TX_THREAD_STRUCT
575                         *tx_thread_performance_last_preempting_thread;
576 
577     /* Define the total number of times this thread was time-sliced.  */
578     ULONG               tx_thread_performance_time_slice_count;
579 
580     /* Define the total number of times this thread relinquishes.  */
581     ULONG               tx_thread_performance_relinquish_count;
582 
583     /* Define the total number of times this thread had a timeout.  */
584     ULONG               tx_thread_performance_timeout_count;
585 
586     /* Define the total number of times this thread had suspension lifted
587        because of the tx_thread_wait_abort service.  */
588     ULONG               tx_thread_performance_wait_abort_count;
589 #endif
590 
591     /* Define the highest stack pointer variable.  */
592     VOID                *tx_thread_stack_highest_ptr;   /* Stack highest usage pointer  */
593 
594 
595 #ifndef TX_DISABLE_NOTIFY_CALLBACKS
596 
597     /* Define the application callback routine used to notify the application when
598        the thread is entered or exits.  */
599     VOID                (*tx_thread_entry_exit_notify)(struct TX_THREAD_STRUCT *thread_ptr, UINT type);
600 #endif
601 
602     /* Define the fourth port extension in the thread control block. This
603        is typically defined to whitespace in tx_port.h.  */
604     TX_THREAD_EXTENSION_3
605 
606 
607     /* Define variables for supporting execution profile. */
608     /* Note that in ThreadX 5.x, user would define TX_ENABLE_EXECUTION_CHANGE_NOTIFY and use TX_THREAD_EXTENSION_3
609        to define the following two variables.
610        For Azure RTOS 6, user shall use TX_EXECUTION_PROFILE_ENABLE instead of TX_ENABLE_EXECUTION_CHANGE_NOTIFY,
611        and SHALL NOT add variables to TX_THREAD_EXTENSION_3. */
612 #if (defined(TX_EXECUTION_PROFILE_ENABLE) && !defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY))
613     EXECUTION_TIME              tx_thread_execution_time_total;
614     EXECUTION_TIME_SOURCE_TYPE  tx_thread_execution_time_last_start;
615 #endif
616 
617     /* Define suspension sequence number.  This is used to ensure suspension is still valid when
618        cleanup routine executes.  */
619     ULONG               tx_thread_suspension_sequence;
620 
621     /* Define the user extension field.  This typically is defined
622        to white space, but some ports of ThreadX may need to have
623        additional fields in the thread control block.  This is
624        defined in the file tx_port.h.  */
625     TX_THREAD_USER_EXTENSION
626 
627 } TX_THREAD;
628 
629 
630 /* Define the block memory pool structure utilized by the application.  */
631 
632 typedef struct TX_BLOCK_POOL_STRUCT
633 {
634 
635     /* Define the block pool ID used for error checking.  */
636     ULONG               tx_block_pool_id;
637 
638     /* Define the block pool's name.  */
639     CHAR                *tx_block_pool_name;
640 
641     /* Define the number of available memory blocks in the pool.  */
642     UINT                tx_block_pool_available;
643 
644     /* Save the initial number of blocks.  */
645     UINT                tx_block_pool_total;
646 
647     /* Define the head pointer of the available block pool.  */
648     UCHAR               *tx_block_pool_available_list;
649 
650     /* Save the start address of the block pool's memory area.  */
651     UCHAR               *tx_block_pool_start;
652 
653     /* Save the block pool's size in bytes.  */
654     ULONG               tx_block_pool_size;
655 
656     /* Save the individual memory block size - rounded for alignment.  */
657     UINT                tx_block_pool_block_size;
658 
659     /* Define the block pool suspension list head along with a count of
660        how many threads are suspended.  */
661     struct TX_THREAD_STRUCT
662                         *tx_block_pool_suspension_list;
663     UINT                tx_block_pool_suspended_count;
664 
665     /* Define the created list next and previous pointers.  */
666     struct TX_BLOCK_POOL_STRUCT
667                         *tx_block_pool_created_next,
668                         *tx_block_pool_created_previous;
669 
670 #ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
671 
672     /* Define the number of block allocates.  */
673     ULONG               tx_block_pool_performance_allocate_count;
674 
675     /* Define the number of block releases.  */
676     ULONG               tx_block_pool_performance_release_count;
677 
678     /* Define the number of block pool suspensions.  */
679     ULONG               tx_block_pool_performance_suspension_count;
680 
681     /* Define the number of block pool timeouts.  */
682     ULONG               tx_block_pool_performance_timeout_count;
683 #endif
684 
685     /* Define the port extension in the block pool control block. This
686        is typically defined to whitespace in tx_port.h.  */
687     TX_BLOCK_POOL_EXTENSION
688 
689 } TX_BLOCK_POOL;
690 
691 
692 /* Determine if the byte allocate extension is defined. If not, define the
693    extension to whitespace.  */
694 
695 #ifndef TX_BYTE_ALLOCATE_EXTENSION
696 #define TX_BYTE_ALLOCATE_EXTENSION
697 #endif
698 
699 
700 /* Determine if the byte release extension is defined. If not, define the
701    extension to whitespace.  */
702 
703 #ifndef TX_BYTE_RELEASE_EXTENSION
704 #define TX_BYTE_RELEASE_EXTENSION
705 #endif
706 
707 
708 /* Define the byte memory pool structure utilized by the application.  */
709 
710 typedef struct TX_BYTE_POOL_STRUCT
711 {
712 
713     /* Define the byte pool ID used for error checking.  */
714     ULONG               tx_byte_pool_id;
715 
716     /* Define the byte pool's name.  */
717     CHAR                *tx_byte_pool_name;
718 
719     /* Define the number of available bytes in the pool.  */
720     ULONG               tx_byte_pool_available;
721 
722     /* Define the number of fragments in the pool.  */
723     UINT                tx_byte_pool_fragments;
724 
725     /* Define the head pointer of byte pool.  */
726     UCHAR               *tx_byte_pool_list;
727 
728     /* Define the search pointer used for initial searching for memory
729        in a byte pool.  */
730     UCHAR               *tx_byte_pool_search;
731 
732     /* Save the start address of the byte pool's memory area.  */
733     UCHAR               *tx_byte_pool_start;
734 
735     /* Save the byte pool's size in bytes.  */
736     ULONG               tx_byte_pool_size;
737 
738     /* This is used to mark the owner of the byte memory pool during
739        a search.  If this value changes during the search, the local search
740        pointer must be reset.  */
741     struct TX_THREAD_STRUCT
742                         *tx_byte_pool_owner;
743 
744     /* Define the byte pool suspension list head along with a count of
745        how many threads are suspended.  */
746     struct TX_THREAD_STRUCT
747                         *tx_byte_pool_suspension_list;
748     UINT                tx_byte_pool_suspended_count;
749 
750     /* Define the created list next and previous pointers.  */
751     struct TX_BYTE_POOL_STRUCT
752                         *tx_byte_pool_created_next,
753                         *tx_byte_pool_created_previous;
754 
755 #ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
756 
757     /* Define the number of allocates.  */
758     ULONG               tx_byte_pool_performance_allocate_count;
759 
760     /* Define the number of releases.  */
761     ULONG               tx_byte_pool_performance_release_count;
762 
763     /* Define the number of adjacent memory fragment merges.  */
764     ULONG               tx_byte_pool_performance_merge_count;
765 
766     /* Define the number of memory fragment splits.  */
767     ULONG               tx_byte_pool_performance_split_count;
768 
769     /* Define the number of memory fragments searched that either were not free or could not satisfy the
770        request.  */
771     ULONG               tx_byte_pool_performance_search_count;
772 
773     /* Define the number of byte pool suspensions.  */
774     ULONG               tx_byte_pool_performance_suspension_count;
775 
776     /* Define the number of byte pool timeouts.  */
777     ULONG               tx_byte_pool_performance_timeout_count;
778 #endif
779 
780     /* Define the port extension in the byte pool control block. This
781        is typically defined to whitespace in tx_port.h.  */
782     TX_BYTE_POOL_EXTENSION
783 
784 } TX_BYTE_POOL;
785 
786 
787 /* Define the event flags group structure utilized by the application.  */
788 
789 typedef struct TX_EVENT_FLAGS_GROUP_STRUCT
790 {
791 
792     /* Define the event flags group ID used for error checking.  */
793     ULONG               tx_event_flags_group_id;
794 
795     /* Define the event flags group's name.  */
796     CHAR                *tx_event_flags_group_name;
797 
798     /* Define the actual current event flags in this group. A zero in a
799        particular bit indicates the event flag is not set.  */
800     ULONG               tx_event_flags_group_current;
801 
802     /* Define the reset search flag that is set when an ISR sets flags during
803        the search of the suspended threads list.  */
804     UINT                tx_event_flags_group_reset_search;
805 
806     /* Define the event flags group suspension list head along with a count of
807        how many threads are suspended.  */
808     struct TX_THREAD_STRUCT
809                         *tx_event_flags_group_suspension_list;
810     UINT                tx_event_flags_group_suspended_count;
811 
812     /* Define the created list next and previous pointers.  */
813     struct TX_EVENT_FLAGS_GROUP_STRUCT
814                         *tx_event_flags_group_created_next,
815                         *tx_event_flags_group_created_previous;
816 
817     /* Define the delayed clearing event flags.  */
818     ULONG               tx_event_flags_group_delayed_clear;
819 
820 #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
821 
822     /* Define the number of event flag sets.  */
823     ULONG               tx_event_flags_group_performance_set_count;
824 
825     /* Define the number of event flag gets.  */
826     ULONG               tx_event_flags_group__performance_get_count;
827 
828     /* Define the number of event flag suspensions.  */
829     ULONG               tx_event_flags_group___performance_suspension_count;
830 
831     /* Define the number of event flag timeouts.  */
832     ULONG               tx_event_flags_group____performance_timeout_count;
833 #endif
834 
835 #ifndef TX_DISABLE_NOTIFY_CALLBACKS
836 
837     /* Define the application callback routine used to notify the application when
838        an event flag is set.  */
839     VOID                (*tx_event_flags_group_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *group_ptr);
840 #endif
841 
842     /* Define the port extension in the event flags group control block. This
843        is typically defined to whitespace in tx_port.h.  */
844     TX_EVENT_FLAGS_GROUP_EXTENSION
845 
846 } TX_EVENT_FLAGS_GROUP;
847 
848 
849 /* Determine if the mutex put extension 1 is defined. If not, define the
850    extension to whitespace.  */
851 
852 #ifndef TX_MUTEX_PUT_EXTENSION_1
853 #define TX_MUTEX_PUT_EXTENSION_1
854 #endif
855 
856 
857 /* Determine if the mutex put extension 2 is defined. If not, define the
858    extension to whitespace.  */
859 
860 #ifndef TX_MUTEX_PUT_EXTENSION_2
861 #define TX_MUTEX_PUT_EXTENSION_2
862 #endif
863 
864 
865 /* Determine if the mutex priority change extension is defined. If not, define the
866    extension to whitespace.  */
867 
868 #ifndef TX_MUTEX_PRIORITY_CHANGE_EXTENSION
869 #define TX_MUTEX_PRIORITY_CHANGE_EXTENSION
870 #endif
871 
872 
873 /* Define the mutex structure utilized by the application.  */
874 
875 typedef struct TX_MUTEX_STRUCT
876 {
877 
878     /* Define the mutex ID used for error checking.  */
879     ULONG               tx_mutex_id;
880 
881     /* Define the mutex's name.  */
882     CHAR                *tx_mutex_name;
883 
884     /* Define the mutex ownership count.  */
885     UINT                tx_mutex_ownership_count;
886 
887     /* Define the mutex ownership pointer.  This pointer points to the
888        the thread that owns the mutex.  */
889     TX_THREAD           *tx_mutex_owner;
890 
891     /* Define the priority inheritance flag.  If this flag is set, priority
892        inheritance will be in effect.  */
893     UINT                tx_mutex_inherit;
894 
895     /* Define the save area for the owning thread's original priority.  */
896     UINT                tx_mutex_original_priority;
897 
898     /* Define the mutex suspension list head along with a count of
899        how many threads are suspended.  */
900     struct TX_THREAD_STRUCT
901                         *tx_mutex_suspension_list;
902     UINT                tx_mutex_suspended_count;
903 
904     /* Define the created list next and previous pointers.  */
905     struct TX_MUTEX_STRUCT
906                         *tx_mutex_created_next,
907                         *tx_mutex_created_previous;
908 
909     /* Define the priority of the highest priority thread waiting for
910        this mutex.  */
911     UINT                tx_mutex_highest_priority_waiting;
912 
913     /* Define the owned list next and previous pointers.  */
914     struct TX_MUTEX_STRUCT
915                         *tx_mutex_owned_next,
916                         *tx_mutex_owned_previous;
917 
918 #ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO
919 
920     /* Define the number of mutex puts.  */
921     ULONG               tx_mutex_performance_put_count;
922 
923     /* Define the total number of mutex gets.  */
924     ULONG               tx_mutex_performance_get_count;
925 
926     /* Define the total number of mutex suspensions.  */
927     ULONG               tx_mutex_performance_suspension_count;
928 
929     /* Define the total number of mutex timeouts.  */
930     ULONG               tx_mutex_performance_timeout_count;
931 
932     /* Define the total number of priority inversions.  */
933     ULONG               tx_mutex_performance_priority_inversion_count;
934 
935     /* Define the total number of priority inheritance conditions.  */
936     ULONG               tx_mutex_performance__priority_inheritance_count;
937 #endif
938 
939     /* Define the port extension in the mutex control block. This
940        is typically defined to whitespace in tx_port.h.  */
941     TX_MUTEX_EXTENSION
942 
943 } TX_MUTEX;
944 
945 
946 /* Define the queue structure utilized by the application.  */
947 
948 typedef struct TX_QUEUE_STRUCT
949 {
950 
951     /* Define the queue ID used for error checking.  */
952     ULONG               tx_queue_id;
953 
954     /* Define the queue's name.  */
955     CHAR                *tx_queue_name;
956 
957     /* Define the message size that was specified in queue creation.  */
958     UINT                tx_queue_message_size;
959 
960     /* Define the total number of messages in the queue.  */
961     UINT                tx_queue_capacity;
962 
963     /* Define the current number of messages enqueued and the available
964        queue storage space.  */
965     UINT                tx_queue_enqueued;
966     UINT                tx_queue_available_storage;
967 
968     /* Define pointers that represent the start and end for the queue's
969        message area.  */
970     ULONG               *tx_queue_start;
971     ULONG               *tx_queue_end;
972 
973     /* Define the queue read and write pointers.  Send requests use the write
974        pointer while receive requests use the read pointer.  */
975     ULONG               *tx_queue_read;
976     ULONG               *tx_queue_write;
977 
978     /* Define the queue suspension list head along with a count of
979        how many threads are suspended.  */
980     struct TX_THREAD_STRUCT
981                         *tx_queue_suspension_list;
982     UINT                tx_queue_suspended_count;
983 
984     /* Define the created list next and previous pointers.  */
985     struct TX_QUEUE_STRUCT
986                         *tx_queue_created_next,
987                         *tx_queue_created_previous;
988 
989 #ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
990 
991     /* Define the number of messages sent to this queue.  */
992     ULONG               tx_queue_performance_messages_sent_count;
993 
994     /* Define the number of messages received from this queue.  */
995     ULONG               tx_queue_performance_messages_received_count;
996 
997     /* Define the number of empty suspensions on this queue.  */
998     ULONG               tx_queue_performance_empty_suspension_count;
999 
1000     /* Define the number of full suspensions on this queue.  */
1001     ULONG               tx_queue_performance_full_suspension_count;
1002 
1003     /* Define the number of full non-suspensions on this queue. These
1004        messages are rejected with an appropriate error code.  */
1005     ULONG               tx_queue_performance_full_error_count;
1006 
1007     /* Define the number of queue timeouts.  */
1008     ULONG               tx_queue_performance_timeout_count;
1009 #endif
1010 
1011 #ifndef TX_DISABLE_NOTIFY_CALLBACKS
1012 
1013     /* Define the application callback routine used to notify the application when
1014        the a message is sent to the queue.  */
1015     VOID                (*tx_queue_send_notify)(struct TX_QUEUE_STRUCT *queue_ptr);
1016 #endif
1017 
1018     /* Define the port extension in the queue control block. This
1019        is typically defined to whitespace in tx_port.h.  */
1020     TX_QUEUE_EXTENSION
1021 
1022 } TX_QUEUE;
1023 
1024 
1025 /* Define the semaphore structure utilized by the application.  */
1026 
1027 typedef struct TX_SEMAPHORE_STRUCT
1028 {
1029 
1030     /* Define the semaphore ID used for error checking.  */
1031     ULONG               tx_semaphore_id;
1032 
1033     /* Define the semaphore's name.  */
1034     CHAR                *tx_semaphore_name;
1035 
1036     /* Define the actual semaphore count.  A zero means that no semaphore
1037        instance is available.  */
1038     ULONG               tx_semaphore_count;
1039 
1040     /* Define the semaphore suspension list head along with a count of
1041        how many threads are suspended.  */
1042     struct TX_THREAD_STRUCT
1043                         *tx_semaphore_suspension_list;
1044     UINT                tx_semaphore_suspended_count;
1045 
1046     /* Define the created list next and previous pointers.  */
1047     struct TX_SEMAPHORE_STRUCT
1048                         *tx_semaphore_created_next,
1049                         *tx_semaphore_created_previous;
1050 
1051 #ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
1052 
1053     /* Define the number of semaphore puts.  */
1054     ULONG               tx_semaphore_performance_put_count;
1055 
1056     /* Define the number of semaphore gets.  */
1057     ULONG               tx_semaphore_performance_get_count;
1058 
1059     /* Define the number of semaphore suspensions.  */
1060     ULONG               tx_semaphore_performance_suspension_count;
1061 
1062     /* Define the number of semaphore timeouts.  */
1063     ULONG               tx_semaphore_performance_timeout_count;
1064 #endif
1065 
1066 #ifndef TX_DISABLE_NOTIFY_CALLBACKS
1067 
1068     /* Define the application callback routine used to notify the application when
1069        the a semaphore is put.  */
1070     VOID                (*tx_semaphore_put_notify)(struct TX_SEMAPHORE_STRUCT *semaphore_ptr);
1071 #endif
1072 
1073     /* Define the port extension in the semaphore control block. This
1074        is typically defined to whitespace in tx_port.h.  */
1075     TX_SEMAPHORE_EXTENSION
1076 
1077 } TX_SEMAPHORE;
1078 
1079 
1080 /* Define the system API mappings based on the error checking
1081    selected by the user.  Note: this section is only applicable to
1082    application source code, hence the conditional that turns off this
1083    stuff when the include file is processed by the ThreadX source. */
1084 
1085 #ifndef TX_SOURCE_CODE
1086 
1087 
1088 /* Determine if error checking is desired.  If so, map API functions
1089    to the appropriate error checking front-ends.  Otherwise, map API
1090    functions to the core functions that actually perform the work.
1091    Note: error checking is enabled by default.  */
1092 
1093 #ifdef TX_DISABLE_ERROR_CHECKING
1094 
1095 
1096 /* Services without error checking.  */
1097 
1098 #define tx_kernel_enter                             _tx_initialize_kernel_enter
1099 
1100 #define tx_block_allocate                           _tx_block_allocate
1101 #define tx_block_pool_create                        _tx_block_pool_create
1102 #define tx_block_pool_delete                        _tx_block_pool_delete
1103 #define tx_block_pool_info_get                      _tx_block_pool_info_get
1104 #define tx_block_pool_performance_info_get          _tx_block_pool_performance_info_get
1105 #define tx_block_pool_performance_system_info_get   _tx_block_pool_performance_system_info_get
1106 #define tx_block_pool_prioritize                    _tx_block_pool_prioritize
1107 #define tx_block_release                            _tx_block_release
1108 
1109 #define tx_byte_allocate                            _tx_byte_allocate
1110 #define tx_byte_pool_create                         _tx_byte_pool_create
1111 #define tx_byte_pool_delete                         _tx_byte_pool_delete
1112 #define tx_byte_pool_info_get                       _tx_byte_pool_info_get
1113 #define tx_byte_pool_performance_info_get           _tx_byte_pool_performance_info_get
1114 #define tx_byte_pool_performance_system_info_get    _tx_byte_pool_performance_system_info_get
1115 #define tx_byte_pool_prioritize                     _tx_byte_pool_prioritize
1116 #define tx_byte_release                             _tx_byte_release
1117 
1118 #define tx_event_flags_create                       _tx_event_flags_create
1119 #define tx_event_flags_delete                       _tx_event_flags_delete
1120 #define tx_event_flags_get                          _tx_event_flags_get
1121 #define tx_event_flags_info_get                     _tx_event_flags_info_get
1122 #define tx_event_flags_performance_info_get         _tx_event_flags_performance_info_get
1123 #define tx_event_flags_performance_system_info_get  _tx_event_flags_performance_system_info_get
1124 #define tx_event_flags_set                          _tx_event_flags_set
1125 #define tx_event_flags_set_notify                   _tx_event_flags_set_notify
1126 
1127 #ifdef TX_ENABLE_EVENT_LOGGING
1128 UINT    _tx_el_interrupt_control(UINT new_posture);
1129 #define tx_interrupt_control                        _tx_el_interrupt_control
1130 #else
1131 #ifdef TX_ENABLE_EVENT_TRACE
1132 UINT    _tx_trace_interrupt_control(UINT new_posture);
1133 #define tx_interrupt_control                        _tx_trace_interrupt_control
1134 #else
1135 #define tx_interrupt_control                        _tx_thread_interrupt_control
1136 #endif
1137 #endif
1138 
1139 #define tx_mutex_create                             _tx_mutex_create
1140 #define tx_mutex_delete                             _tx_mutex_delete
1141 #define tx_mutex_get                                _tx_mutex_get
1142 #define tx_mutex_info_get                           _tx_mutex_info_get
1143 #define tx_mutex_performance_info_get               _tx_mutex_performance_info_get
1144 #define tx_mutex_performance_system_info_get        _tx_mutex_performance_system_info_get
1145 #define tx_mutex_prioritize                         _tx_mutex_prioritize
1146 #define tx_mutex_put                                _tx_mutex_put
1147 
1148 #define tx_queue_create                             _tx_queue_create
1149 #define tx_queue_delete                             _tx_queue_delete
1150 #define tx_queue_flush                              _tx_queue_flush
1151 #define tx_queue_info_get                           _tx_queue_info_get
1152 #define tx_queue_performance_info_get               _tx_queue_performance_info_get
1153 #define tx_queue_performance_system_info_get        _tx_queue_performance_system_info_get
1154 #define tx_queue_receive                            _tx_queue_receive
1155 #define tx_queue_send                               _tx_queue_send
1156 #define tx_queue_send_notify                        _tx_queue_send_notify
1157 #define tx_queue_front_send                         _tx_queue_front_send
1158 #define tx_queue_prioritize                         _tx_queue_prioritize
1159 
1160 #define tx_semaphore_ceiling_put                    _tx_semaphore_ceiling_put
1161 #define tx_semaphore_create                         _tx_semaphore_create
1162 #define tx_semaphore_delete                         _tx_semaphore_delete
1163 #define tx_semaphore_get                            _tx_semaphore_get
1164 #define tx_semaphore_info_get                       _tx_semaphore_info_get
1165 #define tx_semaphore_performance_info_get           _tx_semaphore_performance_info_get
1166 #define tx_semaphore_performance_system_info_get    _tx_semaphore_performance_system_info_get
1167 #define tx_semaphore_prioritize                     _tx_semaphore_prioritize
1168 #define tx_semaphore_put                            _tx_semaphore_put
1169 #define tx_semaphore_put_notify                     _tx_semaphore_put_notify
1170 
1171 #define tx_thread_create                            _tx_thread_create
1172 #define tx_thread_delete                            _tx_thread_delete
1173 #define tx_thread_entry_exit_notify                 _tx_thread_entry_exit_notify
1174 #define tx_thread_identify                          _tx_thread_identify
1175 #define tx_thread_info_get                          _tx_thread_info_get
1176 #define tx_thread_performance_info_get              _tx_thread_performance_info_get
1177 #define tx_thread_performance_system_info_get       _tx_thread_performance_system_info_get
1178 #define tx_thread_preemption_change                 _tx_thread_preemption_change
1179 #define tx_thread_priority_change                   _tx_thread_priority_change
1180 #define tx_thread_relinquish                        _tx_thread_relinquish
1181 #define tx_thread_reset                             _tx_thread_reset
1182 #define tx_thread_resume                            _tx_thread_resume
1183 #define tx_thread_sleep                             _tx_thread_sleep
1184 #define tx_thread_stack_error_notify                _tx_thread_stack_error_notify
1185 #define tx_thread_suspend                           _tx_thread_suspend
1186 #define tx_thread_terminate                         _tx_thread_terminate
1187 #define tx_thread_time_slice_change                 _tx_thread_time_slice_change
1188 #define tx_thread_wait_abort                        _tx_thread_wait_abort
1189 
1190 #define tx_time_get                                 _tx_time_get
1191 #define tx_time_set                                 _tx_time_set
1192 #define tx_timer_activate                           _tx_timer_activate
1193 #define tx_timer_change                             _tx_timer_change
1194 #define tx_timer_create                             _tx_timer_create
1195 #define tx_timer_deactivate                         _tx_timer_deactivate
1196 #define tx_timer_delete                             _tx_timer_delete
1197 #define tx_timer_info_get                           _tx_timer_info_get
1198 #define tx_timer_performance_info_get               _tx_timer_performance_info_get
1199 #define tx_timer_performance_system_info_get        _tx_timer_performance_system_info_get
1200 
1201 #define tx_trace_enable                             _tx_trace_enable
1202 #define tx_trace_event_filter                       _tx_trace_event_filter
1203 #define tx_trace_event_unfilter                     _tx_trace_event_unfilter
1204 #define tx_trace_disable                            _tx_trace_disable
1205 #define tx_trace_isr_enter_insert                   _tx_trace_isr_enter_insert
1206 #define tx_trace_isr_exit_insert                    _tx_trace_isr_exit_insert
1207 #define tx_trace_buffer_full_notify                 _tx_trace_buffer_full_notify
1208 #define tx_trace_user_event_insert                  _tx_trace_user_event_insert
1209 
1210 #else
1211 
1212 /* Services with error checking.  */
1213 
1214 #define tx_kernel_enter                             _tx_initialize_kernel_enter
1215 
1216 /* Define the system API mappings depending on the runtime error
1217    checking behavior selected by the user.  */
1218 
1219 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
1220 
1221 /* Services with MULTI runtime error checking ThreadX.  */
1222 
1223 #define tx_block_allocate                           _txr_block_allocate
1224 #define tx_block_pool_create(p,n,b,s,l)             _txr_block_pool_create((p),(n),(b),(s),(l),(sizeof(TX_BLOCK_POOL)))
1225 #define tx_block_pool_delete                        _txr_block_pool_delete
1226 #define tx_block_pool_info_get                      _txr_block_pool_info_get
1227 #define tx_block_pool_performance_info_get          _tx_block_pool_performance_info_get
1228 #define tx_block_pool_performance_system_info_get   _tx_block_pool_performance_system_info_get
1229 #define tx_block_pool_prioritize                    _txr_block_pool_prioritize
1230 #define tx_block_release                            _txr_block_release
1231 
1232 #define tx_byte_allocate                            _txr_byte_allocate
1233 #define tx_byte_pool_create(p,n,s,l)                _txr_byte_pool_create((p),(n),(s),(l),(sizeof(TX_BYTE_POOL)))
1234 #define tx_byte_pool_delete                         _txr_byte_pool_delete
1235 #define tx_byte_pool_info_get                       _txr_byte_pool_info_get
1236 #define tx_byte_pool_performance_info_get           _tx_byte_pool_performance_info_get
1237 #define tx_byte_pool_performance_system_info_get    _tx_byte_pool_performance_system_info_get
1238 #define tx_byte_pool_prioritize                     _txr_byte_pool_prioritize
1239 #define tx_byte_release                             _txr_byte_release
1240 
1241 #define tx_event_flags_create(g,n)                  _txr_event_flags_create((g),(n),(sizeof(TX_EVENT_FLAGS_GROUP)))
1242 #define tx_event_flags_delete                       _txr_event_flags_delete
1243 #define tx_event_flags_get                          _txr_event_flags_get
1244 #define tx_event_flags_info_get                     _txr_event_flags_info_get
1245 #define tx_event_flags_performance_info_get         _tx_event_flags_performance_info_get
1246 #define tx_event_flags_performance_system_info_get  _tx_event_flags_performance_system_info_get
1247 #define tx_event_flags_set                          _txr_event_flags_set
1248 #define tx_event_flags_set_notify                   _txr_event_flags_set_notify
1249 
1250 #ifdef TX_ENABLE_EVENT_LOGGING
1251 UINT    _tx_el_interrupt_control(UINT new_posture);
1252 #define tx_interrupt_control                        _tx_el_interrupt_control
1253 #else
1254 #ifdef TX_ENABLE_EVENT_TRACE
1255 UINT    _tx_trace_interrupt_control(UINT new_posture);
1256 #define tx_interrupt_control                        _tx_trace_interrupt_control
1257 #else
1258 #define tx_interrupt_control                        _tx_thread_interrupt_control
1259 #endif
1260 #endif
1261 
1262 #define tx_mutex_create(m,n,i)                      _txr_mutex_create((m),(n),(i),(sizeof(TX_MUTEX)))
1263 #define tx_mutex_delete                             _txr_mutex_delete
1264 #define tx_mutex_get                                _txr_mutex_get
1265 #define tx_mutex_info_get                           _txr_mutex_info_get
1266 #define tx_mutex_performance_info_get               _tx_mutex_performance_info_get
1267 #define tx_mutex_performance_system_info_get        _tx_mutex_performance_system_info_get
1268 #define tx_mutex_prioritize                         _txr_mutex_prioritize
1269 #define tx_mutex_put                                _txr_mutex_put
1270 
1271 #define tx_queue_create(q,n,m,s,l)                  _txr_queue_create((q),(n),(m),(s),(l),(sizeof(TX_QUEUE)))
1272 #define tx_queue_delete                             _txr_queue_delete
1273 #define tx_queue_flush                              _txr_queue_flush
1274 #define tx_queue_info_get                           _txr_queue_info_get
1275 #define tx_queue_performance_info_get               _tx_queue_performance_info_get
1276 #define tx_queue_performance_system_info_get        _tx_queue_performance_system_info_get
1277 #define tx_queue_receive                            _txr_queue_receive
1278 #define tx_queue_send                               _txr_queue_send
1279 #define tx_queue_send_notify                        _txr_queue_send_notify
1280 #define tx_queue_front_send                         _txr_queue_front_send
1281 #define tx_queue_prioritize                         _txr_queue_prioritize
1282 
1283 #define tx_semaphore_ceiling_put                    _txr_semaphore_ceiling_put
1284 #define tx_semaphore_create(s,n,i)                  _txr_semaphore_create((s),(n),(i),(sizeof(TX_SEMAPHORE)))
1285 #define tx_semaphore_delete                         _txr_semaphore_delete
1286 #define tx_semaphore_get                            _txr_semaphore_get
1287 #define tx_semaphore_info_get                       _txr_semaphore_info_get
1288 #define tx_semaphore_performance_info_get           _tx_semaphore_performance_info_get
1289 #define tx_semaphore_performance_system_info_get    _tx_semaphore_performance_system_info_get
1290 #define tx_semaphore_prioritize                     _txr_semaphore_prioritize
1291 #define tx_semaphore_put                            _txr_semaphore_put
1292 #define tx_semaphore_put_notify                     _txr_semaphore_put_notify
1293 
1294 #define tx_thread_create(t,n,e,i,s,l,p,r,c,a)       _txr_thread_create((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD)))
1295 #define tx_thread_delete                            _txr_thread_delete
1296 #define tx_thread_entry_exit_notify                 _txr_thread_entry_exit_notify
1297 #define tx_thread_identify                          _tx_thread_identify
1298 #define tx_thread_info_get                          _txr_thread_info_get
1299 #define tx_thread_performance_info_get              _tx_thread_performance_info_get
1300 #define tx_thread_performance_system_info_get       _tx_thread_performance_system_info_get
1301 #define tx_thread_preemption_change                 _txr_thread_preemption_change
1302 #define tx_thread_priority_change                   _txr_thread_priority_change
1303 #define tx_thread_relinquish                        _txe_thread_relinquish
1304 #define tx_thread_reset                             _txr_thread_reset
1305 #define tx_thread_resume                            _txr_thread_resume
1306 #define tx_thread_sleep                             _tx_thread_sleep
1307 #define tx_thread_stack_error_notify                _tx_thread_stack_error_notify
1308 #define tx_thread_suspend                           _txr_thread_suspend
1309 #define tx_thread_terminate                         _txr_thread_terminate
1310 #define tx_thread_time_slice_change                 _txr_thread_time_slice_change
1311 #define tx_thread_wait_abort                        _txr_thread_wait_abort
1312 
1313 #define tx_time_get                                 _tx_time_get
1314 #define tx_time_set                                 _tx_time_set
1315 #define tx_timer_activate                           _txr_timer_activate
1316 #define tx_timer_change                             _txr_timer_change
1317 #define tx_timer_create(t,n,e,i,c,r,a)              _txr_timer_create((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER)))
1318 #define tx_timer_deactivate                         _txr_timer_deactivate
1319 #define tx_timer_delete                             _txr_timer_delete
1320 #define tx_timer_info_get                           _txr_timer_info_get
1321 #define tx_timer_performance_info_get               _tx_timer_performance_info_get
1322 #define tx_timer_performance_system_info_get        _tx_timer_performance_system_info_get
1323 
1324 #define tx_trace_enable                             _tx_trace_enable
1325 #define tx_trace_event_filter                       _tx_trace_event_filter
1326 #define tx_trace_event_unfilter                     _tx_trace_event_unfilter
1327 #define tx_trace_disable                            _tx_trace_disable
1328 #define tx_trace_isr_enter_insert                   _tx_trace_isr_enter_insert
1329 #define tx_trace_isr_exit_insert                    _tx_trace_isr_exit_insert
1330 #define tx_trace_buffer_full_notify                 _tx_trace_buffer_full_notify
1331 #define tx_trace_user_event_insert                  _tx_trace_user_event_insert
1332 
1333 #else
1334 
1335 #define tx_block_allocate                           _txe_block_allocate
1336 #define tx_block_pool_create(p,n,b,s,l)             _txe_block_pool_create((p),(n),(b),(s),(l),(sizeof(TX_BLOCK_POOL)))
1337 #define tx_block_pool_delete                        _txe_block_pool_delete
1338 #define tx_block_pool_info_get                      _txe_block_pool_info_get
1339 #define tx_block_pool_performance_info_get          _tx_block_pool_performance_info_get
1340 #define tx_block_pool_performance_system_info_get   _tx_block_pool_performance_system_info_get
1341 #define tx_block_pool_prioritize                    _txe_block_pool_prioritize
1342 #define tx_block_release                            _txe_block_release
1343 
1344 #define tx_byte_allocate                            _txe_byte_allocate
1345 #define tx_byte_pool_create(p,n,s,l)                _txe_byte_pool_create((p),(n),(s),(l),(sizeof(TX_BYTE_POOL)))
1346 #define tx_byte_pool_delete                         _txe_byte_pool_delete
1347 #define tx_byte_pool_info_get                       _txe_byte_pool_info_get
1348 #define tx_byte_pool_performance_info_get           _tx_byte_pool_performance_info_get
1349 #define tx_byte_pool_performance_system_info_get    _tx_byte_pool_performance_system_info_get
1350 #define tx_byte_pool_prioritize                     _txe_byte_pool_prioritize
1351 #define tx_byte_release                             _txe_byte_release
1352 
1353 #define tx_event_flags_create(g,n)                  _txe_event_flags_create((g),(n),(sizeof(TX_EVENT_FLAGS_GROUP)))
1354 #define tx_event_flags_delete                       _txe_event_flags_delete
1355 #define tx_event_flags_get                          _txe_event_flags_get
1356 #define tx_event_flags_info_get                     _txe_event_flags_info_get
1357 #define tx_event_flags_performance_info_get         _tx_event_flags_performance_info_get
1358 #define tx_event_flags_performance_system_info_get  _tx_event_flags_performance_system_info_get
1359 #define tx_event_flags_set                          _txe_event_flags_set
1360 #define tx_event_flags_set_notify                   _txe_event_flags_set_notify
1361 
1362 #ifdef TX_ENABLE_EVENT_LOGGING
1363 UINT    _tx_el_interrupt_control(UINT new_posture);
1364 #define tx_interrupt_control                        _tx_el_interrupt_control
1365 #else
1366 #ifdef TX_ENABLE_EVENT_TRACE
1367 #define tx_interrupt_control                        _tx_trace_interrupt_control
1368 #else
1369 #define tx_interrupt_control                        _tx_thread_interrupt_control
1370 #endif
1371 #endif
1372 
1373 #define tx_mutex_create(m,n,i)                      _txe_mutex_create((m),(n),(i),(sizeof(TX_MUTEX)))
1374 #define tx_mutex_delete                             _txe_mutex_delete
1375 #define tx_mutex_get                                _txe_mutex_get
1376 #define tx_mutex_info_get                           _txe_mutex_info_get
1377 #define tx_mutex_performance_info_get               _tx_mutex_performance_info_get
1378 #define tx_mutex_performance_system_info_get        _tx_mutex_performance_system_info_get
1379 #define tx_mutex_prioritize                         _txe_mutex_prioritize
1380 #define tx_mutex_put                                _txe_mutex_put
1381 
1382 #define tx_queue_create(q,n,m,s,l)                  _txe_queue_create((q),(n),(m),(s),(l),(sizeof(TX_QUEUE)))
1383 #define tx_queue_delete                             _txe_queue_delete
1384 #define tx_queue_flush                              _txe_queue_flush
1385 #define tx_queue_info_get                           _txe_queue_info_get
1386 #define tx_queue_performance_info_get               _tx_queue_performance_info_get
1387 #define tx_queue_performance_system_info_get        _tx_queue_performance_system_info_get
1388 #define tx_queue_receive                            _txe_queue_receive
1389 #define tx_queue_send                               _txe_queue_send
1390 #define tx_queue_send_notify                        _txe_queue_send_notify
1391 #define tx_queue_front_send                         _txe_queue_front_send
1392 #define tx_queue_prioritize                         _txe_queue_prioritize
1393 
1394 #define tx_semaphore_ceiling_put                    _txe_semaphore_ceiling_put
1395 #define tx_semaphore_create(s,n,i)                  _txe_semaphore_create((s),(n),(i),(sizeof(TX_SEMAPHORE)))
1396 #define tx_semaphore_delete                         _txe_semaphore_delete
1397 #define tx_semaphore_get                            _txe_semaphore_get
1398 #define tx_semaphore_info_get                       _txe_semaphore_info_get
1399 #define tx_semaphore_performance_info_get           _tx_semaphore_performance_info_get
1400 #define tx_semaphore_performance_system_info_get    _tx_semaphore_performance_system_info_get
1401 #define tx_semaphore_prioritize                     _txe_semaphore_prioritize
1402 #define tx_semaphore_put                            _txe_semaphore_put
1403 #define tx_semaphore_put_notify                     _txe_semaphore_put_notify
1404 
1405 #define tx_thread_create(t,n,e,i,s,l,p,r,c,a)       _txe_thread_create((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD)))
1406 #define tx_thread_delete                            _txe_thread_delete
1407 #define tx_thread_entry_exit_notify                 _txe_thread_entry_exit_notify
1408 #define tx_thread_identify                          _tx_thread_identify
1409 #define tx_thread_info_get                          _txe_thread_info_get
1410 #define tx_thread_performance_info_get              _tx_thread_performance_info_get
1411 #define tx_thread_performance_system_info_get       _tx_thread_performance_system_info_get
1412 #define tx_thread_preemption_change                 _txe_thread_preemption_change
1413 #define tx_thread_priority_change                   _txe_thread_priority_change
1414 #define tx_thread_relinquish                        _txe_thread_relinquish
1415 #define tx_thread_reset                             _txe_thread_reset
1416 #define tx_thread_resume                            _txe_thread_resume
1417 #define tx_thread_sleep                             _tx_thread_sleep
1418 #define tx_thread_stack_error_notify                _tx_thread_stack_error_notify
1419 #define tx_thread_suspend                           _txe_thread_suspend
1420 #define tx_thread_terminate                         _txe_thread_terminate
1421 #define tx_thread_time_slice_change                 _txe_thread_time_slice_change
1422 #define tx_thread_wait_abort                        _txe_thread_wait_abort
1423 
1424 #define tx_time_get                                 _tx_time_get
1425 #define tx_time_set                                 _tx_time_set
1426 #define tx_timer_activate                           _txe_timer_activate
1427 #define tx_timer_change                             _txe_timer_change
1428 #define tx_timer_create(t,n,e,i,c,r,a)              _txe_timer_create((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER)))
1429 #define tx_timer_deactivate                         _txe_timer_deactivate
1430 #define tx_timer_delete                             _txe_timer_delete
1431 #define tx_timer_info_get                           _txe_timer_info_get
1432 #define tx_timer_performance_info_get               _tx_timer_performance_info_get
1433 #define tx_timer_performance_system_info_get        _tx_timer_performance_system_info_get
1434 
1435 #define tx_trace_enable                             _tx_trace_enable
1436 #define tx_trace_event_filter                       _tx_trace_event_filter
1437 #define tx_trace_event_unfilter                     _tx_trace_event_unfilter
1438 #define tx_trace_disable                            _tx_trace_disable
1439 #define tx_trace_isr_enter_insert                   _tx_trace_isr_enter_insert
1440 #define tx_trace_isr_exit_insert                    _tx_trace_isr_exit_insert
1441 #define tx_trace_buffer_full_notify                 _tx_trace_buffer_full_notify
1442 #define tx_trace_user_event_insert                  _tx_trace_user_event_insert
1443 
1444 #endif
1445 #endif
1446 
1447 #endif
1448 
1449 
1450 /* Declare the tx_application_define function as having C linkage.  */
1451 
1452 VOID        tx_application_define(VOID *first_unused_memory);
1453 
1454 
1455 /* Define the function prototypes of the ThreadX API.  */
1456 
1457 
1458 /* Define block memory pool management function prototypes.  */
1459 
1460 UINT        _tx_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option);
1461 UINT        _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
1462                     VOID *pool_start, ULONG pool_size);
1463 UINT        _tx_block_pool_delete(TX_BLOCK_POOL *pool_ptr);
1464 UINT        _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
1465                     ULONG *total_blocks, TX_THREAD **first_suspended,
1466                     ULONG *suspended_count, TX_BLOCK_POOL **next_pool);
1467 UINT        _tx_block_pool_performance_info_get(TX_BLOCK_POOL *pool_ptr, ULONG *allocates, ULONG *releases,
1468                     ULONG *suspensions, ULONG *timeouts);
1469 UINT        _tx_block_pool_performance_system_info_get(ULONG *allocates, ULONG *releases,
1470                     ULONG *suspensions, ULONG *timeouts);
1471 UINT        _tx_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr);
1472 UINT        _tx_block_release(VOID *block_ptr);
1473 
1474 
1475 /* Define error checking shells for API services.  These are only referenced by the
1476    application.  */
1477 
1478 UINT        _txe_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option);
1479 UINT        _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
1480                     VOID *pool_start, ULONG pool_size, UINT pool_control_block_size);
1481 UINT        _txe_block_pool_delete(TX_BLOCK_POOL *pool_ptr);
1482 UINT        _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
1483                     ULONG *total_blocks, TX_THREAD **first_suspended,
1484                     ULONG *suspended_count, TX_BLOCK_POOL **next_pool);
1485 UINT        _txe_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr);
1486 UINT        _txe_block_release(VOID *block_ptr);
1487 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
1488 UINT        _txr_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option);
1489 UINT        _txr_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
1490                     VOID *pool_start, ULONG pool_size, UINT pool_control_block_size);
1491 UINT        _txr_block_pool_delete(TX_BLOCK_POOL *pool_ptr);
1492 UINT        _txr_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
1493                     ULONG *total_blocks, TX_THREAD **first_suspended,
1494                     ULONG *suspended_count, TX_BLOCK_POOL **next_pool);
1495 UINT        _txr_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr);
1496 UINT        _txr_block_release(VOID *block_ptr);
1497 #endif
1498 
1499 
1500 /* Define byte memory pool management function prototypes.  */
1501 
1502 UINT        _tx_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size,
1503                     ULONG wait_option);
1504 UINT        _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
1505                     ULONG pool_size);
1506 UINT        _tx_byte_pool_delete(TX_BYTE_POOL *pool_ptr);
1507 UINT        _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
1508                     ULONG *fragments, TX_THREAD **first_suspended,
1509                     ULONG *suspended_count, TX_BYTE_POOL **next_pool);
1510 UINT        _tx_byte_pool_performance_info_get(TX_BYTE_POOL *pool_ptr, ULONG *allocates, ULONG *releases,
1511                     ULONG *fragments_searched, ULONG *merges, ULONG *splits, ULONG *suspensions, ULONG *timeouts);
1512 UINT        _tx_byte_pool_performance_system_info_get(ULONG *allocates, ULONG *releases,
1513                     ULONG *fragments_searched, ULONG *merges, ULONG *splits, ULONG *suspensions, ULONG *timeouts);
1514 UINT        _tx_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr);
1515 UINT        _tx_byte_release(VOID *memory_ptr);
1516 
1517 
1518 /* Define error checking shells for API services.  These are only referenced by the
1519    application.  */
1520 
1521 UINT        _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size,
1522                     ULONG wait_option);
1523 UINT        _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
1524                     ULONG pool_size, UINT pool_control_block_size);
1525 UINT        _txe_byte_pool_delete(TX_BYTE_POOL *pool_ptr);
1526 UINT        _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
1527                     ULONG *fragments, TX_THREAD **first_suspended,
1528                     ULONG *suspended_count, TX_BYTE_POOL **next_pool);
1529 UINT        _txe_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr);
1530 UINT        _txe_byte_release(VOID *memory_ptr);
1531 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
1532 UINT        _txr_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size,
1533                     ULONG wait_option);
1534 UINT        _txr_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
1535                     ULONG pool_size, UINT pool_control_block_size);
1536 UINT        _txr_byte_pool_delete(TX_BYTE_POOL *pool_ptr);
1537 UINT        _txr_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
1538                     ULONG *fragments, TX_THREAD **first_suspended,
1539                     ULONG *suspended_count, TX_BYTE_POOL **next_pool);
1540 UINT        _txr_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr);
1541 UINT        _txr_byte_release(VOID *memory_ptr);
1542 #endif
1543 
1544 
1545 /* Define event flags management function prototypes.  */
1546 
1547 UINT        _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr);
1548 UINT        _tx_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
1549 UINT        _tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
1550                     UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option);
1551 UINT        _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
1552                     TX_THREAD **first_suspended, ULONG *suspended_count,
1553                     TX_EVENT_FLAGS_GROUP **next_group);
1554 UINT        _tx_event_flags_performance_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG *sets, ULONG *gets,
1555                     ULONG *suspensions, ULONG *timeouts);
1556 UINT        _tx_event_flags_performance_system_info_get(ULONG *sets, ULONG *gets,
1557                     ULONG *suspensions, ULONG *timeouts);
1558 UINT        _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
1559                     UINT set_option);
1560 UINT        _tx_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr));
1561 
1562 
1563 /* Define error checking shells for API services.  These are only referenced by the
1564    application.  */
1565 
1566 UINT        _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size);
1567 UINT        _txe_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
1568 UINT        _txe_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
1569                     UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option);
1570 UINT        _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
1571                     TX_THREAD **first_suspended, ULONG *suspended_count,
1572                     TX_EVENT_FLAGS_GROUP **next_group);
1573 UINT        _txe_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
1574                     UINT set_option);
1575 UINT        _txe_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr));
1576 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
1577 UINT        _txr_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size);
1578 UINT        _txr_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
1579 UINT        _txr_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
1580                     UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option);
1581 UINT        _txr_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
1582                     TX_THREAD **first_suspended, ULONG *suspended_count,
1583                     TX_EVENT_FLAGS_GROUP **next_group);
1584 UINT        _txr_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
1585                     UINT set_option);
1586 UINT        _txr_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr));
1587 #endif
1588 
1589 
1590 /* Define initialization function prototypes.  */
1591 
1592 VOID        _tx_initialize_kernel_enter(VOID);
1593 
1594 
1595 /* Define mutex management function prototypes.  */
1596 
1597 UINT        _tx_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit);
1598 UINT        _tx_mutex_delete(TX_MUTEX *mutex_ptr);
1599 UINT        _tx_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option);
1600 UINT        _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
1601                     TX_THREAD **first_suspended, ULONG *suspended_count,
1602                     TX_MUTEX **next_mutex);
1603 UINT        _tx_mutex_performance_info_get(TX_MUTEX *mutex_ptr, ULONG *puts, ULONG *gets,
1604                     ULONG *suspensions, ULONG *timeouts, ULONG *inversions, ULONG *inheritances);
1605 UINT        _tx_mutex_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts,
1606                     ULONG *inversions, ULONG *inheritances);
1607 UINT        _tx_mutex_prioritize(TX_MUTEX *mutex_ptr);
1608 UINT        _tx_mutex_put(TX_MUTEX *mutex_ptr);
1609 
1610 
1611 /* Define error checking shells for API services.  These are only referenced by the
1612    application.  */
1613 
1614 UINT        _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
1615 UINT        _txe_mutex_delete(TX_MUTEX *mutex_ptr);
1616 UINT        _txe_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option);
1617 UINT        _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
1618                     TX_THREAD **first_suspended, ULONG *suspended_count,
1619                     TX_MUTEX **next_mutex);
1620 UINT        _txe_mutex_prioritize(TX_MUTEX *mutex_ptr);
1621 UINT        _txe_mutex_put(TX_MUTEX *mutex_ptr);
1622 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
1623 UINT        _txr_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
1624 UINT        _txr_mutex_delete(TX_MUTEX *mutex_ptr);
1625 UINT        _txr_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option);
1626 UINT        _txr_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
1627                     TX_THREAD **first_suspended, ULONG *suspended_count,
1628                     TX_MUTEX **next_mutex);
1629 UINT        _txr_mutex_prioritize(TX_MUTEX *mutex_ptr);
1630 UINT        _txr_mutex_put(TX_MUTEX *mutex_ptr);
1631 #endif
1632 
1633 
1634 /* Define queue management function prototypes.  */
1635 
1636 UINT        _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
1637                         VOID *queue_start, ULONG queue_size);
1638 UINT        _tx_queue_delete(TX_QUEUE *queue_ptr);
1639 UINT        _tx_queue_flush(TX_QUEUE *queue_ptr);
1640 UINT        _tx_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage,
1641                     TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue);
1642 UINT        _tx_queue_performance_info_get(TX_QUEUE *queue_ptr, ULONG *messages_sent, ULONG *messages_received,
1643                     ULONG *empty_suspensions, ULONG *full_suspensions, ULONG *full_errors, ULONG *timeouts);
1644 UINT        _tx_queue_performance_system_info_get(ULONG *messages_sent, ULONG *messages_received,
1645                     ULONG *empty_suspensions, ULONG *full_suspensions, ULONG *full_errors, ULONG *timeouts);
1646 UINT        _tx_queue_prioritize(TX_QUEUE *queue_ptr);
1647 UINT        _tx_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option);
1648 UINT        _tx_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option);
1649 UINT        _tx_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr));
1650 UINT        _tx_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option);
1651 
1652 
1653 /* Define error checking shells for API services.  These are only referenced by the
1654    application.  */
1655 
1656 UINT        _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
1657                         VOID *queue_start, ULONG queue_size, UINT queue_control_block_size);
1658 UINT        _txe_queue_delete(TX_QUEUE *queue_ptr);
1659 UINT        _txe_queue_flush(TX_QUEUE *queue_ptr);
1660 UINT        _txe_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage,
1661                     TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue);
1662 UINT        _txe_queue_prioritize(TX_QUEUE *queue_ptr);
1663 UINT        _txe_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option);
1664 UINT        _txe_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option);
1665 UINT        _txe_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr));
1666 UINT        _txe_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option);
1667 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
1668 UINT        _txr_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
1669                         VOID *queue_start, ULONG queue_size, UINT queue_control_block_size);
1670 UINT        _txr_queue_delete(TX_QUEUE *queue_ptr);
1671 UINT        _txr_queue_flush(TX_QUEUE *queue_ptr);
1672 UINT        _txr_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage,
1673                     TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue);
1674 UINT        _txr_queue_prioritize(TX_QUEUE *queue_ptr);
1675 UINT        _txr_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option);
1676 UINT        _txr_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option);
1677 UINT        _txr_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr));
1678 UINT        _txr_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option);
1679 #endif
1680 
1681 
1682 /* Define semaphore management function prototypes.  */
1683 
1684 UINT        _tx_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling);
1685 UINT        _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count);
1686 UINT        _tx_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
1687 UINT        _tx_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option);
1688 UINT        _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
1689                     TX_THREAD **first_suspended, ULONG *suspended_count,
1690                     TX_SEMAPHORE **next_semaphore);
1691 UINT        _tx_semaphore_performance_info_get(TX_SEMAPHORE *semaphore_ptr, ULONG *puts, ULONG *gets,
1692                     ULONG *suspensions, ULONG *timeouts);
1693 UINT        _tx_semaphore_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts);
1694 UINT        _tx_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr);
1695 UINT        _tx_semaphore_put(TX_SEMAPHORE *semaphore_ptr);
1696 UINT        _tx_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr));
1697 
1698 
1699 /* Define error checking shells for API services.  These are only referenced by the
1700    application.  */
1701 
1702 UINT        _txe_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling);
1703 UINT        _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
1704 UINT        _txe_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
1705 UINT        _txe_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option);
1706 UINT        _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
1707                     TX_THREAD **first_suspended, ULONG *suspended_count,
1708                     TX_SEMAPHORE **next_semaphore);
1709 UINT        _txe_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr);
1710 UINT        _txe_semaphore_put(TX_SEMAPHORE *semaphore_ptr);
1711 UINT        _txe_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr));
1712 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
1713 UINT        _txr_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling);
1714 UINT        _txr_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
1715 UINT        _txr_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
1716 UINT        _txr_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option);
1717 UINT        _txr_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
1718                     TX_THREAD **first_suspended, ULONG *suspended_count,
1719                     TX_SEMAPHORE **next_semaphore);
1720 UINT        _txr_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr);
1721 UINT        _txr_semaphore_put(TX_SEMAPHORE *semaphore_ptr);
1722 UINT        _txr_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr));
1723 #endif
1724 
1725 
1726 /* Define thread control function prototypes.  */
1727 
1728 VOID        _tx_thread_context_save(VOID);
1729 VOID        _tx_thread_context_restore(VOID);
1730 UINT        _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
1731                 VOID (*entry_function)(ULONG entry_input), ULONG entry_input,
1732                 VOID *stack_start, ULONG stack_size,
1733                 UINT priority, UINT preempt_threshold,
1734                 ULONG time_slice, UINT auto_start);
1735 UINT        _tx_thread_delete(TX_THREAD *thread_ptr);
1736 UINT        _tx_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
1737 TX_THREAD  *_tx_thread_identify(VOID);
1738 UINT        _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
1739                 UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
1740                 TX_THREAD **next_thread, TX_THREAD **next_suspended_thread);
1741 UINT        _tx_thread_interrupt_control(UINT new_posture);
1742 UINT        _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions,
1743                 ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions,
1744                 ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts, TX_THREAD **last_preempted_by);
1745 UINT        _tx_thread_performance_system_info_get(ULONG *resumptions, ULONG *suspensions,
1746                 ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions,
1747                 ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts,
1748                 ULONG *non_idle_returns, ULONG *idle_returns);
1749 UINT        _tx_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold,
1750                         UINT *old_threshold);
1751 UINT        _tx_thread_priority_change(TX_THREAD *thread_ptr, UINT new_priority,
1752                         UINT *old_priority);
1753 VOID        _tx_thread_relinquish(VOID);
1754 UINT        _tx_thread_reset(TX_THREAD *thread_ptr);
1755 UINT        _tx_thread_resume(TX_THREAD *thread_ptr);
1756 UINT        _tx_thread_sleep(ULONG timer_ticks);
1757 UINT        _tx_thread_stack_error_notify(VOID (*stack_error_handler)(TX_THREAD *thread_ptr));
1758 UINT        _tx_thread_suspend(TX_THREAD *thread_ptr);
1759 UINT        _tx_thread_terminate(TX_THREAD *thread_ptr);
1760 UINT        _tx_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice);
1761 UINT        _tx_thread_wait_abort(TX_THREAD *thread_ptr);
1762 
1763 
1764 /* Define error checking shells for API services.  These are only referenced by the
1765    application.  */
1766 
1767 UINT        _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
1768                 VOID (*entry_function)(ULONG entry_input), ULONG entry_input,
1769                 VOID *stack_start, ULONG stack_size,
1770                 UINT priority, UINT preempt_threshold,
1771                 ULONG time_slice, UINT auto_start, UINT thread_control_block_size);
1772 UINT        _txe_thread_delete(TX_THREAD *thread_ptr);
1773 UINT        _txe_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
1774 UINT        _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
1775                 UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
1776                 TX_THREAD **next_thread, TX_THREAD **next_suspended_thread);
1777 UINT        _txe_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold,
1778                         UINT *old_threshold);
1779 UINT        _txe_thread_priority_change(TX_THREAD *thread_ptr, UINT new_priority,
1780                         UINT *old_priority);
1781 VOID        _txe_thread_relinquish(VOID);
1782 UINT        _txe_thread_reset(TX_THREAD *thread_ptr);
1783 UINT        _txe_thread_resume(TX_THREAD *thread_ptr);
1784 UINT        _txe_thread_suspend(TX_THREAD *thread_ptr);
1785 UINT        _txe_thread_terminate(TX_THREAD *thread_ptr);
1786 UINT        _txe_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice);
1787 UINT        _txe_thread_wait_abort(TX_THREAD *thread_ptr);
1788 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
1789 UINT        _txr_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
1790                 VOID (*entry_function)(ULONG entry_input), ULONG entry_input,
1791                 VOID *stack_start, ULONG stack_size,
1792                 UINT priority, UINT preempt_threshold,
1793                 ULONG time_slice, UINT auto_start, UINT thread_control_block_size);
1794 UINT        _txr_thread_delete(TX_THREAD *thread_ptr);
1795 UINT        _txr_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
1796 UINT        _txr_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
1797                 UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
1798                 TX_THREAD **next_thread, TX_THREAD **next_suspended_thread);
1799 UINT        _txr_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold,
1800                         UINT *old_threshold);
1801 UINT        _txr_thread_priority_change(TX_THREAD *thread_ptr, UINT new_priority,
1802                         UINT *old_priority);
1803 UINT        _txr_thread_reset(TX_THREAD *thread_ptr);
1804 UINT        _txr_thread_resume(TX_THREAD *thread_ptr);
1805 UINT        _txr_thread_suspend(TX_THREAD *thread_ptr);
1806 UINT        _txr_thread_terminate(TX_THREAD *thread_ptr);
1807 UINT        _txr_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice);
1808 UINT        _txr_thread_wait_abort(TX_THREAD *thread_ptr);
1809 #endif
1810 
1811 
1812 /* Define timer management function prototypes.  */
1813 
1814 UINT        _tx_timer_activate(TX_TIMER *timer_ptr);
1815 UINT        _tx_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks);
1816 UINT        _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
1817                 VOID (*expiration_function)(ULONG input), ULONG expiration_input,
1818                 ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate);
1819 UINT        _tx_timer_deactivate(TX_TIMER *timer_ptr);
1820 UINT        _tx_timer_delete(TX_TIMER *timer_ptr);
1821 UINT        _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
1822                 ULONG *reschedule_ticks, TX_TIMER **next_timer);
1823 UINT        _tx_timer_performance_info_get(TX_TIMER *timer_ptr, ULONG *activates, ULONG *reactivates,
1824                 ULONG *deactivates, ULONG *expirations, ULONG *expiration_adjusts);
1825 UINT        _tx_timer_performance_system_info_get(ULONG *activates, ULONG *reactivates,
1826                 ULONG *deactivates, ULONG *expirations, ULONG *expiration_adjusts);
1827 
1828 ULONG       _tx_time_get(VOID);
1829 VOID        _tx_time_set(ULONG new_time);
1830 
1831 
1832 /* Define error checking shells for API services.  These are only referenced by the
1833    application.  */
1834 
1835 UINT        _txe_timer_activate(TX_TIMER *timer_ptr);
1836 UINT        _txe_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks);
1837 UINT        _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
1838                 VOID (*expiration_function)(ULONG input), ULONG expiration_input,
1839                 ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
1840 UINT        _txe_timer_deactivate(TX_TIMER *timer_ptr);
1841 UINT        _txe_timer_delete(TX_TIMER *timer_ptr);
1842 UINT        _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
1843                 ULONG *reschedule_ticks, TX_TIMER **next_timer);
1844 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
1845 UINT        _txr_timer_activate(TX_TIMER *timer_ptr);
1846 UINT        _txr_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks);
1847 UINT        _txr_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
1848                 VOID (*expiration_function)(ULONG input), ULONG expiration_input,
1849                 ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
1850 UINT        _txr_timer_deactivate(TX_TIMER *timer_ptr);
1851 UINT        _txr_timer_delete(TX_TIMER *timer_ptr);
1852 UINT        _txr_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
1853                 ULONG *reschedule_ticks, TX_TIMER **next_timer);
1854 #endif
1855 
1856 
1857 /* Define trace API function prototypes.  */
1858 
1859 UINT        _tx_trace_enable(VOID *trace_buffer_start, ULONG trace_buffer_size, ULONG registry_entries);
1860 UINT        _tx_trace_event_filter(ULONG event_filter_bits);
1861 UINT        _tx_trace_event_unfilter(ULONG event_unfilter_bits);
1862 UINT        _tx_trace_disable(VOID);
1863 VOID        _tx_trace_isr_enter_insert(ULONG isr_id);
1864 VOID        _tx_trace_isr_exit_insert(ULONG isr_id);
1865 UINT        _tx_trace_buffer_full_notify(VOID (*full_buffer_callback)(VOID *buffer));
1866 UINT        _tx_trace_user_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4);
1867 UINT        _tx_trace_interrupt_control(UINT new_posture);
1868 
1869 
1870 /* Add a default macro that can be re-defined in tx_port.h to add default processing when a thread starts. Common usage
1871    would be for enabling floating point for a thread by default, however, the additional processing could be anything
1872    defined in tx_port.h.  */
1873 
1874 #ifndef TX_THREAD_STARTED_EXTENSION
1875 #define TX_THREAD_STARTED_EXTENSION(thread_ptr)
1876 #endif
1877 
1878 
1879 /* Add a default macro that can be re-defined in tx_port.h to add processing to the thread stack analyze function.
1880    By default, this is simply defined as whitespace.  */
1881 
1882 #ifndef TX_THREAD_STACK_ANALYZE_EXTENSION
1883 #define TX_THREAD_STACK_ANALYZE_EXTENSION
1884 #endif
1885 
1886 
1887 /* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize kernel enter function.
1888    By default, this is simply defined as whitespace.  */
1889 
1890 #ifndef TX_INITIALIZE_KERNEL_ENTER_EXTENSION
1891 #define TX_INITIALIZE_KERNEL_ENTER_EXTENSION
1892 #endif
1893 
1894 
1895 /* Check for MISRA compliance requirements.  */
1896 
1897 #ifdef TX_MISRA_ENABLE
1898 
1899 
1900 /* Define MISRA-specific routines.  */
1901 
1902 VOID                    _tx_misra_memset(VOID *ptr, UINT value, UINT size);
1903 UCHAR                   *_tx_misra_uchar_pointer_add(UCHAR *ptr, ULONG amount);
1904 UCHAR                   *_tx_misra_uchar_pointer_sub(UCHAR *ptr, ULONG amount);
1905 ULONG                   _tx_misra_uchar_pointer_dif(UCHAR *ptr1, UCHAR *ptr2);
1906 ULONG                   _tx_misra_pointer_to_ulong_convert(VOID *ptr);
1907 ULONG                   *_tx_misra_ulong_pointer_add(ULONG *ptr, ULONG amount);
1908 ULONG                   *_tx_misra_ulong_pointer_sub(ULONG *ptr, ULONG amount);
1909 ULONG                   _tx_misra_ulong_pointer_dif(ULONG *ptr1, ULONG *ptr2);
1910 VOID                    *_tx_misra_ulong_to_pointer_convert(ULONG input);
1911 VOID                    _tx_misra_message_copy(ULONG **source, ULONG **destination, UINT size);
1912 ULONG                   _tx_misra_timer_pointer_dif(TX_TIMER_INTERNAL **ptr1, TX_TIMER_INTERNAL **ptr2);
1913 TX_TIMER_INTERNAL       **_tx_misra_timer_pointer_add(TX_TIMER_INTERNAL **ptr1, ULONG size);
1914 VOID                    _tx_misra_user_timer_pointer_get(TX_TIMER_INTERNAL *internal_timer, TX_TIMER **user_timer);
1915 VOID                    _tx_misra_thread_stack_check(TX_THREAD *thread_ptr, VOID **highest_stack);
1916 VOID                    _tx_misra_trace_event_insert(ULONG event_id, VOID *info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4, ULONG filter, ULONG time_stamp);
1917 UINT                    _tx_misra_always_true(void);
1918 UCHAR                   **_tx_misra_indirect_void_to_uchar_pointer_convert(VOID **pointer);
1919 UCHAR                   **_tx_misra_uchar_to_indirect_uchar_pointer_convert(UCHAR *pointer);
1920 UCHAR                   *_tx_misra_block_pool_to_uchar_pointer_convert(TX_BLOCK_POOL *pool);
1921 TX_BLOCK_POOL           *_tx_misra_void_to_block_pool_pointer_convert(VOID *pointer);
1922 UCHAR                   *_tx_misra_void_to_uchar_pointer_convert(VOID *pointer);
1923 TX_BLOCK_POOL           *_tx_misra_uchar_to_block_pool_pointer_convert(UCHAR *pointer);
1924 UCHAR                   **_tx_misra_void_to_indirect_uchar_pointer_convert(VOID *pointer);
1925 TX_BYTE_POOL            *_tx_misra_void_to_byte_pool_pointer_convert(VOID *pointer);
1926 UCHAR                   *_tx_misra_byte_pool_to_uchar_pointer_convert(TX_BYTE_POOL *pool);
1927 ALIGN_TYPE              *_tx_misra_uchar_to_align_type_pointer_convert(UCHAR *pointer);
1928 TX_BYTE_POOL            **_tx_misra_uchar_to_indirect_byte_pool_pointer_convert(UCHAR *pointer);
1929 TX_EVENT_FLAGS_GROUP    *_tx_misra_void_to_event_flags_pointer_convert(VOID *pointer);
1930 ULONG                   *_tx_misra_void_to_ulong_pointer_convert(VOID *pointer);
1931 TX_MUTEX                *_tx_misra_void_to_mutex_pointer_convert(VOID *pointer);
1932 UINT                    _tx_misra_status_get(UINT status);
1933 TX_QUEUE                *_tx_misra_void_to_queue_pointer_convert(VOID *pointer);
1934 TX_SEMAPHORE            *_tx_misra_void_to_semaphore_pointer_convert(VOID *pointer);
1935 VOID                    *_tx_misra_uchar_to_void_pointer_convert(UCHAR  *pointer);
1936 TX_THREAD               *_tx_misra_ulong_to_thread_pointer_convert(ULONG value);
1937 VOID                    *_tx_misra_timer_indirect_to_void_pointer_convert(TX_TIMER_INTERNAL **pointer);
1938 CHAR                    *_tx_misra_const_char_to_char_pointer_convert(const char *pointer);
1939 TX_THREAD               *_tx_misra_void_to_thread_pointer_convert(VOID  *pointer);
1940 UCHAR                   *_tx_misra_char_to_uchar_pointer_convert(CHAR  *pointer);
1941 VOID                    _tx_misra_event_flags_group_not_used(TX_EVENT_FLAGS_GROUP *group_ptr);
1942 VOID                    _tx_misra_event_flags_set_notify_not_used(VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr));
1943 VOID                    _tx_misra_queue_not_used(TX_QUEUE *queue_ptr);
1944 VOID                    _tx_misra_queue_send_notify_not_used(VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr));
1945 VOID                    _tx_misra_semaphore_not_used(TX_SEMAPHORE *semaphore_ptr);
1946 VOID                    _tx_misra_semaphore_put_notify_not_used(VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr));
1947 VOID                    _tx_misra_thread_not_used(TX_THREAD *thread_ptr);
1948 VOID                    _tx_misra_thread_entry_exit_notify_not_used(VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT id));
1949 
1950 #define TX_MEMSET(a,b,c)                                _tx_misra_memset((a), (UINT) (b), (UINT) (c))
1951 #define TX_UCHAR_POINTER_ADD(a,b)                       _tx_misra_uchar_pointer_add((UCHAR *) (a), (ULONG) (b))
1952 #define TX_UCHAR_POINTER_SUB(a,b)                       _tx_misra_uchar_pointer_sub((UCHAR *) (a), (ULONG) (b))
1953 #define TX_UCHAR_POINTER_DIF(a,b)                       _tx_misra_uchar_pointer_dif((UCHAR *) (a), (UCHAR *) (b))
1954 #define TX_ULONG_POINTER_ADD(a,b)                       _tx_misra_ulong_pointer_add((ULONG *) (a), (ULONG) (b))
1955 #define TX_ULONG_POINTER_SUB(a,b)                       _tx_misra_ulong_pointer_sub((ULONG *) (a), (ULONG) (b))
1956 #define TX_ULONG_POINTER_DIF(a,b)                       _tx_misra_ulong_pointer_dif((ULONG *) (a), (ULONG *) (b))
1957 #define TX_POINTER_TO_ULONG_CONVERT(a)                  _tx_misra_pointer_to_ulong_convert((VOID *) (a))
1958 #define TX_ULONG_TO_POINTER_CONVERT(a)                  _tx_misra_ulong_to_pointer_convert((ULONG) (a))
1959 #define TX_QUEUE_MESSAGE_COPY(s,d,z)                    _tx_misra_message_copy(&(s), &(d), (z));
1960 #define TX_TIMER_POINTER_DIF(a,b)                       _tx_misra_timer_pointer_dif((TX_TIMER_INTERNAL **) (a), (TX_TIMER_INTERNAL **) (b))
1961 #define TX_TIMER_POINTER_ADD(a,b)                       _tx_misra_timer_pointer_add((TX_TIMER_INTERNAL **) (a), (ULONG) (b))
1962 #define TX_USER_TIMER_POINTER_GET(a,b)                  _tx_misra_user_timer_pointer_get((TX_TIMER_INTERNAL *) (a), (TX_TIMER **) &(b));
1963 #define TX_THREAD_STACK_CHECK(a)                        _tx_misra_thread_stack_check((a), &((a)->tx_thread_stack_highest_ptr));
1964 #ifdef TX_ENABLE_EVENT_TRACE
1965 #define TX_TRACE_IN_LINE_INSERT(i,a,b,c,d,e)            _tx_misra_trace_event_insert((ULONG) (i), (VOID *) (a), (ULONG) (b), (ULONG) (c), (ULONG) (d), (ULONG) (e), ((ULONG) TX_TRACE_TIME_SOURCE));
1966 #endif
1967 #define TX_LOOP_FOREVER                                 (_tx_misra_always_true() == TX_TRUE)
1968 #define TX_INDIRECT_VOID_TO_UCHAR_POINTER_CONVERT(a)    _tx_misra_indirect_void_to_uchar_pointer_convert((a))
1969 #define TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(a)   _tx_misra_uchar_to_indirect_uchar_pointer_convert((a))
1970 #define TX_BLOCK_POOL_TO_UCHAR_POINTER_CONVERT(a)       _tx_misra_block_pool_to_uchar_pointer_convert((a))
1971 #define TX_VOID_TO_BLOCK_POOL_POINTER_CONVERT(a)        _tx_misra_void_to_block_pool_pointer_convert((a))
1972 #define TX_VOID_TO_UCHAR_POINTER_CONVERT(a)             _tx_misra_void_to_uchar_pointer_convert((a))
1973 #define TX_UCHAR_TO_BLOCK_POOL_POINTER_CONVERT(a)       _tx_misra_uchar_to_block_pool_pointer_convert((a))
1974 #define TX_VOID_TO_INDIRECT_UCHAR_POINTER_CONVERT(a)    _tx_misra_void_to_indirect_uchar_pointer_convert((a))
1975 #define TX_VOID_TO_BYTE_POOL_POINTER_CONVERT(a)         _tx_misra_void_to_byte_pool_pointer_convert((a))
1976 #define TX_BYTE_POOL_TO_UCHAR_POINTER_CONVERT(a)        _tx_misra_byte_pool_to_uchar_pointer_convert((a))
1977 #define TX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(a)       _tx_misra_uchar_to_align_type_pointer_convert((a))
1978 #define TX_UCHAR_TO_INDIRECT_BYTE_POOL_POINTER(a)       _tx_misra_uchar_to_indirect_byte_pool_pointer_convert((a))
1979 #define TX_VOID_TO_EVENT_FLAGS_POINTER_CONVERT(a)       _tx_misra_void_to_event_flags_pointer_convert((a))
1980 #define TX_VOID_TO_ULONG_POINTER_CONVERT(a)             _tx_misra_void_to_ulong_pointer_convert((a))
1981 #define TX_VOID_TO_MUTEX_POINTER_CONVERT(a)             _tx_misra_void_to_mutex_pointer_convert((a))
1982 #define TX_MUTEX_PRIORITIZE_MISRA_EXTENSION(a)          _tx_misra_status_get((a))
1983 #define TX_VOID_TO_QUEUE_POINTER_CONVERT(a)             _tx_misra_void_to_queue_pointer_convert((a))
1984 #define TX_VOID_TO_SEMAPHORE_POINTER_CONVERT(a)         _tx_misra_void_to_semaphore_pointer_convert((a))
1985 #define TX_UCHAR_TO_VOID_POINTER_CONVERT(a)             _tx_misra_uchar_to_void_pointer_convert((a))
1986 #define TX_ULONG_TO_THREAD_POINTER_CONVERT(a)           _tx_misra_ulong_to_thread_pointer_convert((a))
1987 #define TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(a)    _tx_misra_timer_indirect_to_void_pointer_convert((a))
1988 #ifndef TX_TIMER_INITIALIZE_EXTENSION
1989 #define TX_TIMER_INITIALIZE_EXTENSION(a)                status =  _tx_misra_status_get((a));
1990 #endif
1991 #define TX_CONST_CHAR_TO_CHAR_POINTER_CONVERT(a)        _tx_misra_const_char_to_char_pointer_convert((a))
1992 #define TX_VOID_TO_THREAD_POINTER_CONVERT(a)            _tx_misra_void_to_thread_pointer_convert((a))
1993 #define TX_CHAR_TO_UCHAR_POINTER_CONVERT(a)             _tx_misra_char_to_uchar_pointer_convert((a))
1994 #define TX_EVENT_FLAGS_GROUP_NOT_USED(a)                _tx_misra_event_flags_group_not_used((a))
1995 #define TX_EVENT_FLAGS_SET_NOTIFY_NOT_USED(a)           _tx_misra_event_flags_set_notify_not_used((a))
1996 #define TX_QUEUE_NOT_USED(a)                            _tx_misra_queue_not_used((a))
1997 #define TX_QUEUE_SEND_NOTIFY_NOT_USED(a)                _tx_misra_queue_send_notify_not_used((a))
1998 #define TX_SEMAPHORE_NOT_USED(a)                        _tx_misra_semaphore_not_used((a))
1999 #define TX_SEMAPHORE_PUT_NOTIFY_NOT_USED(a)             _tx_misra_semaphore_put_notify_not_used((a))
2000 #define TX_THREAD_NOT_USED(a)                           _tx_misra_thread_not_used((a))
2001 #define TX_THREAD_ENTRY_EXIT_NOTIFY_NOT_USED(a)         _tx_misra_thread_entry_exit_notify_not_used((a))
2002 
2003 #else
2004 
2005 /* Define the TX_MEMSET macro to the standard library function, if not already defined.  */
2006 
2007 #ifndef TX_MEMSET
2008 #define TX_MEMSET(a,b,c)                                memset((a),(b),(c))
2009 #endif
2010 
2011 #define TX_UCHAR_POINTER_ADD(a,b)                       (((UCHAR *) (a)) + ((UINT) (b)))
2012 #define TX_UCHAR_POINTER_SUB(a,b)                       (((UCHAR *) (a)) - ((UINT) (b)))
2013 #define TX_UCHAR_POINTER_DIF(a,b)                       ((ULONG)(((UCHAR *) (a)) - ((UCHAR *) (b))))
2014 #define TX_ULONG_POINTER_ADD(a,b)                       (((ULONG *) (a)) + ((UINT) (b)))
2015 #define TX_ULONG_POINTER_SUB(a,b)                       (((ULONG *) (a)) - ((UINT) (b)))
2016 #define TX_ULONG_POINTER_DIF(a,b)                       ((ULONG)(((ULONG *) (a)) - ((ULONG *) (b))))
2017 #define TX_POINTER_TO_ULONG_CONVERT(a)                  ((ULONG) ((VOID *) (a)))
2018 #define TX_ULONG_TO_POINTER_CONVERT(a)                  ((VOID *) ((ULONG) (a)))
2019 #define TX_POINTER_TO_ALIGN_TYPE_CONVERT(a)             ((ALIGN_TYPE) ((VOID *) (a)))
2020 #define TX_ALIGN_TYPE_TO_POINTER_CONVERT(a)             ((VOID *) ((ALIGN_TYPE) (a)))
2021 #define TX_TIMER_POINTER_DIF(a,b)                       ((ULONG)(((TX_TIMER_INTERNAL **) (a)) - ((TX_TIMER_INTERNAL **) (b))))
2022 #define TX_TIMER_POINTER_ADD(a,b)                       (((TX_TIMER_INTERNAL **) (a)) + ((ULONG) (b)))
2023 #define TX_USER_TIMER_POINTER_GET(a,b)                  { \
2024                                                             UCHAR   *working_ptr; \
2025                                                             working_ptr =  (UCHAR *) (a);   \
2026                                                             (b) =  (TX_TIMER *) working_ptr; \
2027                                                             working_ptr =  working_ptr - (((UCHAR *) &(b) -> tx_timer_internal) - ((UCHAR *) &(b) -> tx_timer_id)); \
2028                                                             (b) =  (TX_TIMER *) working_ptr; \
2029                                                         }
2030 #define TX_LOOP_FOREVER                                 ((UINT) 1)
2031 #define TX_INDIRECT_VOID_TO_UCHAR_POINTER_CONVERT(a)    ((UCHAR **) ((VOID *) (a)))
2032 #define TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(a)   ((UCHAR **) ((VOID *) (a)))
2033 #define TX_BLOCK_POOL_TO_UCHAR_POINTER_CONVERT(a)       ((UCHAR *) ((VOID *) (a)))
2034 #define TX_VOID_TO_BLOCK_POOL_POINTER_CONVERT(a)        ((TX_BLOCK_POOL *) ((VOID *) (a)))
2035 #define TX_VOID_TO_UCHAR_POINTER_CONVERT(a)             ((UCHAR *) ((VOID *) (a)))
2036 #define TX_UCHAR_TO_BLOCK_POOL_POINTER_CONVERT(a)       ((TX_BLOCK_POOL *) ((VOID *) (a)))
2037 #define TX_VOID_TO_INDIRECT_UCHAR_POINTER_CONVERT(a)    ((UCHAR **) ((VOID *) (a)))
2038 #define TX_VOID_TO_BYTE_POOL_POINTER_CONVERT(a)         ((TX_BYTE_POOL *) ((VOID *) (a)))
2039 #define TX_BYTE_POOL_TO_UCHAR_POINTER_CONVERT(a)        ((UCHAR *) ((VOID *) (a)))
2040 #ifndef TX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT
2041 #define TX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(a)       ((ALIGN_TYPE *) ((VOID *) (a)))
2042 #endif
2043 #define TX_UCHAR_TO_INDIRECT_BYTE_POOL_POINTER(a)       ((TX_BYTE_POOL **) ((VOID *) (a)))
2044 #define TX_VOID_TO_EVENT_FLAGS_POINTER_CONVERT(a)       ((TX_EVENT_FLAGS_GROUP *) ((VOID *) (a)))
2045 #define TX_VOID_TO_ULONG_POINTER_CONVERT(a)             ((ULONG *) ((VOID *) (a)))
2046 #define TX_VOID_TO_MUTEX_POINTER_CONVERT(a)             ((TX_MUTEX *) ((VOID *) (a)))
2047 #define TX_VOID_TO_QUEUE_POINTER_CONVERT(a)             ((TX_QUEUE *) ((VOID *) (a)))
2048 #define TX_VOID_TO_SEMAPHORE_POINTER_CONVERT(a)         ((TX_SEMAPHORE *) ((VOID *) (a)))
2049 #define TX_UCHAR_TO_VOID_POINTER_CONVERT(a)             ((VOID *) (a))
2050 #define TX_ULONG_TO_THREAD_POINTER_CONVERT(a)           ((TX_THREAD *) ((VOID *) (a)))
2051 #ifndef TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT
2052 #define TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(a)    ((VOID *) (a))
2053 #endif
2054 #ifndef TX_TIMER_INITIALIZE_EXTENSION
2055 #define TX_TIMER_INITIALIZE_EXTENSION(a)
2056 #endif
2057 #define TX_CONST_CHAR_TO_CHAR_POINTER_CONVERT(a)        ((CHAR *) ((VOID *) (a)))
2058 #define TX_VOID_TO_THREAD_POINTER_CONVERT(a)            ((TX_THREAD *) ((VOID *) (a)))
2059 #define TX_CHAR_TO_UCHAR_POINTER_CONVERT(a)             ((UCHAR *) ((VOID *) (a)))
2060 #ifndef TX_EVENT_FLAGS_GROUP_NOT_USED
2061 #define TX_EVENT_FLAGS_GROUP_NOT_USED(a)                ((void)(a))
2062 #endif
2063 #ifndef TX_EVENT_FLAGS_SET_NOTIFY_NOT_USED
2064 #define TX_EVENT_FLAGS_SET_NOTIFY_NOT_USED(a)           ((void)(a))
2065 #endif
2066 #ifndef TX_QUEUE_NOT_USED
2067 #define TX_QUEUE_NOT_USED(a)                            ((void)(a))
2068 #endif
2069 #ifndef TX_QUEUE_SEND_NOTIFY_NOT_USED
2070 #define TX_QUEUE_SEND_NOTIFY_NOT_USED(a)                ((void)(a))
2071 #endif
2072 #ifndef TX_SEMAPHORE_NOT_USED
2073 #define TX_SEMAPHORE_NOT_USED(a)                        ((void)(a))
2074 #endif
2075 #ifndef TX_SEMAPHORE_PUT_NOTIFY_NOT_USED
2076 #define TX_SEMAPHORE_PUT_NOTIFY_NOT_USED(a)             ((void)(a))
2077 #endif
2078 #ifndef TX_THREAD_NOT_USED
2079 #define TX_THREAD_NOT_USED(a)                           ((void)(a))
2080 #endif
2081 #ifndef TX_THREAD_ENTRY_EXIT_NOTIFY_NOT_USED
2082 #define TX_THREAD_ENTRY_EXIT_NOTIFY_NOT_USED(a)         ((void)(a))
2083 #endif
2084 
2085 #endif
2086 
2087 
2088 /* Determine if there is an tx_api.h extension file to include.  */
2089 
2090 #ifdef TX_THREAD_API_EXTENSION
2091 
2092 /* Yes, bring in the tx_api.h extension file.  */
2093 #include "tx_api_extension.h"
2094 
2095 #endif
2096 
2097 
2098 /* Define safety critical configuration and exception handling.  */
2099 
2100 #ifdef TX_SAFETY_CRITICAL
2101 
2102 /* Ensure the maximum number of priorities is defined in safety critical mode.  */
2103 #ifndef TX_MAX_PRIORITIES
2104 #error "tx_port.h: TX_MAX_PRIORITIES not defined."
2105 #endif
2106 
2107 /* Ensure the maximum number of priorities is a multiple of 32.  */
2108 #if (TX_MAX_PRIORITIES  %32) != 0
2109 #error "tx_port.h: TX_MAX_PRIORITIES must be a multiple of 32."
2110 #endif
2111 
2112 /* Ensure error checking is enabled.  */
2113 #ifdef TX_DISABLE_ERROR_CHECKING
2114 #error "TX_DISABLE_ERROR_CHECKING must not be defined."
2115 #endif
2116 
2117 /* Ensure timer ISR processing is not defined.  */
2118 #ifdef TX_TIMER_PROCESS_IN_ISR
2119 #error "TX_TIMER_PROCESS_IN_ISR must not be defined."
2120 #endif
2121 
2122 /* Ensure timer reactivation in-line is not defined.  */
2123 #ifdef TX_REACTIVATE_INLINE
2124 #error "TX_REACTIVATE_INLINE must not be defined."
2125 #endif
2126 
2127 /* Ensure disable stack filling is not defined.  */
2128 #ifdef TX_DISABLE_STACK_FILLING
2129 #error "TX_DISABLE_STACK_FILLING must not be defined."
2130 #endif
2131 
2132 /* Ensure enable stack checking is not defined.  */
2133 #ifdef TX_ENABLE_STACK_CHECKING
2134 #error "TX_ENABLE_STACK_CHECKING must not be defined."
2135 #endif
2136 
2137 /* Ensure disable preemption-threshold is not defined.  */
2138 #ifdef TX_DISABLE_PREEMPTION_THRESHOLD
2139 #error "TX_DISABLE_PREEMPTION_THRESHOLD must not be defined."
2140 #endif
2141 
2142 /* Ensure disable redundant clearing is not defined.  */
2143 #ifdef TX_DISABLE_REDUNDANT_CLEARING
2144 #error "TX_DISABLE_REDUNDANT_CLEARING must not be defined."
2145 #endif
2146 
2147 /* Ensure no timer is not defined.  */
2148 #ifdef TX_NO_TIMER
2149 #error "TX_NO_TIMER must not be defined."
2150 #endif
2151 
2152 /* Ensure disable notify callbacks is not defined.  */
2153 #ifdef TX_DISABLE_NOTIFY_CALLBACKS
2154 #error "TX_DISABLE_NOTIFY_CALLBACKS must not be defined."
2155 #endif
2156 
2157 /* Ensure in-line thread suspend/resume is not defined.  */
2158 #ifdef TX_INLINE_THREAD_RESUME_SUSPEND
2159 #error "TX_INLINE_THREAD_RESUME_SUSPEND must not be defined."
2160 #endif
2161 
2162 /* Ensure not interruptable is not defined.  */
2163 #ifdef TX_NOT_INTERRUPTABLE
2164 #error "TX_NOT_INTERRUPTABLE must not be defined."
2165 #endif
2166 
2167 /* Ensure event trace enable is not defined.  */
2168 #ifdef TX_ENABLE_EVENT_TRACE
2169 #error "TX_ENABLE_EVENT_TRACE must not be defined."
2170 #endif
2171 
2172 /* Ensure block pool performance info enable is not defined.  */
2173 #ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
2174 #error "TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO must not be defined."
2175 #endif
2176 
2177 /* Ensure byte pool performance info enable is not defined.  */
2178 #ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
2179 #error "TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO must not be defined."
2180 #endif
2181 
2182 /* Ensure event flag performance info enable is not defined.  */
2183 #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
2184 #error "TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO must not be defined."
2185 #endif
2186 
2187 /* Ensure mutex performance info enable is not defined.   */
2188 #ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO
2189 #error "TX_MUTEX_ENABLE_PERFORMANCE_INFO must not be defined."
2190 #endif
2191 
2192 /* Ensure queue performance info enable is not defined.  */
2193 #ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
2194 #error "TX_QUEUE_ENABLE_PERFORMANCE_INFO must not be defined."
2195 #endif
2196 
2197 /* Ensure semaphore performance info enable is not defined.  */
2198 #ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
2199 #error "TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO must not be defined."
2200 #endif
2201 
2202 /* Ensure thread performance info enable is not defined.  */
2203 #ifdef TX_THREAD_ENABLE_PERFORMANCE_INFO
2204 #error "TX_THREAD_ENABLE_PERFORMANCE_INFO must not be defined."
2205 #endif
2206 
2207 /* Ensure timer performance info enable is not defined.  */
2208 #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO
2209 #error "TX_TIMER_ENABLE_PERFORMANCE_INFO must not be defined."
2210 #endif
2211 
2212 
2213 /* Now define the safety critical exception handler.  */
2214 
2215 VOID    _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status);
2216 
2217 
2218 #ifndef TX_SAFETY_CRITICAL_EXCEPTION
2219 #define TX_SAFETY_CRITICAL_EXCEPTION(a, b, c)   _tx_safety_critical_exception_handler(a, b, c);
2220 #endif
2221 
2222 #ifndef TX_SAFETY_CRITICAL_EXCEPTION_HANDLER
2223 #define TX_SAFETY_CRITICAL_EXCEPTION_HANDLER    VOID  _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status) \
2224                                                 { \
2225                                                     while(1) \
2226                                                     { \
2227                                                     } \
2228                                                 }
2229 #endif
2230 #endif
2231 
2232 
2233 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING
2234 
2235 /* Define ThreadX API MULTI run-time error checking function.  */
2236 void __ghs_rnerr(char *errMsg, int stackLevels, int stackTraceDisplay, void *hexVal);
2237 
2238 #endif
2239 
2240 /* Bring in the event logging constants and prototypes.  Note that
2241    TX_ENABLE_EVENT_LOGGING must be defined when building the ThreadX
2242    library components in order to enable event logging.  */
2243 
2244 #ifdef TX_ENABLE_EVENT_LOGGING
2245 #include "tx_el.h"
2246 #else
2247 #ifndef TX_SOURCE_CODE
2248 #ifndef TX_MISRA_ENABLE
2249 #define _tx_el_user_event_insert(a,b,c,d,e)
2250 #endif
2251 #endif
2252 #define TX_EL_INITIALIZE
2253 #define TX_EL_THREAD_REGISTER(a)
2254 #define TX_EL_THREAD_UNREGISTER(a)
2255 #define TX_EL_THREAD_STATUS_CHANGE_INSERT(a, b)
2256 #define TX_EL_BYTE_ALLOCATE_INSERT
2257 #define TX_EL_BYTE_POOL_CREATE_INSERT
2258 #define TX_EL_BYTE_POOL_DELETE_INSERT
2259 #define TX_EL_BYTE_RELEASE_INSERT
2260 #define TX_EL_BLOCK_ALLOCATE_INSERT
2261 #define TX_EL_BLOCK_POOL_CREATE_INSERT
2262 #define TX_EL_BLOCK_POOL_DELETE_INSERT
2263 #define TX_EL_BLOCK_RELEASE_INSERT
2264 #define TX_EL_EVENT_FLAGS_CREATE_INSERT
2265 #define TX_EL_EVENT_FLAGS_DELETE_INSERT
2266 #define TX_EL_EVENT_FLAGS_GET_INSERT
2267 #define TX_EL_EVENT_FLAGS_SET_INSERT
2268 #define TX_EL_INTERRUPT_CONTROL_INSERT
2269 #define TX_EL_QUEUE_CREATE_INSERT
2270 #define TX_EL_QUEUE_DELETE_INSERT
2271 #define TX_EL_QUEUE_FLUSH_INSERT
2272 #define TX_EL_QUEUE_RECEIVE_INSERT
2273 #define TX_EL_QUEUE_SEND_INSERT
2274 #define TX_EL_SEMAPHORE_CREATE_INSERT
2275 #define TX_EL_SEMAPHORE_DELETE_INSERT
2276 #define TX_EL_SEMAPHORE_GET_INSERT
2277 #define TX_EL_SEMAPHORE_PUT_INSERT
2278 #define TX_EL_THREAD_CREATE_INSERT
2279 #define TX_EL_THREAD_DELETE_INSERT
2280 #define TX_EL_THREAD_IDENTIFY_INSERT
2281 #define TX_EL_THREAD_PREEMPTION_CHANGE_INSERT
2282 #define TX_EL_THREAD_PRIORITY_CHANGE_INSERT
2283 #define TX_EL_THREAD_RELINQUISH_INSERT
2284 #define TX_EL_THREAD_RESUME_INSERT
2285 #define TX_EL_THREAD_SLEEP_INSERT
2286 #define TX_EL_THREAD_SUSPEND_INSERT
2287 #define TX_EL_THREAD_TERMINATE_INSERT
2288 #define TX_EL_THREAD_TIME_SLICE_CHANGE_INSERT
2289 #define TX_EL_TIME_GET_INSERT
2290 #define TX_EL_TIME_SET_INSERT
2291 #define TX_EL_TIMER_ACTIVATE_INSERT
2292 #define TX_EL_TIMER_CHANGE_INSERT
2293 #define TX_EL_TIMER_CREATE_INSERT
2294 #define TX_EL_TIMER_DEACTIVATE_INSERT
2295 #define TX_EL_TIMER_DELETE_INSERT
2296 #define TX_EL_BLOCK_POOL_INFO_GET_INSERT
2297 #define TX_EL_BLOCK_POOL_PRIORITIZE_INSERT
2298 #define TX_EL_BYTE_POOL_INFO_GET_INSERT
2299 #define TX_EL_BYTE_POOL_PRIORITIZE_INSERT
2300 #define TX_EL_EVENT_FLAGS_INFO_GET_INSERT
2301 #define TX_EL_MUTEX_CREATE_INSERT
2302 #define TX_EL_MUTEX_DELETE_INSERT
2303 #define TX_EL_MUTEX_GET_INSERT
2304 #define TX_EL_MUTEX_INFO_GET_INSERT
2305 #define TX_EL_MUTEX_PRIORITIZE_INSERT
2306 #define TX_EL_MUTEX_PUT_INSERT
2307 #define TX_EL_QUEUE_INFO_GET_INSERT
2308 #define TX_EL_QUEUE_FRONT_SEND_INSERT
2309 #define TX_EL_QUEUE_PRIORITIZE_INSERT
2310 #define TX_EL_SEMAPHORE_INFO_GET_INSERT
2311 #define TX_EL_SEMAPHORE_PRIORITIZE_INSERT
2312 #define TX_EL_THREAD_INFO_GET_INSERT
2313 #define TX_EL_THREAD_WAIT_ABORT_INSERT
2314 #define TX_EL_TIMER_INFO_GET_INSERT
2315 #define TX_EL_BLOCK_POOL_PERFORMANCE_INFO_GET_INSERT
2316 #define TX_EL_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET_INSERT
2317 #define TX_EL_BYTE_POOL_PERFORMANCE_INFO_GET_INSERT
2318 #define TX_EL_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET_INSERT
2319 #define TX_EL_EVENT_FLAGS_PERFORMANCE_INFO_GET_INSERT
2320 #define TX_EL_EVENT_FLAGS__PERFORMANCE_SYSTEM_INFO_GET_INSERT
2321 #define TX_EL_EVENT_FLAGS_SET_NOTIFY_INSERT
2322 #define TX_EL_MUTEX_PERFORMANCE_INFO_GET_INSERT
2323 #define TX_EL_MUTEX_PERFORMANCE_SYSTEM_INFO_GET_INSERT
2324 #define TX_EL_QUEUE_PERFORMANCE_INFO_GET_INSERT
2325 #define TX_EL_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_INSERT
2326 #define TX_EL_QUEUE_SEND_NOTIFY_INSERT
2327 #define TX_EL_SEMAPHORE_CEILING_PUT_INSERT
2328 #define TX_EL_SEMAPHORE_PERFORMANCE_INFO_GET_INSERT
2329 #define TX_EL_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET_INSERT
2330 #define TX_EL_SEMAPHORE_PUT_NOTIFY_INSERT
2331 #define TX_EL_THREAD_ENTRY_EXIT_NOTIFY_INSERT
2332 #define TX_EL_THREAD_RESET_INSERT
2333 #define TX_EL_THREAD_PERFORMANCE_INFO_GET_INSERT
2334 #define TX_EL_THREAD_PERFORMANCE_SYSTEM_INFO_GET_INSERT
2335 #define TX_EL_THREAD_STACK_ERROR_NOTIFY_INSERT
2336 #define TX_EL_TIMER_PERFORMANCE_INFO_GET_INSERT
2337 #define TX_EL_TIMER_PERFORMANCE_SYSTEM_INFO_GET_INSERT
2338 
2339 #endif
2340 
2341 /* Define the get system state macro. By default, it simply maps to the variable _tx_thread_system_state.  */
2342 /* Note that prior to Azure RTOS 6.1, this symbol was defined in tx_thread.h. */
2343 #ifndef TX_THREAD_GET_SYSTEM_STATE
2344 #define TX_THREAD_GET_SYSTEM_STATE()        _tx_thread_system_state
2345 #endif
2346 
2347 
2348 
2349 
2350 /* Determine if a C++ compiler is being used.  If so, complete the standard
2351    C conditional started above.  */
2352 #ifdef __cplusplus
2353         }
2354 #endif
2355 
2356 #endif
2357 
2358