library for USB DFU to write on internal flash (code)
More...
Go to the source code of this file.
|
static void | usb_disconnect (void) |
| disconnect USB to force re-enumerate
|
|
static void | usb_dfu_flash (usbd_device *usbd_dev, struct usb_setup_data *req) |
| flash downloaded data block More...
|
|
static void | usb_dfu_reset (usbd_device *usbd_dev, struct usb_setup_data *req) |
| disconnect USB and perform system reset More...
|
|
static int | usb_dfu_control_request (usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void(**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) |
| handle incoming USB DFU control request More...
|
|
void | usb_dfu_setup (void) |
| setup USB DFU peripheral
|
|
void | usb_dfu_start (void) |
| start USB DFU handling
|
|
library for USB DFU to write on internal flash (code)
- Author
- King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
- Date
- 2017
Definition in file usb_dfu.c.
◆ usb_dfu_control_request()
static int usb_dfu_control_request |
( |
usbd_device * |
usbd_dev, |
|
|
struct usb_setup_data * |
req, |
|
|
uint8_t ** |
buf, |
|
|
uint16_t * |
len, |
|
|
void(**)(usbd_device *usbd_dev, struct usb_setup_data *req) |
complete |
|
) |
| |
|
static |
handle incoming USB DFU control request
- Parameters
-
[in] | usbd_dev | USB device descriptor |
[in] | req | control request information |
[in] | buf | control request data |
[in] | len | control request data length |
[in] | complete | not used |
- Returns
- 0 if succeeded, error else
- Note
- resets device when configured with 5 bits
Definition at line 193 of file usb_dfu.c.
◆ usb_dfu_flash()
static void usb_dfu_flash |
( |
usbd_device * |
usbd_dev, |
|
|
struct usb_setup_data * |
req |
|
) |
| |
|
static |
flash downloaded data block
- Parameters
-
[in] | usbd_dev | USB device (unused) |
[in] | req | USB request (unused) |
- Note
- this function is called after the corresponding GETSTATUS request
Definition at line 155 of file usb_dfu.c.
◆ usb_dfu_reset()
static void usb_dfu_reset |
( |
usbd_device * |
usbd_dev, |
|
|
struct usb_setup_data * |
req |
|
) |
| |
|
static |
disconnect USB and perform system reset
- Parameters
-
[in] | usbd_dev | USB device (unused) |
[in] | req | USB request (unused) |
- Note
- this function is called after the corresponding GETSTATUS request
Definition at line 175 of file usb_dfu.c.
◆ usb_dfu_configuration
const struct usb_config_descriptor usb_dfu_configuration |
|
static |
Initial value:= {
.bLength = USB_DT_CONFIGURATION_SIZE,
.bDescriptorType = USB_DT_CONFIGURATION,
.wTotalLength = 0,
.bConfigurationValue = 1,
.iConfiguration = 0,
.bmAttributes = 0x80,
.bMaxPower = 0x32,
}
#define LENGTH(x)
get the length of an array
static const struct usb_interface usb_dfu_interfaces[]
USB DFU interface descriptor list.
USB DFU configuration descriptor.
- Note
- as defined in USB Device Firmware Upgrade specification section 4.2.2
Definition at line 105 of file usb_dfu.c.
◆ usb_dfu_device
const struct usb_device_descriptor usb_dfu_device |
|
static |
Initial value:= {
.bLength = USB_DT_DEVICE_SIZE,
.bDescriptorType = USB_DT_DEVICE,
.bcdUSB = 0x0200,
.bDeviceClass = 0,
.bDeviceSubClass = 0,
.bDeviceProtocol = 0,
.bMaxPacketSize0 = 64,
.idVendor = 0x1209,
.idProduct = 0x4256,
.bcdDevice = 0x0000,
.iManufacturer = 1,
.iProduct = 2,
.iSerialNumber = 0,
.bNumConfigurations = 1,
}
USB DFU device descriptor.
- Note
- as defined in USB Device Firmware Upgrade specification section 4.2.1
Definition at line 50 of file usb_dfu.c.
◆ usb_dfu_functional
const struct usb_dfu_descriptor usb_dfu_functional |
|
static |
Initial value:= {
.bLength = sizeof(struct usb_dfu_descriptor),
.bDescriptorType = DFU_FUNCTIONAL,
.bmAttributes = USB_DFU_CAN_DOWNLOAD | USB_DFU_WILL_DETACH,
.wDetachTimeout = 200,
.bcdDFUVersion = 0x0110,
}
static uint8_t usbd_control_buffer[1024]
buffer to be used for control requests (fit to flash page size)
USB DFU functional descriptor.
- Note
- as defined in USB Device Firmware Upgrade specification section 4.2.4
Definition at line 70 of file usb_dfu.c.
◆ usb_dfu_interface
const struct usb_interface_descriptor usb_dfu_interface |
|
static |
Initial value:= {
.bLength = USB_DT_INTERFACE_SIZE,
.bDescriptorType = USB_DT_INTERFACE,
.bInterfaceNumber = 0,
.bAlternateSetting = 0,
.bNumEndpoints = 0,
.bInterfaceClass = 0xFE,
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 2,
.iInterface = 3,
}
static const struct usb_dfu_descriptor usb_dfu_functional
USB DFU functional descriptor.
USB DFU interface descriptor.
- Note
- as defined in USB Device Firmware Upgrade specification section 4.2.3
Definition at line 82 of file usb_dfu.c.
◆ usb_dfu_interfaces
const struct usb_interface usb_dfu_interfaces[] |
|
static |
Initial value:= {{
.num_altsetting = 1,
}}
static const struct usb_interface_descriptor usb_dfu_interface
USB DFU interface descriptor.
USB DFU interface descriptor list.
Definition at line 97 of file usb_dfu.c.
◆ usb_dfu_strings
const char* usb_dfu_strings[] |
|
static |
Initial value:= {
"CuVoodoo",
"BusVoodoo multi-protocol debugging adapter ",
"DFU bootloader (DFU mode)",
}
USB string table.
- Note
- starts with index 1
Definition at line 121 of file usb_dfu.c.