summaryrefslogtreecommitdiff
path: root/tinyusb/common
diff options
context:
space:
mode:
Diffstat (limited to 'tinyusb/common')
-rw-r--r--tinyusb/common/common.h13
-rw-r--r--tinyusb/common/errors.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h
index 63ba26d56..ed543de00 100644
--- a/tinyusb/common/common.h
+++ b/tinyusb/common/common.h
@@ -101,6 +101,19 @@
//--------------------------------------------------------------------+
#define memclr_(buffer, size) memset(buffer, 0, size)
+
+static inline uint8_t const * descriptor_next(uint8_t const * p_desc) ATTR_ALWAYS_INLINE ATTR_PURE;
+static inline uint8_t const * descriptor_next(uint8_t const * p_desc)
+{
+ return p_desc + p_desc[DESCRIPTOR_OFFSET_LENGTH];
+}
+
+static inline uint8_t descriptor_typeof(uint8_t const * p_desc) ATTR_ALWAYS_INLINE ATTR_PURE;
+static inline uint8_t descriptor_typeof(uint8_t const * p_desc)
+{
+ return p_desc[DESCRIPTOR_OFFSET_TYPE];
+}
+
//------------- Conversion -------------//
/// form an uint32_t from 4 x uint8_t
static inline uint32_t u32_from_u8(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4) ATTR_ALWAYS_INLINE ATTR_CONST;
diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h
index dc9908bfd..6118242ad 100644
--- a/tinyusb/common/errors.h
+++ b/tinyusb/common/errors.h
@@ -80,6 +80,9 @@
ENTRY(TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE )\
ENTRY(TUSB_ERROR_HIDH_NOT_SUPPORTED_PROTOCOL )\
ENTRY(TUSB_ERROR_HIDH_NOT_SUPPORTED_SUBCLASS )\
+ ENTRY(TUSB_ERROR_CDCH_DESCRIPTOR_CORRUPTED )\
+ ENTRY(TUSB_ERROR_CDCH_UNSUPPORTED_SUBCLASS )\
+ ENTRY(TUSB_ERROR_CDCH_UNSUPPORTED_PROTOCOL )\
ENTRY(TUSB_ERROR_NOT_SUPPORTED_YET )\
ENTRY(TUSB_ERROR_FAILED )\