fix task def with cmsis rtx

This commit is contained in:
hathach 2013-09-13 23:01:43 +07:00
parent ad0ef2e266
commit 67453b89f0
3 changed files with 13 additions and 12 deletions

View File

@ -64,8 +64,8 @@ static inline void helper_class_close_expect(uint8_t dev_addr)
static inline void helper_usbh_init_expect(void)
{
osal_semaphore_create_IgnoreAndReturn( (osal_semaphore_handle_t) 0x1234);
osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE);
osal_queue_create_IgnoreAndReturn( (osal_queue_handle_t) 0x4566 );
osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE);
osal_mutex_create_IgnoreAndReturn((osal_mutex_handle_t) 0x789a);
}

View File

@ -87,26 +87,27 @@ void test_usbh_init_hcd_failed(void)
TEST_ASSERT_EQUAL(TUSB_ERROR_HCD_FAILED, usbh_init());
}
void test_usbh_init_enum_task_create_failed(void)
{
hcd_init_ExpectAndReturn(TUSB_ERROR_NONE);
osal_task_create_IgnoreAndReturn(TUSB_ERROR_OSAL_TASK_FAILED);
TEST_ASSERT_EQUAL(TUSB_ERROR_OSAL_TASK_FAILED, usbh_init());
}
void test_usbh_init_enum_queue_create_failed(void)
{
hcd_init_ExpectAndReturn(TUSB_ERROR_NONE);
osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE);
osal_queue_create_IgnoreAndReturn(NULL);
TEST_ASSERT_EQUAL(TUSB_ERROR_OSAL_QUEUE_FAILED, usbh_init());
}
void test_usbh_init_enum_task_create_failed(void)
{
hcd_init_ExpectAndReturn(TUSB_ERROR_NONE);
osal_queue_create_IgnoreAndReturn((osal_queue_handle_t) 0x1234);
osal_task_create_IgnoreAndReturn(TUSB_ERROR_OSAL_TASK_FAILED);
TEST_ASSERT_EQUAL(TUSB_ERROR_OSAL_TASK_FAILED, usbh_init());
}
void test_usbh_init_semaphore_create_failed(void)
{
hcd_init_ExpectAndReturn(TUSB_ERROR_NONE);
osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE);
osal_queue_create_IgnoreAndReturn((osal_queue_handle_t) 0x1234);
osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE);
osal_semaphore_create_IgnoreAndReturn(NULL);
TEST_ASSERT_EQUAL(TUSB_ERROR_OSAL_SEMAPHORE_FAILED, usbh_init());
}
@ -114,8 +115,8 @@ void test_usbh_init_semaphore_create_failed(void)
void test_usbh_init_mutex_create_failed(void)
{
hcd_init_ExpectAndReturn(TUSB_ERROR_NONE);
osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE);
osal_queue_create_IgnoreAndReturn((osal_queue_handle_t) 0x1234);
osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE);
osal_semaphore_create_IgnoreAndReturn((osal_semaphore_handle_t) 0x1234);
osal_mutex_create_IgnoreAndReturn(NULL);
TEST_ASSERT_EQUAL(TUSB_ERROR_OSAL_MUTEX_FAILED, usbh_init());

View File

@ -66,7 +66,7 @@
typedef osThreadDef_t osal_task_t;
#define OSAL_TASK_DEF(task_name, task_code, task_stack_depth, task_prio) \
#define OSAL_TASK_DEF(task_code, task_stack_depth, task_prio) \
osThreadDef(task_code, task_prio, 1, task_stack_depth*4) // stack depth is in bytes
#define OSAL_TASK_REF(task_name) osThread(task_name)