mirror of
https://github.com/sakumisu/CherryUSB.git
synced 2025-05-09 00:21:44 +08:00
update(common/usb_log): update USB_ASSERT
Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
parent
d3de69ae38
commit
644ac2b37f
@ -75,12 +75,29 @@
|
||||
|
||||
#define USB_LOG_RAW(...) CONFIG_USB_PRINTF(__VA_ARGS__)
|
||||
|
||||
void usb_assert(const char *filename, int linenum);
|
||||
#define USB_ASSERT(f) \
|
||||
do { \
|
||||
if (!(f)) \
|
||||
usb_assert(__FILE__, __LINE__); \
|
||||
} while (0)
|
||||
#ifndef CONFIG_USB_ASSERT_DISABLE
|
||||
#define USB_ASSERT(f) \
|
||||
do { \
|
||||
if (!(f)) { \
|
||||
USB_LOG_ERR("ASSERT FAIL [%s] @ %s:%d\r\n", #f, __FILE__, __LINE__); \
|
||||
while (1) { \
|
||||
} \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define USB_ASSERT_MSG(f, fmt, ...) \
|
||||
do { \
|
||||
if (!(f)) { \
|
||||
USB_LOG_ERR("ASSERT FAIL [%s] @ %s:%d\r\n", #f, __FILE__, __LINE__); \
|
||||
USB_LOG_ERR(fmt "\r\n", ##__VA_ARGS__); \
|
||||
while (1) { \
|
||||
} \
|
||||
} \
|
||||
} while (false)
|
||||
#else
|
||||
#define USB_ASSERT(f) {}
|
||||
#define USB_ASSERT_MSG(f, fmt, ...) {}
|
||||
#endif
|
||||
|
||||
#define ___is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
|
||||
static inline void usb_hexdump(const void *ptr, uint32_t buflen)
|
||||
|
Loading…
x
Reference in New Issue
Block a user