From a4f7dc1105f2a2f9aa27fdef810024eebbb7f2ba Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 1 Jul 2013 10:35:37 +0700 Subject: add & pass a first few test for cdc host implement cdch_open_subtask --- tinyusb/common/common.h | 13 +++++++++++++ tinyusb/common/errors.h | 3 +++ 2 files changed, 16 insertions(+) (limited to 'tinyusb/common') 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 )\ -- cgit v1.3.1