summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2019-03-19 12:58:48 +0100
committerVegard Storheil Eriksen <v.eriksen@diinef.com>2019-03-19 13:02:30 +0100
commitdb9ec44f359992f5c49fc5602fe919fffe134289 (patch)
tree2b14f89962f619bd835f0d8e0a3b7e1b47f72bfb
parent41e3e88a1728a191c5027cec7fb3c6ae833d564a (diff)
USB: Added IAD descriptor.
-rw-r--r--usb/descriptor.h34
1 files changed, 34 insertions, 0 deletions
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 <typename... R>
+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;