diff options
Diffstat (limited to 'test/tx/regression/threadx_timer_simple_test.c')
| -rw-r--r-- | test/tx/regression/threadx_timer_simple_test.c | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/test/tx/regression/threadx_timer_simple_test.c b/test/tx/regression/threadx_timer_simple_test.c index 3df62caa..7fdf022e 100644 --- a/test/tx/regression/threadx_timer_simple_test.c +++ b/test/tx/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; @@ -234,7 +234,7 @@ UINT status; 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); @@ -247,7 +247,7 @@ UINT status; (timer_memory.next_to_last != 0x99aabbcc) || (timer_memory.last != 0xddeeff00)) { - + /* Memory overwrite error. */ printf("ERROR #4\n"); test_control_return(1); @@ -257,11 +257,11 @@ UINT status; /* 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); @@ -270,11 +270,11 @@ UINT status; /* 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); @@ -285,11 +285,11 @@ UINT status; 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); @@ -301,11 +301,11 @@ UINT status; 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); @@ -315,11 +315,11 @@ UINT status; /* 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); @@ -328,11 +328,11 @@ UINT status; /* 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); @@ -340,11 +340,11 @@ UINT status; /* 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); @@ -353,11 +353,11 @@ UINT status; /* 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); @@ -365,11 +365,11 @@ UINT status; /* 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); @@ -377,11 +377,11 @@ UINT status; /* 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); @@ -390,11 +390,11 @@ UINT status; /* 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); @@ -402,11 +402,11 @@ UINT status; /* 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); @@ -415,11 +415,11 @@ UINT status; /* 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); @@ -432,7 +432,7 @@ UINT status; /* Check status. */ if (status != TX_TIMER_ERROR) { - + /* Application timer error. */ printf("ERROR #18\n"); test_control_return(1); @@ -445,7 +445,7 @@ UINT status; /* Check status. */ if (status != TX_TIMER_ERROR) { - + /* Application timer error. */ printf("ERROR #19\n"); test_control_return(1); @@ -458,7 +458,7 @@ UINT status; /* Check status. */ if (status != TX_TIMER_ERROR) { - + /* Application timer error. */ printf("ERROR #20\n"); test_control_return(1); @@ -471,7 +471,7 @@ UINT status; /* Check status. */ if (status != TX_TICK_ERROR) { - + /* Application timer error. */ printf("ERROR #21\n"); test_control_return(1); @@ -484,7 +484,7 @@ UINT status; /* Check status. */ if (status != TX_ACTIVATE_ERROR) { - + /* Application timer error. */ printf("ERROR #22\n"); test_control_return(1); @@ -502,7 +502,7 @@ UINT status; /* Application timer error. */ printf("ERROR #23\n"); test_control_return(1); - } + } /* Deactivate the timer. */ status = tx_timer_deactivate(&timer_0); @@ -526,7 +526,7 @@ UINT status; /* Application timer error. */ printf("ERROR #25\n"); test_control_return(1); - } + } /* Modify the timer. */ status = tx_timer_change(&timer_0, 100, 1); @@ -613,7 +613,7 @@ UINT status; /* Test for error. */ if ((error) || (timer_executed != 1) || (isr_executed != 1)) { - + /* Thread error. */ printf("ERROR #30\n"); test_control_return(1); @@ -623,7 +623,7 @@ UINT status; if (error) { - + /* Thread error. */ printf("ERROR #31\n"); test_control_return(1); @@ -639,11 +639,11 @@ UINT status; static void thread_1_entry(ULONG thread_input) { - + while(1) { - - tx_thread_relinquish(); + + tx_thread_relinquish(); } } @@ -658,7 +658,7 @@ static void timer_0_expiration(ULONG timer_input) static void timer_1_expiration(ULONG timer_input) { - + /* Process timer expiration. */ timer_1_counter++; } |
