From 67453b89f03e43408bf165f610aa62a63c000f1c Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 13 Sep 2013 23:01:43 +0700 Subject: [PATCH] fix task def with cmsis rtx --- tests/lpc18xx_43xx/test/host/host_helper.h | 2 +- tests/lpc18xx_43xx/test/host/usbh/test_usbh.c | 21 ++++++++++--------- tinyusb/osal/osal_cmsis_rtx.h | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/lpc18xx_43xx/test/host/host_helper.h b/tests/lpc18xx_43xx/test/host/host_helper.h index eecd03a8b..a81ce37d9 100644 --- a/tests/lpc18xx_43xx/test/host/host_helper.h +++ b/tests/lpc18xx_43xx/test/host/host_helper.h @@ -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); } diff --git a/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c b/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c index 9a1a03bb4..95e667a6a 100644 --- a/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c +++ b/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c @@ -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()); diff --git a/tinyusb/osal/osal_cmsis_rtx.h b/tinyusb/osal/osal_cmsis_rtx.h index 4381b1eb1..b2b2258f2 100644 --- a/tinyusb/osal/osal_cmsis_rtx.h +++ b/tinyusb/osal/osal_cmsis_rtx.h @@ -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)