diff options
Diffstat (limited to 'usb')
-rw-r--r-- | usb/device/dfu/dfu.h | 59 |
1 files changed, 14 insertions, 45 deletions
diff --git a/usb/device/dfu/dfu.h b/usb/device/dfu/dfu.h index 52b4ea5..f0e86f4 100644 --- a/usb/device/dfu/dfu.h +++ b/usb/device/dfu/dfu.h @@ -46,54 +46,26 @@ struct dfu_desc { .bcdDFUVersion = 0x0100, \ } -#define DFU_IF_DESCRIPTORS_STRUCT \ - USBInterfaceDescriptor dfu_interface[DFU_NUM_IF]; +#define DFURT_NUM_IF 1 -#define DFU_IF_DESCRIPTORS { \ - { \ - .bLength = sizeof(USBInterfaceDescriptor), \ - .bDescriptorType = USBGenericDescriptor_INTERFACE, \ - .bInterfaceNumber = CONFIG_DFU_NUM_APP_IF, \ - .bAlternateSetting = 0, \ - .bNumEndpoints = 0, \ - .bInterfaceClass = 0xFE, \ - .bInterfaceSubClass = 0x01, \ - .bInterfaceProtocol = 0x01, \ - .iInterface = CONFIG_DFU_NUM_APP_STR, \ - }, \ - { \ - .bLength = sizeof(USBInterfaceDescriptor), \ - .bDescriptorType = USBGenericDescriptor_INTERFACE, \ - .bInterfaceNumber = CONFIG_DFU_NUM_APP_IF+1, \ - .bAlternateSetting = 0, \ - .bNumEndpoints = 0, \ - .bInterfaceClass = 0xFE, \ - .bInterfaceSubClass = 0x01, \ - .bInterfaceProtocol = 0x01, \ - .iInterface = CONFIG_DFU_NUM_APP_STR+1, \ - }, \ - { \ +#define DFURT_IF_DESCRIPTOR_STRUCT \ + USBInterfaceDescriptor dfu_rt; \ + struct usb_dfu_func_descriptor func_dfu; + + +#define DFURT_IF_DESCRIPTOR(dfuIF, dfuSTR) \ + .dfu_rt = { \ .bLength = sizeof(USBInterfaceDescriptor), \ .bDescriptorType = USBGenericDescriptor_INTERFACE, \ - .bInterfaceNumber = CONFIG_DFU_NUM_APP_IF+2, \ + .bInterfaceNumber = dfuIF, \ .bAlternateSetting = 0, \ .bNumEndpoints = 0, \ .bInterfaceClass = 0xFE, \ .bInterfaceSubClass = 0x01, \ .bInterfaceProtocol = 0x01, \ - .iInterface = CONFIG_DFU_NUM_APP_STR+2, \ + .iInterface = dfuSTR, \ }, \ -} - -extern const struct USBStringDescriptor USBDFU_string1; -extern const struct USBStringDescriptor USBDFU_string2; -extern const struct USBStringDescriptor USBDFU_string3; - -#define DFU_NUM_STRINGS 3 -#define DFU_STRING_DESCRIPTORS \ - (const unsigned char *) &USBDFU_string1, \ - (const unsigned char *) &USBDFU_string2, \ - (const unsigned char *) &USBDFU_string3, + .func_dfu = DFU_FUNC_DESC \ const struct dfu_desc dfu_cfg_descriptor; const USBDDriverDescriptors dfu_descriptors; @@ -101,12 +73,9 @@ const USBDDriverDescriptors dfu_descriptors; #else /* BOARD_USB_DFU */ /* no DFU bootloader is being used */ -#define DFU_NUM_IF 0 -#define DFU_IF_DESCRIPTORS_STRUCT -#define DFU_IF_DESCRIPTORS - -#define DFU_NUM_STRINGS 0 -#define DFU_STRING_DESCRIPTORS +#define DFURT_NUM_IF 0 +#define DFURT_IF_DESCRIPTOR_STRUCT(a, b) +#define DFURT_IF_DESCRIPTOR #endif /* BOARD_USB_DFU */ |