summaryrefslogtreecommitdiff
path: root/test/smp/regression/threadx_timer_simple_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/smp/regression/threadx_timer_simple_test.c')
-rw-r--r--test/smp/regression/threadx_timer_simple_test.c180
1 files changed, 90 insertions, 90 deletions
diff --git a/test/smp/regression/threadx_timer_simple_test.c b/test/smp/regression/threadx_timer_simple_test.c
index ec3ff235..b763ad55 100644
--- a/test/smp/regression/threadx_timer_simple_test.c
+++ b/test/smp/regression/threadx_timer_simple_test.c
@@ -1,4 +1,4 @@
-/* This test is designed to test a simple application timer services, including create,
+/* This test is designed to test a simple application timer services, including create,
activate, deactivate, change, and delete. */
#include <stdio.h>
@@ -52,7 +52,7 @@ static void thread_1_entry(ULONG thread_input);
static void timer_0_expiration(ULONG timer_input);
static void timer_1_expiration(ULONG timer_input);
-UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
+UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
VOID (*expiration_function)(ULONG), ULONG expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
@@ -75,18 +75,18 @@ UINT status;
/* Determine if the timer was able to be created durning initialization. */
if (test_timer_create_init != TX_SUCCESS)
{
-
+
/* Error! */
error++;
}
/* Attempt to delete a timer from a timer. */
status = tx_timer_delete(&timer_0);
-
+
/* Check status. */
if (status != TX_CALLER_ERROR)
{
-
+
/* Error! */
error++;
}
@@ -98,7 +98,7 @@ UINT status;
/* Check status. */
if (status != TX_CALLER_ERROR)
{
-
+
/* Error! */
error++;
}
@@ -124,11 +124,11 @@ UINT status;
/* Attempt to delete a timer from an ISR. */
status = tx_timer_delete(&timer_0);
-
+
/* Check status. */
if (status != TX_CALLER_ERROR)
{
-
+
/* Error! */
error++;
}
@@ -140,7 +140,7 @@ UINT status;
/* Check status. */
if (status != TX_CALLER_ERROR)
{
-
+
/* Error! */
error++;
}
@@ -168,13 +168,13 @@ CHAR *pointer;
/* Put system definition stuff in here, e.g. thread creates and other assorted
create information. */
- status = tx_thread_create(&thread_0, "thread 0", thread_0_entry, 1,
- pointer, TEST_STACK_SIZE_PRINTF,
+ status = tx_thread_create(&thread_0, "thread 0", thread_0_entry, 1,
+ pointer, TEST_STACK_SIZE_PRINTF,
16, 16, 3, TX_AUTO_START);
pointer = pointer + TEST_STACK_SIZE_PRINTF;
- status += tx_thread_create(&thread_1, "thread 1", thread_1_entry, 1,
- pointer, TEST_STACK_SIZE_PRINTF,
+ status += tx_thread_create(&thread_1, "thread 1", thread_1_entry, 1,
+ pointer, TEST_STACK_SIZE_PRINTF,
18, 18, 3, TX_DONT_START);
pointer = pointer + TEST_STACK_SIZE_PRINTF;
@@ -236,7 +236,7 @@ ULONG exclusion_map;
timer_memory.second = 0x55667788;
timer_memory.next_to_last = 0x99aabbcc;
timer_memory.last = 0xddeeff00;
-
+
/* Create the timer. */
status = tx_timer_create(&timer_memory.timer, "timer memory", timer_0_expiration, 0x1234,
1000000, 100000, TX_NO_ACTIVATE);
@@ -249,7 +249,7 @@ ULONG exclusion_map;
(timer_memory.next_to_last != 0x99aabbcc) ||
(timer_memory.last != 0xddeeff00))
{
-
+
/* Memory overwrite error. */
printf("ERROR #4\n");
test_control_return(1);
@@ -259,11 +259,11 @@ ULONG exclusion_map;
/* Attempt to activate a non-timer. */
status = tx_timer_activate(TX_NULL);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #5\n");
test_control_return(1);
@@ -272,11 +272,11 @@ ULONG exclusion_map;
/* Attempt to activate a non-created timer. */
timer_2.tx_timer_id = 0;
status = tx_timer_activate(&timer_2);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #6\n");
test_control_return(1);
@@ -287,11 +287,11 @@ ULONG exclusion_map;
timer_2.tx_timer_internal.tx_timer_internal_list_head = TX_NULL;
timer_2.tx_timer_internal.tx_timer_internal_remaining_ticks = 0;
status = tx_timer_activate(&timer_2);
-
+
/* Check status. */
if (status != TX_ACTIVATE_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #7\n");
test_control_return(1);
@@ -303,11 +303,11 @@ ULONG exclusion_map;
timer_2.tx_timer_internal.tx_timer_internal_list_head = TX_NULL;
timer_2.tx_timer_internal.tx_timer_internal_remaining_ticks = TX_WAIT_FOREVER;
status = tx_timer_activate(&timer_2);
-
+
/* Check status. */
if (status != TX_SUCCESS)
{
-
+
/* Application timer error. */
printf("ERROR #8\n");
test_control_return(1);
@@ -317,11 +317,11 @@ ULONG exclusion_map;
/* Attempt to deactivate a non-timer. */
status = tx_timer_deactivate(TX_NULL);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #9\n");
test_control_return(1);
@@ -330,11 +330,11 @@ ULONG exclusion_map;
/* Attempt to deactivate a non-created timer. */
timer_2.tx_timer_id = 0;
status = tx_timer_deactivate(&timer_2);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #10\n");
test_control_return(1);
@@ -342,11 +342,11 @@ ULONG exclusion_map;
/* Attempt to change a non-timer. */
status = tx_timer_change(TX_NULL, 1, 1);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #11\n");
test_control_return(1);
@@ -355,11 +355,11 @@ ULONG exclusion_map;
/* Attempt to change a non-created timer. */
timer_2.tx_timer_id = 0;
status = tx_timer_change(&timer_2, 1, 1);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #12\n");
test_control_return(1);
@@ -367,11 +367,11 @@ ULONG exclusion_map;
/* Attempt to change a timer with a 0 initial ticks. */
status = tx_timer_change(&timer_0, 0, 1);
-
+
/* Check status. */
if (status != TX_TICK_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #13\n");
test_control_return(1);
@@ -379,11 +379,11 @@ ULONG exclusion_map;
/* Attempt to delete a non-time. */
status = tx_timer_delete(TX_NULL);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #14\n");
test_control_return(1);
@@ -392,11 +392,11 @@ ULONG exclusion_map;
/* Attempt to delete a non-created time. */
timer_2.tx_timer_id = 0;
status = tx_timer_delete(&timer_2);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #15\n");
test_control_return(1);
@@ -404,11 +404,11 @@ ULONG exclusion_map;
/* Attempt to get info from a non-timer. */
status = tx_timer_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #16\n");
test_control_return(1);
@@ -417,11 +417,11 @@ ULONG exclusion_map;
/* Attempt to get info from a non-created timer. */
timer_2.tx_timer_id = 0;
status = tx_timer_info_get(&timer_2, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #17\n");
test_control_return(1);
@@ -434,7 +434,7 @@ ULONG exclusion_map;
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #18\n");
test_control_return(1);
@@ -447,7 +447,7 @@ ULONG exclusion_map;
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #19\n");
test_control_return(1);
@@ -460,7 +460,7 @@ ULONG exclusion_map;
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #20\n");
test_control_return(1);
@@ -473,7 +473,7 @@ ULONG exclusion_map;
/* Check status. */
if (status != TX_TICK_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #21\n");
test_control_return(1);
@@ -486,7 +486,7 @@ ULONG exclusion_map;
/* Check status. */
if (status != TX_ACTIVATE_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #22\n");
test_control_return(1);
@@ -504,7 +504,7 @@ ULONG exclusion_map;
/* Application timer error. */
printf("ERROR #23\n");
test_control_return(1);
- }
+ }
/* Deactivate the timer. */
status = tx_timer_deactivate(&timer_0);
@@ -528,7 +528,7 @@ ULONG exclusion_map;
/* Application timer error. */
printf("ERROR #25\n");
test_control_return(1);
- }
+ }
/* Modify the timer. */
status = tx_timer_change(&timer_0, 100, 1);
@@ -615,7 +615,7 @@ ULONG exclusion_map;
/* Test for error. */
if ((error) || (timer_executed != 1) || (isr_executed != 1))
{
-
+
/* Thread error. */
printf("ERROR #30\n");
test_control_return(1);
@@ -628,7 +628,7 @@ ULONG exclusion_map;
/* Check status. */
if (status != TX_SUCCESS)
{
-
+
/* Application timer error. */
printf("ERROR #31\n");
test_control_return(1);
@@ -639,58 +639,58 @@ ULONG exclusion_map;
/* Check for ISR errors. */
if (error)
{
-
+
/* Thread error. */
printf("ERROR #32\n");
test_control_return(1);
}
-
+
/* Test the SMP timer exclusion get routines with bad values. */
status = tx_timer_smp_core_exclude_get(TX_NULL, TX_NULL);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #33\n");
test_control_return(1);
}
-
+
status = tx_timer_smp_core_exclude_get(&timer_0, TX_NULL);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #34\n");
test_control_return(1);
}
-
+
/* Test the SMP timer exclusion set routines with bad values. */
status = tx_timer_smp_core_exclude(TX_NULL, 0);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #35\n");
test_control_return(1);
}
-
+
status = tx_timer_smp_core_exclude(&timer_0, 0);
-
+
/* Check status. */
if (status != TX_TIMER_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #36\n");
test_control_return(1);
- }
-
+ }
+
/* Create two timers and exclude them from core 0. */
status = tx_timer_create(&timer_0, "timer 0", timer_0_expiration, 0x1234,
10, 10, TX_NO_ACTIVATE);
@@ -698,60 +698,60 @@ ULONG exclusion_map;
/* Check status. */
if (status != TX_SUCCESS)
{
-
+
/* Application timer error. */
printf("ERROR #37\n");
test_control_return(1);
}
-
+
status = tx_timer_create(&timer_1, "timer 1", timer_1_expiration, 0x1234,
10, 10, TX_NO_ACTIVATE);
/* Check status. */
if (status != TX_SUCCESS)
{
-
+
/* Application timer error. */
printf("ERROR #38\n");
test_control_return(1);
}
-
+
/* Now test the exclusion get with a valid timer, but with a NULL destination. */
status = tx_timer_smp_core_exclude_get(&timer_0, TX_NULL);
-
+
/* Check status. */
if (status != TX_PTR_ERROR)
{
-
+
/* Application timer error. */
printf("ERROR #39\n");
test_control_return(1);
- }
-
+ }
+
/* Now exclude the processing of each timer from executing on core 0. */
status = tx_timer_smp_core_exclude(&timer_0, 0x1);
status += tx_timer_smp_core_exclude(&timer_1, 0x1);
-
+
/* Check status. */
if (status != TX_SUCCESS)
{
-
+
/* Application timer error. */
printf("ERROR #40\n");
test_control_return(1);
- }
+ }
/* Now test the exclusion get with a valid timer. */
status = tx_timer_smp_core_exclude_get(&timer_0, &exclusion_map);
-
+
/* Check status. */
if ((status != TX_SUCCESS) || (exclusion_map != 0x1))
{
-
+
/* Application timer error. */
printf("ERROR #41\n");
test_control_return(1);
- }
+ }
/* Clear the timer counters. */
timer_0_counter = 0;
@@ -766,34 +766,34 @@ ULONG exclusion_map;
tx_interrupt_save = _tx_thread_smp_protect();
_tx_timer_system_deactivate(&timer_1.tx_timer_internal);
_tx_thread_smp_unprotect(tx_interrupt_save);
-
+
/* Check status. */
if (status != TX_SUCCESS)
{
-
+
/* Application timer error. */
printf("ERROR #42\n");
test_control_return(1);
- }
+ }
/* Now sleep for 20 ticks to ensure the timer works when excluded from core 0. */
tx_thread_sleep(20);
/* Deactivate timer 0. */
status = tx_timer_deactivate(&timer_0);
-
+
/* Delete both timers. */
status += tx_timer_delete(&timer_0);
status += tx_timer_delete(&timer_1);
-
+
/* Check status. */
if ((status != TX_SUCCESS) || (timer_0_counter == 0) || (timer_1_counter != 0))
{
-
+
/* Application timer error. */
printf("ERROR #43\n");
test_control_return(1);
- }
+ }
else
{
@@ -805,11 +805,11 @@ ULONG exclusion_map;
static void thread_1_entry(ULONG thread_input)
{
-
+
while(1)
{
-
- tx_thread_relinquish();
+
+ tx_thread_relinquish();
}
}
@@ -824,7 +824,7 @@ static void timer_0_expiration(ULONG timer_input)
static void timer_1_expiration(ULONG timer_input)
{
-
+
/* Process timer expiration. */
timer_1_counter++;
}