hathach 6 лет назад
Родитель
Сommit
90b6b5d137
2 измененных файлов с 15 добавлено и 39 удалено
  1. 15 36
      src/common/tusb_verify.h
  2. 0 3
      src/osal/osal.h

+ 15 - 36
src/common/tusb_verify.h

@@ -107,20 +107,6 @@
   if ( !(_cond) ) { _handler; return _ret;  }                  \
   if ( !(_cond) ) { _handler; return _ret;  }                  \
 } while(0)
 } while(0)
 
 
-/*------------- Generator for TU_VERIFY_ERR and TU_VERIFY_ERR_HDLR -------------*/
-#define TU_VERIFY_ERR_DEF2(_error, _handler)  do               \
-{                                                              \
-  uint32_t _err = (uint32_t)(_error);                          \
-  if ( 0 != _err ) { _MESS_ERR(_err); _handler; return _err; } \
-} while(0)
-
-#define TU_VERIFY_ERR_DEF3(_error, _handler, _ret) do          \
-{                                                              \
-  uint32_t _err = (uint32_t)(_error);                          \
-  if ( 0 != _err ) { _MESS_ERR(_err); _handler; return _ret; } \
-} while(0)
-
-
 /*------------------------------------------------------------------*/
 /*------------------------------------------------------------------*/
 /* TU_VERIFY
 /* TU_VERIFY
  * - TU_VERIFY_1ARGS : return false if failed
  * - TU_VERIFY_1ARGS : return false if failed
@@ -142,28 +128,6 @@
 
 
 #define TU_VERIFY_HDLR(...)              GET_4TH_ARG(__VA_ARGS__, TU_VERIFY_HDLR_3ARGS, TU_VERIFY_HDLR_2ARGS,UNUSED)(__VA_ARGS__)
 #define TU_VERIFY_HDLR(...)              GET_4TH_ARG(__VA_ARGS__, TU_VERIFY_HDLR_3ARGS, TU_VERIFY_HDLR_2ARGS,UNUSED)(__VA_ARGS__)
 
 
-
-/*------------------------------------------------------------------*/
-/* TU_VERIFY STATUS
- * - TU_VERIFY_ERR_1ARGS : return status of condition if failed
- * - TU_VERIFY_ERR_2ARGS : return provided status code if failed
- *------------------------------------------------------------------*/
-#define TU_VERIFY_ERR_1ARGS(_error)                       TU_VERIFY_ERR_DEF2(_error, )
-#define TU_VERIFY_ERR_2ARGS(_error, _ret)                 TU_VERIFY_ERR_DEF3(_error, ,_ret)
-
-#define TU_VERIFY_ERR(...)            GET_3RD_ARG(__VA_ARGS__, TU_VERIFY_ERR_2ARGS, TU_VERIFY_ERR_1ARGS,UNUSED)(__VA_ARGS__)
-
-/*------------------------------------------------------------------*/
-/* TU_VERIFY STATUS WITH HANDLER
- * - TU_VERIFY_ERR_HDLR_2ARGS : execute handler, return status if failed
- * - TU_VERIFY_ERR_HDLR_3ARGS : execute handler, return provided error if failed
- *------------------------------------------------------------------*/
-#define TU_VERIFY_ERR_HDLR_2ARGS(_error, _handler)        TU_VERIFY_ERR_DEF2(_error, _handler)
-#define TU_VERIFY_ERR_HDLR_3ARGS(_error, _handler, _ret)  TU_VERIFY_ERR_DEF3(_error, _handler, _ret)
-
-#define TU_VERIFY_ERR_HDLR(...)       GET_4TH_ARG(__VA_ARGS__, TU_VERIFY_ERR_HDLR_3ARGS, TU_VERIFY_ERR_HDLR_2ARGS,UNUSED)(__VA_ARGS__)
-
-
 /*------------------------------------------------------------------*/
 /*------------------------------------------------------------------*/
 /* ASSERT
 /* ASSERT
  * basically TU_VERIFY with TU_BREAKPOINT() as handler
  * basically TU_VERIFY with TU_BREAKPOINT() as handler
@@ -175,6 +139,21 @@
 
 
 #define TU_ASSERT(...)             GET_3RD_ARG(__VA_ARGS__, ASSERT_2ARGS, ASSERT_1ARGS,UNUSED)(__VA_ARGS__)
 #define TU_ASSERT(...)             GET_3RD_ARG(__VA_ARGS__, ASSERT_2ARGS, ASSERT_1ARGS,UNUSED)(__VA_ARGS__)
 
 
+// TODO remove TU_ASSERT_ERR() later
+
+/*------------- Generator for TU_VERIFY_ERR and TU_VERIFY_ERR_HDLR -------------*/
+#define TU_VERIFY_ERR_DEF2(_error, _handler)  do               \
+{                                                              \
+  uint32_t _err = (uint32_t)(_error);                          \
+  if ( 0 != _err ) { _MESS_ERR(_err); _handler; return _err; } \
+} while(0)
+
+#define TU_VERIFY_ERR_DEF3(_error, _handler, _ret) do          \
+{                                                              \
+  uint32_t _err = (uint32_t)(_error);                          \
+  if ( 0 != _err ) { _MESS_ERR(_err); _handler; return _ret; } \
+} while(0)
+
 /*------------------------------------------------------------------*/
 /*------------------------------------------------------------------*/
 /* ASSERT Error
 /* ASSERT Error
  * basically TU_VERIFY Error with TU_BREAKPOINT() as handler
  * basically TU_VERIFY Error with TU_BREAKPOINT() as handler

+ 0 - 3
src/osal/osal.h

@@ -86,9 +86,6 @@ static inline bool osal_queue_send(osal_queue_t const qhdl, void const * data, b
 
 
 #define STASK_RETURN(_error)                return _error;
 #define STASK_RETURN(_error)                return _error;
 #define STASK_INVOKE(_subtask, _status)     (_status) = _subtask
 #define STASK_INVOKE(_subtask, _status)     (_status) = _subtask
-
-// Sub Task Assert
-#define STASK_ASSERT_ERR(_err)              TU_VERIFY_ERR(_err)
 #define STASK_ASSERT(_cond)                 TU_VERIFY(_cond, TUSB_ERROR_OSAL_TASK_FAILED)
 #define STASK_ASSERT(_cond)                 TU_VERIFY(_cond, TUSB_ERROR_OSAL_TASK_FAILED)
 #endif
 #endif