-
Notifications
You must be signed in to change notification settings - Fork 926
Expand file tree
/
Copy pathtestcontrol.c
More file actions
1621 lines (1319 loc) · 68.1 KB
/
testcontrol.c
File metadata and controls
1621 lines (1319 loc) · 68.1 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
/* This is the test control routine of the ThreadX kernel. All tests are dispatched from this routine. */
#define TX_THREAD_SMP_SOURCE_CODE
#include "tx_api.h"
#include <stdio.h>
#include "tx_initialize.h"
#include "tx_timer.h"
#include "tx_thread.h"
#include "tx_semaphore.h"
#include "tx_queue.h"
#include "tx_mutex.h"
#include "tx_block_pool.h"
#include "tx_byte_pool.h"
#include "tx_event_flags.h"
#define TEST_STACK_SIZE 6144
/* Define the test control ThreadX objects... */
TX_THREAD test_control_thread;
TX_THREAD test_thread;
TX_THREAD test_thread1;
TX_THREAD test_thread2;
TX_THREAD test_thread3;
ULONG test_thread3_stack[256];
TX_QUEUE test_queue;
ULONG test_thread2_stack[256];
TX_TIMER test_timer;
TX_MUTEX init_mutex;
TX_MUTEX init_mutex_inherit;
TX_MUTEX cleanup_mutex;
TX_EVENT_FLAGS_GROUP cleanup_event_flags;
TX_BLOCK_POOL cleanup_block_pool;
TX_BYTE_POOL cleanup_byte_pool;
TX_QUEUE cleanup_queue;
TX_SEMAPHORE cleanup_semaphore;
TX_SEMAPHORE init_semaphore;
ULONG init_queue_area[20];
TX_QUEUE init_queue;
TX_BYTE_POOL init_byte_pool;
ULONG init_byte_pool_area[50];
TX_BLOCK_POOL init_block_pool;
ULONG init_block_pool_area[50];
TX_EVENT_FLAGS_GROUP init_event_flags;
TX_TIMER init_timer;
TX_THREAD init_test_thread;
TX_THREAD second_test_thread;
#ifndef TX_TIMER_PROCESS_IN_ISR
TEST_FLAG threadx_delete_timer_thread;
#endif
TX_TIMER_INTERNAL **_timer_list_start_backup;
TEST_FLAG test_stack_analyze_flag;
TEST_FLAG test_initialize_flag;
TX_BLOCK_POOL fake_block_pool;
TX_BYTE_POOL fake_byte_pool;
TX_EVENT_FLAGS_GROUP fake_event_flags;
TX_MUTEX fake_mutex;
TX_QUEUE fake_queue;
TX_SEMAPHORE fake_semaphore;
TX_THREAD test_thread4;
TX_THREAD test_thread5;
TX_THREAD test_thread6;
TX_THREAD test_thread7;
TX_THREAD test_thread8;
TX_THREAD test_thread9;
TX_THREAD test_thread10;
TX_THREAD test_thread11;
TX_THREAD test_thread12;
TX_THREAD test_thread13;
TX_THREAD test_thread14;
ULONG test_thread4_stack[256];
ULONG test_thread5_stack[256];
ULONG test_thread6_stack[256];
ULONG test_thread7_stack[256];
ULONG test_thread8_stack[256];
ULONG test_thread9_stack[256];
ULONG test_thread10_stack[256];
ULONG test_thread11_stack[256];
ULONG test_thread12_stack[256];
ULONG test_thread13_stack[256];
ULONG test_thread14_stack[256];
/* Define the test control global variables. */
ULONG test_control_return_status;
ULONG test_control_successful_tests;
ULONG test_control_failed_tests;
ULONG test_control_system_errors;
UINT test_mutex_from_init;
UINT test_semaphore_from_init;
UINT test_queue_from_init;
UINT test_event_flags_from_init;
UINT test_byte_pool_create_init;
UINT test_block_pool_create_init;
UINT test_timer_create_init;
/* Remember the start of free memory. */
UCHAR *test_free_memory_ptr;
/* Define the function pointer for ISR dispatch. */
VOID (*test_isr_dispatch)(void);
UCHAR test_control_memory[0x60000];
UCHAR tests_memory[0x60000];
UINT mutex_priority_change_extension_selection;
UINT priority_change_extension_selection;
TEST_FLAG test_forced_mutex_timeout;
TEST_FLAG threadx_byte_allocate_loop_test;
TEST_FLAG threadx_byte_release_loop_test;
TEST_FLAG threadx_mutex_suspension_put_test;
TEST_FLAG threadx_mutex_suspension_priority_test;
/* Define the external reference for the preempt disable flag. */
extern volatile UINT _tx_thread_preempt_disable;
extern volatile ULONG _tx_thread_system_state[TX_THREAD_SMP_MAX_CORES];
/* Define test entry pointer type. */
typedef struct TEST_ENTRY_STRUCT
{
VOID (*test_entry)(void *);
} TEST_ENTRY;
/* Define the prototypes for the test entry points. */
void threadx_block_memory_basic_application_define(void *);
void threadx_block_memory_error_detection_application_define(void *);
void threadx_block_memory_suspension_application_define(void *);
void threadx_block_memory_suspension_timeout_application_define(void *);
void threadx_block_memory_thread_terminate_application_define(void *);
void threadx_block_memory_prioritize_application_define(void *);
void threadx_block_memory_information_application_define(void *);
void threadx_byte_memory_basic_application_define(void *);
void threadx_byte_memory_thread_contention_application_define(void *);
void threadx_byte_memory_suspension_application_define(void *);
void threadx_byte_memory_suspension_timeout_application_define(void *);
void threadx_byte_memory_thread_terminate_application_define(void *);
void threadx_byte_memory_prioritize_application_define(void *);
void threadx_byte_memory_information_application_define(void *);
void threadx_event_flag_basic_application_define(void *);
void threadx_event_flag_suspension_application_define(void *);
void threadx_event_flag_suspension_consume_application_define(void *);
void threadx_event_flag_suspension_different_bits_application_define(void *);
void threadx_event_flag_suspension_different_bits_consume_application_define(void *);
void threadx_event_flag_suspension_timeout_application_define(void *);
void threadx_event_flag_thread_terminate_application_define(void *);
void threadx_event_flag_single_thread_terminate_application_define(void *);
void threadx_event_flag_isr_set_clear_application_define(void *);
void threadx_event_flag_isr_wait_abort_application_define(void *);
void threadx_event_flag_information_application_define(void *);
void threadx_interrupt_control_application_define(void *);
void threadx_mutex_basic_application_define(void *);
void threadx_mutex_delete_application_define(void *);
void threadx_mutex_preemption_application_define(void *);
void threadx_mutext_no_preemption_application_define(void *);
void threadx_mutex_suspension_timeout_application_define(void *);
void threadx_mutex_thread_terminate_application_define(void *);
void threadx_mutex_priority_inheritance_application_define(void *);
void threadx_mutex_nested_priority_inheritance_application_define(void *);
void threadx_mutex_prioritize_application_define(void *);
void threadx_mutex_information_application_define(void *);
void threadx_queue_basic_application_define(void *);
void threadx_queue_basic_two_word_application_define(void *);
void threadx_queue_basic_four_word_application_define(void *);
void threadx_queue_basic_eight_word_application_define(void *);
void threadx_queue_basic_sixteen_word_application_define(void *);
void threadx_queue_empty_suspension_application_define(void *);
void threadx_queue_full_suspension_application_define(void *);
void threadx_queue_suspension_timeout_application_define(void *);
void threadx_queue_thread_terminate_application_define(void *);
void threadx_queue_flush_application_define(void *);
void threadx_queue_flush_no_suspension_application_define(void *);
void threadx_queue_front_send_application_define(void *);
void threadx_queue_prioritize_application_define(void *);
void threadx_queue_information_application_define(void *);
void threadx_semaphore_basic_application_define(void *);
void threadx_semaphore_delete_application_define(void *);
void threadx_semaphore_preemption_application_define(void *);
void threadx_semaphore_non_preemption_application_define(void *);
void threadx_semaphore_timeout_application_define(void *);
void threadx_semaphore_thread_terminate_application_define(void *);
void threadx_semaphore_prioritize_application_define(void *);
void threadx_semaphore_ceiling_put_application_define(void *);
void threadx_semaphore_information_application_define(void *);
void threadx_thread_basic_execution_application_define(void *);
void threadx_thread_completed_application_define(void *);
void threadx_thread_relinquish_application_define(void *);
void threadx_thread_simple_suspend_application_define(void *);
void threadx_thread_multiple_suspension_application_define(void *);
void threadx_thread_multiple_non_current_suspension_application_define(void *);
void threadx_thread_multi_level_preemption_threshold_application_define(void *);
void threadx_thread_preemptable_suspension_application_define(void *);
void threadx_thread_basic_time_slice_application_define(void *);
void threadx_thread_multiple_time_slice_application_define(void *);
void threadx_thread_simple_sleep_application_define(void *);
void threadx_thread_simple_sleep_non_clear_application_define(void *);
void threadx_thread_sleep_for_100ticks_application_define(void *);
void threadx_thread_multiple_sleep_application_define(void *);
void threadx_thread_terminate_delete_application_define(void *);
void threadx_thread_preemption_change_application_define(void *);
void threadx_thread_priority_change_application_define(void *);
void threadx_thread_time_slice_change_application_define(void *);
void threadx_thread_sleep_terminate_application_define(void *);
void threadx_thread_delayed_suspension_application_define(void *);
void threadx_thread_wait_abort_application_define(void *);
void threadx_thread_wait_abort_and_isr_application_define(void *);
void threadx_thread_create_preemption_threshold_application_define(void *);
void threadx_thread_information_application_define(void *);
void threadx_thread_reset_application_define(void *);
void threadx_thread_stack_checking_application_define(void *);
void threadx_time_get_set_application_define(void *);
void threadx_timer_simple_application_define(void *);
void threadx_timer_activate_deactivate_application_define(void *);
void threadx_timer_deactivate_accuracy_application_define(void *);
void threadx_timer_large_timer_accuracy_application_define(void *);
void threadx_timer_multiple_application_define(void *);
void threadx_timer_multiple_accuracy_application_define(void *);
void threadx_timer_information_application_define(void *);
void threadx_trace_basic_application_define(void *);
void threadx_smp_rebalance_exclustion_test(void *first_unused_memory);
void threadx_smp_two_threads_one_core_test(void *first_unused_memory);
void threadx_smp_multiple_threads_one_core_test(void *first_unused_memory);
void threadx_smp_one_thread_dynamic_exclusion_test(void *first_unused_memory);
void threadx_smp_non_trivial_scheduling_test(void *first_unused_memory);
void threadx_smp_resume_suspend_ascending_order_test(void *first_unused_memory);
void threadx_smp_resume_suspend_descending_order_test(void *first_unused_memory);
void threadx_smp_preemption_threshold_test(void *first_unused_memory);
void threadx_smp_relinquish_test(void *first_unused_memory);
void threadx_smp_time_slice_test(void *first_unused_memory);
void threadx_smp_random_resume_suspend_test(void *first_unused_memory);
void threadx_smp_random_resume_suspend_exclusion_test(void *first_unused_memory);
void threadx_smp_random_resume_suspend_exclusion_pt_test(void *first_unused_memory);
void test_application_define(void *first_unused_memory);
/* Define the array of test entry points. */
TEST_ENTRY test_control_tests[] =
{
#if CTEST
test_application_define,
#else
threadx_smp_rebalance_exclustion_test,
threadx_smp_two_threads_one_core_test,
threadx_smp_multiple_threads_one_core_test,
threadx_smp_one_thread_dynamic_exclusion_test,
threadx_smp_non_trivial_scheduling_test,
threadx_smp_resume_suspend_ascending_order_test,
threadx_smp_resume_suspend_descending_order_test,
threadx_smp_preemption_threshold_test,
threadx_smp_relinquish_test,
threadx_smp_time_slice_test,
threadx_smp_random_resume_suspend_test,
threadx_smp_random_resume_suspend_exclusion_test,
threadx_smp_random_resume_suspend_exclusion_pt_test,
threadx_block_memory_basic_application_define,
threadx_block_memory_error_detection_application_define,
threadx_block_memory_prioritize_application_define,
threadx_block_memory_suspension_application_define,
threadx_block_memory_suspension_timeout_application_define,
threadx_block_memory_thread_terminate_application_define,
threadx_block_memory_information_application_define,
threadx_byte_memory_basic_application_define,
threadx_byte_memory_suspension_application_define,
threadx_byte_memory_suspension_timeout_application_define,
threadx_byte_memory_thread_terminate_application_define,
threadx_byte_memory_prioritize_application_define,
threadx_byte_memory_thread_contention_application_define,
threadx_byte_memory_information_application_define,
threadx_event_flag_basic_application_define,
threadx_event_flag_suspension_application_define,
threadx_event_flag_suspension_consume_application_define,
threadx_event_flag_suspension_different_bits_application_define,
threadx_event_flag_suspension_different_bits_consume_application_define,
threadx_event_flag_suspension_timeout_application_define,
threadx_event_flag_thread_terminate_application_define,
threadx_event_flag_single_thread_terminate_application_define,
threadx_event_flag_isr_set_clear_application_define,
threadx_event_flag_isr_wait_abort_application_define,
threadx_event_flag_information_application_define,
threadx_interrupt_control_application_define,
threadx_mutex_basic_application_define,
threadx_mutex_delete_application_define,
threadx_mutex_preemption_application_define,
threadx_mutext_no_preemption_application_define,
threadx_mutex_suspension_timeout_application_define,
threadx_mutex_thread_terminate_application_define,
threadx_mutex_priority_inheritance_application_define,
threadx_mutex_prioritize_application_define,
threadx_mutex_nested_priority_inheritance_application_define,
threadx_mutex_information_application_define,
threadx_queue_basic_application_define,
threadx_queue_basic_two_word_application_define,
threadx_queue_basic_four_word_application_define,
threadx_queue_basic_eight_word_application_define,
threadx_queue_basic_sixteen_word_application_define,
threadx_queue_empty_suspension_application_define,
threadx_queue_full_suspension_application_define,
threadx_queue_suspension_timeout_application_define,
threadx_queue_thread_terminate_application_define,
threadx_queue_flush_application_define,
threadx_queue_flush_no_suspension_application_define,
threadx_queue_front_send_application_define,
threadx_queue_prioritize_application_define,
threadx_queue_information_application_define,
threadx_semaphore_basic_application_define,
threadx_semaphore_delete_application_define,
threadx_semaphore_preemption_application_define,
threadx_semaphore_non_preemption_application_define,
threadx_semaphore_timeout_application_define,
threadx_semaphore_thread_terminate_application_define,
threadx_semaphore_prioritize_application_define,
threadx_semaphore_ceiling_put_application_define,
threadx_semaphore_information_application_define,
threadx_thread_basic_execution_application_define,
threadx_thread_completed_application_define,
threadx_thread_relinquish_application_define,
threadx_thread_simple_suspend_application_define,
threadx_thread_multiple_suspension_application_define,
threadx_thread_multiple_non_current_suspension_application_define,
threadx_thread_multi_level_preemption_threshold_application_define,
threadx_thread_preemptable_suspension_application_define,
threadx_thread_basic_time_slice_application_define,
threadx_thread_multiple_time_slice_application_define,
threadx_thread_simple_sleep_application_define,
threadx_thread_simple_sleep_non_clear_application_define,
threadx_thread_sleep_for_100ticks_application_define,
threadx_thread_multiple_sleep_application_define,
threadx_thread_terminate_delete_application_define,
threadx_thread_priority_change_application_define,
threadx_thread_time_slice_change_application_define,
threadx_thread_sleep_terminate_application_define,
threadx_thread_delayed_suspension_application_define,
threadx_thread_wait_abort_application_define,
threadx_thread_wait_abort_and_isr_application_define,
threadx_thread_create_preemption_threshold_application_define,
threadx_thread_preemption_change_application_define,
threadx_thread_information_application_define,
threadx_thread_reset_application_define,
threadx_thread_stack_checking_application_define,
threadx_time_get_set_application_define,
threadx_timer_simple_application_define,
threadx_timer_activate_deactivate_application_define,
threadx_timer_deactivate_accuracy_application_define,
threadx_timer_large_timer_accuracy_application_define,
threadx_timer_multiple_application_define,
threadx_timer_multiple_accuracy_application_define,
threadx_timer_information_application_define,
threadx_trace_basic_application_define,
#endif
TX_NULL,
};
/* Define thread prototypes. */
void test_control_thread_entry(ULONG thread_input);
void test_thread_entry(ULONG thread_input);
void test_thread_entry1(ULONG thread_input);
void test_control_return(UINT status);
void test_control_cleanup(void);
void test_exit_notify(TX_THREAD *thread_ptr, UINT type);
/* Define necessary exernal references. */
#ifdef __ghs
extern TX_MUTEX __ghLockMutex;
#endif
extern TX_TIMER *_tx_timer_created_ptr;
extern ULONG _tx_timer_created_count;
#ifndef TX_TIMER_PROCESS_IN_ISR
extern TX_THREAD _tx_timer_thread;
#endif
extern TX_THREAD *_tx_thread_created_ptr;
extern ULONG _tx_thread_created_count;
extern TX_SEMAPHORE *_tx_semaphore_created_ptr;
extern ULONG _tx_semaphore_created_count;
extern TX_QUEUE *_tx_queue_created_ptr;
extern ULONG _tx_queue_created_count;
extern TX_MUTEX *_tx_mutex_created_ptr;
extern ULONG _tx_mutex_created_count;
extern TX_EVENT_FLAGS_GROUP *_tx_event_flags_created_ptr;
extern ULONG _tx_event_flags_created_count;
extern TX_BYTE_POOL *_tx_byte_pool_created_ptr;
extern ULONG _tx_byte_pool_created_count;
extern TX_BLOCK_POOL *_tx_block_pool_created_ptr;
extern ULONG _tx_block_pool_created_count;
#ifdef EXTERNAL_EXIT
void external_exit(UINT code);
#endif
/* Define the interrupt processing dispatcher. The individual tests will set this up when they desire
asynchrouns processing for testing purposes. */
void test_interrupt_dispatch(void)
{
#ifndef TX_DISABLE_ERROR_CHECKING
/* Test calling tx_thread_relinquish from ISR to see if the error checking throws it out. */
tx_thread_relinquish();
#endif
/* Check for something to run... */
if (test_isr_dispatch)
{
(test_isr_dispatch)();
}
}
/* Define init timer entry. */
static void init_timer_entry(ULONG timer_input)
{
}
#ifndef TX_TIMER_PROCESS_IN_ISR
/* Define the deletion of the system timer thread. */
void delete_timer_thread(void)
{
_tx_thread_terminate(&_tx_timer_thread);
_tx_thread_delete(&_tx_timer_thread);
}
#endif
/* Define main entry point. */
#ifndef EXTERNAL_MAIN
void main()
{
#ifndef TX_MISRA_ENABLE
#ifndef TX_MANUAL_TEST
/* Test the pre-initialize path through _tx_initialize_kernel_enter. */
_tx_thread_system_state[0] = TX_INITIALIZE_ALMOST_DONE;
test_initialize_flag = 1;
/* Call the internal kernel enter function to exercise two paths. */
_tx_initialize_kernel_enter();
_tx_thread_system_state[0] = 0;
#ifndef TX_TIMER_PROCESS_IN_ISR
threadx_delete_timer_thread = 1;
#endif
#endif
#endif
/* Enter the ThreadX kernel. */
tx_kernel_enter();
}
#endif
/* Define what the initial system looks like. */
void tx_application_define(void *first_unused_memory)
{
UCHAR *pointer;
VOID (*temp_mutex_release)(TX_THREAD *thread_ptr);
TX_THREAD *temp_thread;
UINT old_preemption;
ULONG old_time_slice;
UINT status;
ULONG flags;
ULONG temp;
UINT i, j;
#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
TX_THREAD *thread_ptr;
#endif
/* Initialize the test error/success counters. */
test_control_successful_tests = 0;
test_control_failed_tests = 0;
test_control_system_errors = 0;
/* Create two equal priority threads. */
status = tx_thread_create(&test_thread4, "test thread 4", test_thread_entry1, 4,
test_thread4_stack, sizeof(test_thread4_stack), 15, 15, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread5, "test thread 5", test_thread_entry1, 5,
test_thread5_stack, sizeof(test_thread5_stack), 15, 15, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread6, "test thread 6", test_thread_entry1, 6,
test_thread6_stack, sizeof(test_thread6_stack), 16, 16, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread7, "test thread 7", test_thread_entry1, 7,
test_thread7_stack, sizeof(test_thread7_stack), 17, 17, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread8, "test thread 8", test_thread_entry1, 8,
test_thread8_stack, sizeof(test_thread8_stack), 18, 18, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread9, "test thread 9", test_thread_entry1, 9,
test_thread9_stack, sizeof(test_thread9_stack), 19, 19, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread10, "test thread 10", test_thread_entry1, 10,
test_thread10_stack, sizeof(test_thread10_stack), 20, 20, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread11, "test thread 11", test_thread_entry1, 11,
test_thread11_stack, sizeof(test_thread11_stack), 20, 20, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread12, "test thread 12", test_thread_entry1, 12,
test_thread12_stack, sizeof(test_thread12_stack), 20, 20, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread13, "test thread 13", test_thread_entry1, 13,
test_thread13_stack, sizeof(test_thread13_stack), 20, 20, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_create(&test_thread14, "test thread 14", test_thread_entry1, 14,
test_thread14_stack, sizeof(test_thread14_stack), 20, 20, TX_NO_TIME_SLICE, TX_DONT_START);
status += tx_thread_smp_core_exclude(&test_thread4, 0xD);
status += tx_thread_smp_core_exclude(&test_thread5, 0xD);
status += tx_thread_resume(&test_thread4);
status += tx_thread_suspend(&test_thread4);
status += tx_thread_resume(&test_thread4);
status += tx_thread_resume(&test_thread5);
status += tx_thread_suspend(&test_thread4);
status += tx_thread_suspend(&test_thread5);
/* Test the fringe cases in tx_thread_system_resume to make sure the behave properly. */
status += tx_thread_smp_core_exclude(&test_thread14, 0);
status += tx_thread_smp_core_exclude(&test_thread13, 0);
status += tx_thread_smp_core_exclude(&test_thread12, 0);
status += tx_thread_smp_core_exclude(&test_thread11, 0);
status += tx_thread_smp_core_exclude(&test_thread10, 0);
status += tx_thread_smp_core_exclude(&test_thread9, 0xC);
status += tx_thread_smp_core_exclude(&test_thread8, 0x3);
status += tx_thread_smp_core_exclude(&test_thread7, 0xE);
status += tx_thread_smp_core_exclude(&test_thread6, 0xD);
status += tx_thread_smp_core_exclude(&test_thread5, 0xB);
status += tx_thread_smp_core_exclude(&test_thread4, 0x7);
test_thread13.tx_thread_timer.tx_timer_internal_active_next = &test_thread13.tx_thread_timer;
test_thread13.tx_thread_timer.tx_timer_internal_list_head = (TX_TIMER_INTERNAL **) &test_thread13.tx_thread_timer;
status += tx_thread_resume(&test_thread14);
status += tx_thread_resume(&test_thread13);
status += tx_thread_resume(&test_thread12);
status += tx_thread_resume(&test_thread11);
status += tx_thread_resume(&test_thread10);
status += tx_thread_resume(&test_thread9);
status += tx_thread_resume(&test_thread8);
status += tx_thread_resume(&test_thread7);
status += tx_thread_resume(&test_thread6);
status += tx_thread_resume(&test_thread5);
status += tx_thread_resume(&test_thread4);
status += tx_thread_suspend(&test_thread14);
status += tx_thread_suspend(&test_thread13);
status += tx_thread_suspend(&test_thread12);
status += tx_thread_suspend(&test_thread11);
status += tx_thread_suspend(&test_thread10);
status += tx_thread_suspend(&test_thread9);
status += tx_thread_suspend(&test_thread8);
status += _tx_thread_preemption_change(&test_thread8, 17, &old_preemption);
status += tx_thread_resume(&test_thread8);
status += tx_thread_suspend(&test_thread8);
status += tx_thread_suspend(&test_thread7);
status += tx_thread_suspend(&test_thread6);
status += tx_thread_suspend(&test_thread5);
status += tx_thread_suspend(&test_thread4);
/* Setup a pointer to the first unused memory. */
pointer = (UCHAR *) &test_control_memory[0]; //first_unused_memory;
/* Create the test control thread. */
tx_thread_create(&test_control_thread, "test control thread", test_control_thread_entry, 0,
pointer, TEST_STACK_SIZE,
17, 15, TX_NO_TIME_SLICE, TX_AUTO_START);
pointer = pointer + TEST_STACK_SIZE;
/* Create the test thread. */
tx_thread_create(&test_thread, "test thread", test_thread_entry, 0,
pointer, TEST_STACK_SIZE,
15, 15, TX_NO_TIME_SLICE, TX_AUTO_START);
pointer = pointer + TEST_STACK_SIZE;
/* Create the second test thread. */
tx_thread_create(&test_thread1, "test thread 1", test_thread_entry1, 0,
pointer, TEST_STACK_SIZE,
15, 15, TX_NO_TIME_SLICE, TX_DONT_START);
pointer = pointer + TEST_STACK_SIZE;
/* Suspend the test thread temporarily. */
tx_thread_suspend(&test_thread);
/* Resume the test thread again to exercise the resume code fully. */
tx_thread_resume(&test_thread);
/* Timer change just to exercise the code... an error from initialization! */
test_timer.tx_timer_id = TX_TIMER_ID;
tx_timer_change(&test_timer, 1, 1);
/* Test mutex created and used in initialization. */
test_mutex_from_init = tx_mutex_create(&init_mutex, "init mutex", TX_INHERIT);
test_mutex_from_init += tx_mutex_get(&init_mutex, TX_NO_WAIT);
test_mutex_from_init += tx_mutex_get(&init_mutex, TX_NO_WAIT);
test_mutex_from_init += tx_mutex_put(&init_mutex);
test_mutex_from_init += tx_mutex_put(&init_mutex);
test_mutex_from_init = tx_mutex_create(&init_mutex_inherit, "init mutex", TX_INHERIT);
test_mutex_from_init += tx_mutex_get(&init_mutex_inherit, TX_NO_WAIT);
test_mutex_from_init += tx_mutex_get(&init_mutex_inherit, TX_NO_WAIT);
test_mutex_from_init += tx_mutex_put(&init_mutex_inherit);
test_mutex_from_init += tx_mutex_put(&init_mutex_inherit);
#ifndef TX_DISABLE_ERROR_CHECKING
/* Test timer create from initialization. */
test_block_pool_create_init = tx_block_pool_create(&init_block_pool, "init block pool", 10, init_block_pool_area, sizeof(init_block_pool_area));
/* Test byte pool create from initialization. */
test_byte_pool_create_init = tx_byte_pool_create(&init_byte_pool, "init byte pool", init_byte_pool_area, sizeof(init_byte_pool_area));
test_byte_pool_create_init += tx_byte_allocate(&init_byte_pool, (VOID **) &pointer, 20, TX_NO_WAIT);
test_byte_pool_create_init += tx_byte_release(pointer);
/* Test event flag create from initialization. */
test_event_flags_from_init = tx_event_flags_create(&init_event_flags, "init events");
/* Test queue create from initialization. */
test_queue_from_init = tx_queue_create(&init_queue, "init queue", TX_1_ULONG, init_queue_area, sizeof(init_queue_area));
/* Test semaphore create from initialization. */
test_semaphore_from_init = tx_semaphore_create(&init_semaphore, "init semaphore", 0);
/* Test timer creat from initialization. */
test_timer_create_init = tx_timer_create(&init_timer, "init timer", init_timer_entry, 0x5678,
100, 200, TX_AUTO_ACTIVATE);
/* Test calling tx_thread_relinquish to see if the error checking throws it out. */
tx_thread_relinquish();
#endif
/* Remember the free memory pointer. */
test_free_memory_ptr = &tests_memory[0]; //pointer;
/* Clear the ISR dispatch. */
test_isr_dispatch = TX_NULL;
/* Ensure that _tx_thread_time_slice can handle NULL thread, note that current thread pointer is NULL at this point. */
_tx_thread_time_slice();
/* Test to make sure _tx_thread_time_slice can handle a none-ready thread. */
init_test_thread.tx_thread_state = TX_IO_DRIVER;
init_test_thread.tx_thread_new_time_slice = 0;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_suspending = TX_TRUE;
_tx_thread_current_ptr[0] = &init_test_thread;
_tx_thread_time_slice();
/* Test to make sure _tx_thread_time_slice can handle preemption-threshold set. */
init_test_thread.tx_thread_state = TX_READY;
init_test_thread.tx_thread_new_time_slice = 0;
init_test_thread.tx_thread_priority = 10;
init_test_thread.tx_thread_preempt_threshold = 9;
init_test_thread.tx_thread_ready_next = &init_test_thread;
init_test_thread.tx_thread_ready_previous = &init_test_thread;
_tx_thread_time_slice();
_tx_thread_current_ptr[0] = TX_NULL;
/* Test to make sure _tx_thread_shell_entry can handle a NULL mutex release function pointer. */
temp_mutex_release = _tx_thread_mutex_release;
temp_thread = _tx_thread_execute_ptr[0];
_tx_thread_mutex_release = TX_NULL;
init_test_thread.tx_thread_state = TX_READY;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
init_test_thread.tx_thread_new_time_slice = 0;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_suspending = TX_FALSE;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_entry = test_thread_entry1;
_tx_thread_current_ptr[0] = &init_test_thread;
_tx_thread_execute_ptr[0] = &init_test_thread;
_tx_thread_entry_exit_notify(&init_test_thread, test_exit_notify);
_tx_thread_shell_entry();
_tx_thread_current_ptr[0] = TX_NULL;
_tx_thread_execute_ptr[0] = temp_thread;
_tx_thread_mutex_release = temp_mutex_release; /* Recover Mutex release pointer. */
/* Test _tx_thread_system_suspend when not current, preemption is needed but disabled. */
temp_thread = _tx_thread_execute_ptr[0];
init_test_thread.tx_thread_state = TX_READY;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
init_test_thread.tx_thread_new_time_slice = 0;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_suspending = TX_FALSE;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_entry = test_thread_entry1;
_tx_thread_execute_ptr[0] = &init_test_thread;
#ifndef TX_NOT_INTERRUPTABLE
_tx_thread_preempt_disable++;
#endif
_tx_thread_system_suspend(&init_test_thread);
_tx_thread_execute_ptr[0] = temp_thread;
/* Test _tx_thread_system_resume when not current, suspending and in a COMPLETED state. */
temp_thread = _tx_thread_execute_ptr[0];
init_test_thread.tx_thread_state = TX_COMPLETED;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
init_test_thread.tx_thread_new_time_slice = 0;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_suspending = TX_TRUE;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_entry = test_thread_entry1;
#ifndef TX_NOT_INTERRUPTABLE
_tx_thread_preempt_disable++;
#endif
_tx_thread_execute_ptr[0] = &init_test_thread;
_tx_thread_system_resume(&init_test_thread);
_tx_thread_execute_ptr[0] = temp_thread;
/* Test _tx_thread_system_resume when not current, not suspending and already in a TX_READY state. */
temp_thread = _tx_thread_execute_ptr[0];
init_test_thread.tx_thread_state = TX_READY;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
init_test_thread.tx_thread_new_time_slice = 0;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_suspending = TX_FALSE;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_entry = test_thread_entry1;
#ifndef TX_NOT_INTERRUPTABLE
_tx_thread_preempt_disable++;
#endif
_tx_thread_execute_ptr[0] = &init_test_thread;
_tx_thread_system_resume(&init_test_thread);
_tx_thread_execute_ptr[0] = temp_thread;
/* Test _tx_thread_system_resume when not current, suspending and in a TERMINATED state. */
temp_thread = _tx_thread_execute_ptr[0];
init_test_thread.tx_thread_state = TX_TERMINATED;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
init_test_thread.tx_thread_new_time_slice = 0;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_suspending = TX_TRUE;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_entry = test_thread_entry1;
#ifndef TX_NOT_INTERRUPTABLE
_tx_thread_preempt_disable++;
#endif
_tx_thread_execute_ptr[0] = &init_test_thread;
_tx_thread_system_resume(&init_test_thread);
_tx_thread_execute_ptr[0] = temp_thread;
/* Test tx_thread_resume to test the saved_thread_ptr being NULL. */
temp_thread = _tx_thread_execute_ptr[0];
_tx_thread_execute_ptr[0] = TX_NULL;
tx_thread_resume(&test_thread1);
tx_thread_suspend(&test_thread1);
_tx_thread_execute_ptr[0] = temp_thread;
/* Test preemption change when the new priority is the same as the threshold. */
init_test_thread.tx_thread_state = TX_SUSPENDED;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
init_test_thread.tx_thread_new_time_slice = 0;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_suspending = TX_FALSE;
init_test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL;
init_test_thread.tx_thread_user_priority = 10;
init_test_thread.tx_thread_user_preempt_threshold = 10;
init_test_thread.tx_thread_priority = 10;
init_test_thread.tx_thread_preempt_threshold = 10;
init_test_thread.tx_thread_entry = test_thread_entry1;
_tx_thread_preemption_change(&init_test_thread, 10, &old_preemption);
#ifndef TX_NOT_INTERRUPTABLE
/* Test semaphore cleanup with an invalid semaphore ID. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_semaphore;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_semaphore_cleanup);
cleanup_semaphore.tx_semaphore_id = 0;
cleanup_semaphore.tx_semaphore_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_semaphore_cleanup(&init_test_thread, 0);
/* Test semaphore cleanup with an invalid suspension sequence. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_semaphore;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_semaphore_cleanup);
cleanup_semaphore.tx_semaphore_id = 0;
cleanup_semaphore.tx_semaphore_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_semaphore_cleanup(&init_test_thread, 1);
/* Test semaphore cleanup with a NULL semaphore pointer. */
init_test_thread.tx_thread_suspend_control_block = TX_NULL;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_semaphore_cleanup);
cleanup_semaphore.tx_semaphore_id = TX_SEMAPHORE_ID;
cleanup_semaphore.tx_semaphore_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_semaphore_cleanup(&init_test_thread, 0);
/* Test semaphore cleanup with an valid semaphore ID but a suspension count of 0. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_semaphore;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_semaphore_cleanup);
cleanup_semaphore.tx_semaphore_id = TX_SEMAPHORE_ID;
cleanup_semaphore.tx_semaphore_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_semaphore_cleanup(&init_test_thread, 0);
/* Test queue cleanup with a NULL cleanup pointer. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_queue;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
cleanup_queue.tx_queue_id = 0;
cleanup_queue.tx_queue_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_queue_cleanup(&init_test_thread, 0);
/* Test queue cleanup with a NULL queue pointer. */
init_test_thread.tx_thread_suspend_control_block = TX_NULL;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_queue_cleanup);
cleanup_queue.tx_queue_id = 0;
cleanup_queue.tx_queue_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_queue_cleanup(&init_test_thread, 0);
/* Test queue cleanup with an invalid queue ID. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_queue;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_queue_cleanup);
cleanup_queue.tx_queue_id = 0;
cleanup_queue.tx_queue_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_queue_cleanup(&init_test_thread, 0);
/* Test queue cleanup with an invalid suspension sequence. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_queue;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_queue_cleanup);
cleanup_queue.tx_queue_id = 0;
cleanup_queue.tx_queue_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_queue_cleanup(&init_test_thread, 1);
/* Test queue cleanup with an valid queue ID but a suspension count of 0. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_queue;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_queue_cleanup);
cleanup_queue.tx_queue_id = TX_QUEUE_ID;
cleanup_queue.tx_queue_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_queue_cleanup(&init_test_thread, 0);
/* Test mutex cleanup with a NULL cleanup pointer. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_mutex;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
cleanup_mutex.tx_mutex_id = 0;
cleanup_mutex.tx_mutex_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_mutex_cleanup(&init_test_thread, 0);
/* Test mutex cleanup with a NULL mutex pointer. */
init_test_thread.tx_thread_suspend_control_block = TX_NULL;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_mutex_cleanup);
cleanup_mutex.tx_mutex_id = 0;
cleanup_mutex.tx_mutex_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_mutex_cleanup(&init_test_thread, 0);
/* Test mutex cleanup with an invalid mutex ID. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_mutex;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_mutex_cleanup);
cleanup_mutex.tx_mutex_id = 0;
cleanup_mutex.tx_mutex_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_mutex_cleanup(&init_test_thread, 0);
/* Test mutex cleanup with an invalid suspension sequence. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_mutex;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_mutex_cleanup);
cleanup_mutex.tx_mutex_id = 0;
cleanup_mutex.tx_mutex_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_mutex_cleanup(&init_test_thread, 1);
/* Test mutex cleanup with an valid mutex ID but a suspension count of 0. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_mutex;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_mutex_cleanup);
cleanup_mutex.tx_mutex_id = TX_MUTEX_ID;
cleanup_mutex.tx_mutex_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_mutex_cleanup(&init_test_thread, 0);
/* Test event flag cleanup with a NULL cleanup pointer. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_event_flags;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
cleanup_event_flags.tx_event_flags_group_id = 0;
cleanup_event_flags.tx_event_flags_group_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_event_flags_cleanup(&init_test_thread, 0);
/* Test event flag cleanup with a NULL event flag pointer. */
init_test_thread.tx_thread_suspend_control_block = TX_NULL;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_event_flags_cleanup);
cleanup_event_flags.tx_event_flags_group_id = 0;
cleanup_event_flags.tx_event_flags_group_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_event_flags_cleanup(&init_test_thread, 0);
/* Test event flag cleanup with an invalid ID. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_event_flags;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_event_flags_cleanup);
cleanup_event_flags.tx_event_flags_group_id = 0;
cleanup_event_flags.tx_event_flags_group_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_event_flags_cleanup(&init_test_thread, 0);
/* Test event flag cleanup with an invalid suspension sequence. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_event_flags;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_event_flags_cleanup);
cleanup_event_flags.tx_event_flags_group_id = 0;
cleanup_event_flags.tx_event_flags_group_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_event_flags_cleanup(&init_test_thread, 1);
/* Test event flag cleanup with an valid ID but a suspension count of 0. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_event_flags;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_event_flags_cleanup);
cleanup_event_flags.tx_event_flags_group_id = TX_EVENT_FLAGS_ID;
cleanup_event_flags.tx_event_flags_group_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_event_flags_cleanup(&init_test_thread, 0);
/* Test block pool cleanup with a NULL cleanup pointer. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_block_pool;
init_test_thread.tx_thread_suspend_cleanup = TX_NULL;
cleanup_block_pool.tx_block_pool_id = 0;
cleanup_block_pool.tx_block_pool_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_block_pool_cleanup(&init_test_thread, 0);
/* Test block pool cleanup with a NULL block pool pointer. */
init_test_thread.tx_thread_suspend_control_block = TX_NULL;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_block_pool_cleanup);
cleanup_block_pool.tx_block_pool_id = 0;
cleanup_block_pool.tx_block_pool_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_block_pool_cleanup(&init_test_thread, 0);
/* Test block pool cleanup with an invalid ID. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_block_pool;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_block_pool_cleanup);
cleanup_block_pool.tx_block_pool_id = 0;
cleanup_block_pool.tx_block_pool_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_block_pool_cleanup(&init_test_thread, 0);
/* Test block pool cleanup with an invalid suspension sequence. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_block_pool;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_block_pool_cleanup);
cleanup_block_pool.tx_block_pool_id = 0;
cleanup_block_pool.tx_block_pool_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_block_pool_cleanup(&init_test_thread, 1);
/* Test block pool cleanup with an valid ID but a suspension count of 0. */
init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_block_pool;
init_test_thread.tx_thread_suspend_cleanup = &(_tx_block_pool_cleanup);
cleanup_block_pool.tx_block_pool_id = TX_BLOCK_POOL_ID;
cleanup_block_pool.tx_block_pool_suspended_count = 0;
init_test_thread.tx_thread_suspension_sequence = 0;
_tx_block_pool_cleanup(&init_test_thread, 0);