summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2013-10-11 21:15:20 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2013-10-11 21:15:48 +0200
commitb4a27cc8e6a5eb91266cc515cef0b63e7e20db2b (patch)
treeb2b20fd9c3838b2baa1131190d38e85be6161d83
parent18c63621da45909918d147c46c3e702106335e3a (diff)
Add DFU descriptors.
-rw-r--r--usb/dfu.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/usb/dfu.h b/usb/dfu.h
new file mode 100644
index 0000000..ed6c6c9
--- /dev/null
+++ b/usb/dfu.h
@@ -0,0 +1,30 @@
+#ifndef DFU_H
+#define DFU_H
+
+struct DFU_Functional_desc {
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint8_t bmAttributes;
+ uint16_t wDetachTimeOut;
+ uint16_t wTransferSize;
+ uint16_t bcdDFUVersion;
+} __attribute__((packed));
+
+constexpr DFU_Functional_desc dfu_functional_desc(
+ uint8_t bmAttributes,
+ uint16_t wDetachTimeOut,
+ uint16_t wTransferSize,
+ uint16_t bcdDFUVersion
+ ) {
+
+ return {
+ sizeof(DFU_Functional_desc),
+ 0x21,
+ bmAttributes,
+ wDetachTimeOut,
+ wTransferSize,
+ bcdDFUVersion
+ };
+}
+
+#endif