diff options
Diffstat (limited to 'tinyusb/common')
| -rw-r--r-- | tinyusb/common/assertion.h | 8 | ||||
| -rw-r--r-- | tinyusb/common/common.h | 6 | ||||
| -rw-r--r-- | tinyusb/common/errors.h | 1 |
3 files changed, 13 insertions, 2 deletions
diff --git a/tinyusb/common/assertion.h b/tinyusb/common/assertion.h index f0f780fe9..67aeb90b9 100644 --- a/tinyusb/common/assertion.h +++ b/tinyusb/common/assertion.h @@ -58,6 +58,14 @@ extern "C" #include "tusb_option.h" +//--------------------------------------------------------------------+ +// Compile-time Assert +//--------------------------------------------------------------------+ +#ifdef __COUNTER__ +#define STATIC_ASSSERT(const_expr) enum { XSTRING_CONCAT(static_assert_, __COUNTER__) = 1/(!!(const_expr)) } +#else +#define STATIC_ASSSERT(const_expr) enum { XSTRING_CONCAT(static_assert_, __LINE__) = 1/(!!(const_expr)) } +#endif //#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG ) #if TUSB_CFG_DEBUG #define _PRINTF(...) printf(__VA_ARGS__) diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h index c883faf2c..0f02cb3f0 100644 --- a/tinyusb/common/common.h +++ b/tinyusb/common/common.h @@ -85,8 +85,10 @@ #define INLINE_ #endif -#define STRING_(x) #x // stringify without expand -#define XSTRING_(x) STRING_(x) // expand then stringify +#define STRING_(x) #x // stringify without expand +#define XSTRING_(x) STRING_(x) // expand then stringify +#define STRING_CONCAT_(a, b) a##b // concat without expand +#define XSTRING_CONCAT_(a, b) STRING_CONCAT_(a, b) // expand then concat #define U16_HIGH_U8(u16) ((uint8_t) (((u16) > 8) & 0x00ff)) #define U16_LOW_U8(u16) ((uint8_t) ((u16) & 0x00ff)) diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h index 42855ffed..5ed6e6549 100644 --- a/tinyusb/common/errors.h +++ b/tinyusb/common/errors.h @@ -69,6 +69,7 @@ ENTRY(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND)\ ENTRY(TUSB_ERROR_USBH_MOUNT_CONFIG_DESC_TOO_LONG)\ ENTRY(TUSB_ERROR_OSAL_TIMEOUT)\ + ENTRY(TUSB_ERROR_OSAL_WAITING)\ ENTRY(TUSB_ERROR_OSAL_TASK_FAILED)\ ENTRY(TUSB_ERROR_OSAL_QUEUE_FAILED)\ ENTRY(TUSB_ERROR_OSAL_SEMAPHORE_FAILED)\ |
