From b4a27cc8e6a5eb91266cc515cef0b63e7e20db2b Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Fri, 11 Oct 2013 21:15:20 +0200 Subject: Add DFU descriptors. --- usb/dfu.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 usb/dfu.h 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 -- cgit v1.2.3