diff options
| author | hathach <[email protected]> | 2013-06-27 16:32:54 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-06-27 16:32:54 +0700 |
| commit | a07ff5a3cece890534ffdd7865676fc8b3a637fd (patch) | |
| tree | d8a05c17660dfa2769550c7e64d8ca12a0aaafbe | |
| parent | 3bca56665cb802e6e599fb4a1a2be5dd6e64b70b (diff) | |
use SUBTASK_EXIT to restart & exit task without "assert"
| -rw-r--r-- | tinyusb/class/hid_host.c | 6 | ||||
| -rw-r--r-- | tinyusb/osal/osal_none.h | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/tinyusb/class/hid_host.c b/tinyusb/class/hid_host.c index 5d780a819..9328ba782 100644 --- a/tinyusb/class/hid_host.c +++ b/tinyusb/class/hid_host.c @@ -276,13 +276,11 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con #endif { - // TODO assert without breaking into debugger - SUBTASK_ASSERT_STATUS(TUSB_ERROR_HIDH_NOT_SUPPORTED_PROTOCOL); + SUBTASK_EXIT(TUSB_ERROR_HIDH_NOT_SUPPORTED_PROTOCOL); // exit & restart task } }else { - // TODO assert without breaking into debugger - SUBTASK_ASSERT_STATUS(TUSB_ERROR_HIDH_NOT_SUPPORTED_SUBCLASS); + SUBTASK_EXIT(TUSB_ERROR_HIDH_NOT_SUPPORTED_SUBCLASS); // exit & restart task } *p_length = sizeof(tusb_descriptor_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_descriptor_endpoint_t); diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index 5090d14f5..79acb8a8e 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -118,7 +118,9 @@ static inline volatile uint32_t osal_tick_get(void) return TUSB_ERROR_OSAL_WAITING;\ }while(0) - +//--------------------------------------------------------------------+ +// SUBTASK (a sub function that uses OS blocking services & called by a task +//--------------------------------------------------------------------+ //------------- Sub Task -------------// #define OSAL_SUBTASK_INVOKED_AND_WAIT(subtask, status) \ do {\ @@ -134,6 +136,9 @@ static inline volatile uint32_t osal_tick_get(void) #define OSAL_SUBTASK_END OSAL_TASK_LOOP_END //------------- Sub Task Assert -------------// +#define SUBTASK_EXIT(error) \ + TASK_RESTART; return error + #define _SUBTASK_ASSERT_ERROR_HANDLER(error, func_call) \ func_call; TASK_RESTART; return error |
