From 9e3785e7e1bd5bac3c8e24477edbde12cc09dd4b Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 1 Feb 2013 10:33:43 +0700 Subject: add std=gnu99 for test build add hcd_init to usbh_init and update test code add TUSB_CFG_OS_TICK_PER_SECOND define for TUSB_OS_NONE change osal_semaphore_wait and osal_queue_receive API to have timeout effectively --- tests/test/test_osal_none.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests/test/test_osal_none.c') diff --git a/tests/test/test_osal_none.c b/tests/test/test_osal_none.c index 8ae0bfd51..122dc48e2 100644 --- a/tests/test/test_osal_none.c +++ b/tests/test/test_osal_none.c @@ -107,19 +107,20 @@ void test_queue_send(void) //--------------------------------------------------------------------+ void sample_task_semaphore(void) { + tusb_error_t error = TUSB_ERROR_NONE; OSAL_TASK_LOOP { OSAL_TASK_LOOP_BEGIN statements[0]++; - osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_WAIT_FOREVER); + osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_WAIT_FOREVER, &error); statements[1]++; - osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_WAIT_FOREVER); + osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_WAIT_FOREVER, &error); statements[2]++; - osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_WAIT_FOREVER); + osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_WAIT_FOREVER, &error); statements[3]++; OSAL_TASK_LOOP_END @@ -139,12 +140,16 @@ void test_task_with_semaphore(void) sample_task_semaphore(); TEST_ASSERT_EQUAL(1, statements[1]); + // post 2 consecutive times osal_semaphore_post(sem_hdl); osal_semaphore_post(sem_hdl); sample_task_semaphore(); TEST_ASSERT_EQUAL(1, statements[2]); TEST_ASSERT_EQUAL(1, statements[3]); + // timeout + + // reach end of task loop, back to beginning sample_task_semaphore(); TEST_ASSERT_EQUAL(2, statements[0]); -- cgit v1.3.1