summaryrefslogtreecommitdiff
path: root/tinyusb/common/assertion.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-02-04 00:03:08 +0700
committerhathach <[email protected]>2013-02-04 00:03:08 +0700
commit5f8839fff8ff12bbf172b5fb9a984867a0d1d8da (patch)
tree0f983489c408ecea8d79661b40d42498a0e709ed /tinyusb/common/assertion.h
parent3ac88f1b4ec4ab83682b5c1b1589970096bbc1c4 (diff)
refine ASSERT_DEFINE to allow special error_handler for os task
add device_addr0 for enumeration task start to add osal port for freeRTOS
Diffstat (limited to 'tinyusb/common/assertion.h')
-rw-r--r--tinyusb/common/assertion.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/tinyusb/common/assertion.h b/tinyusb/common/assertion.h
index c507d3a2a..f6aff004e 100644
--- a/tinyusb/common/assertion.h
+++ b/tinyusb/common/assertion.h
@@ -68,23 +68,23 @@ extern "C"
//--------------------------------------------------------------------+
// Assert Helper
//--------------------------------------------------------------------+
-#define ASSERT_FILENAME __FILE__
-#define ASSERT_FUNCTION __PRETTY_FUNCTION__
#define ASSERT_MESSAGE(format, ...)\
- _PRINTF("Assert at %s: %s:%d: " format "\n", ASSERT_FILENAME, ASSERT_FUNCTION, __LINE__, __VA_ARGS__)
+ _PRINTF("Assert at %s: %s:%d: " format "\n", __FILE__, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
#ifndef _TEST_ASSERT_
- #define ASSERT_ERROR_HANDLE(x) return (x)
+ #define ASSERT_ERROR_HANDLER(x) return (x)
#else
- #define ASSERT_ERROR_HANDLE(x) Throw(x)
+ #define ASSERT_ERROR_HANDLER(x) Throw(x)
#endif
-#define ASSERT_DEFINE(setup_statement, condition, error, format, ...) \
+#define ASSERT_DEFINE(...) ASSERT_DEFINE_WITH_HANDLER(ASSERT_ERROR_HANDLER, __VA_ARGS__)
+
+#define ASSERT_DEFINE_WITH_HANDLER(error_handler, setup_statement, condition, error, format, ...) \
do{\
setup_statement;\
if (!(condition)) {\
ASSERT_MESSAGE(format, __VA_ARGS__);\
- ASSERT_ERROR_HANDLE(error);\
+ error_handler(error);\
}\
}while(0)