-
Notifications
You must be signed in to change notification settings - Fork 925
Expand file tree
/
Copy pathtx_api.h
More file actions
2331 lines (1874 loc) · 114 KB
/
tx_api.h
File metadata and controls
2331 lines (1874 loc) · 114 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
* Copyright (c) 2026-present Eclipse ThreadX contributors
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Application Interface (API) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* tx_api.h PORTABLE C */
/* 6.4.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the basic Application Interface (API) to the */
/* high-performance ThreadX real-time kernel. All service prototypes */
/* and data structure definitions are defined in this file. */
/* Please note that basic data type definitions and other architecture-*/
/* specific information is contained in the file tx_port.h. */
/* */
/**************************************************************************/
#ifndef TX_API_H
#define TX_API_H
/* Determine if a C++ compiler is being used. If so, ensure that standard
C is used to process the API information. */
#ifdef __cplusplus
/* Yes, C++ compiler is present. Use standard C. */
extern "C" {
#endif
/* Disable warning of parameter not used. */
#ifndef TX_PARAMETER_NOT_USED
#define TX_PARAMETER_NOT_USED(p) ((void)(p))
#endif /* TX_PARAMETER_NOT_USED */
/* Include the port-specific data type file. */
#include "tx_port.h"
#if (defined(TX_EXECUTION_PROFILE_ENABLE) && !defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY))
#include "tx_execution_profile.h"
#endif
/* Define basic constants for the ThreadX kernel. */
/* Define the major/minor version information that can be used by the application
and the ThreadX source as well. */
#define AZURE_RTOS_THREADX
#define THREADX_MAJOR_VERSION 6
#define THREADX_MINOR_VERSION 5
#define THREADX_PATCH_VERSION 0
#define THREADX_BUILD_VERSION 202601
#define THREADX_HOTFIX_VERSION ' '
/* Define the following symbol for backward compatibility */
#define EL_PRODUCT_THREADX
/* API input parameters and general constants. */
#define TX_NO_WAIT ((ULONG) 0)
#define TX_WAIT_FOREVER ((ULONG) 0xFFFFFFFFUL)
#define TX_AND ((UINT) 2)
#define TX_AND_CLEAR ((UINT) 3)
#define TX_OR ((UINT) 0)
#define TX_OR_CLEAR ((UINT) 1)
#define TX_1_ULONG ((UINT) 1)
#define TX_2_ULONG ((UINT) 2)
#define TX_4_ULONG ((UINT) 4)
#define TX_8_ULONG ((UINT) 8)
#define TX_16_ULONG ((UINT) 16)
#define TX_NO_TIME_SLICE ((ULONG) 0)
#define TX_AUTO_START ((UINT) 1)
#define TX_DONT_START ((UINT) 0)
#define TX_AUTO_ACTIVATE ((UINT) 1)
#define TX_NO_ACTIVATE ((UINT) 0)
#define TX_TRUE ((UINT) 1)
#define TX_FALSE ((UINT) 0)
#define TX_NULL ((void *) 0)
#define TX_INHERIT ((UINT) 1)
#define TX_NO_INHERIT ((UINT) 0)
#define TX_THREAD_ENTRY ((UINT) 0)
#define TX_THREAD_EXIT ((UINT) 1)
#define TX_NO_SUSPENSIONS ((UINT) 0)
#define TX_NO_MESSAGES ((UINT) 0)
#define TX_EMPTY ((ULONG) 0)
#define TX_CLEAR_ID ((ULONG) 0)
#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
#define TX_STACK_FILL (thread_ptr -> tx_thread_stack_fill_value)
#else
#define TX_STACK_FILL ((ULONG) 0xEFEFEFEFUL)
#endif
/* Thread execution state values. */
#define TX_READY ((UINT) 0)
#define TX_COMPLETED ((UINT) 1)
#define TX_TERMINATED ((UINT) 2)
#define TX_SUSPENDED ((UINT) 3)
#define TX_SLEEP ((UINT) 4)
#define TX_QUEUE_SUSP ((UINT) 5)
#define TX_SEMAPHORE_SUSP ((UINT) 6)
#define TX_EVENT_FLAG ((UINT) 7)
#define TX_BLOCK_MEMORY ((UINT) 8)
#define TX_BYTE_MEMORY ((UINT) 9)
#define TX_IO_DRIVER ((UINT) 10)
#define TX_FILE ((UINT) 11)
#define TX_TCP_IP ((UINT) 12)
#define TX_MUTEX_SUSP ((UINT) 13)
#define TX_PRIORITY_CHANGE ((UINT) 14)
/* API return values. */
#define TX_SUCCESS ((UINT) 0x00)
#define TX_DELETED ((UINT) 0x01)
#define TX_POOL_ERROR ((UINT) 0x02)
#define TX_PTR_ERROR ((UINT) 0x03)
#define TX_WAIT_ERROR ((UINT) 0x04)
#define TX_SIZE_ERROR ((UINT) 0x05)
#define TX_GROUP_ERROR ((UINT) 0x06)
#define TX_NO_EVENTS ((UINT) 0x07)
#define TX_OPTION_ERROR ((UINT) 0x08)
#define TX_QUEUE_ERROR ((UINT) 0x09)
#define TX_QUEUE_EMPTY ((UINT) 0x0A)
#define TX_QUEUE_FULL ((UINT) 0x0B)
#define TX_SEMAPHORE_ERROR ((UINT) 0x0C)
#define TX_NO_INSTANCE ((UINT) 0x0D)
#define TX_THREAD_ERROR ((UINT) 0x0E)
#define TX_PRIORITY_ERROR ((UINT) 0x0F)
#define TX_NO_MEMORY ((UINT) 0x10)
#define TX_START_ERROR ((UINT) 0x10)
#define TX_DELETE_ERROR ((UINT) 0x11)
#define TX_RESUME_ERROR ((UINT) 0x12)
#define TX_CALLER_ERROR ((UINT) 0x13)
#define TX_SUSPEND_ERROR ((UINT) 0x14)
#define TX_TIMER_ERROR ((UINT) 0x15)
#define TX_TICK_ERROR ((UINT) 0x16)
#define TX_ACTIVATE_ERROR ((UINT) 0x17)
#define TX_THRESH_ERROR ((UINT) 0x18)
#define TX_SUSPEND_LIFTED ((UINT) 0x19)
#define TX_WAIT_ABORTED ((UINT) 0x1A)
#define TX_WAIT_ABORT_ERROR ((UINT) 0x1B)
#define TX_MUTEX_ERROR ((UINT) 0x1C)
#define TX_NOT_AVAILABLE ((UINT) 0x1D)
#define TX_NOT_OWNED ((UINT) 0x1E)
#define TX_INHERIT_ERROR ((UINT) 0x1F)
#define TX_NOT_DONE ((UINT) 0x20)
#define TX_CEILING_EXCEEDED ((UINT) 0x21)
#define TX_INVALID_CEILING ((UINT) 0x22)
#define TX_FEATURE_NOT_ENABLED ((UINT) 0xFF)
#ifdef TX_64_BIT
#ifndef TX_THREAD_EXTENSION_PTR_SET
#define TX_THREAD_EXTENSION_PTR_SET(a, b) { \
TX_THREAD *thread_ptr; \
thread_ptr = (TX_THREAD *) (a); \
(thread_ptr -> tx_thread_extension_ptr) = (VOID *)(b); \
}
#endif /* TX_THREAD_EXTENSION_PTR_SET */
#ifndef TX_THREAD_EXTENSION_PTR_GET
#define TX_THREAD_EXTENSION_PTR_GET(a, b, c) { \
TX_PARAMETER_NOT_USED(c); \
TX_THREAD *thread_ptr; \
thread_ptr = tx_thread_identify(); \
while(1)\
{ \
if (thread_ptr -> tx_thread_extension_ptr) \
{ \
(a) = (b *)(thread_ptr -> tx_thread_extension_ptr); \
break; \
} \
tx_thread_sleep(1); \
} \
}
#endif /* TX_THREAD_EXTENSION_PTR_GET */
#ifndef TX_TIMER_EXTENSION_PTR_SET
#define TX_TIMER_EXTENSION_PTR_SET(a, b) { \
TX_TIMER *timer_ptr; \
timer_ptr = (TX_TIMER *) (a); \
(timer_ptr -> tx_timer_internal.tx_timer_internal_extension_ptr) = (VOID *)(b); \
}
#endif /* TX_TIMER_EXTENSION_PTR_SET */
#ifndef TX_TIMER_EXTENSION_PTR_GET
#define TX_TIMER_EXTENSION_PTR_GET(a, b, c) { \
TX_PARAMETER_NOT_USED(c); \
if (!_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr) \
return; \
(a) = (b *)(_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr); \
}
#endif /* TX_TIMER_EXTENSION_PTR_GET */
#else /* not 64 bit */
#ifndef TX_THREAD_EXTENSION_PTR_SET
#define TX_THREAD_EXTENSION_PTR_SET(a, b)
#endif /* TX_THREAD_EXTENSION_PTR_SET */
#ifndef TX_THREAD_EXTENSION_PTR_GET
#define TX_THREAD_EXTENSION_PTR_GET(a, b, c) { \
(a) = (b *)(c); \
}
#endif /* TX_THREAD_EXTENSION_PTR_GET */
#ifndef TX_TIMER_EXTENSION_PTR_SET
#define TX_TIMER_EXTENSION_PTR_SET(a, b)
#endif /* TX_TIMER_EXTENSION_PTR_SET */
#ifndef TX_TIMER_EXTENSION_PTR_GET
#define TX_TIMER_EXTENSION_PTR_GET(a, b, c) { \
(a) = (b *)(c); \
}
#endif /* TX_TIMER_EXTENSION_PTR_GET */
#endif /* TX_64_BIT */
/* Define the common timer tick reference for use by other middleware components. The default
value is 10ms, but may be replaced by a port specific version in tx_port.h or by the user
as a compilation option. */
#ifndef TX_TIMER_TICKS_PER_SECOND
#define TX_TIMER_TICKS_PER_SECOND (100UL)
#endif
/* Define the default maximum message size in a queue. The default value is TX_16_ULONG, but may
be customized in tx_user.h or as a compilation option. */
#ifndef TX_QUEUE_MESSAGE_MAX_SIZE
#define TX_QUEUE_MESSAGE_MAX_SIZE TX_16_ULONG
#endif
/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are:
ThreadX events: 1-199
FileX events: 200-299
NetX events: 300-599
USBX events: 600-999
GUIX events: 1000-1500
User-defined event numbers start at 4096 and continue through 65535, as defined by the constants
TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based
on these constants in case the user event number assignment is changed in future releases. */
#define TX_TRACE_USER_EVENT_START 4096 /* I1, I2, I3, I4 are user defined */
#define TX_TRACE_USER_EVENT_END 65535 /* I1, I2, I3, I4 are user defined */
/* Define event filters that can be used to selectively disable certain events or groups of events. */
#define TX_TRACE_ALL_EVENTS 0x000007FF /* All ThreadX events */
#define TX_TRACE_INTERNAL_EVENTS 0x00000001 /* ThreadX internal events */
#define TX_TRACE_BLOCK_POOL_EVENTS 0x00000002 /* ThreadX Block Pool events */
#define TX_TRACE_BYTE_POOL_EVENTS 0x00000004 /* ThreadX Byte Pool events */
#define TX_TRACE_EVENT_FLAGS_EVENTS 0x00000008 /* ThreadX Event Flags events */
#define TX_TRACE_INTERRUPT_CONTROL_EVENT 0x00000010 /* ThreadX Interrupt Control events */
#define TX_TRACE_MUTEX_EVENTS 0x00000020 /* ThreadX Mutex events */
#define TX_TRACE_QUEUE_EVENTS 0x00000040 /* ThreadX Queue events */
#define TX_TRACE_SEMAPHORE_EVENTS 0x00000080 /* ThreadX Semaphore events */
#define TX_TRACE_THREAD_EVENTS 0x00000100 /* ThreadX Thread events */
#define TX_TRACE_TIME_EVENTS 0x00000200 /* ThreadX Time events */
#define TX_TRACE_TIMER_EVENTS 0x00000400 /* ThreadX Timer events */
#define TX_TRACE_USER_EVENTS 0x80000000UL /* ThreadX User Events */
/* Define basic alignment type used in block and byte pool operations. This data type must
be at least 32-bits in size and also be large enough to hold a pointer type. */
#ifndef ALIGN_TYPE_DEFINED
#define ALIGN_TYPE ULONG
#endif
/* Define the control block definitions for all system objects. */
/* Define the basic timer management structures. These are the structures
used to manage thread sleep, timeout, and user timer requests. */
/* Determine if the internal timer control block has an extension defined. If not,
define the extension to whitespace. */
#ifndef TX_TIMER_INTERNAL_EXTENSION
#define TX_TIMER_INTERNAL_EXTENSION
#endif
/* Define the common internal timer control block. */
typedef struct TX_TIMER_INTERNAL_STRUCT
{
/* Define the remaining ticks and re-initialization tick values. */
ULONG tx_timer_internal_remaining_ticks;
ULONG tx_timer_internal_re_initialize_ticks;
/* Define the timeout function and timeout function parameter. */
VOID (*tx_timer_internal_timeout_function)(ULONG id);
ULONG tx_timer_internal_timeout_param;
/* Define the next and previous internal link pointers for active
internal timers. */
struct TX_TIMER_INTERNAL_STRUCT
*tx_timer_internal_active_next,
*tx_timer_internal_active_previous;
/* Keep track of the pointer to the head of this list as well. */
struct TX_TIMER_INTERNAL_STRUCT
**tx_timer_internal_list_head;
/* Define optional extension to internal timer control block. */
TX_TIMER_INTERNAL_EXTENSION
} TX_TIMER_INTERNAL;
/* Determine if the timer control block has an extension defined. If not,
define the extension to whitespace. */
#ifndef TX_TIMER_EXTENSION
#define TX_TIMER_EXTENSION
#endif
/* Define the timer structure utilized by the application. */
typedef struct TX_TIMER_STRUCT
{
/* Define the timer ID used for error checking. */
ULONG tx_timer_id;
/* Define the timer's name. */
CHAR *tx_timer_name;
/* Define the actual contents of the timer. This is the block that
is used in the actual timer expiration processing. */
TX_TIMER_INTERNAL tx_timer_internal;
/* Define the pointers for the created list. */
struct TX_TIMER_STRUCT
*tx_timer_created_next,
*tx_timer_created_previous;
/* Define optional extension to timer control block. */
TX_TIMER_EXTENSION
#ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO
/* Define the number of timer activations. */
ULONG tx_timer_performance_activate_count;
/* Define the number of timer reactivations. */
ULONG tx_timer_performance_reactivate_count;
/* Define the number of timer deactivations. */
ULONG tx_timer_performance_deactivate_count;
/* Define the number of timer expirations. */
ULONG tx_timer_performance_expiration_count;
/* Define the total number of timer expiration adjustments. */
ULONG tx_timer_performance__expiration_adjust_count;
#endif
} TX_TIMER;
/* ThreadX thread control block structure follows. Additional fields
can be added providing they are added after the information that is
referenced in the port-specific assembly code. */
typedef struct TX_THREAD_STRUCT
{
/* The first section of the control block contains critical
information that is referenced by the port-specific
assembly language code. Any changes in this section could
necessitate changes in the assembly language. */
ULONG tx_thread_id; /* Control block ID */
ULONG tx_thread_run_count; /* Thread's run counter */
VOID *tx_thread_stack_ptr; /* Thread's stack pointer */
VOID *tx_thread_stack_start; /* Stack starting address */
VOID *tx_thread_stack_end; /* Stack ending address */
ULONG tx_thread_stack_size; /* Stack size */
ULONG tx_thread_time_slice; /* Current time-slice */
ULONG tx_thread_new_time_slice; /* New time-slice */
/* Define pointers to the next and previous ready threads. */
struct TX_THREAD_STRUCT
*tx_thread_ready_next,
*tx_thread_ready_previous;
/***************************************************************/
/* Define the first port extension in the thread control block. This
is typically defined to whitespace or a pointer type in tx_port.h. */
TX_THREAD_EXTENSION_0
CHAR *tx_thread_name; /* Pointer to thread's name */
UINT tx_thread_priority; /* Priority of thread (0-1023) */
UINT tx_thread_state; /* Thread's execution state */
UINT tx_thread_delayed_suspend; /* Delayed suspend flag */
UINT tx_thread_suspending; /* Thread suspending flag */
UINT tx_thread_preempt_threshold; /* Preemption threshold */
/* Define the thread schedule hook. The usage of this is port/application specific,
but when used, the function pointer designated is called whenever the thread is
scheduled and unscheduled. */
VOID (*tx_thread_schedule_hook)(struct TX_THREAD_STRUCT *thread_ptr, ULONG id);
/* Nothing after this point is referenced by the target-specific
assembly language. Hence, information after this point can
be added to the control block providing the complete system
is recompiled. */
/* Define the thread's entry point and input parameter. */
VOID (*tx_thread_entry)(ULONG id);
ULONG tx_thread_entry_parameter;
/* Define the thread's timer block. This is used for thread
sleep and timeout requests. */
TX_TIMER_INTERNAL tx_thread_timer;
/* Define the thread's cleanup function and associated data. This
is used to cleanup various data structures when a thread
suspension is lifted or terminated either by the user or
a timeout. */
VOID (*tx_thread_suspend_cleanup)(struct TX_THREAD_STRUCT *thread_ptr, ULONG suspension_sequence);
VOID *tx_thread_suspend_control_block;
struct TX_THREAD_STRUCT
*tx_thread_suspended_next,
*tx_thread_suspended_previous;
ULONG tx_thread_suspend_info;
VOID *tx_thread_additional_suspend_info;
UINT tx_thread_suspend_option;
UINT tx_thread_suspend_status;
/* Define the second port extension in the thread control block. This
is typically defined to whitespace or a pointer type in tx_port.h. */
TX_THREAD_EXTENSION_1
/* Define pointers to the next and previous threads in the
created list. */
struct TX_THREAD_STRUCT
*tx_thread_created_next,
*tx_thread_created_previous;
/* Define the third port extension in the thread control block. This
is typically defined to whitespace in tx_port.h. */
TX_THREAD_EXTENSION_2
/* Define a pointer type for FileX extensions. */
#ifndef TX_NO_FILEX_POINTER
VOID *tx_thread_filex_ptr;
#endif
/* Define the priority inheritance variables. These will be used
to manage priority inheritance changes applied to this thread
as a result of mutex get operations. */
UINT tx_thread_user_priority;
UINT tx_thread_user_preempt_threshold;
UINT tx_thread_inherit_priority;
/* Define the owned mutex count and list head pointer. */
UINT tx_thread_owned_mutex_count;
struct TX_MUTEX_STRUCT
*tx_thread_owned_mutex_list;
#ifdef TX_THREAD_ENABLE_PERFORMANCE_INFO
/* Define the number of times this thread is resumed. */
ULONG tx_thread_performance_resume_count;
/* Define the number of times this thread suspends. */
ULONG tx_thread_performance_suspend_count;
/* Define the number of times this thread is preempted by calling
a ThreadX API service. */
ULONG tx_thread_performance_solicited_preemption_count;
/* Define the number of times this thread is preempted by an
ISR calling a ThreadX API service. */
ULONG tx_thread_performance_interrupt_preemption_count;
/* Define the number of priority inversions for this thread. */
ULONG tx_thread_performance_priority_inversion_count;
/* Define the last thread pointer to preempt this thread. */
struct TX_THREAD_STRUCT
*tx_thread_performance_last_preempting_thread;
/* Define the total number of times this thread was time-sliced. */
ULONG tx_thread_performance_time_slice_count;
/* Define the total number of times this thread relinquishes. */
ULONG tx_thread_performance_relinquish_count;
/* Define the total number of times this thread had a timeout. */
ULONG tx_thread_performance_timeout_count;
/* Define the total number of times this thread had suspension lifted
because of the tx_thread_wait_abort service. */
ULONG tx_thread_performance_wait_abort_count;
#endif
/* Define the highest stack pointer variable. */
VOID *tx_thread_stack_highest_ptr; /* Stack highest usage pointer */
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
/* Define the application callback routine used to notify the application when
the thread is entered or exits. */
VOID (*tx_thread_entry_exit_notify)(struct TX_THREAD_STRUCT *thread_ptr, UINT type);
#endif
/* Define the fourth port extension in the thread control block. This
is typically defined to whitespace in tx_port.h. */
TX_THREAD_EXTENSION_3
/* Define variables for supporting execution profile. */
/* Note that in ThreadX 5.x, user would define TX_ENABLE_EXECUTION_CHANGE_NOTIFY and use TX_THREAD_EXTENSION_3
to define the following two variables.
For Azure RTOS 6, user shall use TX_EXECUTION_PROFILE_ENABLE instead of TX_ENABLE_EXECUTION_CHANGE_NOTIFY,
and SHALL NOT add variables to TX_THREAD_EXTENSION_3. */
#if (defined(TX_EXECUTION_PROFILE_ENABLE) && !defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY))
EXECUTION_TIME tx_thread_execution_time_total;
EXECUTION_TIME_SOURCE_TYPE tx_thread_execution_time_last_start;
#endif
/* Define suspension sequence number. This is used to ensure suspension is still valid when
cleanup routine executes. */
ULONG tx_thread_suspension_sequence;
#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
/* Define the random stack fill number. This can be used to detect stack overflow. */
ULONG tx_thread_stack_fill_value;
#endif
/* Define the user extension field. This typically is defined
to white space, but some ports of ThreadX may need to have
additional fields in the thread control block. This is
defined in the file tx_port.h. */
TX_THREAD_USER_EXTENSION
} TX_THREAD;
/* Define the block memory pool structure utilized by the application. */
typedef struct TX_BLOCK_POOL_STRUCT
{
/* Define the block pool ID used for error checking. */
ULONG tx_block_pool_id;
/* Define the block pool's name. */
CHAR *tx_block_pool_name;
/* Define the number of available memory blocks in the pool. */
UINT tx_block_pool_available;
/* Save the initial number of blocks. */
UINT tx_block_pool_total;
/* Define the head pointer of the available block pool. */
UCHAR *tx_block_pool_available_list;
/* Save the start address of the block pool's memory area. */
UCHAR *tx_block_pool_start;
/* Save the block pool's size in bytes. */
ULONG tx_block_pool_size;
/* Save the individual memory block size - rounded for alignment. */
UINT tx_block_pool_block_size;
/* Define the block pool suspension list head along with a count of
how many threads are suspended. */
struct TX_THREAD_STRUCT
*tx_block_pool_suspension_list;
UINT tx_block_pool_suspended_count;
/* Define the created list next and previous pointers. */
struct TX_BLOCK_POOL_STRUCT
*tx_block_pool_created_next,
*tx_block_pool_created_previous;
#ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
/* Define the number of block allocates. */
ULONG tx_block_pool_performance_allocate_count;
/* Define the number of block releases. */
ULONG tx_block_pool_performance_release_count;
/* Define the number of block pool suspensions. */
ULONG tx_block_pool_performance_suspension_count;
/* Define the number of block pool timeouts. */
ULONG tx_block_pool_performance_timeout_count;
#endif
/* Define the port extension in the block pool control block. This
is typically defined to whitespace in tx_port.h. */
TX_BLOCK_POOL_EXTENSION
} TX_BLOCK_POOL;
/* Determine if the byte allocate extension is defined. If not, define the
extension to whitespace. */
#ifndef TX_BYTE_ALLOCATE_EXTENSION
#define TX_BYTE_ALLOCATE_EXTENSION
#endif
/* Determine if the byte release extension is defined. If not, define the
extension to whitespace. */
#ifndef TX_BYTE_RELEASE_EXTENSION
#define TX_BYTE_RELEASE_EXTENSION
#endif
/* Define the byte memory pool structure utilized by the application. */
typedef struct TX_BYTE_POOL_STRUCT
{
/* Define the byte pool ID used for error checking. */
ULONG tx_byte_pool_id;
/* Define the byte pool's name. */
CHAR *tx_byte_pool_name;
/* Define the number of available bytes in the pool. */
ULONG tx_byte_pool_available;
/* Define the number of fragments in the pool. */
UINT tx_byte_pool_fragments;
/* Define the head pointer of byte pool. */
UCHAR *tx_byte_pool_list;
/* Define the search pointer used for initial searching for memory
in a byte pool. */
UCHAR *tx_byte_pool_search;
/* Save the start address of the byte pool's memory area. */
UCHAR *tx_byte_pool_start;
/* Save the byte pool's size in bytes. */
ULONG tx_byte_pool_size;
/* This is used to mark the owner of the byte memory pool during
a search. If this value changes during the search, the local search
pointer must be reset. */
struct TX_THREAD_STRUCT
*tx_byte_pool_owner;
/* Define the byte pool suspension list head along with a count of
how many threads are suspended. */
struct TX_THREAD_STRUCT
*tx_byte_pool_suspension_list;
UINT tx_byte_pool_suspended_count;
/* Define the created list next and previous pointers. */
struct TX_BYTE_POOL_STRUCT
*tx_byte_pool_created_next,
*tx_byte_pool_created_previous;
#ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
/* Define the number of allocates. */
ULONG tx_byte_pool_performance_allocate_count;
/* Define the number of releases. */
ULONG tx_byte_pool_performance_release_count;
/* Define the number of adjacent memory fragment merges. */
ULONG tx_byte_pool_performance_merge_count;
/* Define the number of memory fragment splits. */
ULONG tx_byte_pool_performance_split_count;
/* Define the number of memory fragments searched that either were not free or could not satisfy the
request. */
ULONG tx_byte_pool_performance_search_count;
/* Define the number of byte pool suspensions. */
ULONG tx_byte_pool_performance_suspension_count;
/* Define the number of byte pool timeouts. */
ULONG tx_byte_pool_performance_timeout_count;
#endif
/* Define the port extension in the byte pool control block. This
is typically defined to whitespace in tx_port.h. */
TX_BYTE_POOL_EXTENSION
} TX_BYTE_POOL;
/* Define the event flags group structure utilized by the application. */
typedef struct TX_EVENT_FLAGS_GROUP_STRUCT
{
/* Define the event flags group ID used for error checking. */
ULONG tx_event_flags_group_id;
/* Define the event flags group's name. */
CHAR *tx_event_flags_group_name;
/* Define the actual current event flags in this group. A zero in a
particular bit indicates the event flag is not set. */
ULONG tx_event_flags_group_current;
/* Define the reset search flag that is set when an ISR sets flags during
the search of the suspended threads list. */
UINT tx_event_flags_group_reset_search;
/* Define the event flags group suspension list head along with a count of
how many threads are suspended. */
struct TX_THREAD_STRUCT
*tx_event_flags_group_suspension_list;
UINT tx_event_flags_group_suspended_count;
/* Define the created list next and previous pointers. */
struct TX_EVENT_FLAGS_GROUP_STRUCT
*tx_event_flags_group_created_next,
*tx_event_flags_group_created_previous;
/* Define the delayed clearing event flags. */
ULONG tx_event_flags_group_delayed_clear;
#ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
/* Define the number of event flag sets. */
ULONG tx_event_flags_group_performance_set_count;
/* Define the number of event flag gets. */
ULONG tx_event_flags_group__performance_get_count;
/* Define the number of event flag suspensions. */
ULONG tx_event_flags_group___performance_suspension_count;
/* Define the number of event flag timeouts. */
ULONG tx_event_flags_group____performance_timeout_count;
#endif
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
/* Define the application callback routine used to notify the application when
an event flag is set. */
VOID (*tx_event_flags_group_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *group_ptr);
#endif
/* Define the port extension in the event flags group control block. This
is typically defined to whitespace in tx_port.h. */
TX_EVENT_FLAGS_GROUP_EXTENSION
} TX_EVENT_FLAGS_GROUP;
/* Determine if the mutex put extension 1 is defined. If not, define the
extension to whitespace. */
#ifndef TX_MUTEX_PUT_EXTENSION_1
#define TX_MUTEX_PUT_EXTENSION_1
#endif
/* Determine if the mutex put extension 2 is defined. If not, define the
extension to whitespace. */
#ifndef TX_MUTEX_PUT_EXTENSION_2
#define TX_MUTEX_PUT_EXTENSION_2
#endif
/* Determine if the mutex priority change extension is defined. If not, define the
extension to whitespace. */
#ifndef TX_MUTEX_PRIORITY_CHANGE_EXTENSION
#define TX_MUTEX_PRIORITY_CHANGE_EXTENSION
#endif
/* Define the mutex structure utilized by the application. */
typedef struct TX_MUTEX_STRUCT
{
/* Define the mutex ID used for error checking. */
ULONG tx_mutex_id;
/* Define the mutex's name. */
CHAR *tx_mutex_name;
/* Define the mutex ownership count. */
UINT tx_mutex_ownership_count;
/* Define the mutex ownership pointer. This pointer points to the
the thread that owns the mutex. */
TX_THREAD *tx_mutex_owner;
/* Define the priority inheritance flag. If this flag is set, priority
inheritance will be in effect. */
UINT tx_mutex_inherit;
/* Define the save area for the owning thread's original priority. */
UINT tx_mutex_original_priority;
/* Define the mutex suspension list head along with a count of
how many threads are suspended. */
struct TX_THREAD_STRUCT
*tx_mutex_suspension_list;
UINT tx_mutex_suspended_count;
/* Define the created list next and previous pointers. */
struct TX_MUTEX_STRUCT
*tx_mutex_created_next,
*tx_mutex_created_previous;
/* Define the priority of the highest priority thread waiting for
this mutex. */
UINT tx_mutex_highest_priority_waiting;
/* Define the owned list next and previous pointers. */
struct TX_MUTEX_STRUCT
*tx_mutex_owned_next,
*tx_mutex_owned_previous;
#ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO
/* Define the number of mutex puts. */
ULONG tx_mutex_performance_put_count;
/* Define the total number of mutex gets. */
ULONG tx_mutex_performance_get_count;
/* Define the total number of mutex suspensions. */
ULONG tx_mutex_performance_suspension_count;
/* Define the total number of mutex timeouts. */
ULONG tx_mutex_performance_timeout_count;
/* Define the total number of priority inversions. */
ULONG tx_mutex_performance_priority_inversion_count;
/* Define the total number of priority inheritance conditions. */
ULONG tx_mutex_performance__priority_inheritance_count;
#endif
/* Define the port extension in the mutex control block. This
is typically defined to whitespace in tx_port.h. */
TX_MUTEX_EXTENSION
} TX_MUTEX;
/* Define the queue structure utilized by the application. */
typedef struct TX_QUEUE_STRUCT
{
/* Define the queue ID used for error checking. */
ULONG tx_queue_id;
/* Define the queue's name. */
CHAR *tx_queue_name;
/* Define the message size that was specified in queue creation. */
UINT tx_queue_message_size;
/* Define the total number of messages in the queue. */
UINT tx_queue_capacity;
/* Define the current number of messages enqueued and the available
queue storage space. */
UINT tx_queue_enqueued;
UINT tx_queue_available_storage;
/* Define pointers that represent the start and end for the queue's
message area. */
ULONG *tx_queue_start;
ULONG *tx_queue_end;
/* Define the queue read and write pointers. Send requests use the write
pointer while receive requests use the read pointer. */
ULONG *tx_queue_read;
ULONG *tx_queue_write;
/* Define the queue suspension list head along with a count of
how many threads are suspended. */
struct TX_THREAD_STRUCT
*tx_queue_suspension_list;
UINT tx_queue_suspended_count;
/* Define the created list next and previous pointers. */
struct TX_QUEUE_STRUCT
*tx_queue_created_next,
*tx_queue_created_previous;
#ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
/* Define the number of messages sent to this queue. */
ULONG tx_queue_performance_messages_sent_count;
/* Define the number of messages received from this queue. */
ULONG tx_queue_performance_messages_received_count;
/* Define the number of empty suspensions on this queue. */
ULONG tx_queue_performance_empty_suspension_count;
/* Define the number of full suspensions on this queue. */
ULONG tx_queue_performance_full_suspension_count;
/* Define the number of full non-suspensions on this queue. These
messages are rejected with an appropriate error code. */
ULONG tx_queue_performance_full_error_count;
/* Define the number of queue timeouts. */
ULONG tx_queue_performance_timeout_count;
#endif
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
/* Define the application callback routine used to notify the application when
the a message is sent to the queue. */
VOID (*tx_queue_send_notify)(struct TX_QUEUE_STRUCT *queue_ptr);
#endif
/* Define the port extension in the queue control block. This
is typically defined to whitespace in tx_port.h. */
TX_QUEUE_EXTENSION
} TX_QUEUE;
/* Define the semaphore structure utilized by the application. */
typedef struct TX_SEMAPHORE_STRUCT
{
/* Define the semaphore ID used for error checking. */
ULONG tx_semaphore_id;
/* Define the semaphore's name. */
CHAR *tx_semaphore_name;
/* Define the actual semaphore count. A zero means that no semaphore
instance is available. */
ULONG tx_semaphore_count;
/* Define the semaphore suspension list head along with a count of
how many threads are suspended. */