update(common/usb_log): update USB_ASSERT
Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
@@ -75,12 +75,29 @@
|
|||||||
|
|
||||||
#define USB_LOG_RAW(...) CONFIG_USB_PRINTF(__VA_ARGS__)
|
#define USB_LOG_RAW(...) CONFIG_USB_PRINTF(__VA_ARGS__)
|
||||||
|
|
||||||
void usb_assert(const char *filename, int linenum);
|
#ifndef CONFIG_USB_ASSERT_DISABLE
|
||||||
#define USB_ASSERT(f) \
|
#define USB_ASSERT(f) \
|
||||||
do { \
|
do { \
|
||||||
if (!(f)) \
|
if (!(f)) { \
|
||||||
usb_assert(__FILE__, __LINE__); \
|
USB_LOG_ERR("ASSERT FAIL [%s] @ %s:%d\r\n", #f, __FILE__, __LINE__); \
|
||||||
} while (0)
|
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 - ' ')
|
#define ___is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
|
||||||
static inline void usb_hexdump(const void *ptr, uint32_t buflen)
|
static inline void usb_hexdump(const void *ptr, uint32_t buflen)
|
||||||
|
|||||||
Reference in New Issue
Block a user