diff options
| author | hathach <[email protected]> | 2013-07-01 10:35:37 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-07-01 10:35:37 +0700 |
| commit | a4f7dc1105f2a2f9aa27fdef810024eebbb7f2ba (patch) | |
| tree | 33eb906a997038d36ac32d68e9a3dcac1103c05d /tinyusb/common | |
| parent | a943cce99110eabeaea98a390a41842a15de715f (diff) | |
add & pass a first few test for cdc host
implement cdch_open_subtask
Diffstat (limited to 'tinyusb/common')
| -rw-r--r-- | tinyusb/common/common.h | 13 | ||||
| -rw-r--r-- | tinyusb/common/errors.h | 3 |
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 )\ |
