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