DFU: runtime only has _one_ interface/altsetting

This commit is contained in:
Harald Welte 2012-01-08 19:24:21 +01:00
parent 7261a4b6b7
commit 3505594094
1 changed files with 14 additions and 45 deletions

View File

@ -46,54 +46,26 @@ struct dfu_desc {
.bcdDFUVersion = 0x0100, \ .bcdDFUVersion = 0x0100, \
} }
#define DFU_IF_DESCRIPTORS_STRUCT \ #define DFURT_NUM_IF 1
USBInterfaceDescriptor dfu_interface[DFU_NUM_IF];
#define DFU_IF_DESCRIPTORS { \ #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), \ .bLength = sizeof(USBInterfaceDescriptor), \
.bDescriptorType = USBGenericDescriptor_INTERFACE, \ .bDescriptorType = USBGenericDescriptor_INTERFACE, \
.bInterfaceNumber = CONFIG_DFU_NUM_APP_IF, \ .bInterfaceNumber = dfuIF, \
.bAlternateSetting = 0, \ .bAlternateSetting = 0, \
.bNumEndpoints = 0, \ .bNumEndpoints = 0, \
.bInterfaceClass = 0xFE, \ .bInterfaceClass = 0xFE, \
.bInterfaceSubClass = 0x01, \ .bInterfaceSubClass = 0x01, \
.bInterfaceProtocol = 0x01, \ .bInterfaceProtocol = 0x01, \
.iInterface = CONFIG_DFU_NUM_APP_STR, \ .iInterface = dfuSTR, \
}, \ }, \
{ \ .func_dfu = DFU_FUNC_DESC \
.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, \
}, \
{ \
.bLength = sizeof(USBInterfaceDescriptor), \
.bDescriptorType = USBGenericDescriptor_INTERFACE, \
.bInterfaceNumber = CONFIG_DFU_NUM_APP_IF+2, \
.bAlternateSetting = 0, \
.bNumEndpoints = 0, \
.bInterfaceClass = 0xFE, \
.bInterfaceSubClass = 0x01, \
.bInterfaceProtocol = 0x01, \
.iInterface = CONFIG_DFU_NUM_APP_STR+2, \
}, \
}
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,
const struct dfu_desc dfu_cfg_descriptor; const struct dfu_desc dfu_cfg_descriptor;
const USBDDriverDescriptors dfu_descriptors; const USBDDriverDescriptors dfu_descriptors;
@ -101,12 +73,9 @@ const USBDDriverDescriptors dfu_descriptors;
#else /* BOARD_USB_DFU */ #else /* BOARD_USB_DFU */
/* no DFU bootloader is being used */ /* no DFU bootloader is being used */
#define DFU_NUM_IF 0 #define DFURT_NUM_IF 0
#define DFU_IF_DESCRIPTORS_STRUCT #define DFURT_IF_DESCRIPTOR_STRUCT(a, b)
#define DFU_IF_DESCRIPTORS #define DFURT_IF_DESCRIPTOR
#define DFU_NUM_STRINGS 0
#define DFU_STRING_DESCRIPTORS
#endif /* BOARD_USB_DFU */ #endif /* BOARD_USB_DFU */