diff options
| author | hathach <[email protected]> | 2013-02-01 10:33:43 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-02-01 10:33:43 +0700 |
| commit | 9e3785e7e1bd5bac3c8e24477edbde12cc09dd4b (patch) | |
| tree | c2233323659aeda002dbbcb6e910b669f1147aac /tests/test/test_osal_none.c | |
| parent | 1b963f6a7117d754c47e860159ac0aa90d1db6dc (diff) | |
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
Diffstat (limited to 'tests/test/test_osal_none.c')
| -rw-r--r-- | tests/test/test_osal_none.c | 11 |
1 files changed, 8 insertions, 3 deletions
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]); |
