make USB descriptor available for the two state machines

this is required to know the DFU bmAttributes since they affect
the state machine

Change-Id: Ib3907423bb9e197f53ed4522e8a5789a3d29489e
This commit is contained in:
Kevin Redon 2019-01-03 18:13:11 +01:00
parent 2f8fcbbef6
commit 9e94e7d7ca
3 changed files with 15 additions and 5 deletions

View File

@ -22,8 +22,9 @@
#include "dfudf.h"
#include "usb_protocol_dfu.h"
#include "dfudf_desc.h"
/** USB Device DFU Fucntion Specific Data */
/** USB Device DFU Function Specific Data */
struct dfudf_func_data {
/** DFU Interface information */
uint8_t func_iface;
@ -34,6 +35,10 @@ struct dfudf_func_data {
static struct usbdf_driver _dfudf;
static struct dfudf_func_data _dfudf_funcd;
/** USB DFU functional descriptor (with DFU attributes) */
static const uint8_t usb_dfu_func_desc_bytes[] = {DFUD_IFACE_DESCB};
static const usb_dfu_func_desc_t* usb_dfu_func_desc = (usb_dfu_func_desc_t*)&usb_dfu_func_desc_bytes;
enum usb_dfu_state dfu_state = USB_DFU_STATE_DFU_IDLE;
enum usb_dfu_status dfu_status = USB_DFU_STATUS_OK;

View File

@ -75,6 +75,11 @@
CONF_USB_DFUD_BMATTRI, \
CONF_USB_DFUD_BMAXPOWER)
#define DFUD_IFACE_DESCB USB_DFU_FUNC_DESC_BYTES(USB_DFU_ATTRIBUTES_CAN_DOWNLOAD | USB_DFU_ATTRIBUTES_WILL_DETACH, \
0, /**< detaching makes only sense in run-time mode */ \
512, /**< transfer size corresponds to page size for optimal flash writing */ \
0x0110 /**< DFU specification version 1.1 used */ )
#define DFUD_IFACE_DESCES \
USB_IFACE_DESC_BYTES(CONF_USB_DFUD_BIFCNUM, \
CONF_USB_DFUD_BALTSET, \
@ -83,10 +88,7 @@
USB_DFU_SUBCLASS, \
USB_DFU_PROTOCOL_DFU, \
CONF_USB_DFUD_IINTERFACE), \
USB_DFU_FUNC_DESC_BYTES(USB_DFU_ATTRIBUTES_CAN_DOWNLOAD | USB_DFU_ATTRIBUTES_WILL_DETACH, \
0, /**< detaching makes only sense in run-time mode */ \
1024, /**< transfer size corresponds to page size for optimal flash writing */ \
0x0110 /**< DFU specification version 1.1 used */ )
DFUD_IFACE_DESCB
#define DFUD_STR_DESCES \
CONF_USB_DFUD_LANGID_DESC \

View File

@ -39,6 +39,9 @@ static struct usbd_descriptors single_desc[]
#endif
};
/** USB DFU functional descriptor (with DFU attributes) */
static const uint8_t usb_dfu_func_desc_bytes[] = {DFUD_IFACE_DESCB};
static const usb_dfu_func_desc_t* usb_dfu_func_desc = (usb_dfu_func_desc_t*)&usb_dfu_func_desc_bytes;
/** Ctrl endpoint buffer */
static uint8_t ctrl_buffer[64];