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