mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-07 05:54:11 +08:00
use SUBTASK_EXIT to restart & exit task without "assert"
This commit is contained in:
parent
3bca56665c
commit
a07ff5a3ce
@ -276,13 +276,11 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
// TODO assert without breaking into debugger
|
SUBTASK_EXIT(TUSB_ERROR_HIDH_NOT_SUPPORTED_PROTOCOL); // exit & restart task
|
||||||
SUBTASK_ASSERT_STATUS(TUSB_ERROR_HIDH_NOT_SUPPORTED_PROTOCOL);
|
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// TODO assert without breaking into debugger
|
SUBTASK_EXIT(TUSB_ERROR_HIDH_NOT_SUPPORTED_SUBCLASS); // exit & restart task
|
||||||
SUBTASK_ASSERT_STATUS(TUSB_ERROR_HIDH_NOT_SUPPORTED_SUBCLASS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*p_length = sizeof(tusb_descriptor_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_descriptor_endpoint_t);
|
*p_length = sizeof(tusb_descriptor_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_descriptor_endpoint_t);
|
||||||
|
@ -118,7 +118,9 @@ static inline volatile uint32_t osal_tick_get(void)
|
|||||||
return TUSB_ERROR_OSAL_WAITING;\
|
return TUSB_ERROR_OSAL_WAITING;\
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// SUBTASK (a sub function that uses OS blocking services & called by a task
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
//------------- Sub Task -------------//
|
//------------- Sub Task -------------//
|
||||||
#define OSAL_SUBTASK_INVOKED_AND_WAIT(subtask, status) \
|
#define OSAL_SUBTASK_INVOKED_AND_WAIT(subtask, status) \
|
||||||
do {\
|
do {\
|
||||||
@ -134,6 +136,9 @@ static inline volatile uint32_t osal_tick_get(void)
|
|||||||
#define OSAL_SUBTASK_END OSAL_TASK_LOOP_END
|
#define OSAL_SUBTASK_END OSAL_TASK_LOOP_END
|
||||||
|
|
||||||
//------------- Sub Task Assert -------------//
|
//------------- Sub Task Assert -------------//
|
||||||
|
#define SUBTASK_EXIT(error) \
|
||||||
|
TASK_RESTART; return error
|
||||||
|
|
||||||
#define _SUBTASK_ASSERT_ERROR_HANDLER(error, func_call) \
|
#define _SUBTASK_ASSERT_ERROR_HANDLER(error, func_call) \
|
||||||
func_call; TASK_RESTART; return error
|
func_call; TASK_RESTART; return error
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user