change default TUSB_CFG_DEBUG to 0

change meaning of TUSB_CFG_DEBUG
This commit is contained in:
hathach
2014-04-17 10:33:59 +07:00
parent 5c6f8750da
commit ccc65e620a
8 changed files with 52 additions and 53 deletions

View File

@@ -69,9 +69,9 @@ extern "C"
#define STATIC_ASSERT(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) }
#endif
//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
#if TUSB_CFG_DEBUG == 3
#define _PRINTF(...) printf(__VA_ARGS__) // PRINTF
//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
#if TUSB_CFG_DEBUG
#define _PRINTF(...) printf(__VA_ARGS__)
#else
#define _PRINTF(...)
#endif
@@ -80,11 +80,9 @@ extern "C"
// Assert Helper
//--------------------------------------------------------------------+
#ifndef _TEST_
#define ASSERT_MESSAGE(format, ...)\
_PRINTF("Assert at %s: %s: %d: " format "\n", __BASE_FILE__, __func__ , __LINE__, __VA_ARGS__)
#else
#define ASSERT_MESSAGE(format, ...)\
_PRINTF("%d:note: Assert " format "\n", __LINE__, __VA_ARGS__)
#define ASSERT_MESSAGE(format, ...) _PRINTF("Assert at %s: %s: %d: " format "\n", __BASE_FILE__, __func__ , __LINE__, __VA_ARGS__)
#else // TODO remove this
#define ASSERT_MESSAGE(format, ...) _PRINTF("%d:note: Assert " format "\n", __LINE__, __VA_ARGS__)
#endif
#ifndef _TEST_ASSERT_
@@ -97,11 +95,8 @@ extern "C"
do{\
setup_statement;\
if (!(condition)) {\
if (hal_debugger_is_attached()){\
hal_debugger_breakpoint();\
}else{\
ASSERT_MESSAGE(format, __VA_ARGS__);\
}\
hal_debugger_breakpoint();\
ASSERT_MESSAGE(format, __VA_ARGS__);\
error_handler(error, handler_para);\
}\
}while(0)
@@ -129,9 +124,9 @@ extern "C"
//--------------------------------------------------------------------+
// Pointer Assert
//--------------------------------------------------------------------+
#define ASSERT_PTR(...) ASSERT_PTR_NOT_NULL(__VA_ARGS__)
#define ASSERT_PTR(...) ASSERT_PTR_NOT_NULL(__VA_ARGS__)
#define ASSERT_PTR_NOT_NULL(pointer, error) ASSERT_DEFINE( , NULL != (pointer), error, "%s", "pointer is NULL")
#define ASSERT_PTR_NULL(pointer, error) ASSERT_DEFINE( , NULL == (pointer), error, "%s", "pointer is not NULL")
#define ASSERT_PTR_NULL(pointer, error) ASSERT_DEFINE( , NULL == (pointer), error, "%s", "pointer is not NULL")
//--------------------------------------------------------------------+
// Integral Assert
@@ -165,7 +160,7 @@ extern "C"
#define ASSERT_HEX_WITHIN(...) ASSERT_XXX_WITHIN("0x%x", __VA_ARGS__)
//--------------------------------------------------------------------+
// TODO Bin Assert
// Bin Assert
//--------------------------------------------------------------------+
#define BIN8_PRINTF_PATTERN "%d%d%d%d%d%d%d%d"
#define BIN8_PRINTF_CONVERT(byte) \