diff options
| author | hathach <[email protected]> | 2013-02-01 12:00:34 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-02-01 12:25:02 +0700 |
| commit | aab92b40d2e904e8ad85386e4a4f3b59e84eb844 (patch) | |
| tree | f8099f4075a1e7612b6522d1c8902d56aa13b3f7 /tests/test/test_osal_none.c | |
| parent | 9e3785e7e1bd5bac3c8e24477edbde12cc09dd4b (diff) | |
change osal_timeout_t to uint32_t
implement osal_tick_get & osal_tick_tock for osal_none
implement timeout for osal_semaphore_wait
Diffstat (limited to 'tests/test/test_osal_none.c')
| -rw-r--r-- | tests/test/test_osal_none.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/test/test_osal_none.c b/tests/test/test_osal_none.c index 122dc48e2..231edbef1 100644 --- a/tests/test/test_osal_none.c +++ b/tests/test/test_osal_none.c @@ -123,15 +123,18 @@ void sample_task_semaphore(void) osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_WAIT_FOREVER, &error); statements[3]++; + osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_NORMAL, &error); + statements[4]++; + TEST_ASSERT_EQUAL(TUSB_ERROR_OSAL_TIMEOUT, error); + OSAL_TASK_LOOP_END } } void test_task_with_semaphore(void) { - uint32_t i; // several invoke before sempahore is available - for(i=0; i<10; i++) + for(uint32_t i=0; i<10; i++) sample_task_semaphore(); TEST_ASSERT_EQUAL(1, statements[0]); @@ -148,7 +151,12 @@ void test_task_with_semaphore(void) TEST_ASSERT_EQUAL(1, statements[3]); // timeout - + for(uint32_t i=0; i<(OSAL_TIMEOUT_NORMAL*TUSB_CFG_OS_TICKS_PER_SECOND)/1000 ; i++) // not enough time + osal_tick_tock(); + sample_task_semaphore(); + TEST_ASSERT_EQUAL(0, statements[4]); + osal_tick_tock(); + sample_task_semaphore(); // reach end of task loop, back to beginning sample_task_semaphore(); |
