From db9ec44f359992f5c49fc5602fe919fffe134289 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Tue, 19 Mar 2019 12:58:48 +0100 Subject: USB: Added IAD descriptor. --- usb/descriptor.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/usb/descriptor.h b/usb/descriptor.h index a45b04d..a2dde3a 100644 --- a/usb/descriptor.h +++ b/usb/descriptor.h @@ -171,6 +171,40 @@ constexpr Endpoint_desc endpoint_desc( }; } +struct IAD_desc { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bFirstInterface; + uint8_t bInterfaceCount; + uint8_t bFunctionClass; + uint8_t bFunctionSubClass; + uint8_t bFunctionProtocol; + uint8_t iFunction; +} __attribute__((packed)); + +template +constexpr auto iad_desc( + uint8_t bFirstInterface, + uint8_t bInterfaceCount, + uint8_t bFunctionClass, + uint8_t bFunctionSubClass, + uint8_t bFunctionProtocol, + uint8_t iFunction, + R... r + ) -> decltype(pack(IAD_desc(), r...)) { + + return pack(IAD_desc { + sizeof(IAD_desc), + 0x0b, + bFirstInterface, + bInterfaceCount, + bFunctionClass, + bFunctionSubClass, + bFunctionProtocol, + iFunction + }, r...); +} + struct CDC_Header_desc { uint8_t bLength; uint8_t bDescriptorType; -- cgit v1.2.3