From ce2fc0470cbdbd64faa7b4460d3745d78722d49f Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 22 Mar 2018 14:15:16 +0700 Subject: improve usbd control transfer --- tinyusb/osal/osal.h | 6 +++--- tinyusb/osal/osal_none.h | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'tinyusb/osal') diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index 4faca3d5c..e4827bf37 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -72,10 +72,10 @@ //------------- Sub Task -------------// #define OSAL_SUBTASK_BEGIN - #define OSAL_SUBTASK_END return TUSB_ERROR_NONE; + #define OSAL_SUBTASK_END return TUSB_ERROR_NONE; - #define SUBTASK_RETURN(error) return error; - #define SUBTASK_INVOKE(subtask, status) status = subtask + #define SUBTASK_RETURN(_error) return _error; + #define SUBTASK_INVOKE(_subtask, _status) (_status) = _subtask //------------- Sub Task Assert -------------// #define SUBTASK_ASSERT_STATUS(sts) VERIFY_STATUS(sts) diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index f2f3dcefc..9bf7367ec 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -107,19 +107,19 @@ static inline osal_task_t osal_task_create(osal_func_t code, const char* name, u // SUBTASK (a sub function that uses OS blocking services & called by a task //--------------------------------------------------------------------+ #define OSAL_SUBTASK_BEGIN OSAL_TASK_BEGIN -#define OSAL_SUBTASK_END \ - default: TASK_RESTART; break; \ - }}\ + +#define OSAL_SUBTASK_END \ + default: TASK_RESTART; break; \ + }} \ return TUSB_ERROR_NONE; -#define SUBTASK_INVOKE(_subtask, _status) \ - do {\ - _state = __LINE__; case __LINE__:\ - {\ - _status = _subtask; /* invoke sub task */\ - if (TUSB_ERROR_OSAL_WAITING == _status) /* sub task not finished -> continue waiting */\ - return TUSB_ERROR_OSAL_WAITING;\ - }\ +#define SUBTASK_INVOKE(_subtask, _status) \ + do { \ + _state = __LINE__; case __LINE__: \ + { \ + (_status) = _subtask; /* invoke sub task */ \ + if (TUSB_ERROR_OSAL_WAITING == (_status)) return TUSB_ERROR_OSAL_WAITING; \ + } \ }while(0) //------------- Sub Task Assert -------------// -- cgit v1.3.1