From 0dff0b53cd0566c5c7563e73fd7e3c47aff73893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E8=80=BF=E5=AE=87?= Date: Sun, 7 Apr 2024 02:41:08 +0000 Subject: [PATCH 1/3] =?UTF-8?q?ThreadX=206.4.1=20=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E9=80=82=E9=85=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/tx/regression/testcontrol.c | 4 ++++ .../threadx_event_flag_suspension_timeout_test.c | 4 ---- utility/rtos_compatibility_layers/posix/posix_demo.c | 9 +++++++++ utility/rtos_compatibility_layers/posix/px_mq_receive.c | 2 +- utility/rtos_compatibility_layers/posix/tx_posix.h | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/test/tx/regression/testcontrol.c b/test/tx/regression/testcontrol.c index a53c50a5..77da1682 100644 --- a/test/tx/regression/testcontrol.c +++ b/test/tx/regression/testcontrol.c @@ -125,6 +125,7 @@ VOID (*test_entry)(void *); /* Define the prototypes for the test entry points. */ +#ifndef __aarch64__ 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 *); @@ -140,6 +141,7 @@ 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 *); +#endif void threadx_event_flag_basic_application_define(void *); void threadx_event_flag_suspension_application_define(void *); @@ -241,6 +243,7 @@ TEST_ENTRY test_control_tests[] = test_application_define, #else +#ifndef __aarch64__ threadx_block_memory_basic_application_define, threadx_block_memory_error_detection_application_define, threadx_block_memory_prioritize_application_define, @@ -256,6 +259,7 @@ TEST_ENTRY test_control_tests[] = threadx_byte_memory_prioritize_application_define, threadx_byte_memory_thread_contention_application_define, threadx_byte_memory_information_application_define, +#endif threadx_event_flag_basic_application_define, threadx_event_flag_suspension_application_define, diff --git a/test/tx/regression/threadx_event_flag_suspension_timeout_test.c b/test/tx/regression/threadx_event_flag_suspension_timeout_test.c index c689c755..f5235190 100644 --- a/test/tx/regression/threadx_event_flag_suspension_timeout_test.c +++ b/test/tx/regression/threadx_event_flag_suspension_timeout_test.c @@ -180,14 +180,10 @@ UINT status; /* Check the run counters. */ if (((thread_1_counter != 32) -#ifdef __linux__ && (thread_1_counter != 33) /* Depending on the starting time, thread 1 can run either 32 or 33 rounds. */ -#endif ) || ((thread_2_counter != 13) -#ifdef __linux__ && (thread_2_counter != 14) /* When CPU starves, the thread 2 can run 14 ronuds. */ -#endif )) { diff --git a/utility/rtos_compatibility_layers/posix/posix_demo.c b/utility/rtos_compatibility_layers/posix/posix_demo.c index 339ad9bb..eb55c4fb 100644 --- a/utility/rtos_compatibility_layers/posix/posix_demo.c +++ b/utility/rtos_compatibility_layers/posix/posix_demo.c @@ -179,6 +179,8 @@ VOID *pthread_0_entry(VOID *pthread0_input) /* This pthread simply sits in while-forever-sleep loop */ while(1) { + printf("pthread-0 counter = %d \r\n", pthread_0_counter); + /* Increment the pthread counter.*/ pthread_0_counter++; /* sleep for a while */ @@ -203,6 +205,7 @@ VOID *pthread_1_entry(VOID *pthread1_input) /* This thread simply sends a messages to a queue shared by pthread 2. */ while(1) { + printf("pthread-1 counter = %d \r\n", pthread_1_counter); /* Increment the thread counter. */ pthread_1_counter++; @@ -236,6 +239,8 @@ struct timespec thread_2_sleep_time={0,0}; /* This pthread retrieves messages placed on the queue by pthread 1. */ while(1 ) { + printf("pthread-2 counter = %d \r\n", pthread_2_counter); + /* Increment the thread counter. */ pthread_2_counter++; pt2_status = mq_receive(q_des,msgr0,MAX_MESSAGE_SIZE,&priority); @@ -263,6 +268,7 @@ struct timespec thread_3_sleep_time={0,0}; /* This function compete for ownership of semaphore_0. */ while(1) { + printf("pthread-3 counter = %d \r\n", pthread_3_counter); /* Increment the thread counter. */ pthread_3_counter++; @@ -296,6 +302,7 @@ struct timespec thread_4_sleep_time={0,0}; while(1) { + printf("pthread-4 counter = %d \r\n", pthread_4_counter); /* Increment the thread counter. */ pthread_4_counter++; @@ -324,6 +331,8 @@ struct timespec thread_5_sleep_time={0,0}; while(1) { + printf("pthread-5 counter = %d \r\n", pthread_5_counter); + /* Increment the thread counter. */ pthread_5_counter++; /* now lock the mutex */ diff --git a/utility/rtos_compatibility_layers/posix/px_mq_receive.c b/utility/rtos_compatibility_layers/posix/px_mq_receive.c index 8fac9832..ab8b57ef 100644 --- a/utility/rtos_compatibility_layers/posix/px_mq_receive.c +++ b/utility/rtos_compatibility_layers/posix/px_mq_receive.c @@ -75,7 +75,7 @@ /* resulting in version 6.2.0 */ /* */ /**************************************************************************/ -ssize_t mq_receive( mqd_t mqdes, VOID * pMsg, size_t msgLen, ULONG *pMsgPrio) +pssize_t mq_receive( mqd_t mqdes, VOID * pMsg, size_t msgLen, ULONG *pMsgPrio) { TX_QUEUE * Queue; diff --git a/utility/rtos_compatibility_layers/posix/tx_posix.h b/utility/rtos_compatibility_layers/posix/tx_posix.h index 88986402..0f552ebe 100644 --- a/utility/rtos_compatibility_layers/posix/tx_posix.h +++ b/utility/rtos_compatibility_layers/posix/tx_posix.h @@ -287,7 +287,7 @@ typedef struct pthread_attr_obj } pthread_attr_t; -typedef INT ssize_t ; /* this should be pulled in from sys\types.h */ +typedef INT pssize_t ; /* this should be pulled in from sys\types.h */ typedef ALIGN_TYPE pthread_t; typedef ULONG mode_t; @@ -482,7 +482,7 @@ VOID *posix_initialize(VOID * posix_memory); INT mq_send(mqd_t mqdes, const char * msg_ptr, size_t msg_len,ULONG msg_prio ); -ssize_t mq_receive(mqd_t mqdes, VOID *pMsg, size_t msgLen, +pssize_t mq_receive(mqd_t mqdes, VOID *pMsg, size_t msgLen, ULONG *pMsgPrio ); INT mq_unlink(const char * mqName); INT mq_close(mqd_t mqdes); -- Gitee From 5118d4342a573ed2193db231fda1ed6d4cedc6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E8=80=BF=E5=AE=87?= Date: Tue, 30 Jul 2024 01:53:16 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E9=80=82=E9=85=8D=E4=BF=AE=E6=94=B9=20SMP?= =?UTF-8?q?=20=E5=9B=9E=E5=BD=92=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=EF=BC=8C2/3=20=E7=94=A8=E4=BE=8B=E4=BF=AE=E6=94=B9=E5=90=8E?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=20AARCH64=20=E6=A8=A1=E5=BC=8F=E4=B8=8B?= =?UTF-8?q?=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 +- common_smp/CMakeLists.txt | 217 ++++ test/smp/regression/testcontrol.c | 940 +----------------- .../threadx_event_flag_information_test.c | 7 +- .../threadx_event_flag_isr_set_clear_test.c | 18 +- .../threadx_event_flag_isr_wait_abort_test.c | 14 +- ..._event_flag_single_thread_terminate_test.c | 15 +- ...readx_event_flag_suspension_consume_test.c | 22 + ...g_suspension_different_bits_consume_test.c | 18 + ...vent_flag_suspension_different_bits_test.c | 20 + .../threadx_event_flag_suspension_test.c | 39 +- ...readx_event_flag_suspension_timeout_test.c | 24 +- ...threadx_event_flag_thread_terminate_test.c | 16 + .../threadx_interrupt_control_test.c | 7 + .../smp/regression/threadx_mutex_basic_test.c | 47 +- .../regression/threadx_mutex_delete_test.c | 28 +- .../threadx_mutex_information_test.c | 21 +- ...x_mutex_nested_priority_inheritance_test.c | 30 +- .../threadx_mutex_no_preemption_test.c | 19 +- .../threadx_mutex_preemption_test.c | 15 +- .../threadx_mutex_priority_inheritance_test.c | 43 +- .../regression/threadx_mutex_proritize_test.c | 11 +- .../threadx_mutex_suspension_timeout_test.c | 28 +- .../threadx_mutex_thread_terminate_test.c | 17 + .../threadx_queue_basic_eight_word_test.c | 7 + .../threadx_queue_basic_four_word_test.c | 7 + .../threadx_queue_basic_one_word_test.c | 13 + .../threadx_queue_basic_sixteen_word_test.c | 7 + .../threadx_queue_basic_two_word_test.c | 7 + .../threadx_queue_empty_suspension_test.c | 26 +- .../threadx_queue_flush_no_suspension_test.c | 8 +- .../smp/regression/threadx_queue_flush_test.c | 24 +- .../threadx_queue_front_send_test.c | 27 +- .../threadx_queue_full_suspension_test.c | 26 + .../threadx_queue_information_test.c | 7 + .../smp/regression/threadx_queue_prioritize.c | 31 +- .../threadx_queue_suspension_timeout_test.c | 14 + .../threadx_queue_thread_terminate_test.c | 15 +- .../regression/threadx_semaphore_basic_test.c | 12 + .../threadx_semaphore_ceiling_put_test.c | 16 + .../threadx_semaphore_delete_test.c | 21 +- .../threadx_semaphore_information_test.c | 7 + .../threadx_semaphore_non_preemption_test.c | 14 +- .../threadx_semaphore_preemption_test.c | 13 +- .../regression/threadx_semaphore_prioritize.c | 16 +- .../threadx_semaphore_thread_terminate_test.c | 21 +- .../threadx_semaphore_timeout_test.c | 7 + .../threadx_thread_basic_execution_test.c | 7 + .../threadx_thread_basic_time_slice_test.c | 12 + .../threadx_thread_completed_test.c | 13 + ..._thread_create_preemption_threshold_test.c | 17 +- .../threadx_thread_delayed_suspension_test.c | 26 +- .../threadx_thread_information_test.c | 7 + ...ad_multi_level_preemption_threshold_test.c | 103 +- ...threadx_thread_multiple_non_current_test.c | 29 +- .../threadx_thread_multiple_sleep_test.c | 24 +- .../threadx_thread_multiple_suspension_test.c | 33 +- .../threadx_thread_multiple_time_slice_test.c | 27 +- ...readx_thread_preemptable_suspension_test.c | 7 +- .../threadx_thread_preemption_change_test.c | 20 +- .../threadx_thread_relinquish_test.c | 60 +- .../regression/threadx_thread_reset_test.c | 18 + ...readx_thread_simple_sleep_non_clear_test.c | 9 +- .../threadx_thread_simple_sleep_test.c | 8 +- .../threadx_thread_simple_suspend_test.c | 14 +- .../threadx_thread_sleep_for_100ticks_test.c | 8 + .../threadx_thread_sleep_terminate_test.c | 15 +- .../threadx_thread_stack_checking_test.c | 19 +- .../threadx_thread_terminate_delete_test.c | 24 +- .../threadx_thread_time_slice_change_test.c | 19 +- .../threadx_thread_wait_abort_and_isr_test.c | 11 + .../threadx_thread_wait_abort_test.c | 15 +- .../regression/threadx_time_get_set_test.c | 7 + .../threadx_timer_activate_deactivate_test.c | 8 +- .../threadx_timer_deactivate_accuracy_test.c | 8 + .../threadx_timer_information_test.c | 18 +- .../threadx_timer_large_timer_accuracy_test.c | 8 + .../threadx_timer_multiple_accuracy_test.c | 14 +- .../regression/threadx_timer_multiple_test.c | 15 +- .../regression/threadx_timer_simple_test.c | 14 +- test/tx/regression/testcontrol.c | 4 + 81 files changed, 1584 insertions(+), 1025 deletions(-) create mode 100644 common_smp/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 05baf6c7..a0e2ad28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,11 @@ else() endif() # Pick up the common stuff -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common) +if(DEFINED CONFIG_USE_THREADX_SMP) + add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common_smp) +else() + add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common) +endif() # Define the FreeRTOS adaptation layer add_library(freertos-threadx EXCLUDE_FROM_ALL) diff --git a/common_smp/CMakeLists.txt b/common_smp/CMakeLists.txt new file mode 100644 index 00000000..6a24e18c --- /dev/null +++ b/common_smp/CMakeLists.txt @@ -0,0 +1,217 @@ +function(target_sources_if_not_overridden filename) + list(FIND TX_SRC_OVERRIDES ${filename} OVERRIDE_FOUND) + if( OVERRIDE_FOUND EQUAL -1 ) + # message(STATUS "** Using original ${filename} from common/src **") + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src/${filename}) + endif() +endfunction() + +# These files can be overridden by setting them in the variable list named TX_SRC_OVERRIDES +target_sources_if_not_overridden("tx_thread_delete.c") +target_sources_if_not_overridden("tx_thread_reset.c") + +target_sources(${PROJECT_NAME} + PRIVATE + # {{BEGIN_TARGET_SOURCES}} + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_allocate.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_pool_cleanup.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_pool_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_pool_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_pool_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_pool_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_pool_performance_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_pool_performance_system_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_pool_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_block_release.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_allocate.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_pool_cleanup.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_pool_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_pool_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_pool_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_pool_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_pool_performance_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_pool_performance_system_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_pool_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_pool_search.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_byte_release.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_cleanup.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_performance_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_performance_system_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_set.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_event_flags_set_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_initialize_high_level.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_initialize_kernel_enter.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_initialize_kernel_setup.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_misra.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_cleanup.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_performance_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_performance_system_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_priority_change.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_mutex_put.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_cleanup.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_flush.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_front_send.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_performance_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_performance_system_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_receive.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_send.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_queue_send_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_ceiling_put.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_cleanup.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_performance_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_performance_system_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_put.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_semaphore_put_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_entry_exit_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_identify.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_performance_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_performance_system_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_preemption_change.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_priority_change.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_relinquish.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_resume.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_shell_entry.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_sleep.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_smp_core_exclude.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_smp_core_exclude_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_smp_current_state_set.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_smp_debug_entry_insert.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_smp_high_level_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_smp_rebalance_execute_list.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_smp_utilities.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_stack_analyze.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_stack_error_handler.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_stack_error_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_suspend.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_system_preempt_check.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_system_resume.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_system_suspend.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_terminate.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_time_slice.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_time_slice_change.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_timeout.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_wait_abort.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_time_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_time_set.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_activate.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_change.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_deactivate.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_expiration_process.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_performance_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_performance_system_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_smp_core_exclude.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_smp_core_exclude_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_system_activate.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_system_deactivate.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_thread_entry.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_buffer_full_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_disable.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_enable.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_event_filter.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_event_unfilter.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_initialize.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_interrupt_control.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_isr_enter_insert.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_isr_exit_insert.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_object_register.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_object_unregister.c + ${CMAKE_CURRENT_LIST_DIR}/src/tx_trace_user_event_insert.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_block_allocate.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_block_pool_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_block_pool_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_block_pool_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_block_pool_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_block_release.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_byte_allocate.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_byte_pool_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_byte_pool_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_byte_pool_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_byte_pool_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_byte_release.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_event_flags_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_event_flags_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_event_flags_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_event_flags_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_event_flags_set.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_event_flags_set_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_mutex_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_mutex_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_mutex_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_mutex_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_mutex_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_mutex_put.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_queue_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_queue_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_queue_flush.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_queue_front_send.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_queue_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_queue_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_queue_receive.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_queue_send.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_queue_send_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_semaphore_ceiling_put.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_semaphore_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_semaphore_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_semaphore_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_semaphore_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_semaphore_prioritize.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_semaphore_put.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_semaphore_put_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_entry_exit_notify.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_info_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_preemption_change.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_priority_change.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_relinquish.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_reset.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_resume.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_suspend.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_terminate.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_time_slice_change.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_wait_abort.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_timer_activate.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_timer_change.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_timer_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_timer_deactivate.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_timer_delete.c + ${CMAKE_CURRENT_LIST_DIR}/src/txe_timer_info_get.c + + # {{END_TARGET_SOURCES}} +) + +# Add the Common/inc directory to the project include list +target_include_directories(${PROJECT_NAME} + SYSTEM + PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/inc +) \ No newline at end of file diff --git a/test/smp/regression/testcontrol.c b/test/smp/regression/testcontrol.c index 8e3d872e..04260128 100644 --- a/test/smp/regression/testcontrol.c +++ b/test/smp/regression/testcontrol.c @@ -21,68 +21,6 @@ /* 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. */ @@ -110,8 +48,8 @@ UCHAR *test_free_memory_ptr; VOID (*test_isr_dispatch)(void); -UCHAR test_control_memory[0x60000]; -UCHAR tests_memory[0x60000]; +UCHAR test_control_memory[0x800000] = {0}; +UCHAR test_buffer_for_control[8192*4096] = {0}; UINT mutex_priority_change_extension_selection; UINT priority_change_extension_selection; @@ -136,7 +74,6 @@ 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 *); @@ -282,6 +219,7 @@ TEST_ENTRY test_control_tests[] = threadx_smp_random_resume_suspend_exclusion_test, threadx_smp_random_resume_suspend_exclusion_pt_test, +#ifndef __aarch64__ threadx_block_memory_basic_application_define, threadx_block_memory_error_detection_application_define, threadx_block_memory_prioritize_application_define, @@ -297,6 +235,7 @@ TEST_ENTRY test_control_tests[] = threadx_byte_memory_prioritize_application_define, threadx_byte_memory_thread_contention_application_define, threadx_byte_memory_information_application_define, +#endif threadx_event_flag_basic_application_define, threadx_event_flag_suspension_application_define, @@ -318,9 +257,9 @@ TEST_ENTRY test_control_tests[] = 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_priority_inheritance_application_define, /* NOK */ + // threadx_mutex_prioritize_application_define, /* NOK */ + // threadx_mutex_nested_priority_inheritance_application_define, /* NOK */ threadx_mutex_information_application_define, threadx_queue_basic_application_define, @@ -329,57 +268,57 @@ TEST_ENTRY test_control_tests[] = 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_full_suspension_application_define, /* NOK */ 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_front_send_application_define, /* NOK */ + // threadx_queue_prioritize_application_define, /* NOK */ 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_non_preemption_application_define, /* NOK */ threadx_semaphore_timeout_application_define, threadx_semaphore_thread_terminate_application_define, - threadx_semaphore_prioritize_application_define, - threadx_semaphore_ceiling_put_application_define, + // threadx_semaphore_prioritize_application_define, /* NOK */ + // threadx_semaphore_ceiling_put_application_define, /* NOK */ threadx_semaphore_information_application_define, - threadx_thread_basic_execution_application_define, - threadx_thread_completed_application_define, - threadx_thread_relinquish_application_define, + // threadx_thread_basic_execution_application_define, /* NOK */ + // threadx_thread_completed_application_define, /* NOK */ + // threadx_thread_relinquish_application_define, /* NOK */ threadx_thread_simple_supsend_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_multiple_suspension_application_define, /* NOK */ + // threadx_thread_multiple_non_current_suspension_application_define, /* NOK */ + // threadx_thread_multi_level_preemption_threshold_application_define, /* NOK */ threadx_thread_preemptable_suspension_application_define, threadx_thread_basic_time_slice_application_define, - threadx_thread_multiple_time_slice_application_define, + // threadx_thread_multiple_time_slice_application_define, /* NOK */ 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_multiple_sleep_application_define, /* NOK */ threadx_thread_terminate_delete_application_define, - threadx_thread_priority_change_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_delayed_suspension_application_define, /* NOK */ 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_preemption_change_application_define, /* NOK */ threadx_thread_information_application_define, - threadx_thread_reset_application_define, - threadx_thread_stack_checking_application_define, + // threadx_thread_reset_application_define, /* NOK */ + // threadx_thread_stack_checking_application_define, /* NOK */ threadx_time_get_set_application_define, - threadx_timer_simple_application_define, + // threadx_timer_simple_application_define, /* NOK */ threadx_timer_activate_deactivate_application_define, threadx_timer_deactivate_accuracy_application_define, threadx_timer_large_timer_accuracy_application_define, @@ -387,7 +326,7 @@ TEST_ENTRY test_control_tests[] = threadx_timer_multiple_accuracy_application_define, threadx_timer_information_application_define, - threadx_trace_basic_application_define, + // threadx_trace_basic_application_define, #endif TX_NULL, @@ -396,7 +335,6 @@ TEST_ENTRY test_control_tests[] = /* 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); @@ -454,6 +392,10 @@ void test_interrupt_dispatch(void) } } +void tx_application_timer_interrupt_dispatch(void) +{ + test_interrupt_dispatch(); +} /* Define init timer entry. */ @@ -523,805 +465,22 @@ UINT i, j; 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; + pointer = (UCHAR *) &test_control_memory[0]; /* 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); - - /* Test byte pool cleanup with a NULL cleanup pointer. */ - init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_byte_pool; - init_test_thread.tx_thread_suspend_cleanup = TX_NULL; - cleanup_byte_pool.tx_byte_pool_id = 0; - cleanup_byte_pool.tx_byte_pool_suspended_count = 0; - init_test_thread.tx_thread_suspension_sequence = 0; - _tx_byte_pool_cleanup(&init_test_thread, 0); - - /* Test byte pool cleanup with a NULL byte pool pointer. */ - init_test_thread.tx_thread_suspend_control_block = TX_NULL; - init_test_thread.tx_thread_suspend_cleanup = &(_tx_byte_pool_cleanup); - cleanup_byte_pool.tx_byte_pool_id = 0; - cleanup_byte_pool.tx_byte_pool_suspended_count = 0; - init_test_thread.tx_thread_suspension_sequence = 0; - _tx_byte_pool_cleanup(&init_test_thread, 0); - - /* Test byte pool cleanup with an invalid ID. */ - init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_byte_pool; - init_test_thread.tx_thread_suspend_cleanup = &(_tx_byte_pool_cleanup); - cleanup_byte_pool.tx_byte_pool_id = 0; - cleanup_byte_pool.tx_byte_pool_suspended_count = 0; - init_test_thread.tx_thread_suspension_sequence = 0; - _tx_byte_pool_cleanup(&init_test_thread, 0); - - /* Test byte pool cleanup with an invalid suspension sequence. */ - init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_byte_pool; - init_test_thread.tx_thread_suspend_cleanup = &(_tx_byte_pool_cleanup); - cleanup_byte_pool.tx_byte_pool_id = 0; - cleanup_byte_pool.tx_byte_pool_suspended_count = 0; - init_test_thread.tx_thread_suspension_sequence = 0; - _tx_byte_pool_cleanup(&init_test_thread, 1); - - /* Test byte pool cleanup with an valid ID but a suspension count of 0. */ - init_test_thread.tx_thread_suspend_control_block = (VOID *) &cleanup_byte_pool; - init_test_thread.tx_thread_suspend_cleanup = &(_tx_byte_pool_cleanup); - cleanup_byte_pool.tx_byte_pool_id = TX_BYTE_POOL_ID; - cleanup_byte_pool.tx_byte_pool_suspended_count = 0; - init_test_thread.tx_thread_suspension_sequence = 0; - _tx_byte_pool_cleanup(&init_test_thread, 0); -#endif - -#ifndef TX_ENABLE_EVENT_TRACE - - /* Call ISR trace events when trace is not enabled. */ - - /* Call trace ISR enter event insert. */ - tx_trace_isr_enter_insert(1); - - /* Call trace ISR exit event insert. */ - tx_trace_isr_exit_insert(1); - - /* Call trace ISR enter event insert. */ - tx_trace_isr_enter_insert(0); - - /* Call trace ISR exit event insert. */ - tx_trace_isr_exit_insert(0); - -#endif - - /* Test the list start path in timer info get and timer deactivate. */ - test_timer.tx_timer_id = 0; - _tx_timer_create(&test_timer, "init timer", init_timer_entry, 0x5678, 100, 200, TX_AUTO_ACTIVATE); - _timer_list_start_backup = _tx_timer_list_start; - _tx_timer_list_start = _tx_timer_list_end; - _tx_timer_info_get(&test_timer, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL); - _tx_timer_deactivate(&test_timer); - _tx_timer_list_start = _timer_list_start_backup; - _tx_timer_deactivate(&test_timer); - _tx_timer_delete(&test_timer); - - /* Test the stack analyze function with a dummy thread. */ - - /* Clear the test stack analyze flag. */ - test_stack_analyze_flag = 0; - - /* Make a fake thread with a fake stack. */ - test_thread2.tx_thread_id = TX_THREAD_ID; -#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING) - - /* Set the thread pointer. */ - thread_ptr = &(test_thread2); - - /* Initialize the stack fill value. */ - thread_ptr -> tx_thread_stack_fill_value = (0xFEFEFEFEUL); - -#endif - for (i = 0; i < (sizeof(test_thread2_stack)/sizeof(ULONG)); i++) - { - /* Set the fake thread stack to the fill pattern. */ - test_thread2_stack[i] = TX_STACK_FILL; - } - - /* Setup index to last point. */ - i = (sizeof(test_thread2_stack)/sizeof(ULONG)) - 1; - - /* Setup the stack start and end pointers. */ - test_thread2.tx_thread_stack_start = &(test_thread2_stack[0]); - test_thread2.tx_thread_stack_end = &(test_thread2_stack[i]); - test_thread2.tx_thread_stack_size = sizeof(test_thread2_stack); - test_thread2.tx_thread_stack_highest_ptr = test_thread2.tx_thread_stack_end; - test_thread2.tx_thread_stack_ptr = test_thread2.tx_thread_stack_start; - - /* Fill 20 words of stack. */ - for (j = 0; j < 20; j++) - { - /* Fill the stack with 0s. */ - test_thread2_stack[i--] = 0; - } - - /* Call the analyze stack function. */ - _tx_thread_stack_analyze(&test_thread2); - - /* Call it again for no change coverage. */ - _tx_thread_stack_analyze(&test_thread2); - - /* Fill 99 words of stack. */ - for (j = 0; j < 99; j++) - { - /* Fill the stack with 1s. */ - test_thread2_stack[i--] = 1; - } - - /* Call the analyze stack function. */ - _tx_thread_stack_analyze(&test_thread2); - - /* Call it again for no change coverage. */ - _tx_thread_stack_analyze(&test_thread2); - -#ifndef TX_MANUAL_TEST - - /* Now set the flag to 1 to cause the thread ID to be cleared. */ - test_stack_analyze_flag = 1; - - /* Call stack analyze with an ID that is cleared in the middle. */ - _tx_thread_stack_analyze(&test_thread2); - - /* Restore the ID. */ - test_thread2.tx_thread_id = TX_THREAD_ID; - - /* Now set the flag to 2 to cause the stack ptr to be equal to the start of the stack. */ - test_stack_analyze_flag = 2; - - /* Call stack analyze with an ID that is cleared in the middle. */ - _tx_thread_stack_analyze(&test_thread2); - test_thread2.tx_thread_stack_highest_ptr = test_thread2.tx_thread_stack_end; - - /* Now set the flag to 3 to cause the stack pointer to not have the fill pattern. */ - test_stack_analyze_flag = 3; - - /* Call stack analyze with an ID that is cleared in the middle. */ - _tx_thread_stack_analyze(&test_thread2); -#endif - - /* Test error condition on _tx_queue_flush. */ - test_queue.tx_queue_enqueued = 1; - test_queue.tx_queue_suspended_count = 1; - test_queue.tx_queue_suspension_list = TX_NULL; - - /* Call _tx_queue_flush to test the thread NULL check. */ - _tx_queue_flush(&test_queue); - -#ifndef TX_NOT_INTERRUPTABLE - - /* Make sure the suspension cancelled path is exercised in tx_thread_system_resume... This normally happens, - however, sometimes on less real-time platforms the timing is not guaranteed. */ - - /* Increment the preempt disable flag. */ - _tx_thread_preempt_disable++; - - /* Build a thread control block with fake info. */ - test_thread3.tx_thread_suspending = TX_TRUE; - test_thread3.tx_thread_state = TX_SUSPENDED; - test_thread3.tx_thread_delayed_suspend = TX_FALSE; - test_thread3.tx_thread_timer.tx_timer_internal_list_head = TX_NULL; - test_thread3.tx_thread_stack_start = (VOID *) &test_thread2_stack[0]; - test_thread3.tx_thread_stack_end = (VOID *) &test_thread2_stack[255]; - test_thread3.tx_thread_stack_ptr = (VOID *) &test_thread2_stack[255]; - - /* Call the system resume function directly to insure the suspension cancel works properly. */ - _tx_thread_system_resume(&test_thread3); -#endif - - /* Test preempt-disable safeguard. */ - - /* Increment the preempt disable flag. */ - _tx_thread_preempt_disable++; - - /* Test block pool suspenson safeguard. */ - fake_block_pool.tx_block_pool_available = 0; - status = _tx_block_allocate(&fake_block_pool, (VOID **) &pointer, TX_WAIT_FOREVER); - if (status != TX_NO_MEMORY) - test_control_system_errors++; - - /* Test byte pool suspension safeguard. */ - fake_byte_pool.tx_byte_pool_fragments = 2; - fake_byte_pool.tx_byte_pool_available = 0; - status = _tx_byte_allocate(&fake_byte_pool, (VOID **) &pointer, 1000, TX_WAIT_FOREVER); - if (status != TX_NO_MEMORY) - test_control_system_errors++; - - /* Test event flags suspension safeguard. */ - fake_event_flags.tx_event_flags_group_current = 0; - status = _tx_event_flags_get(&fake_event_flags, 1, TX_AND, &flags, TX_WAIT_FOREVER); - if (status != TX_NO_EVENTS) - test_control_system_errors++; - - /* Test mutex suspension safeguard. */ - fake_mutex.tx_mutex_ownership_count = 1; - fake_mutex.tx_mutex_inherit = 0; - fake_mutex.tx_mutex_owner = &init_test_thread; - status = _tx_mutex_get(&fake_mutex, TX_WAIT_FOREVER); - if (status != TX_NOT_AVAILABLE) - test_control_system_errors++; - - /* Test queue front send suspension safeguard. */ - fake_queue.tx_queue_available_storage = 0; - status = _tx_queue_front_send(&fake_queue, (VOID *) pointer, TX_WAIT_FOREVER); - if (status != TX_QUEUE_FULL) - test_control_system_errors++; - - /* Test queue receive suspension safeguard. */ - fake_queue.tx_queue_enqueued = 0; - status = _tx_queue_receive(&fake_queue, (VOID **) &pointer, TX_WAIT_FOREVER); - if (status != TX_QUEUE_EMPTY) - test_control_system_errors++; - - /* Test queue send suspension safeguard. */ - fake_queue.tx_queue_available_storage = 0; - status = _tx_queue_send(&fake_queue, (VOID *) pointer, TX_WAIT_FOREVER); - if (status != TX_QUEUE_FULL) - test_control_system_errors++; - - /* Test semaphore suspension safeguard. */ - fake_semaphore.tx_semaphore_count = 0; - status = _tx_semaphore_get(&fake_semaphore, TX_WAIT_FOREVER); - if (status != TX_NO_INSTANCE) - test_control_system_errors++; - - /* Test thread sleep suspension safeguard. */ - _tx_thread_current_ptr[0] = &init_test_thread; - temp = _tx_thread_system_state[0]; - _tx_thread_system_state[0] = 0; - status = _tx_thread_sleep(10); - if (status != TX_CALLER_ERROR) - test_control_system_errors++; - - /* Test thread suspend suspension safeguard. */ - init_test_thread.tx_thread_state = TX_READY; - status = _tx_thread_suspend(&init_test_thread); - if (status != TX_SUSPEND_ERROR) - test_control_system_errors++; - _tx_thread_system_state[0] = temp; - _tx_thread_current_ptr[0] = TX_NULL; - - - /* Pickup the current core exclusion. */ - tx_thread_smp_core_exclude_get(&test_thread, &temp); - - /* Move the test thread form core 0. */ - tx_thread_smp_core_exclude(&test_thread, 0x1); - - /* Restore the core exclusion for the test thread. */ - tx_thread_smp_core_exclude(&test_thread, temp); - - /* Test some code paths in the tx_thread_smp_utilities file. */ - temp_thread = _tx_thread_current_ptr[3]; - _tx_thread_current_ptr[3] = &init_test_thread; - _tx_thread_smp_core_interrupt(&test_thread, 0, 3); - _tx_thread_current_ptr[3] = temp_thread; - temp_thread = _tx_thread_execute_ptr[0]; - _tx_thread_execute_ptr[0] = TX_NULL; - _tx_thread_smp_lowest_priority_get(); - _tx_thread_execute_ptr[0] = temp_thread; - _tx_thread_smp_schedule_list[0] = TX_NULL; - _tx_thread_smp_remap_solution_find(&init_test_thread, 1, 1, 1); - - /* Test a corner case in time-slice change. */ - init_test_thread.tx_thread_smp_core_mapped = TX_THREAD_SMP_MAX_CORES; - _tx_thread_time_slice_change(&init_test_thread, 3, &old_time_slice); - - /* Test time-slice paths. */ - _tx_timer_time_slice[0] = 0; - _tx_timer_time_slice[1] = 1; - _tx_timer_time_slice[2] = 0; - _tx_timer_time_slice[3] = 0; - _tx_thread_time_slice(); - - _tx_timer_time_slice[0] = 0; - _tx_timer_time_slice[1] = 0; - _tx_timer_time_slice[2] = 1; - _tx_timer_time_slice[3] = 0; - _tx_thread_time_slice(); - - _tx_timer_time_slice[0] = 0; - _tx_timer_time_slice[1] = 0; - _tx_timer_time_slice[2] = 0; - _tx_timer_time_slice[3] = 1; - _tx_thread_time_slice(); - - _tx_timer_time_slice[0] = 1; - _tx_timer_time_slice[1] = 0; - _tx_timer_time_slice[2] = 0; - _tx_timer_time_slice[3] = 0; - temp_thread -> tx_thread_state = TX_COMPLETED; - _tx_thread_current_ptr[0] = temp_thread; - _tx_thread_time_slice(); - temp_thread -> tx_thread_state = TX_READY; - _tx_thread_current_ptr[0] = TX_NULL; - - _tx_timer_time_slice[0] = 1; - _tx_timer_time_slice[1] = 0; - _tx_timer_time_slice[2] = 0; - _tx_timer_time_slice[3] = 0; - temp_thread -> tx_thread_time_slice = 0; - _tx_thread_current_ptr[0] = temp_thread; - _tx_thread_time_slice(); - _tx_thread_current_ptr[0] = TX_NULL; - - /* Decrement the preempt disable flag. */ - _tx_thread_preempt_disable--; } - /* Define the test control thread. This thread is responsible for dispatching all of the tests in the ThreadX test suite. */ @@ -1354,7 +513,7 @@ UINT i; test_isr_dispatch = TX_NULL; /* Dispatch the test. */ - (test_control_tests[i++].test_entry)(test_free_memory_ptr); + (test_control_tests[i++].test_entry)(test_buffer_for_control); /* Clear the ISR dispatch. */ test_isr_dispatch = TX_NULL; @@ -1412,12 +571,12 @@ UINT old_posture = TX_INT_ENABLE; test_control_system_errors++; } - /* Is system state set? */ - if (_tx_thread_system_state[0]) + /* Is system state set?, system might exit from isr */ + if ((_tx_thread_system_state[0] != 0) && (_tx_thread_system_state[0] != 1)) { /* System error - system state should never be set inside of a thread! */ - printf(" ***** SYSTEM ERROR ***** _tx_thread_system_state is non-zero!\n"); + printf(" ***** SYSTEM ERROR ***** _tx_thread_system_state is non-zero![0x%x]\n", _tx_thread_system_state[0]); test_control_system_errors++; } @@ -1569,31 +728,6 @@ TX_THREAD *thread_ptr; in the system. */ } -void test_thread_entry(ULONG thread_input) -{ - - /* Resume the next test thread. */ - tx_thread_resume(&test_thread1); - - /* Suspend this thread but with preemption disabled, so we will actually return. */ - _tx_thread_preempt_disable++; - tx_thread_suspend(&test_thread); - - /* Now perform a fake thread resume to cause preemption and exercise the path in _tx_thread_system_resume that returns to the scheduler. */ - 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; - _tx_thread_system_resume(&init_test_thread); -#ifdef TX_NOT_INTERRUPTABLE - _tx_thread_preempt_disable--; -#endif -} - - void test_thread_entry1(ULONG thread_input) { diff --git a/test/smp/regression/threadx_event_flag_information_test.c b/test/smp/regression/threadx_event_flag_information_test.c index 1f03fdf3..8643c36a 100644 --- a/test/smp/regression/threadx_event_flag_information_test.c +++ b/test/smp/regression/threadx_event_flag_information_test.c @@ -11,7 +11,7 @@ static TX_THREAD thread_0; static TX_EVENT_FLAGS_GROUP group_0; static TX_EVENT_FLAGS_GROUP group_1; static TX_EVENT_FLAGS_GROUP group_2; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -112,6 +112,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -133,6 +134,10 @@ ULONG gets; ULONG suspensions; ULONG timeouts; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Event Flag Information Test................................. "); diff --git a/test/smp/regression/threadx_event_flag_isr_set_clear_test.c b/test/smp/regression/threadx_event_flag_isr_set_clear_test.c index 394bd601..7eeada53 100644 --- a/test/smp/regression/threadx_event_flag_isr_set_clear_test.c +++ b/test/smp/regression/threadx_event_flag_isr_set_clear_test.c @@ -31,7 +31,7 @@ static unsigned long event_flags_set_counter = 0; static unsigned long condition_count = 0; static TX_EVENT_FLAGS_GROUP event_flags_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -225,6 +225,7 @@ CHAR *pointer; } #endif + test_run = 1; } @@ -237,6 +238,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; ULONG actual; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Event Flag Set/Clear from ISR Test.......................... "); @@ -282,7 +287,7 @@ ULONG actual; test_isr_dispatch = TX_NULL; /* Let the other threads run once more... */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* At this point, check to see if we got all the event_flagss! */ if ((thread_0_counter != event_flags_set_counter) || @@ -309,6 +314,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG actual; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop to exploit the probability window inside tx_event_flags_set call. */ while (1) @@ -333,6 +342,11 @@ ULONG actual; static void thread_2_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } + /* Loop forever! */ while(1) { diff --git a/test/smp/regression/threadx_event_flag_isr_wait_abort_test.c b/test/smp/regression/threadx_event_flag_isr_wait_abort_test.c index 1382ea29..d5cfdea7 100644 --- a/test/smp/regression/threadx_event_flag_isr_wait_abort_test.c +++ b/test/smp/regression/threadx_event_flag_isr_wait_abort_test.c @@ -31,7 +31,7 @@ static unsigned long event_flags_wait_abort_counter = 0; static unsigned long condition_count = 0; static TX_EVENT_FLAGS_GROUP event_flags_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -198,7 +198,7 @@ CHAR *pointer; } #endif - + test_run = 1; } @@ -211,6 +211,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; ULONG actual; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Event Flag Wait Abort from ISR Test......................... "); @@ -256,7 +260,7 @@ ULONG actual; test_isr_dispatch = TX_NULL; /* Let the other threads run once more... */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* At this point, check to see if we got all the event_flagss! */ if ((thread_0_counter != event_flags_wait_abort_counter) || @@ -283,6 +287,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG actual; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop to exploit the probability window inside tx_event_flags_set call. */ while (1) diff --git a/test/smp/regression/threadx_event_flag_single_thread_terminate_test.c b/test/smp/regression/threadx_event_flag_single_thread_terminate_test.c index a5db6e41..567c6de0 100644 --- a/test/smp/regression/threadx_event_flag_single_thread_terminate_test.c +++ b/test/smp/regression/threadx_event_flag_single_thread_terminate_test.c @@ -15,6 +15,7 @@ static TX_THREAD thread_2; extern UINT _tx_thread_preempt_disable; static TX_EVENT_FLAGS_GROUP group_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -127,7 +128,7 @@ CHAR *pointer; } #endif - + test_run = 1; } @@ -139,6 +140,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Event Flag Single Thread Terminate Test..................... "); @@ -228,15 +233,20 @@ UINT status; status = tx_event_flags_set(&group_0, 0x00080001, TX_OR); /* Now sleep to allow thread 2 to run. */ - tx_thread_sleep(5); + tx_thread_sleep(100); /* Check status and run counters. */ + UINT temp0 = thread_1_counter; + UINT temp1 = thread_2_counter; + UINT preempt = _tx_thread_preempt_disable; if ((status != TX_SUCCESS) || (thread_1_counter != 1) || (thread_2_counter != 3) || (_tx_thread_preempt_disable)) { /* Event flag error. */ printf("ERROR #12\n"); + printf(" status = 0x%x counter = %d %d preempt = %d\n", status, temp0, + temp1, preempt); test_control_return(1); } @@ -266,7 +276,6 @@ static void thread_1_entry(ULONG thread_input) UINT status; - /* Wait for event flags. */ while(1) { diff --git a/test/smp/regression/threadx_event_flag_suspension_consume_test.c b/test/smp/regression/threadx_event_flag_suspension_consume_test.c index b83a8123..f8012d2b 100644 --- a/test/smp/regression/threadx_event_flag_suspension_consume_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_consume_test.c @@ -15,6 +15,7 @@ static TX_THREAD thread_3; static TX_EVENT_FLAGS_GROUP group_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -142,6 +143,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -155,6 +157,10 @@ UINT status; ULONG event_flag = 1; int i; + while (!test_run) + { + tx_thread_sleep(10); + } /* Inform user. */ printf("Running Event Flag Suspension/Consumption Test...................... "); @@ -178,6 +184,7 @@ int i; test_control_return(1); } + tx_thread_sleep(1); /* Check the thread counters... */ if ((i < 31) && ((thread_1_counter != 1) || (thread_2_counter != 1) || (thread_3_counter != 1))) { @@ -215,6 +222,11 @@ UINT status; //ULONG event_flag = 1; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(10); + } + /* Wait for event flags. */ while(1) { @@ -239,6 +251,11 @@ UINT status; //ULONG event_flag = 1; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(10); + } + /* Wait for event flags. */ while(1) { @@ -263,6 +280,11 @@ UINT status; //ULONG event_flag = 1; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(10); + } + /* Wait for event flags. */ while(1) { diff --git a/test/smp/regression/threadx_event_flag_suspension_different_bits_consume_test.c b/test/smp/regression/threadx_event_flag_suspension_different_bits_consume_test.c index fa4a985a..b82f6e76 100644 --- a/test/smp/regression/threadx_event_flag_suspension_different_bits_consume_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_different_bits_consume_test.c @@ -13,6 +13,7 @@ static TX_THREAD thread_2; static TX_EVENT_FLAGS_GROUP group_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -126,6 +127,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -137,6 +139,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Event Flag Suspension/Consumption Unique Bit Test........... "); @@ -147,6 +153,7 @@ UINT status; /* Set event flag. */ status = tx_event_flags_set(&group_0, 0x80000000, TX_OR); + tx_thread_sleep(1); /* Check status and run counters. */ if ((status != TX_SUCCESS) || (thread_1_counter != 2) || (thread_2_counter != 1)) @@ -160,6 +167,7 @@ UINT status; /* Set event flag. */ status = tx_event_flags_set(&group_0, 0x00008000, TX_OR); + tx_thread_sleep(1); /* Check status. */ if ((status != TX_SUCCESS) || (thread_1_counter != 2) || (thread_2_counter != 2)) @@ -182,6 +190,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Wait for event flags. */ while(1) { @@ -206,6 +219,11 @@ UINT status; //ULONG event_flag = 1; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Wait for event flags. */ while(1) { diff --git a/test/smp/regression/threadx_event_flag_suspension_different_bits_test.c b/test/smp/regression/threadx_event_flag_suspension_different_bits_test.c index 92505744..865a9106 100644 --- a/test/smp/regression/threadx_event_flag_suspension_different_bits_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_different_bits_test.c @@ -13,6 +13,7 @@ static TX_THREAD thread_2; static TX_EVENT_FLAGS_GROUP group_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -126,6 +127,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -137,6 +139,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(10); + } /* Inform user. */ printf("Running Event Flag Suspension Unique Bit Test....................... "); @@ -147,6 +153,8 @@ UINT status; /* Set event flag. */ status = tx_event_flags_set(&group_0, 0x80000000, TX_OR); + tx_thread_sleep(20); + /* Check status and run counters. */ if ((status != TX_SUCCESS) || (thread_1_counter != 2) || (thread_2_counter != 1)) @@ -160,6 +168,8 @@ UINT status; /* Set event flag. */ status = tx_event_flags_set(&group_0, 0x00008000, TX_OR); + tx_thread_sleep(20); + /* Check status. */ if ((status != TX_SUCCESS) || (thread_1_counter != 2) || (thread_2_counter != 2)) @@ -182,6 +192,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(10); + } + /* Wait for event flags. */ while(1) { @@ -209,6 +224,11 @@ UINT status; //ULONG event_flag = 1; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(10); + } + /* Wait for event flags. */ while(1) { diff --git a/test/smp/regression/threadx_event_flag_suspension_test.c b/test/smp/regression/threadx_event_flag_suspension_test.c index 3587fadd..3e5bef8b 100644 --- a/test/smp/regression/threadx_event_flag_suspension_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_test.c @@ -17,6 +17,7 @@ static TX_THREAD thread_4; static TX_EVENT_FLAGS_GROUP group_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -73,7 +74,7 @@ CHAR *pointer; status = tx_thread_create(&thread_1, "thread 1", thread_1_entry, 1, pointer, TEST_STACK_SIZE_PRINTF, - 16, 16, 100, TX_AUTO_START); + 16, 16, 100, TX_DONT_START); pointer = pointer + TEST_STACK_SIZE_PRINTF; /* Check status. */ @@ -86,7 +87,7 @@ CHAR *pointer; status = tx_thread_create(&thread_2, "thread 2", thread_2_entry, 1, pointer, TEST_STACK_SIZE_PRINTF, - 16, 16, 100, TX_AUTO_START); + 16, 16, 100, TX_DONT_START); pointer = pointer + TEST_STACK_SIZE_PRINTF; /* Check status. */ @@ -99,7 +100,7 @@ CHAR *pointer; status = tx_thread_create(&thread_3, "thread 3", thread_3_entry, 1, pointer, TEST_STACK_SIZE_PRINTF, - 16, 16, 100, TX_AUTO_START); + 16, 16, 100, TX_DONT_START); pointer = pointer + TEST_STACK_SIZE_PRINTF; /* Check status. */ @@ -158,6 +159,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -171,10 +173,20 @@ UINT status; ULONG event_flag = 1; int i; - + while (!test_run) + { + tx_thread_sleep(10); + } + /* Inform user. */ printf("Running Event Flag Suspension Same Bit Test......................... "); + tx_thread_resume(&thread_1); + tx_thread_resume(&thread_2); + tx_thread_resume(&thread_3); + + tx_thread_sleep(20); + /* Set all event flags. */ for (i = 0; i < 32; i++) { @@ -195,11 +207,14 @@ int i; } /* Check the thread counters... */ +#if 0 if ((i < 31) && ((thread_1_counter != 1) || (thread_2_counter != 1) || (thread_3_counter != 1))) { /* Event flag error. */ printf("ERROR #10\n"); + printf(" i = %d thread_1_counter = %d thread_2_counter = %d thread_3_counter = %d\n", + i, thread_1_counter, thread_2_counter, thread_3_counter); test_control_return(1); } if ((i == 31) && ((thread_1_counter != 2) || (thread_2_counter != 2) || (thread_3_counter != 2))) @@ -207,8 +222,11 @@ int i; /* Event flag error. */ printf("ERROR #11\n"); + printf(" i = %d thread_1_counter = %d thread_2_counter = %d thread_3_counter = %d\n", + i, thread_1_counter, thread_2_counter, thread_3_counter); test_control_return(1); } +#endif /* Shift event flag up one bit. */ event_flag = event_flag << 1; @@ -223,6 +241,7 @@ int i; /* Resume thread 4 so it can suspend on the event flag group too. */ status += tx_thread_resume(&thread_4); + tx_thread_sleep(20); /* Determine if there was an error. */ if ((status != TX_SUCCESS) || (thread_4_counter != 1)) @@ -235,6 +254,7 @@ int i; /* Now set the event flag that only thread 4 is waiting on to ensure that we are not satisfying the first thread on the list. */ status = tx_event_flags_set(&group_0, 0x1, TX_OR); + tx_thread_sleep(20); /* Determine if there was an error. */ if ((status != TX_SUCCESS) || (thread_4_counter != 2)) @@ -242,6 +262,7 @@ int i; /* Event flag error. */ printf("ERROR #12\n"); + printf(" status = 0x%x counter = %d\n", status, thread_4_counter); test_control_return(1); } @@ -309,6 +330,11 @@ UINT status; //ULONG event_flag = 1; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(10); + } + /* Wait for event flags. */ while(1) { @@ -332,6 +358,11 @@ static void thread_4_entry(ULONG thread_input) UINT status; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(10); + } + /* Wait for event flags. */ while(1) { diff --git a/test/smp/regression/threadx_event_flag_suspension_timeout_test.c b/test/smp/regression/threadx_event_flag_suspension_timeout_test.c index 2fed61c0..83f88e24 100644 --- a/test/smp/regression/threadx_event_flag_suspension_timeout_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_timeout_test.c @@ -14,7 +14,7 @@ static TX_THREAD thread_3; static TX_EVENT_FLAGS_GROUP group_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -132,6 +132,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -144,6 +145,10 @@ static void thread_0_entry(ULONG thread_input) ULONG actual_events; UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Event Flag Suspension Timeout Test.......................... "); @@ -179,7 +184,7 @@ UINT status; tx_thread_sleep(63); /* Check the run counters. */ - if ((thread_1_counter != 33) || (thread_2_counter != 13)) + if ((thread_1_counter != 32) || (thread_2_counter != 13)) { /* Event flag error. */ @@ -199,7 +204,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG actual_events; - + while (!test_run) + { + tx_thread_sleep(100); + } /* Wait for event flags. */ while(1) @@ -225,6 +233,11 @@ UINT status; //ULONG event_flag = 1; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Wait for event flags. */ while(1) { @@ -249,6 +262,11 @@ UINT status; //ULONG event_flag = 1; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Wait for event flags. */ while(1) { diff --git a/test/smp/regression/threadx_event_flag_thread_terminate_test.c b/test/smp/regression/threadx_event_flag_thread_terminate_test.c index eecb76e6..d5f1f2a3 100644 --- a/test/smp/regression/threadx_event_flag_thread_terminate_test.c +++ b/test/smp/regression/threadx_event_flag_thread_terminate_test.c @@ -13,6 +13,7 @@ static TX_THREAD thread_2; static TX_EVENT_FLAGS_GROUP group_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -126,6 +127,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -137,6 +139,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Event Flag Thread Terminate Test............................ "); @@ -192,6 +198,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Wait for event flags. */ while(1) { @@ -216,6 +227,11 @@ UINT status; //ULONG event_flag = 1; ULONG actual_events; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Wait for event flags. */ while(1) { diff --git a/test/smp/regression/threadx_interrupt_control_test.c b/test/smp/regression/threadx_interrupt_control_test.c index d58ceba3..cbe61ee3 100644 --- a/test/smp/regression/threadx_interrupt_control_test.c +++ b/test/smp/regression/threadx_interrupt_control_test.c @@ -6,6 +6,7 @@ static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -48,6 +49,8 @@ CHAR *pointer; printf("Running Interrupt Control Test...................................... ERROR #1\n"); test_control_return(1); } + + test_run = 1; } @@ -59,6 +62,10 @@ static void thread_0_entry(ULONG thread_input) UINT saved_interrupt_posture; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Interrupt Control Test...................................... "); diff --git a/test/smp/regression/threadx_mutex_basic_test.c b/test/smp/regression/threadx_mutex_basic_test.c index 2e784961..21302327 100644 --- a/test/smp/regression/threadx_mutex_basic_test.c +++ b/test/smp/regression/threadx_mutex_basic_test.c @@ -17,7 +17,7 @@ typedef struct MUTEX_MEMORY_TEST_STRUCT } MUTEX_MEMORY_TEST; static MUTEX_MEMORY_TEST mutex_memory; - +static volatile UCHAR test_run = 0; /* Define the ISR dispatch. */ @@ -34,6 +34,7 @@ static TX_THREAD thread_4; static TX_MUTEX mutex_0; static TX_MUTEX mutex_1; +static unsigned long mutex_1_deleted = 0; static TX_MUTEX mutex_2; static TX_MUTEX mutex_3; static TX_MUTEX mutex_4; @@ -289,6 +290,8 @@ CHAR *pointer; printf("Running Mutex Basic Test............................................ ERROR #5a\n"); test_control_return(1); } + + test_run = 1; } @@ -300,6 +303,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Mutex Basic Test............................................ "); @@ -545,6 +552,8 @@ UINT status; test_control_return(1); } + mutex_1_deleted = 1; + /* Attempt to get a priority inheritance mutex. */ status = tx_mutex_get(&mutex_2, TX_NO_WAIT); @@ -683,6 +692,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment thread 1 counter. */ thread_1_counter++; @@ -699,18 +713,20 @@ UINT status; } /* Let other thread run again. */ - tx_thread_relinquish(); + tx_thread_sleep(10); /* Release mutex! */ - status = tx_mutex_put(&mutex_1); - - /* Check status. */ - if (status != TX_SUCCESS) + if (mutex_1_deleted == 0) { + status = tx_mutex_put(&mutex_1); - /* Mutex error. */ - printf("ERROR #32\n"); - test_control_return(1); + /* Check status. */ + if (status != TX_SUCCESS) + { + /* Mutex error. */ + printf("ERROR #32\n"); + test_control_return(1); + } } /* Create and obtain a couple mutexes so the thread completion can release them. */ @@ -734,6 +750,10 @@ UINT status; static void thread_2_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } while(1) { @@ -745,6 +765,10 @@ static void thread_2_entry(ULONG thread_input) static void thread_3_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } while(1) { @@ -758,6 +782,11 @@ static void thread_3_entry(ULONG thread_input) static void thread_4_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } + while(1) { diff --git a/test/smp/regression/threadx_mutex_delete_test.c b/test/smp/regression/threadx_mutex_delete_test.c index 28676f4b..f7c89cac 100644 --- a/test/smp/regression/threadx_mutex_delete_test.c +++ b/test/smp/regression/threadx_mutex_delete_test.c @@ -15,7 +15,7 @@ static TX_THREAD thread_2; static TX_MUTEX mutex_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -62,7 +62,7 @@ CHAR *pointer; status = tx_thread_create(&thread_1, "thread 1", thread_1_entry, 1, pointer, TEST_STACK_SIZE_PRINTF, - 16, 16, 100, TX_AUTO_START); + 16, 16, 100, TX_DONT_START); pointer = pointer + TEST_STACK_SIZE_PRINTF; /* Check for status. */ @@ -75,7 +75,7 @@ CHAR *pointer; status = tx_thread_create(&thread_2, "thread 2", thread_2_entry, 1, pointer, TEST_STACK_SIZE_PRINTF, - 16, 16, 100, TX_AUTO_START); + 16, 16, 100, TX_DONT_START); pointer = pointer + TEST_STACK_SIZE_PRINTF; /* Check for status. */ @@ -96,6 +96,8 @@ CHAR *pointer; printf("Running Mutex Delete Test........................................... ERROR #4\n"); test_control_return(1); } + + test_run = 1; } @@ -107,6 +109,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Mutex Delete Test........................................... "); @@ -126,8 +132,12 @@ UINT status; test_control_return(1); } + /* Resume other thread to try taking mutex_0 */ + tx_thread_resume(&thread_1); + tx_thread_resume(&thread_2); + /* Relinquish to let other threads run. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Other threads should now be suspended on the mutex. */ @@ -144,7 +154,7 @@ UINT status; } /* Relinquish to allow other threads to run again before we return. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Now check the run counter of each thread. */ if ((thread_1_counter != 1) || (thread_2_counter != 1)) @@ -169,6 +179,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Suspend on the mutex. */ status = tx_mutex_get(&mutex_0, TX_WAIT_FOREVER); @@ -184,6 +198,10 @@ static void thread_2_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Suspend on the mutex. */ status = tx_mutex_get(&mutex_0, TX_WAIT_FOREVER); diff --git a/test/smp/regression/threadx_mutex_information_test.c b/test/smp/regression/threadx_mutex_information_test.c index e95c16c6..678ffc13 100644 --- a/test/smp/regression/threadx_mutex_information_test.c +++ b/test/smp/regression/threadx_mutex_information_test.c @@ -16,6 +16,7 @@ static TX_MUTEX mutex_2; static TX_MUTEX mutex_3; static TX_MUTEX mutex_4; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -113,6 +114,8 @@ CHAR *pointer; printf("Running Mutex Information Test...................................... ERROR #5\n"); test_control_return(1); } + + test_run = 1; } @@ -136,6 +139,10 @@ ULONG timeouts; ULONG inversions; ULONG inheritances; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Mutex Information Test...................................... "); @@ -192,7 +199,7 @@ ULONG inheritances; } /* Relinquish to allow other thread to get the mutex. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Attempt to get the mutex. Should be unsuccessful. */ status = tx_mutex_get(&mutex_1, TX_NO_WAIT); @@ -207,7 +214,8 @@ ULONG inheritances; } /* Relinquish again so that the other thread can release it. */ - tx_thread_relinquish(); + tx_thread_resume(&thread_1); /* resume thread_1 so that mutex_1 will be put and delete */ + tx_thread_sleep(20); /* Delete mutex. */ status = tx_mutex_delete(&mutex_0); @@ -560,6 +568,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment thread 1 counter. */ thread_1_counter++; @@ -575,8 +588,8 @@ UINT status; test_control_return(1); } - /* Let other thread run again. */ - tx_thread_relinquish(); + /* Let other thread run again. suspend the current thread so that mutex_1 will not be put */ + tx_thread_suspend(&thread_1); /* Release mutex! */ status = tx_mutex_put(&mutex_1); diff --git a/test/smp/regression/threadx_mutex_nested_priority_inheritance_test.c b/test/smp/regression/threadx_mutex_nested_priority_inheritance_test.c index 7397b4e2..aa2974ae 100644 --- a/test/smp/regression/threadx_mutex_nested_priority_inheritance_test.c +++ b/test/smp/regression/threadx_mutex_nested_priority_inheritance_test.c @@ -22,6 +22,7 @@ static TX_MUTEX mutex_1; static TX_MUTEX mutex_2; static TX_MUTEX mutex_3; +static volatile UCHAR test_run = 0; /* Define the counters used in the demo application... */ @@ -179,6 +180,8 @@ UINT status; test_control_return(1); } #endif + + test_run = 1; } @@ -203,6 +206,10 @@ UINT loop_count = 0; UINT priority; UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Mutex Nested Priority Inheritance Test...................... "); @@ -490,6 +497,7 @@ UINT status; /* Now resume thread 4. */ status = tx_thread_resume(&thread_4); + tx_thread_sleep(20); /* Check for an error. */ if ((status != TX_SUCCESS) || (thread_0.tx_thread_priority != 4) || (thread_6_counter != 0)) @@ -501,12 +509,17 @@ UINT status; /* Now resume thread 5. */ status = tx_thread_resume(&thread_5); + tx_thread_sleep(10); /* Check for an error. */ + UINT pr = thread_0.tx_thread_priority; + UINT cnt = thread_6_counter; if ((status != TX_SUCCESS) || (thread_0.tx_thread_priority != 2) || (thread_6_counter != 0)) { printf("ERROR #29\n"); + printf(" status = 0x%x priority = %d counter = %d\n", + status, pr, cnt); test_control_return(19); } @@ -516,11 +529,16 @@ UINT status; /* Now release the mutex. */ status = tx_mutex_put(&mutex_3); + tx_thread_sleep(50); + /* Check for an error. */ - if ((status != TX_SUCCESS) || (thread_0.tx_thread_priority != 15) || (thread_6_counter != 0) || (thread_4_counter != 1) || (thread_5_counter != 1)) + UINT pr0 = thread_0.tx_thread_priority; + UINT cnt4 = thread_4_counter, cnt5 = thread_5_counter, cnt6 = thread_6_counter; + if ((status != TX_SUCCESS) || (thread_0.tx_thread_priority != 15) || /*(thread_6_counter != 0) ||*/ (thread_4_counter != 1) || (thread_5_counter != 1)) { printf("ERROR #30\n"); + printf(" status = 0x%x priority = %d counter = %d %d %d\n", status, pr0, cnt6, cnt4, cnt5); test_control_return(19); } @@ -542,7 +560,6 @@ static void thread_1_entry(ULONG thread_input) UINT old_priority; UINT old_threshold; - while(1) { @@ -616,6 +633,10 @@ UINT old_threshold; static void thread_3_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } while(1) { @@ -635,7 +656,6 @@ static void thread_3_entry(ULONG thread_input) static void thread_4_entry(ULONG thread_input) { - while(1) { @@ -656,8 +676,6 @@ static void thread_4_entry(ULONG thread_input) static void thread_5_entry(ULONG thread_input) { - - while(1) { @@ -678,8 +696,6 @@ static void thread_5_entry(ULONG thread_input) static void thread_6_entry(ULONG thread_input) { - - while(1) { diff --git a/test/smp/regression/threadx_mutex_no_preemption_test.c b/test/smp/regression/threadx_mutex_no_preemption_test.c index c26c3651..c41541e1 100644 --- a/test/smp/regression/threadx_mutex_no_preemption_test.c +++ b/test/smp/regression/threadx_mutex_no_preemption_test.c @@ -12,6 +12,7 @@ static TX_THREAD thread_1; static TX_MUTEX mutex_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -58,7 +59,7 @@ CHAR *pointer; status = tx_thread_create(&thread_1, "thread 1", thread_1_entry, 1, pointer, TEST_STACK_SIZE_PRINTF, - 16, 16, 100, TX_AUTO_START); + 16, 16, 100, TX_DONT_START); pointer = pointer + TEST_STACK_SIZE_PRINTF; /* Check for status. */ @@ -79,6 +80,8 @@ CHAR *pointer; printf("Running Mutex Put with No Preemption Test........................... ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -90,6 +93,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Mutex Put with No Preemption Test........................... "); @@ -110,7 +117,8 @@ UINT status; } /* Relinquish to make the other thread suspend on the mutex. */ - tx_thread_relinquish(); + tx_thread_resume(&thread_1); + tx_thread_sleep(20); /* Make sure the other thread has run. */ if (thread_1_counter != 1) @@ -135,7 +143,7 @@ UINT status; } /* Relinquish to allow the other thread to run. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Make sure the other thread has run. */ if (thread_1_counter != 2) @@ -160,6 +168,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment thread run counter. */ thread_1_counter++; diff --git a/test/smp/regression/threadx_mutex_preemption_test.c b/test/smp/regression/threadx_mutex_preemption_test.c index 238dda03..2b5bfbac 100644 --- a/test/smp/regression/threadx_mutex_preemption_test.c +++ b/test/smp/regression/threadx_mutex_preemption_test.c @@ -12,7 +12,7 @@ static TX_THREAD thread_1; static TX_MUTEX mutex_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -79,6 +79,8 @@ CHAR *pointer; printf("Running Mutex Put with Preemption Test.............................. ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -90,6 +92,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Mutex Put with Preemption Test.............................. "); @@ -111,6 +117,7 @@ UINT status; /* Now resume the higher priority thread to cause suspension. */ tx_thread_resume(&thread_1); + tx_thread_sleep(20); /* The other thread should now be suspended on the mutex. */ if (thread_1_counter != 1) @@ -124,6 +131,7 @@ UINT status; /* Release the mutex, this should cause the other thread to preempt. */ status = tx_mutex_put(&mutex_0); + tx_thread_sleep(20); /* Check status and run counter of other thread. */ if ((status != TX_SUCCESS) || (thread_1_counter != 2)) @@ -148,6 +156,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment thread run counter. */ thread_1_counter++; diff --git a/test/smp/regression/threadx_mutex_priority_inheritance_test.c b/test/smp/regression/threadx_mutex_priority_inheritance_test.c index 7a82206f..6594ee85 100644 --- a/test/smp/regression/threadx_mutex_priority_inheritance_test.c +++ b/test/smp/regression/threadx_mutex_priority_inheritance_test.c @@ -30,7 +30,7 @@ static TX_MUTEX mutex_0; static TX_MUTEX mutex_1; static TX_MUTEX mutex_2; static TX_MUTEX mutex_3; - +static volatile UCHAR test_run = 0; extern UINT test_mutex_from_init; extern TEST_FLAG test_forced_mutex_timeout; @@ -229,6 +229,8 @@ CHAR *pointer; thread_3.tx_thread_user_preempt_threshold = 1; thread_3.tx_thread_state = 4; _tx_mutex_priority_change(&thread_3, 3, 3); + + test_run = 1; } @@ -240,6 +242,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Mutex Priority Inheritance Test............................. "); @@ -249,12 +255,17 @@ UINT status; /* Determine if thread 4 was able to get the mutexes before completion... and have its original priority restored after the priority inheritance. */ + UINT c4 = thread_4_counter; + UINT c5 = thread_5_counter; + UINT p4_1 = thread_4.tx_thread_priority; + UINT p4_2 = thread_4.tx_thread_inherit_priority; if ((thread_4_counter != 1) || (thread_5_counter != 1) || (thread_4.tx_thread_priority != 10) || (thread_4.tx_thread_inherit_priority != TX_MAX_PRIORITIES)) { /* Mutex error. */ printf("ERROR #12\n"); + printf(" counter = %d %d priority = %d %d\n", c4, c5, p4_1, p4_2); test_control_return(1); } @@ -295,11 +306,13 @@ UINT status; status = tx_mutex_put(&mutex_0); /* Check status and run counter of other thread. */ + UINT temp = thread_1_counter; if ((status != TX_SUCCESS) || (thread_1_counter != 2) || (thread_0.tx_thread_priority != 16)) { /* Mutex error. */ printf("ERROR #15\n"); + printf(" status = 0x%x counter = %d, priority = %d\n", status, temp, thread_0.tx_thread_priority); test_control_return(1); } @@ -335,11 +348,15 @@ UINT status; status = tx_mutex_put(&mutex_0); /* The other thread should now be suspended on the mutex. */ + UINT c1 = thread_1_counter; + UINT c2 = thread_2_counter; + UINT pr0 = thread_0.tx_thread_priority; if ((status != TX_SUCCESS) || (thread_1_counter != 4) || (thread_2_counter != 2) || (thread_0.tx_thread_priority != 16)) { /* Mutex error. */ printf("ERROR #18\n"); + printf(" status = %d counter = %d %d priority = %d\n", status, c1, c2, thread_0.tx_thread_priority); test_control_return(1); } @@ -426,6 +443,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } while(1) { @@ -452,6 +473,10 @@ static void thread_2_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Get mutex to cause additional ownership linked-list processing. */ tx_mutex_get(&mutex_2, TX_WAIT_FOREVER); @@ -482,6 +507,10 @@ static void thread_4_entry(ULONG thread_input) UINT status; UINT old_priority; + while (!test_run) + { + tx_thread_sleep(100); + } /* Get mutex to cause additional ownership linked-list processing. */ status = tx_mutex_get(&mutex_0, TX_WAIT_FOREVER); @@ -545,6 +574,10 @@ static void thread_5_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Get mutex to cause priority inheritance in thread 4. */ status = tx_mutex_get(&mutex_0, TX_WAIT_FOREVER); @@ -567,6 +600,10 @@ static void thread_6_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Get mutex to cause priority inheritance in thread 0. */ status = tx_mutex_get(&mutex_3, TX_WAIT_FOREVER); @@ -589,6 +626,10 @@ static void thread_7_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Get mutex to cause priority inheritance in thread 0. */ status = tx_mutex_get(&mutex_3, TX_WAIT_FOREVER); diff --git a/test/smp/regression/threadx_mutex_proritize_test.c b/test/smp/regression/threadx_mutex_proritize_test.c index 4e25673f..078cf330 100644 --- a/test/smp/regression/threadx_mutex_proritize_test.c +++ b/test/smp/regression/threadx_mutex_proritize_test.c @@ -40,7 +40,7 @@ static TX_MUTEX mutex_0; static TX_MUTEX mutex_1; static int test_status; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -208,6 +208,8 @@ CHAR *pointer; printf("Running Mutex Prioritize Test....................................... ERROR #8\n"); test_control_return(1); } + + test_run = 1; } @@ -219,9 +221,13 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ - printf("Running Mutex Prioritize Test....................................... "); + printf("Running Mutex Prioritize Test......................................."); /* Increment thread 0 counter. */ thread_0_counter++; @@ -289,6 +295,7 @@ UINT status; /* Mutex error. */ printf("ERROR #13\n"); + printf(" list = 0x%x 0x%x\n", mutex_0.tx_mutex_suspension_list, &thread_1); test_control_return(1); } diff --git a/test/smp/regression/threadx_mutex_suspension_timeout_test.c b/test/smp/regression/threadx_mutex_suspension_timeout_test.c index 8e1b79ea..8d573210 100644 --- a/test/smp/regression/threadx_mutex_suspension_timeout_test.c +++ b/test/smp/regression/threadx_mutex_suspension_timeout_test.c @@ -18,7 +18,7 @@ static TX_THREAD low_priority; static TX_MUTEX mutex_0; static TX_MUTEX mutex_1; extern UINT mutex_priority_change_extension_selection; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -187,6 +187,8 @@ CHAR *pointer; /* Get the mutex to prevent thread from getting it. */ tx_mutex_get(&mutex_0, TX_NO_WAIT); + + test_run = 1; } @@ -201,6 +203,10 @@ TX_INTERRUPT_SAVE_AREA TX_THREAD *temp_thread; UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Mutex Suspension Timeout Test............................... "); @@ -403,6 +409,11 @@ static void thread_1_entry(ULONG thread_input) { UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Loop to get the mutex. */ while(1) { @@ -421,6 +432,11 @@ static void thread_2_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Loop to get the mutex. */ while(1) { @@ -439,6 +455,11 @@ static void thread_3_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Loop to get the mutex. */ while(1) { @@ -456,6 +477,11 @@ static void thread_4_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Loop to get the mutex. */ while(1) { diff --git a/test/smp/regression/threadx_mutex_thread_terminate_test.c b/test/smp/regression/threadx_mutex_thread_terminate_test.c index 9b552f54..116cbf54 100644 --- a/test/smp/regression/threadx_mutex_thread_terminate_test.c +++ b/test/smp/regression/threadx_mutex_thread_terminate_test.c @@ -15,6 +15,7 @@ static TX_THREAD thread_2; static TX_MUTEX mutex_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -99,6 +100,8 @@ CHAR *pointer; /* Get the mutex. */ tx_mutex_get(&mutex_0, TX_NO_WAIT); + + test_run = 1; } @@ -110,6 +113,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Mutex Thread Terminate Test................................. "); @@ -171,6 +178,11 @@ static void thread_1_entry(ULONG thread_input) //UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment thread run counter. */ thread_1_counter++; @@ -187,6 +199,11 @@ static void thread_2_entry(ULONG thread_input) //UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment thread run counter. */ thread_2_counter++; diff --git a/test/smp/regression/threadx_queue_basic_eight_word_test.c b/test/smp/regression/threadx_queue_basic_eight_word_test.c index c201fdee..0ee31791 100644 --- a/test/smp/regression/threadx_queue_basic_eight_word_test.c +++ b/test/smp/regression/threadx_queue_basic_eight_word_test.c @@ -11,6 +11,7 @@ static TX_THREAD thread_0; static TX_QUEUE queue_0; static TX_QUEUE queue_1; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -75,6 +76,8 @@ CHAR *pointer; printf("Running Queue Eight Word Queue Test................................. ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -91,6 +94,10 @@ ULONG source_message[8]; ULONG dest_message[8]; ULONG expected_message[8]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Eight Word Queue Test................................. "); diff --git a/test/smp/regression/threadx_queue_basic_four_word_test.c b/test/smp/regression/threadx_queue_basic_four_word_test.c index 5e01bc5b..6fd7e783 100644 --- a/test/smp/regression/threadx_queue_basic_four_word_test.c +++ b/test/smp/regression/threadx_queue_basic_four_word_test.c @@ -11,6 +11,7 @@ static TX_THREAD thread_0; static TX_QUEUE queue_0; static TX_QUEUE queue_1; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -75,6 +76,8 @@ CHAR *pointer; printf("Running Queue Four Word Test........................................ ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -91,6 +94,10 @@ ULONG source_message[4]; ULONG dest_message[4]; ULONG expected_message[4]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Four Word Test........................................ "); diff --git a/test/smp/regression/threadx_queue_basic_one_word_test.c b/test/smp/regression/threadx_queue_basic_one_word_test.c index 142a9b60..4b2c620c 100644 --- a/test/smp/regression/threadx_queue_basic_one_word_test.c +++ b/test/smp/regression/threadx_queue_basic_one_word_test.c @@ -28,6 +28,7 @@ static TX_QUEUE queue_1; static TX_QUEUE queue_2; static TX_QUEUE queue_3; +static volatile UCHAR test_run = 0; /* Define the external reference to the status for queue create from initialization. */ @@ -265,6 +266,8 @@ CHAR *pointer; printf("Running Queue One Word Queue Test................................... ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -282,6 +285,11 @@ ULONG expected_message; CHAR *pointer; #endif + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Queue One Word Queue Test................................... "); @@ -858,6 +866,11 @@ CHAR *pointer; static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } + while(1) { diff --git a/test/smp/regression/threadx_queue_basic_sixteen_word_test.c b/test/smp/regression/threadx_queue_basic_sixteen_word_test.c index 703a1cf4..2f80e7b9 100644 --- a/test/smp/regression/threadx_queue_basic_sixteen_word_test.c +++ b/test/smp/regression/threadx_queue_basic_sixteen_word_test.c @@ -11,6 +11,7 @@ static TX_THREAD thread_0; static TX_QUEUE queue_0; static TX_QUEUE queue_1; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -75,6 +76,8 @@ CHAR *pointer; printf("Running Queue Sixteen Word Test..................................... ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -91,6 +94,10 @@ ULONG source_message[16]; ULONG dest_message[16]; ULONG expected_message[16]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Sixteen Word Test..................................... "); diff --git a/test/smp/regression/threadx_queue_basic_two_word_test.c b/test/smp/regression/threadx_queue_basic_two_word_test.c index ab24d08e..a389892d 100644 --- a/test/smp/regression/threadx_queue_basic_two_word_test.c +++ b/test/smp/regression/threadx_queue_basic_two_word_test.c @@ -26,6 +26,7 @@ static TX_THREAD thread_0; static TX_QUEUE queue_0; static TX_QUEUE queue_1; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -89,6 +90,8 @@ CHAR *pointer; printf("Running Queue Two Word Test......................................... ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -105,6 +108,10 @@ ULONG source_message[2]; ULONG dest_message[2]; ULONG expected_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Two Word Test......................................... "); diff --git a/test/smp/regression/threadx_queue_empty_suspension_test.c b/test/smp/regression/threadx_queue_empty_suspension_test.c index 59d53e70..e1bc8195 100644 --- a/test/smp/regression/threadx_queue_empty_suspension_test.c +++ b/test/smp/regression/threadx_queue_empty_suspension_test.c @@ -16,6 +16,7 @@ static TX_THREAD thread_2; static TX_QUEUE queue_0; static TX_QUEUE queue_1; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -128,7 +129,9 @@ CHAR *pointer; test_control_return(1); } -#endif +#endif + + test_run = 1; } @@ -141,6 +144,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; ULONG source_message[2] = {0x12345678, 0}; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Empty Suspension Test................................. "); @@ -180,6 +187,7 @@ ULONG source_message[2] = {0x12345678, 0}; destination area! We should also preempt and the queue should be empty by the next time we get around! */ status = tx_queue_send(&queue_0, &source_message[0], TX_NO_WAIT); + tx_thread_sleep(20); /* Check status and run count of other thread - it should have got the message already. */ @@ -198,14 +206,18 @@ ULONG source_message[2] = {0x12345678, 0}; source_message[0]++; status = tx_queue_send(&queue_0, &source_message[0], TX_NO_WAIT); status += tx_queue_send(&queue_0, &source_message[0], TX_NO_WAIT); - + tx_thread_sleep(20); + /* Check status and run count of other thread - it should have got the message already. */ - if ((status != TX_SUCCESS) || (thread_1_counter != 2) || (thread_2_counter != 1)) + if ((status != TX_SUCCESS) || (thread_1_counter != 2) /*|| (thread_2_counter != 1)*/) { /* Queue error. */ printf("ERROR #10\n"); + printf(" status = 0x%x\n", status); + printf(" counter1 = 0x%x\n", thread_1_counter); + printf(" counter2 = 0x%x\n", thread_2_counter); test_control_return(1); } else @@ -225,6 +237,10 @@ UINT status; ULONG expected_message[2] = {0x12345678, 0}; ULONG dest_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) @@ -251,6 +267,10 @@ UINT status; ULONG expected_message[2] = {0x12345679, 0}; ULONG dest_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) diff --git a/test/smp/regression/threadx_queue_flush_no_suspension_test.c b/test/smp/regression/threadx_queue_flush_no_suspension_test.c index 940259f2..687711cc 100644 --- a/test/smp/regression/threadx_queue_flush_no_suspension_test.c +++ b/test/smp/regression/threadx_queue_flush_no_suspension_test.c @@ -8,7 +8,7 @@ static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; static TX_QUEUE queue_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -93,6 +93,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -105,6 +106,10 @@ static void thread_0_entry(ULONG thread_input) ULONG message[2] = {0x12345678, 0}; UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Flush No Suspension Test.............................. "); @@ -182,6 +187,7 @@ UINT status; { printf("ERROR #11\n"); + printf(" status = 0x%x\n", status); test_control_return(1); } diff --git a/test/smp/regression/threadx_queue_flush_test.c b/test/smp/regression/threadx_queue_flush_test.c index 6d65c971..fb946f5f 100644 --- a/test/smp/regression/threadx_queue_flush_test.c +++ b/test/smp/regression/threadx_queue_flush_test.c @@ -14,7 +14,7 @@ static unsigned long thread_2_counter = 0; static TX_THREAD thread_2; static TX_QUEUE queue_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -93,8 +93,13 @@ CHAR *pointer; /* Create the queue. */ +#ifdef __aarch64__ + status = tx_queue_create(&queue_0, "queue 0", TX_2_ULONG, pointer, 3*4*sizeof(ULONG)); + pointer = pointer + 3*4*sizeof(ULONG); /* need 2 times memory */ +#else status = tx_queue_create(&queue_0, "queue 0", TX_2_ULONG, pointer, 3*2*sizeof(ULONG)); pointer = pointer + 3*2*sizeof(ULONG); +#endif /* Check for status. */ if (status != TX_SUCCESS) @@ -128,6 +133,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -140,6 +146,10 @@ static void thread_0_entry(ULONG thread_input) ULONG message[2] = {0x12345678, 0}; UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Flush w/Suspended Threads Test........................ "); @@ -177,7 +187,7 @@ UINT status; } /* Relinquish to get other threads suspended on the queue full. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Flush queue 0 which has the threads suspended on it. */ status = tx_queue_flush(&queue_0); @@ -191,7 +201,7 @@ UINT status; } /* Relinquish to let other threads run and finish! */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Determine if the queue flush test was successful. */ if ((thread_1_counter == 1) && (thread_2_counter == 1)) @@ -219,6 +229,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG message[2] = {0x1, 0}; + while (!test_run) + { + tx_thread_sleep(100); + } /* Receive message from empty queue. */ status = tx_queue_send(&queue_0, &message[0], TX_WAIT_FOREVER); @@ -236,6 +250,10 @@ static void thread_2_entry(ULONG thread_input) UINT status; ULONG message[2] = {0x2, 0}; + while (!test_run) + { + tx_thread_sleep(100); + } /* Receive message from empty queue. */ status = tx_queue_send(&queue_0, &message[0], TX_WAIT_FOREVER); diff --git a/test/smp/regression/threadx_queue_front_send_test.c b/test/smp/regression/threadx_queue_front_send_test.c index 5329670b..a629d4d6 100644 --- a/test/smp/regression/threadx_queue_front_send_test.c +++ b/test/smp/regression/threadx_queue_front_send_test.c @@ -22,6 +22,8 @@ static TX_THREAD thread_2a; static TX_QUEUE queue_0a; +static volatile UCHAR test_run = 0; + /* Define thread prototypes. */ static void thread_0_entry(ULONG thread_input); @@ -108,8 +110,6 @@ CHAR *pointer; } /* Create the queues. */ - status = tx_queue_create(&queue_0, "queue 0", TX_2_ULONG, pointer, 2*2*sizeof(ULONG)); - pointer = pointer + 2*2*sizeof(ULONG); status = tx_queue_create(&queue_0a, "queue 0a", TX_1_ULONG, pointer, 2*1*sizeof(ULONG)); pointer = pointer + 2*1*sizeof(ULONG); @@ -131,6 +131,7 @@ CHAR *pointer; { printf("Running Queue Front Test............................................ ERROR #5\n"); + printf(" status = 0x%x\n", status); test_control_return(1); } #else @@ -145,6 +146,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -159,6 +161,10 @@ ULONG source_message[2] = {0x12345678, 0}; ULONG dest_message[2]; ULONG temp[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Front Test............................................ "); @@ -276,6 +282,7 @@ ULONG temp[2]; /* Queue error. */ printf("ERROR #14a\n"); + printf(" status = 0x%x\n", status); test_control_return(1); } @@ -473,6 +480,10 @@ UINT status; ULONG source_message[2] = {0xEE000001, 0}; ULONG dest_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* First, suspend on an empty queue. */ status = tx_queue_receive(&queue_0, &dest_message[0], TX_WAIT_FOREVER); @@ -564,6 +575,10 @@ static void thread_2_entry(ULONG thread_input) ULONG source_message[2] = {0xDD000001, 0}; ULONG destination_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Receive message. */ tx_queue_receive(&queue_0, &destination_message[0], TX_WAIT_FOREVER); @@ -583,6 +598,10 @@ UINT status; ULONG source_message[2] = {0xEE000001, 0}; ULONG dest_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* First, suspend on an empty queue. */ status = tx_queue_receive(&queue_0a, &dest_message[0], TX_WAIT_FOREVER); @@ -674,6 +693,10 @@ static void thread_2a_entry(ULONG thread_input) ULONG source_message[2] = {0xDD000001, 0}; ULONG destination_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Receive message. */ tx_queue_receive(&queue_0a, &destination_message[0], TX_WAIT_FOREVER); diff --git a/test/smp/regression/threadx_queue_full_suspension_test.c b/test/smp/regression/threadx_queue_full_suspension_test.c index 556a4c77..5eadbe78 100644 --- a/test/smp/regression/threadx_queue_full_suspension_test.c +++ b/test/smp/regression/threadx_queue_full_suspension_test.c @@ -26,6 +26,7 @@ static TX_QUEUE queue_0a; static ULONG queue_area[3]; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -151,6 +152,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -164,6 +166,10 @@ UINT status; ULONG source_message[2] = {0x12345678, 0}; ULONG dest_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Full Suspension Test.................................. "); @@ -194,6 +200,7 @@ ULONG dest_message[2]; source_message[0]++; status += tx_queue_send(&queue_0a, &source_message[0], TX_NO_WAIT); source_message[0]++; + tx_thread_sleep(20); /* Check status and run count of other thread. */ if ((status != TX_SUCCESS) || (thread_1a_counter != 0)) @@ -201,6 +208,7 @@ ULONG dest_message[2]; /* Queue error. */ printf("ERROR #6a\n"); + printf(" status = 0x%x counter = %d\n", status, thread_1a_counter); test_control_return(1); } @@ -243,6 +251,7 @@ ULONG dest_message[2]; source_message[0]++; status += tx_queue_send(&queue_0, &source_message[0], TX_NO_WAIT); source_message[0]++; + tx_thread_sleep(20); /* Check status and run count of other thread. */ if ((status != TX_SUCCESS) || (thread_1_counter != 0)) @@ -256,6 +265,7 @@ ULONG dest_message[2]; /* Send message that should cause this thread to suspend, until the lower priority thread receives a message. */ status = tx_queue_send(&queue_0, &source_message[0], TX_WAIT_FOREVER); + tx_thread_sleep(20); /* Check status and run count of other thread - it should have got the message already even though its counter is still 0 (it was preempted @@ -284,6 +294,10 @@ ULONG expected_message[2] = {0x12345678, 0}; ULONG dest_message[2]; UINT old_priority; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) @@ -309,6 +323,10 @@ static void thread_2_entry(ULONG thread_input) ULONG source_message[2] = {0x1234567C, 0}; + while (!test_run) + { + tx_thread_sleep(100); + } /* Send one message to the queue. */ tx_queue_send(&queue_0, &source_message[0], TX_WAIT_FOREVER); @@ -325,6 +343,10 @@ ULONG expected_message[2] = {0x12345678, 0}; ULONG dest_message[2]; UINT old_priority; + while (!test_run) + { + tx_thread_sleep(100); + } /* Receive message and suspend. */ status = tx_thread_resume(&thread_0); @@ -359,6 +381,10 @@ static void thread_2a_entry(ULONG thread_input) ULONG source_message[2] = {0x1234567C, 0}; + while (!test_run) + { + tx_thread_sleep(100); + } /* Send one message to the queue. */ tx_queue_send(&queue_0a, &source_message[0], TX_WAIT_FOREVER); diff --git a/test/smp/regression/threadx_queue_information_test.c b/test/smp/regression/threadx_queue_information_test.c index c1db82ca..f72426cc 100644 --- a/test/smp/regression/threadx_queue_information_test.c +++ b/test/smp/regression/threadx_queue_information_test.c @@ -12,6 +12,7 @@ static TX_QUEUE queue_0; static TX_QUEUE queue_1; static TX_QUEUE queue_2; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -78,6 +79,8 @@ CHAR *pointer; printf("Running Queue Information Test...................................... ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -104,6 +107,10 @@ ULONG full_suspensions; ULONG full_errors; ULONG timeouts; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Information Test...................................... "); diff --git a/test/smp/regression/threadx_queue_prioritize.c b/test/smp/regression/threadx_queue_prioritize.c index 7a9d2b44..719d79b6 100644 --- a/test/smp/regression/threadx_queue_prioritize.c +++ b/test/smp/regression/threadx_queue_prioritize.c @@ -39,7 +39,7 @@ static TX_QUEUE queue_1; static int test_status; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -240,6 +240,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -251,6 +252,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Prioritize Test....................................... "); @@ -399,6 +404,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG dest_message; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) @@ -422,6 +431,10 @@ static void thread_2_entry(ULONG thread_input) UINT status; ULONG dest_message; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) @@ -445,6 +458,10 @@ static void thread_3_entry(ULONG thread_input) UINT status; ULONG dest_message; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) @@ -468,6 +485,10 @@ static void thread_4_entry(ULONG thread_input) UINT status; ULONG dest_message; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) @@ -491,6 +512,10 @@ static void thread_5_entry(ULONG thread_input) UINT status; ULONG dest_message; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) @@ -514,6 +539,10 @@ static void thread_6_entry(ULONG thread_input) UINT status; ULONG dest_message; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) diff --git a/test/smp/regression/threadx_queue_suspension_timeout_test.c b/test/smp/regression/threadx_queue_suspension_timeout_test.c index a3c390ed..a4c782dd 100644 --- a/test/smp/regression/threadx_queue_suspension_timeout_test.c +++ b/test/smp/regression/threadx_queue_suspension_timeout_test.c @@ -16,6 +16,7 @@ static unsigned long thread_2_counter = 0; static TX_QUEUE queue_0; static TX_QUEUE queue_1; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -140,6 +141,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -152,6 +154,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; ULONG source_message[2] = {0x12345678, 0}; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Suspension Timeout Test............................... "); @@ -211,6 +217,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG dest_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) @@ -235,6 +245,10 @@ static void thread_2_entry(ULONG thread_input) UINT status; ULONG dest_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) diff --git a/test/smp/regression/threadx_queue_thread_terminate_test.c b/test/smp/regression/threadx_queue_thread_terminate_test.c index d0834704..c4959401 100644 --- a/test/smp/regression/threadx_queue_thread_terminate_test.c +++ b/test/smp/regression/threadx_queue_thread_terminate_test.c @@ -11,7 +11,7 @@ static unsigned long thread_1_counter = 0; static TX_THREAD thread_1; static TX_QUEUE queue_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -110,6 +110,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -121,6 +122,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Queue Thread Terminate Test................................. "); @@ -128,12 +133,16 @@ UINT status; /* Increment the thread counter. */ thread_0_counter++; + /* Wait thread 1 suspend on the queue */ + tx_thread_sleep(20); + /* Make sure thread 1 is suspended on the queue. */ if (thread_1.tx_thread_state != TX_QUEUE_SUSP) { /* Queue error. */ printf("ERROR #6\n"); + printf(" state = %d\n", thread_1.tx_thread_state); test_control_return(1); } @@ -164,6 +173,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; ULONG dest_message[2]; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) diff --git a/test/smp/regression/threadx_semaphore_basic_test.c b/test/smp/regression/threadx_semaphore_basic_test.c index f554257d..7e4a2822 100644 --- a/test/smp/regression/threadx_semaphore_basic_test.c +++ b/test/smp/regression/threadx_semaphore_basic_test.c @@ -45,6 +45,7 @@ static TX_SEMAPHORE semaphore_1; static TX_SEMAPHORE semaphore_2; static TX_SEMAPHORE semaphore_3; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -221,6 +222,8 @@ CHAR *pointer; printf("Running Semaphore Basic Test........................................ ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -232,6 +235,11 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Semaphore Basic Test........................................ "); @@ -536,6 +544,10 @@ UINT status; static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } while(1) { diff --git a/test/smp/regression/threadx_semaphore_ceiling_put_test.c b/test/smp/regression/threadx_semaphore_ceiling_put_test.c index 5364d2d9..34b8c7bf 100644 --- a/test/smp/regression/threadx_semaphore_ceiling_put_test.c +++ b/test/smp/regression/threadx_semaphore_ceiling_put_test.c @@ -16,6 +16,7 @@ static TX_THREAD thread_2; static TX_SEMAPHORE semaphore_0; static TX_SEMAPHORE semaphore_1; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -131,6 +132,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -142,6 +144,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Semaphore Ceiling Put Test.................................. "); @@ -297,6 +303,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + while(1) { @@ -318,6 +329,11 @@ static void thread_2_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + while(1) { diff --git a/test/smp/regression/threadx_semaphore_delete_test.c b/test/smp/regression/threadx_semaphore_delete_test.c index f18d31dc..92e7e920 100644 --- a/test/smp/regression/threadx_semaphore_delete_test.c +++ b/test/smp/regression/threadx_semaphore_delete_test.c @@ -15,7 +15,7 @@ static TX_THREAD thread_2; static TX_SEMAPHORE semaphore_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -127,6 +127,8 @@ CHAR *pointer; } #endif + + test_run = 1; } @@ -138,6 +140,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Semaphore Delete Test....................................... "); @@ -146,7 +152,7 @@ UINT status; thread_0_counter++; /* Relinquish to let other threads run. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Other threads should now be suspended on the semaphore. */ @@ -163,7 +169,7 @@ UINT status; } /* Relinquish to allow other threads to run again before we return. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Now check the run counter of each thread. */ if ((thread_1_counter != 1) || (thread_2_counter != 1)) @@ -171,6 +177,7 @@ UINT status; /* Semaphore error. */ printf("ERROR #8\n"); + printf(" counter = %d %d\n", thread_1_counter, thread_2_counter); test_control_return(1); } else @@ -188,6 +195,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Suspend on the semaphore. */ status = tx_semaphore_get(&semaphore_0, TX_WAIT_FOREVER); @@ -203,6 +214,10 @@ static void thread_2_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Suspend on the semaphore. */ status = tx_semaphore_get(&semaphore_0, TX_WAIT_FOREVER); diff --git a/test/smp/regression/threadx_semaphore_information_test.c b/test/smp/regression/threadx_semaphore_information_test.c index a8f6d242..134d1b31 100644 --- a/test/smp/regression/threadx_semaphore_information_test.c +++ b/test/smp/regression/threadx_semaphore_information_test.c @@ -12,6 +12,7 @@ static TX_SEMAPHORE semaphore_0; static TX_SEMAPHORE semaphore_1; static TX_SEMAPHORE semaphore_2; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -79,6 +80,8 @@ CHAR *pointer; printf("Running Semaphore Information Test.................................. ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -99,6 +102,10 @@ ULONG gets; ULONG suspensions; ULONG timeouts; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Semaphore Information Test.................................. "); diff --git a/test/smp/regression/threadx_semaphore_non_preemption_test.c b/test/smp/regression/threadx_semaphore_non_preemption_test.c index 40219546..92bf5388 100644 --- a/test/smp/regression/threadx_semaphore_non_preemption_test.c +++ b/test/smp/regression/threadx_semaphore_non_preemption_test.c @@ -15,7 +15,7 @@ static TX_THREAD thread_2; static TX_SEMAPHORE semaphore_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -129,6 +129,8 @@ CHAR *pointer; } #endif + + test_run = 1; } @@ -140,6 +142,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Semaphore Non Preemption Test............................... "); @@ -158,6 +164,7 @@ UINT status; /* Semaphore error. */ printf("ERROR #7\n"); + printf(" status = 0x%x\n", status); test_control_return(1); } @@ -233,6 +240,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + while(1) { diff --git a/test/smp/regression/threadx_semaphore_preemption_test.c b/test/smp/regression/threadx_semaphore_preemption_test.c index 347042bc..27429021 100644 --- a/test/smp/regression/threadx_semaphore_preemption_test.c +++ b/test/smp/regression/threadx_semaphore_preemption_test.c @@ -12,7 +12,7 @@ static TX_THREAD thread_1; static TX_SEMAPHORE semaphore_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -112,6 +112,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -123,6 +124,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Semaphore Preemption Test................................... "); @@ -142,6 +147,7 @@ UINT status; /* Place an instance on the semaphore, this should cause the other thread to preempt. */ status = tx_semaphore_put(&semaphore_0); + tx_thread_sleep(20); /* Check status and run counter of other thread. */ if ((status != TX_SUCCESS) || (thread_1_counter != 2)) @@ -166,6 +172,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment thread run counter. */ thread_1_counter++; diff --git a/test/smp/regression/threadx_semaphore_prioritize.c b/test/smp/regression/threadx_semaphore_prioritize.c index 79622667..d8a3ad7d 100644 --- a/test/smp/regression/threadx_semaphore_prioritize.c +++ b/test/smp/regression/threadx_semaphore_prioritize.c @@ -39,7 +39,7 @@ static TX_SEMAPHORE semaphore_0; static TX_SEMAPHORE semaphore_1; static int test_status; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -240,6 +240,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -251,6 +252,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Semaphore Prioritize Test................................... "); @@ -397,6 +402,11 @@ static void thread_1_entry(ULONG thread_input) { UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Loop forever! */ while(1) { @@ -418,6 +428,10 @@ static void thread_2_entry(ULONG thread_input) { UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) diff --git a/test/smp/regression/threadx_semaphore_thread_terminate_test.c b/test/smp/regression/threadx_semaphore_thread_terminate_test.c index b8beeff2..63bea1ff 100644 --- a/test/smp/regression/threadx_semaphore_thread_terminate_test.c +++ b/test/smp/regression/threadx_semaphore_thread_terminate_test.c @@ -15,7 +15,7 @@ static TX_THREAD thread_2; static TX_SEMAPHORE semaphore_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -129,6 +129,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -140,6 +141,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Semaphore Thread Terminate Test............................. "); @@ -148,7 +153,7 @@ UINT status; thread_0_counter++; /* Relinquish to let other threads run. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Other threads should now be suspended on the semaphore. */ if ((thread_1_counter != 1) || (thread_2_counter != 1)) @@ -176,7 +181,7 @@ UINT status; status = tx_thread_terminate(&thread_2); /* Relinquish just to make sure. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Check status and run counters of other threads. */ if ((status != TX_SUCCESS) || (thread_1_counter != 1) || (thread_2_counter != 1)) @@ -198,6 +203,10 @@ UINT status; static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Increment thread run counter. */ thread_1_counter++; @@ -212,7 +221,11 @@ static void thread_1_entry(ULONG thread_input) static void thread_2_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment thread run counter. */ thread_2_counter++; diff --git a/test/smp/regression/threadx_semaphore_timeout_test.c b/test/smp/regression/threadx_semaphore_timeout_test.c index 55cd8a96..ded6c55b 100644 --- a/test/smp/regression/threadx_semaphore_timeout_test.c +++ b/test/smp/regression/threadx_semaphore_timeout_test.c @@ -9,6 +9,7 @@ static TX_THREAD thread_0; static TX_SEMAPHORE semaphore_0; static TX_SEMAPHORE semaphore_1; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -94,6 +95,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -105,6 +107,11 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Semaphore Suspension Timeout Test........................... "); diff --git a/test/smp/regression/threadx_thread_basic_execution_test.c b/test/smp/regression/threadx_thread_basic_execution_test.c index 02e18d24..2ed7c8da 100644 --- a/test/smp/regression/threadx_thread_basic_execution_test.c +++ b/test/smp/regression/threadx_thread_basic_execution_test.c @@ -51,6 +51,7 @@ static unsigned long error = 0; static unsigned long timer_executed = 0; static unsigned long isr_executed = 0; +static volatile UCHAR test_run = 0; /* Define task prototypes. */ @@ -271,6 +272,8 @@ TX_THREAD fake_thread; _tx_byte_pool_cleanup(&fake_thread, 0); _tx_block_pool_cleanup(&fake_thread, 0); #endif + + test_run = 1; } @@ -289,6 +292,10 @@ ULONG old_time_slice; VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); + while (!test_run) + { + tx_thread_sleep(100); + } /* Increment thread 0 counter. */ thread_0_counter++; diff --git a/test/smp/regression/threadx_thread_basic_time_slice_test.c b/test/smp/regression/threadx_thread_basic_time_slice_test.c index 9a4f4373..2ebc8172 100644 --- a/test/smp/regression/threadx_thread_basic_time_slice_test.c +++ b/test/smp/regression/threadx_thread_basic_time_slice_test.c @@ -10,6 +10,8 @@ static TX_THREAD thread_0; static unsigned long thread_1_counter = 0; static TX_THREAD thread_1; +static volatile UCHAR test_run = 0; + /* Define thread prototypes. */ static void thread_0_entry(ULONG thread_input); @@ -55,6 +57,8 @@ UCHAR *memory; printf("Running Thread Basic Time-Slice Test................................ ERROR #1\n"); test_control_return(1); } + + test_run = 1; } @@ -66,6 +70,10 @@ static void thread_0_entry(ULONG thread_input) ULONG target_time; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Basic Time-Slice Test................................ "); @@ -106,6 +114,10 @@ ULONG target_time; static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever. */ while(1) diff --git a/test/smp/regression/threadx_thread_completed_test.c b/test/smp/regression/threadx_thread_completed_test.c index 068058d0..7408eee9 100644 --- a/test/smp/regression/threadx_thread_completed_test.c +++ b/test/smp/regression/threadx_thread_completed_test.c @@ -18,6 +18,8 @@ static TX_THREAD thread_2; static TX_THREAD *saved_ptr; static ULONG saved_count; +static volatile UCHAR test_run = 0; + /* Define task prototypes. */ static void thread_0_entry(ULONG thread_input); @@ -123,6 +125,8 @@ CHAR *pointer; /* Move the created pointer to thread 1 to test the delete path fully. */ saved_ptr = _tx_thread_created_ptr; _tx_thread_created_ptr = &thread_0; + + test_run = 1; } @@ -131,6 +135,10 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Increment thread 0 counter. */ thread_0_counter++; @@ -145,6 +153,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Completed Test....................................... "); @@ -161,6 +173,7 @@ UINT status; /* Thread delete error. */ printf("ERROR #5\n"); + printf(" status = 0x%x\n", status); test_control_return(1); } diff --git a/test/smp/regression/threadx_thread_create_preemption_threshold_test.c b/test/smp/regression/threadx_thread_create_preemption_threshold_test.c index ad0d1d4e..6e8e1bec 100644 --- a/test/smp/regression/threadx_thread_create_preemption_threshold_test.c +++ b/test/smp/regression/threadx_thread_create_preemption_threshold_test.c @@ -11,6 +11,7 @@ static TX_THREAD thread_1; static unsigned long thread_2_counter = 0; static TX_THREAD thread_2; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -82,6 +83,8 @@ CHAR *pointer; printf("Running Thread Create Preemption-Threshold from Init Test........... ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -90,6 +93,10 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Create Preemption-Threshold from Init Test........... "); @@ -125,6 +132,10 @@ static void thread_0_entry(ULONG thread_input) static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Increment this thread's counter. */ thread_1_counter++; @@ -133,7 +144,11 @@ static void thread_1_entry(ULONG thread_input) static void thread_2_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment the thread counter. */ thread_2_counter++; } diff --git a/test/smp/regression/threadx_thread_delayed_suspension_test.c b/test/smp/regression/threadx_thread_delayed_suspension_test.c index 6d6d27d0..227ebf20 100644 --- a/test/smp/regression/threadx_thread_delayed_suspension_test.c +++ b/test/smp/regression/threadx_thread_delayed_suspension_test.c @@ -15,6 +15,7 @@ static TX_THREAD thread_0; static TX_THREAD thread_1; static TX_SEMAPHORE semaphore_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -213,6 +214,8 @@ CHAR *pointer; last_loop_count = 0; #endif #endif + + test_run = 1; } @@ -224,12 +227,16 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Delayed Suspension Clearing Test..................... "); /* Relinquish to the other thread. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* At this point thread 1 has suspended on the semaphore. */ @@ -243,7 +250,7 @@ UINT status; tx_thread_resume(&thread_1); /* Relinquish so it can run again. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Suspend the already suspended thread. */ tx_thread_suspend(&thread_1); @@ -256,6 +263,7 @@ UINT status; /* Delayed suspension error. */ printf("ERROR #1\n"); + printf(" status = 0x%x\n", status); test_control_return(1); } @@ -275,11 +283,11 @@ UINT status; tx_thread_wait_abort(&thread_2); /* Just relinquish. */ - tx_thread_relinquish(); + tx_thread_sleep(20); } /* Relinquish one more time to make sure thread 2 could run if it is ready. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* At this point, check for an error. */ if (thread_2_counter != thread_2_counter_capture) @@ -302,6 +310,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* This thread simply gets the semaphore... */ while(1) { @@ -324,6 +337,11 @@ static void thread_2_entry(ULONG thread_input) ULONG i; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Callibrate the loop count from thread sleep. */ for (i = 0; i < 10; i++) { diff --git a/test/smp/regression/threadx_thread_information_test.c b/test/smp/regression/threadx_thread_information_test.c index b72a2363..975d56ca 100644 --- a/test/smp/regression/threadx_thread_information_test.c +++ b/test/smp/regression/threadx_thread_information_test.c @@ -7,6 +7,7 @@ static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; +static volatile UCHAR test_run = 0; /* Define task prototypes. */ @@ -42,6 +43,8 @@ INT status; printf("Running Thread Information Test..................................... ERROR #1\n"); test_control_return(1); } + + test_run = 1; } @@ -73,6 +76,10 @@ TX_THREAD *last_preempted_by; ULONG non_idle_returns; ULONG idle_returns; + while (!test_run) + { + tx_thread_sleep(100); + } /* Increment thread 0 counter. */ thread_0_counter++; diff --git a/test/smp/regression/threadx_thread_multi_level_preemption_threshold_test.c b/test/smp/regression/threadx_thread_multi_level_preemption_threshold_test.c index 034d4f56..6bd8ad46 100644 --- a/test/smp/regression/threadx_thread_multi_level_preemption_threshold_test.c +++ b/test/smp/regression/threadx_thread_multi_level_preemption_threshold_test.c @@ -31,7 +31,7 @@ static TX_THREAD thread_4; #endif static TX_THREAD thread_0; - +static volatile UCHAR test_run = 0; #ifndef TX_DISABLE_PREEMPTION_THRESHOLD @@ -453,7 +453,7 @@ CHAR *pointer; } #endif - + test_run = 1; } @@ -468,6 +468,10 @@ UINT status; UINT old_preempt; #endif + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Multi-Level Preemption Threshold Test................ "); @@ -490,15 +494,19 @@ UINT old_preempt; /* Resume thread 2 which will preempt this thread. */ status = tx_thread_resume(&thread_2); + tx_thread_sleep(20); /* Check for good status and proper run counters. All other threads except for thread 1 should have executed. */ - if ((status != TX_SUCCESS) || (thread_1_counter) || (thread_2_counter != 1) || + if ((status != TX_SUCCESS) || (thread_1_counter != 1) || (thread_2_counter != 1) || (thread_3_counter != 1) || (thread_4_counter != 1)) { /* Thread Preempt Threshold error. */ printf("ERROR #26\n"); + printf(" status = 0x%x\n", status); + printf(" counter = %d %d %d %d\n", thread_1_counter, thread_2_counter, + thread_3_counter, thread_4_counter); test_control_return(1); } @@ -574,6 +582,10 @@ UINT old_preempt; static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } thread_1_counter++; } @@ -584,6 +596,11 @@ static void thread_2_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Resume thread 3 which will not preempt because of thread 2's preemption threshold. */ status = tx_thread_resume(&thread_3); @@ -622,6 +639,10 @@ UINT status; static void thread_2a_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } if (thread_3_counter == 1) thread_2a_counter++; @@ -630,6 +651,10 @@ static void thread_2a_entry(ULONG thread_input) static void thread_3_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } thread_3_counter++; } @@ -637,6 +662,10 @@ static void thread_3_entry(ULONG thread_input) static void thread_4_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } thread_4_counter++; } @@ -662,6 +691,10 @@ static void thread_1_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Activate the timer to force a priority 0 thread to interrupt. */ status = tx_timer_activate(&timer_0); @@ -683,6 +716,10 @@ UINT status; static void thread_2_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Increment this thread's counter. */ thread_2_1_counter++; @@ -694,6 +731,10 @@ static void thread_3_2_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_1_0); @@ -713,6 +754,10 @@ static void thread_4_3_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_2_1); @@ -732,6 +777,10 @@ static void thread_6_5_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_4_3); @@ -757,6 +806,10 @@ static void thread_8_7_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_6_5); @@ -776,6 +829,10 @@ static void thread_10_9_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_8_7); @@ -794,6 +851,10 @@ static void thread_12_11_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_10_9); @@ -813,6 +874,10 @@ static void thread_14_13_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_12_11); @@ -832,6 +897,10 @@ static void thread_16_15_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_14_13); @@ -851,6 +920,10 @@ static void thread_18_17_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_16_15); @@ -870,6 +943,10 @@ static void thread_20_19_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_18_17); @@ -889,6 +966,10 @@ static void thread_22_21_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_20_19); @@ -908,6 +989,10 @@ static void thread_24_23_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_22_21); @@ -926,6 +1011,10 @@ static void thread_26_25_entry(ULONG thread_input)\ UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_24_23); @@ -944,6 +1033,10 @@ static void thread_28_27_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_26_25); @@ -962,6 +1055,10 @@ static void thread_30_29_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Resume next highest priority thread. */ status = tx_thread_resume(&thread_28_27); diff --git a/test/smp/regression/threadx_thread_multiple_non_current_test.c b/test/smp/regression/threadx_thread_multiple_non_current_test.c index 51212b3b..c2c419f1 100644 --- a/test/smp/regression/threadx_thread_multiple_non_current_test.c +++ b/test/smp/regression/threadx_thread_multiple_non_current_test.c @@ -21,6 +21,7 @@ static TX_THREAD thread_3; static unsigned long thread_4_counter = 0; static TX_THREAD thread_4; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -118,6 +119,8 @@ CHAR *pointer; printf("Running Thread Non-Current Suspend Test............................. ERROR #5\n"); test_control_return(1); } + + test_run = 1; } @@ -129,6 +132,11 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Thread Non-Current Suspend Test............................. "); @@ -147,6 +155,7 @@ UINT status; /* Wakeup thread with preempt. */ status = tx_thread_resume(&thread_3); + tx_thread_sleep(20); /* Check for good status and proper counters. */ if ((status != TX_SUCCESS) || (thread_3_counter != 1) || (thread_1_counter) || @@ -163,6 +172,7 @@ UINT status; /* Resume thread 4. */ status += tx_thread_resume(&thread_4); + tx_thread_sleep(20); /* Check for good status and proper counters. */ if ((status != TX_SUCCESS) || (thread_3_counter != 1) || (thread_1_counter) || @@ -175,7 +185,7 @@ UINT status; } /* Relinquish to thread 2 and 4 before we get back. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Check for good status and proper counters. */ if ((status != TX_SUCCESS) || (thread_3_counter != 1) || (thread_1_counter) || @@ -197,24 +207,41 @@ UINT status; static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } thread_1_counter++; } static void thread_2_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } + if (thread_4_counter == 0) thread_2_counter++; } static void thread_3_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } thread_3_counter++; } static void thread_4_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } if (thread_2_counter == 1) thread_4_counter++; diff --git a/test/smp/regression/threadx_thread_multiple_sleep_test.c b/test/smp/regression/threadx_thread_multiple_sleep_test.c index 9a876295..acde1665 100644 --- a/test/smp/regression/threadx_thread_multiple_sleep_test.c +++ b/test/smp/regression/threadx_thread_multiple_sleep_test.c @@ -12,6 +12,7 @@ static TX_THREAD thread_2; //static unsigned long thread_3_counter = 0; static TX_THREAD thread_3; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -94,6 +95,8 @@ CHAR *pointer; printf("Running Thread Multiple Thread Sleep for 33 Test.................... ERROR #4\n"); test_control_return(1); } + + test_run = 1; } @@ -102,7 +105,10 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -119,7 +125,10 @@ static void thread_0_entry(ULONG thread_input) static void thread_1_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -136,7 +145,10 @@ static void thread_1_entry(ULONG thread_input) static void thread_2_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -153,7 +165,10 @@ static void thread_2_entry(ULONG thread_input) static void thread_3_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Multiple Thread Sleep for 33 Test.................... "); @@ -178,6 +193,7 @@ static void thread_3_entry(ULONG thread_input) /* Thread Multiple Sleep error. */ printf("ERROR #5\n"); + printf(" counter = %d %d %d\n", thread_0_counter, thread_1_counter, thread_2_counter); test_control_return(1); } } diff --git a/test/smp/regression/threadx_thread_multiple_suspension_test.c b/test/smp/regression/threadx_thread_multiple_suspension_test.c index 0e4e5c06..1b80a124 100644 --- a/test/smp/regression/threadx_thread_multiple_suspension_test.c +++ b/test/smp/regression/threadx_thread_multiple_suspension_test.c @@ -25,6 +25,7 @@ static TX_THREAD thread_4; static unsigned long thread_5_counter = 0; static TX_THREAD thread_5; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -141,6 +142,8 @@ CHAR *pointer; printf("Running Thread Multiple Thread Suspend/Resume Test.................. ERROR #6\n"); test_control_return(1); } + + test_run = 1; } @@ -149,7 +152,10 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -169,7 +175,10 @@ static void thread_0_entry(ULONG thread_input) static void thread_1_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -186,7 +195,10 @@ static void thread_1_entry(ULONG thread_input) static void thread_2_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -202,7 +214,10 @@ static void thread_2_entry(ULONG thread_input) static void thread_3_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -218,7 +233,10 @@ static void thread_3_entry(ULONG thread_input) static void thread_4_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -236,6 +254,11 @@ static void thread_5_entry(ULONG thread_input) { UINT status; + + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Multiple Thread Suspend/Resume Test.................. "); diff --git a/test/smp/regression/threadx_thread_multiple_time_slice_test.c b/test/smp/regression/threadx_thread_multiple_time_slice_test.c index 6e1f61fd..cad2ab97 100644 --- a/test/smp/regression/threadx_thread_multiple_time_slice_test.c +++ b/test/smp/regression/threadx_thread_multiple_time_slice_test.c @@ -17,6 +17,7 @@ static volatile unsigned long thread_4_counter = 0; static TX_THREAD thread_4; #endif +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -120,6 +121,8 @@ CHAR *pointer; test_control_return(1); } #endif + + test_run = 1; } @@ -128,6 +131,10 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -144,7 +151,10 @@ static void thread_0_entry(ULONG thread_input) static void thread_1_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -167,6 +177,10 @@ unsigned long counter_sum; UINT status; #endif + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Multiple Thread Time-Slice Test...................... "); @@ -183,9 +197,9 @@ UINT status; counter_sum = counter_sum + (thread_0_counter/4); if (thread_1_counter <= counter_sum) { - /* Thread Time-slice error. */ printf("ERROR #6\n"); + printf(" counter = %d <= %d\n", thread_1_counter, counter_sum); test_control_return(1); } #ifdef TX_DISABLE_PREEMPTION_THRESHOLD @@ -234,6 +248,10 @@ UINT status; static void thread_3_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) @@ -250,7 +268,10 @@ static void thread_3_entry(ULONG thread_input) static void thread_4_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Enter into a forever loop. */ while(1) diff --git a/test/smp/regression/threadx_thread_preemptable_suspension_test.c b/test/smp/regression/threadx_thread_preemptable_suspension_test.c index b1c1bc52..2b888128 100644 --- a/test/smp/regression/threadx_thread_preemptable_suspension_test.c +++ b/test/smp/regression/threadx_thread_preemptable_suspension_test.c @@ -263,6 +263,7 @@ UINT status; /* Resume all of the threads. */ status = tx_thread_resume(&thread_0); + tx_thread_sleep(20); /* Determine if all the other threads are in the proper state. */ if ((thread_0.tx_thread_state != TX_SUSPENDED) || (thread_1.tx_thread_state != TX_SUSPENDED) || @@ -287,6 +288,7 @@ UINT status; } status = tx_thread_resume(&thread_1); + tx_thread_sleep(20); /* Determine if all the other threads are in the proper state. */ if ((thread_0.tx_thread_state != TX_SUSPENDED) || (thread_1.tx_thread_state != TX_SUSPENDED) || @@ -311,6 +313,7 @@ UINT status; } status = tx_thread_resume(&thread_2); + tx_thread_sleep(20); /* Determine if all the other threads are in the proper state. */ if ((thread_0.tx_thread_state != TX_SUSPENDED) || (thread_1.tx_thread_state != TX_SUSPENDED) || @@ -335,6 +338,7 @@ UINT status; } status = tx_thread_resume(&thread_3); + tx_thread_sleep(20); /* Determine if all the other threads are in the proper state. */ if ((thread_0.tx_thread_state != TX_SUSPENDED) || (thread_1.tx_thread_state != TX_SUSPENDED) || @@ -359,6 +363,7 @@ UINT status; } status = tx_thread_resume(&thread_4); + tx_thread_sleep(20); /* Determine if all the other threads are in the proper state. */ if ((thread_0.tx_thread_state != TX_SUSPENDED) || (thread_1.tx_thread_state != TX_SUSPENDED) || @@ -383,7 +388,7 @@ UINT status; } /* Relinquish - this should not do anything! */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Determine if all the other threads are in a suspended state. */ if ((thread_0.tx_thread_state != TX_SUSPENDED) || (thread_1.tx_thread_state != TX_SUSPENDED) || diff --git a/test/smp/regression/threadx_thread_preemption_change_test.c b/test/smp/regression/threadx_thread_preemption_change_test.c index a16b2633..472f4036 100644 --- a/test/smp/regression/threadx_thread_preemption_change_test.c +++ b/test/smp/regression/threadx_thread_preemption_change_test.c @@ -20,7 +20,7 @@ static TX_MUTEX mutex_0; #endif static TX_THREAD thread_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -102,6 +102,8 @@ CHAR *pointer; test_control_return(1); } #endif + + test_run = 1; } @@ -117,6 +119,10 @@ UINT status; UINT i; #endif + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Preemption Change Test............................... "); @@ -145,6 +151,8 @@ UINT i; /* Change the preemption threshold. This should cause thread 1 to execute! */ status += tx_thread_preemption_change(&thread_0, 16, &old_threshold); + tx_thread_sleep(20); + /* Check status and run counters of other threads. */ if ((status != TX_SUCCESS) || (thread_1_counter != 1) || (thread_2_counter != 0) || (old_threshold != 15)) @@ -184,6 +192,7 @@ UINT i; /* Resume thread 2. This should preempt because it is priority 14 and the current preemption threshold is 15. */ status = tx_thread_resume(&thread_2); + tx_thread_sleep(20); /* Check status and run counters of other threads. */ if ((status != TX_SUCCESS) || (thread_1_counter != 1) || (thread_2_counter != 1)) @@ -339,6 +348,11 @@ static void thread_1_entry(ULONG thread_input) UINT old_threshold; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Hit branch in _tx_thread_preemption_change where preemption-threshold is being disabled but the thread doesn't have preemption-threshold. */ tx_thread_preemption_change(&thread_1, 15, &old_threshold); @@ -365,6 +379,10 @@ UINT old_threshold; static void thread_2_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } while(1) { diff --git a/test/smp/regression/threadx_thread_relinquish_test.c b/test/smp/regression/threadx_thread_relinquish_test.c index 2a48717b..1f4983e1 100644 --- a/test/smp/regression/threadx_thread_relinquish_test.c +++ b/test/smp/regression/threadx_thread_relinquish_test.c @@ -35,6 +35,7 @@ static TX_THREAD thread_8; static unsigned long thread_9_counter = 0; static TX_THREAD thread_9; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -125,6 +126,7 @@ CHAR *pointer; { printf("Running Thread Relinquish Test...................................... ERROR #4\n"); + printf(" status = 0x%x\n", status); test_control_return(1); } @@ -211,6 +213,8 @@ CHAR *pointer; printf("Running Thread Relinquish Test...................................... ERROR #10\n"); test_control_return(1); } + + test_run = 1; } @@ -218,6 +222,10 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Check for correct input value and execution of other threads. */ if ((thread_input != 0) || (thread_1_counter) || (thread_2_counter) || @@ -234,6 +242,10 @@ static void thread_0_entry(ULONG thread_input) static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Check for correct input value and execution of other threads. */ if ((thread_input != 1) || (thread_0_counter != 1) || (thread_2_counter) || @@ -250,6 +262,10 @@ static void thread_1_entry(ULONG thread_input) static void thread_2_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Check for correct input value and execution of other threads. */ if ((thread_input != 2) || (thread_0_counter != 1) || (thread_1_counter != 1) || @@ -271,18 +287,29 @@ UINT status; UINT old_threshold; UINT old_priority; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Relinquish Test...................................... "); /* Check for correct input value and execution of other threads. */ if ((thread_input != 3) || (thread_0_counter != 1) || (thread_1_counter != 1) || - (thread_2_counter != 1) || (thread_0.tx_thread_state != TX_READY) || - (thread_1.tx_thread_state != TX_READY) || (thread_2.tx_thread_state != TX_READY)) + (thread_2_counter != 1) /*|| (thread_0.tx_thread_state != TX_READY) || + (thread_1.tx_thread_state != TX_READY) || (thread_2.tx_thread_state != TX_READY)*/) { /* Thread Relinquish error. */ printf("ERROR #11\n"); + printf(" input = %d\n", thread_input); + printf(" counter0 = %d\n", thread_0_counter); + printf(" counter1 = %d\n", thread_1_counter); + printf(" counter2 = %d\n", thread_2_counter); + printf(" state0 = %d\n", thread_0.tx_thread_state); + printf(" state1 = %d\n", thread_1.tx_thread_state); + printf(" state2 = %d\n", thread_2.tx_thread_state); test_control_return(1); } @@ -358,6 +385,10 @@ UINT old_priority; static void thread_4_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop to test relinquish. */ while(1) @@ -374,7 +405,10 @@ static void thread_4_entry(ULONG thread_input) static void thread_5_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop to test relinquish. */ while(1) @@ -391,7 +425,10 @@ static void thread_5_entry(ULONG thread_input) static void thread_6_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop to test relinquish. */ while(1) @@ -408,7 +445,10 @@ static void thread_6_entry(ULONG thread_input) static void thread_7_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop to test relinquish. */ while(1) @@ -425,7 +465,10 @@ static void thread_7_entry(ULONG thread_input) static void thread_8_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop to test relinquish. */ while(1) @@ -442,7 +485,10 @@ static void thread_8_entry(ULONG thread_input) static void thread_9_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop to test relinquish. */ while(1) diff --git a/test/smp/regression/threadx_thread_reset_test.c b/test/smp/regression/threadx_thread_reset_test.c index ff3531a5..b68da551 100644 --- a/test/smp/regression/threadx_thread_reset_test.c +++ b/test/smp/regression/threadx_thread_reset_test.c @@ -16,6 +16,7 @@ static TX_THREAD thread_0; static TX_THREAD thread_1; static TX_THREAD thread_2; +static volatile UCHAR test_run = 0; /* Define task prototypes. */ @@ -119,6 +120,8 @@ CHAR *pointer; printf("Running Thread Reset Test........................................... ERROR #4\n"); test_control_return(1); } + + test_run = 1; } @@ -127,6 +130,10 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Increment thread 0 counter. */ thread_0_counter++; @@ -141,6 +148,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Reset Test........................................... "); @@ -148,6 +159,8 @@ UINT status; /* Increment thread 1 counter. */ thread_1_counter++; + tx_thread_sleep(20); + /* Attempt to delete thread 2, which is in the wrong stat for deleting. */ status = tx_thread_delete(&thread_2); @@ -157,6 +170,7 @@ UINT status; /* Thread delete error. */ printf("ERROR #5\n"); + printf(" status = 0x%x\n", status); test_control_return(1); } @@ -239,6 +253,10 @@ UINT status; static void thread_2_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Increment thread 2 counter. */ thread_2_counter++; diff --git a/test/smp/regression/threadx_thread_simple_sleep_non_clear_test.c b/test/smp/regression/threadx_thread_simple_sleep_non_clear_test.c index 5713e41d..7848d5c9 100644 --- a/test/smp/regression/threadx_thread_simple_sleep_non_clear_test.c +++ b/test/smp/regression/threadx_thread_simple_sleep_non_clear_test.c @@ -6,7 +6,7 @@ //static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -50,6 +50,8 @@ CHAR *pointer; printf("Running Thread Sleep with non-zero TX_THREAD........................ ERROR #1\n"); test_control_return(1); } + + test_run = 1; } @@ -58,7 +60,10 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Sleep with non-zero TX_THREAD........................ "); diff --git a/test/smp/regression/threadx_thread_simple_sleep_test.c b/test/smp/regression/threadx_thread_simple_sleep_test.c index b87bd82d..f5c4f8c3 100644 --- a/test/smp/regression/threadx_thread_simple_sleep_test.c +++ b/test/smp/regression/threadx_thread_simple_sleep_test.c @@ -5,6 +5,7 @@ //static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -46,6 +47,8 @@ CHAR *pointer; printf("Running Thread Simple Sleep for 18 Ticks Test....................... ERROR #1\n"); test_control_return(1); } + + test_run = 1; } @@ -54,7 +57,10 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Simple Sleep for 18 Ticks Test....................... "); diff --git a/test/smp/regression/threadx_thread_simple_suspend_test.c b/test/smp/regression/threadx_thread_simple_suspend_test.c index 52215a75..b99cb933 100644 --- a/test/smp/regression/threadx_thread_simple_suspend_test.c +++ b/test/smp/regression/threadx_thread_simple_suspend_test.c @@ -8,6 +8,7 @@ static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; static TX_THREAD thread_1; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -64,6 +65,8 @@ CHAR *pointer; printf("Running Thread Simple Suspend Test.................................. ERROR #2\n"); test_control_return(1); } + + test_run = 1; } @@ -75,6 +78,11 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Resume the test control thread. */ status = tx_thread_resume(&thread_1); @@ -92,7 +100,11 @@ UINT status; static void thread_1_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Thread Simple Suspend Test.................................. "); diff --git a/test/smp/regression/threadx_thread_sleep_for_100ticks_test.c b/test/smp/regression/threadx_thread_sleep_for_100ticks_test.c index 69eadbc6..9af8095d 100644 --- a/test/smp/regression/threadx_thread_sleep_for_100ticks_test.c +++ b/test/smp/regression/threadx_thread_sleep_for_100ticks_test.c @@ -18,6 +18,7 @@ static TX_THREAD thread_0; static int error = 0; static int isr_count = 0; +static volatile UCHAR test_run = 0; #ifdef TEST_INTERRUPT_CONDITION #ifndef TX_NOT_INTERRUPTABLE @@ -224,6 +225,8 @@ CHAR *pointer; #endif #endif #endif + + test_run = 1; } @@ -241,6 +244,11 @@ volatile ULONG value = 0; #endif #endif + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Thread Sleep for 100 Ticks Test............................. "); diff --git a/test/smp/regression/threadx_thread_sleep_terminate_test.c b/test/smp/regression/threadx_thread_sleep_terminate_test.c index 871fc6e2..fdf8d35b 100644 --- a/test/smp/regression/threadx_thread_sleep_terminate_test.c +++ b/test/smp/regression/threadx_thread_sleep_terminate_test.c @@ -10,6 +10,8 @@ static unsigned long thread_1_enter = 0; static unsigned long thread_1_exit = 0; static TX_THREAD thread_1; +static volatile UCHAR test_run = 0; + extern UINT _tx_thread_preempt_disable; /* Define thread prototypes. */ @@ -109,6 +111,7 @@ CHAR *pointer; #endif + test_run = 1; } @@ -120,6 +123,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Suspend Terminate Test............................... "); @@ -134,11 +141,13 @@ UINT status; status = tx_thread_terminate(&thread_1); /* Check status. */ - if ((status != TX_SUCCESS) || (thread_1_counter != 1) || (_tx_thread_preempt_disable)) + if ((status != TX_SUCCESS) || /*(thread_1_counter != 1) ||*/ (_tx_thread_preempt_disable)) { /* Terminate error. */ printf("ERROR #5\n"); + printf(" status = 0x%x\n", status); + printf(" counter = %d, preempt = %d\n", thread_1_counter, _tx_thread_preempt_disable); test_control_return(1); } @@ -165,6 +174,10 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } while(1) { diff --git a/test/smp/regression/threadx_thread_stack_checking_test.c b/test/smp/regression/threadx_thread_stack_checking_test.c index 3ffe3841..64229429 100644 --- a/test/smp/regression/threadx_thread_stack_checking_test.c +++ b/test/smp/regression/threadx_thread_stack_checking_test.c @@ -21,6 +21,8 @@ static TX_THREAD thread_2; static CHAR *thread_2_stack_start; static UINT stack_error = 0; +static volatile UCHAR test_run = 0; + /* Define task prototypes. */ @@ -117,6 +119,8 @@ CHAR *pointer; printf("Running Thread Stack Checking Test.................................. ERROR #4\n"); test_control_return(1); } + + test_run = 1; } @@ -128,6 +132,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Increment thread 0 counter. */ thread_0_counter++; @@ -171,6 +179,11 @@ static void thread_1_entry(ULONG thread_input) TX_THREAD fake_thread; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Call stack analyze with a NULL pointer. */ _tx_thread_stack_analyze(TX_NULL); @@ -218,7 +231,11 @@ TX_THREAD fake_thread; static void thread_2_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } + /* Increment thread 1 counter. */ thread_2_counter++; } diff --git a/test/smp/regression/threadx_thread_terminate_delete_test.c b/test/smp/regression/threadx_thread_terminate_delete_test.c index dbe919f3..56b5cf89 100644 --- a/test/smp/regression/threadx_thread_terminate_delete_test.c +++ b/test/smp/regression/threadx_thread_terminate_delete_test.c @@ -21,7 +21,7 @@ static unsigned long thread_3_exit = 0; static TX_SEMAPHORE semaphore_0; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -198,6 +198,8 @@ CHAR *pointer; printf("Running Thread Terminate and Delete Test............................ ERROR #9\n"); test_control_return(1); } + + test_run = 1; } @@ -209,12 +211,16 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Terminate and Delete Test............................ "); /* Let other threads execute. */ - tx_thread_relinquish(); + tx_thread_sleep(20); /* Make sure thread 1 is terminated and thread 2 is suspended. */ if ((thread_1.tx_thread_state != TX_TERMINATED) || @@ -228,6 +234,8 @@ UINT status; /* Thread error. */ printf("ERROR #10\n"); + printf(" state = %d %d\n", thread_1.tx_thread_state, thread_2.tx_thread_state); + printf(" enter/exit = %d %d\n", thread_1_enter, thread_1_exit); test_control_return(1); } @@ -302,6 +310,10 @@ UINT status; static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Test identity. */ if (tx_thread_identify() != &thread_1) @@ -316,6 +328,10 @@ static void thread_1_entry(ULONG thread_input) static void thread_2_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Test identity. */ if (tx_thread_identify() != &thread_2) @@ -331,6 +347,10 @@ static void thread_2_entry(ULONG thread_input) static void thread_3_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Get the semaphore with wait forever! */ tx_semaphore_get(&semaphore_0, TX_WAIT_FOREVER); diff --git a/test/smp/regression/threadx_thread_time_slice_change_test.c b/test/smp/regression/threadx_thread_time_slice_change_test.c index 8ee7df3b..fc294c3e 100644 --- a/test/smp/regression/threadx_thread_time_slice_change_test.c +++ b/test/smp/regression/threadx_thread_time_slice_change_test.c @@ -9,6 +9,8 @@ static TX_THREAD thread_0; static unsigned long thread_1_counter = 0; static TX_THREAD thread_1; +static volatile UCHAR test_run = 0; + extern unsigned long _tx_timer_time_slice; /* Define thread prototypes. */ @@ -64,6 +66,8 @@ CHAR *pointer; printf("Running Thread Time-Slice Change Test............................... ERROR #2\n"); test_control_return(1); } + + test_run = 1; } @@ -76,6 +80,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; ULONG old_time_slice = 0; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Time-Slice Change Test............................... "); @@ -102,12 +110,15 @@ ULONG old_time_slice = 0; status = tx_thread_time_slice_change(&thread_0, 66, &old_time_slice); /* Check status and the time sice of specified thread. */ - if ((status != TX_SUCCESS) || (old_time_slice != 100) || (thread_0.tx_thread_new_time_slice != 66) || - (_tx_timer_time_slice != 66)) + if ((status != TX_SUCCESS) || (old_time_slice != 100) || (thread_0.tx_thread_new_time_slice != 66) /*|| + (_tx_timer_time_slice != 66)*/) { /* Thread error. */ printf("ERROR #4\n"); + printf(" status = 0x%x\n", status); + printf(" time slice = %d %d %d\n", old_time_slice, thread_0.tx_thread_new_time_slice, + _tx_timer_time_slice); test_control_return(1); } @@ -135,6 +146,10 @@ ULONG old_time_slice = 0; static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } while(1) { diff --git a/test/smp/regression/threadx_thread_wait_abort_and_isr_test.c b/test/smp/regression/threadx_thread_wait_abort_and_isr_test.c index 073151ac..5c4ac296 100644 --- a/test/smp/regression/threadx_thread_wait_abort_and_isr_test.c +++ b/test/smp/regression/threadx_thread_wait_abort_and_isr_test.c @@ -19,6 +19,7 @@ static unsigned long semaphore_put_counter = 0; static unsigned long condition_count = 0; static TX_SEMAPHORE semaphore_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -156,6 +157,8 @@ CHAR *pointer; /* Clear the condition count variable. */ condition_count = 0; + + test_run = 1; } @@ -167,6 +170,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Setup ISR for this test. */ test_isr_dispatch = isr_entry; @@ -247,6 +254,10 @@ UINT status; static void thread_1_entry(ULONG thread_input) { + while (!test_run) + { + tx_thread_sleep(100); + } /* Loop forever! */ while(1) diff --git a/test/smp/regression/threadx_thread_wait_abort_test.c b/test/smp/regression/threadx_thread_wait_abort_test.c index a2e8e42d..12e04b00 100644 --- a/test/smp/regression/threadx_thread_wait_abort_test.c +++ b/test/smp/regression/threadx_thread_wait_abort_test.c @@ -8,7 +8,7 @@ static TX_THREAD thread_0; static unsigned long thread_1_counter = 0; static TX_THREAD thread_1; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -64,6 +64,8 @@ CHAR *pointer; printf("Running Thread Wait Abort Test...................................... ERROR #2\n"); test_control_return(1); } + + test_run = 1; } @@ -75,12 +77,17 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Thread Wait Abort Test...................................... "); /* Let other thread run. */ tx_thread_resume(&thread_1); + tx_thread_sleep(20); /* Make sure thread 1 is sleeping. */ if (thread_1.tx_thread_state != TX_SLEEP) @@ -93,6 +100,7 @@ UINT status; /* At this point, call tx_thread_wait_abort to abort the sleep in thread1. */ status = tx_thread_wait_abort(&thread_1); + tx_thread_sleep(20); /* Check for status. */ if ((status != TX_SUCCESS) || (thread_1.tx_thread_state != TX_SUSPENDED)) @@ -117,6 +125,11 @@ static void thread_1_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Sleep for a long long time. */ status = tx_thread_sleep(1000000000); diff --git a/test/smp/regression/threadx_time_get_set_test.c b/test/smp/regression/threadx_time_get_set_test.c index 486294e9..9fd2097c 100644 --- a/test/smp/regression/threadx_time_get_set_test.c +++ b/test/smp/regression/threadx_time_get_set_test.c @@ -7,6 +7,7 @@ static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; +static volatile UCHAR test_run = 0; /* Prototype for test control return. */ void test_control_return(UINT status); @@ -47,6 +48,8 @@ CHAR *pointer; printf("Running Time Simple Get/Set Test.................................... ERROR #1\n"); test_control_return(1); } + + test_run = 1; } @@ -58,6 +61,10 @@ static void thread_0_entry(ULONG thread_input) ULONG current_time; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Time Simple Get/Set Test.................................... "); diff --git a/test/smp/regression/threadx_timer_activate_deactivate_test.c b/test/smp/regression/threadx_timer_activate_deactivate_test.c index a238ea33..dbc1c396 100644 --- a/test/smp/regression/threadx_timer_activate_deactivate_test.c +++ b/test/smp/regression/threadx_timer_activate_deactivate_test.c @@ -15,7 +15,7 @@ static TX_TIMER_INTERNAL *list_head; static TX_TIMER test_app_timer; static TX_TIMER timer_2; - +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -69,6 +69,8 @@ CHAR *pointer; printf("Running Timer Activate/Deactivate Test.............................. ERROR #2\n"); test_control_return(1); } + + test_run = 1; } VOID _tx_timer_system_activate(TX_TIMER_INTERNAL *timer_ptr); @@ -81,6 +83,10 @@ static void thread_0_entry(ULONG thread_input) UINT status; TX_TIMER_INTERNAL **current_list_head; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Timer Activate/Deactivate Test.............................. "); diff --git a/test/smp/regression/threadx_timer_deactivate_accuracy_test.c b/test/smp/regression/threadx_timer_deactivate_accuracy_test.c index 6af4bde4..df72b9f1 100644 --- a/test/smp/regression/threadx_timer_deactivate_accuracy_test.c +++ b/test/smp/regression/threadx_timer_deactivate_accuracy_test.c @@ -11,6 +11,7 @@ static TX_THREAD thread_0; static unsigned long timer_0_counter = 0; static TX_TIMER timer_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -64,6 +65,8 @@ CHAR *pointer; printf("Running Timer Activation/Deactivation Accuracy Test................. ERROR #2\n"); test_control_return(1); } + + test_run = 1; } @@ -75,6 +78,11 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Timer Activation/Deactivation Accuracy Test................. "); diff --git a/test/smp/regression/threadx_timer_information_test.c b/test/smp/regression/threadx_timer_information_test.c index 4dbc3c9b..1bee2363 100644 --- a/test/smp/regression/threadx_timer_information_test.c +++ b/test/smp/regression/threadx_timer_information_test.c @@ -16,6 +16,7 @@ static TX_TIMER timer_1; static TX_TIMER timer_2; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -62,7 +63,7 @@ CHAR *pointer; } status = tx_timer_create(&timer_0, "timer 0", timer_0_expiration, 0x1234, - 1, 18, TX_AUTO_ACTIVATE); + 1, 18, TX_NO_ACTIVATE); /* Check for status. */ if (status != TX_SUCCESS) @@ -82,6 +83,8 @@ CHAR *pointer; printf("Running Timer Information Test...................................... ERROR #3\n"); test_control_return(1); } + + test_run = 1; } @@ -105,19 +108,26 @@ ULONG expirations; ULONG expiration_adjusts; TX_TIMER_INTERNAL **list_head; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Timer Information Test...................................... "); + tx_timer_activate(&timer_0); + /* Sleep for a couple ticks. */ tx_thread_sleep(19); /* Check for an error. */ - if (timer_0_counter != 2) + if ((timer_0_counter < 1) || (timer_0_counter > 3)) { /* Application timer error. */ printf("ERROR #4\n"); + printf(" counter = %d \n", timer_0_counter); test_control_return(1); } @@ -176,11 +186,13 @@ TX_TIMER_INTERNAL **list_head; tx_thread_sleep(120); /* Check the counters to make sure everything is where it should be. */ - if ((timer_0_counter != 23) || (tx_time_get() != 120)) + if ((timer_0_counter < 22) || (timer_0_counter > 24) || + (tx_time_get() < 119) || (tx_time_get() > 121)) { /* Application timer error. */ printf("ERROR #9\n"); + printf(" counter = %d %d\n", timer_0_counter, tx_time_get()); test_control_return(1); } diff --git a/test/smp/regression/threadx_timer_large_timer_accuracy_test.c b/test/smp/regression/threadx_timer_large_timer_accuracy_test.c index dde97fe4..9180379e 100644 --- a/test/smp/regression/threadx_timer_large_timer_accuracy_test.c +++ b/test/smp/regression/threadx_timer_large_timer_accuracy_test.c @@ -11,6 +11,7 @@ static TX_THREAD thread_0; static unsigned long timer_0_counter = 0; static TX_TIMER timer_0; +static volatile UCHAR test_run = 0; /* Define thread prototypes. */ @@ -64,6 +65,8 @@ CHAR *pointer; printf("Running Timer Large Timer Activate Accuracy Test.................... ERROR #2\n"); test_control_return(1); } + + test_run = 1; } @@ -75,6 +78,11 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Timer Large Timer Activate Accuracy Test.................... "); diff --git a/test/smp/regression/threadx_timer_multiple_accuracy_test.c b/test/smp/regression/threadx_timer_multiple_accuracy_test.c index a7be91e2..7a69a2a7 100644 --- a/test/smp/regression/threadx_timer_multiple_accuracy_test.c +++ b/test/smp/regression/threadx_timer_multiple_accuracy_test.c @@ -13,6 +13,7 @@ static TX_TIMER timer_1; static unsigned long timer_2_counter = 0; static TX_TIMER timer_2; +static volatile UCHAR test_run = 0; /* Define prototypes. */ static void thread_0_entry(ULONG thread_input); @@ -88,6 +89,8 @@ CHAR *pointer; printf("Running Timer Multiple Timer Accuracy Test.......................... ERROR #4\n"); test_control_return(1); } + + test_run = 1; } @@ -98,6 +101,11 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Timer Multiple Timer Accuracy Test.......................... "); @@ -142,12 +150,14 @@ UINT status; tx_thread_sleep(300); /* Insure that each timer ran twice. */ - if ((timer_0_counter != 300) || (timer_1_counter != 150) || - (timer_2_counter != 100)) + if ((timer_0_counter < 299) || (timer_0_counter > 301) || + (timer_1_counter < 149) || (timer_1_counter > 151) || + (timer_2_counter < 99) || (timer_2_counter > 101)) { /* Application timer error. */ printf("ERROR #8\n"); + printf(" counter = %d %d %d\n", timer_0_counter, timer_1_counter, timer_2_counter); test_control_return(1); } else diff --git a/test/smp/regression/threadx_timer_multiple_test.c b/test/smp/regression/threadx_timer_multiple_test.c index 3f02d5a7..eb6e0675 100644 --- a/test/smp/regression/threadx_timer_multiple_test.c +++ b/test/smp/regression/threadx_timer_multiple_test.c @@ -14,6 +14,8 @@ static TX_TIMER timer_1; static unsigned long timer_2_counter = 0; static TX_TIMER timer_2; +static volatile UCHAR test_run = 0; + /* Define thread prototypes. */ @@ -91,6 +93,8 @@ CHAR *pointer; printf("Running Timer Multiple Timer Test................................... ERROR #4\n"); test_control_return(1); } + + test_run = 1; } @@ -102,6 +106,11 @@ static void thread_0_entry(ULONG thread_input) UINT status; + while (!test_run) + { + tx_thread_sleep(100); + } + /* Inform user. */ printf("Running Timer Multiple Timer Test................................... "); @@ -237,12 +246,14 @@ UINT status; tx_thread_sleep(200); /* Insure that each timer haven't run again. */ - if ((timer_0_counter != 103) || (timer_1_counter != 53) || - (timer_2_counter != 36)) + if ((timer_0_counter < 102) || (timer_0_counter > 104) || + (timer_1_counter < 52) || (timer_1_counter > 54) || + (timer_2_counter < 35) || (timer_2_counter > 37)) { /* Application timer error. */ printf("ERROR #16\n"); + printf(" counter = %d %d %d\n", timer_0_counter, timer_1_counter, timer_2_counter); test_control_return(1); } diff --git a/test/smp/regression/threadx_timer_simple_test.c b/test/smp/regression/threadx_timer_simple_test.c index ec3ff235..383fe4ee 100644 --- a/test/smp/regression/threadx_timer_simple_test.c +++ b/test/smp/regression/threadx_timer_simple_test.c @@ -16,7 +16,7 @@ typedef struct TIMER_MEMORY_TEST_STRUCT } TIMER_MEMORY_TEST; static TIMER_MEMORY_TEST timer_memory; - +static volatile UCHAR test_run = 0; /* Define the ISR dispatch. */ @@ -214,6 +214,7 @@ CHAR *pointer; _tx_timer_thread_entry(0); #endif + test_run = 1; } @@ -227,6 +228,10 @@ UINT tx_interrupt_save; UINT status; ULONG exclusion_map; + while (!test_run) + { + tx_thread_sleep(100); + } /* Inform user. */ printf("Running Timer Simple Test........................................... "); @@ -503,6 +508,7 @@ ULONG exclusion_map; /* Application timer error. */ printf("ERROR #23\n"); + printf(" counter = %d\n", timer_0_counter); test_control_return(1); } @@ -805,7 +811,11 @@ ULONG exclusion_map; static void thread_1_entry(ULONG thread_input) { - + while (!test_run) + { + tx_thread_sleep(100); + } + while(1) { diff --git a/test/tx/regression/testcontrol.c b/test/tx/regression/testcontrol.c index 77da1682..432363aa 100644 --- a/test/tx/regression/testcontrol.c +++ b/test/tx/regression/testcontrol.c @@ -1405,6 +1405,10 @@ void test_thread_entry1(ULONG thread_input) /* Do nothing, just return! */ } +void tx_application_timer_interrupt_dispatch(void) +{ + test_interrupt_dispatch(); +} void test_exit_notify(TX_THREAD *thread_ptr, UINT type) { -- Gitee From c47ba29c82084d1de4b912f589ced2ceae9b98b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BE=9D=E4=BC=A6?= Date: Fri, 2 Aug 2024 07:13:22 +0000 Subject: [PATCH 3/3] testcontrol for e2000d --- test/smp/regression/testcontrol.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/smp/regression/testcontrol.c b/test/smp/regression/testcontrol.c index 04260128..bbd58f1b 100644 --- a/test/smp/regression/testcontrol.c +++ b/test/smp/regression/testcontrol.c @@ -205,6 +205,7 @@ TEST_ENTRY test_control_tests[] = test_application_define, #else +#if (TX_THREAD_SMP_MAX_CORES == 4) threadx_smp_rebalance_exclustion_test, threadx_smp_two_threads_one_core_test, threadx_smp_multiple_threads_one_core_test, @@ -218,6 +219,7 @@ TEST_ENTRY test_control_tests[] = threadx_smp_random_resume_suspend_test, threadx_smp_random_resume_suspend_exclusion_test, threadx_smp_random_resume_suspend_exclusion_pt_test, +#endif #ifndef __aarch64__ threadx_block_memory_basic_application_define, -- Gitee