Lightweight USB stack  1.0
USB DFU class

This module contains USB Device Firmware Upgrade class definitions. More...

Data Structures

struct  usb_dfu_func_desc
 USB DFU functional descriptor. More...
 
struct  usb_dfu_status
 Payload packet to response in DFU_GETSTATUS request. More...
 

USB DFU class subclass and protocol definitions

#define USB_CLASS_DFU   0xFE
 USB DFU class.
 
#define USB_DFU_SUBCLASS_DFU   0x01
 USB DFU subclass code.
 
#define USB_DFU_PROTO_RUNTIME   0x01
 USB DFU runtime-mode protocol.
 
#define USB_DFU_PROTO_DFU   0x02
 USB DFU DFU-mode protocol.
 

USB DFU descriptor types

#define USB_DTYPE_DFU_FUNCTIONAL   0x21
 USB DFU functional descriptor type.
 

USB DFU class-specific requests

#define USB_DFU_DETACH   0x00
 Initiates a detach-attach sequence on the bus when it sees this request.
 
#define USB_DFU_DNLOAD   0x01
 Initiates firmware image downloading.
 
#define USB_DFU_UPLOAD   0x02
 This request is employed by the host to solicit firmware from the device.
 
#define USB_DFU_GETSTATUS   0x03
 The host employs this request to facilitate synchronization with the device.
 
#define USB_DFU_CLRSTATUS   0x04
 This request resets DFU machine state to DFU_IDLE.
 
#define USB_DFU_GETSTATE   0x05
 This request solicits a report about the state of the device.
 
#define USB_DFU_ABORT   0x06
 This request enables the host to exit from certain states and return to the DFU_IDLE state.
 

USB DFU capabilities

#define USB_DFU_ATTR_WILL_DETACH   0x08
 Device will perform a bus detach-attach sequence when it receives a DFU_DETACH request.
 
#define USB_DFU_ATTR_MANIF_TOL   0x04
 Device is able to communicate via USB after Manifestation phase.
 
#define USB_DFU_ATTR_CAN_UPLOAD   0x02
 Upload capable.
 
#define USB_DFU_ATTR_CAN_DNLOAD   0x01
 Download capable.
 

USB DFU status codes

#define USB_DFU_STATUS_OK   0x00
 No error condition is present.
 
#define USB_DFU_STATUS_ERR_TARGET   0x01
 File is not targeted for use by this device.
 
#define USB_DFU_STATUS_ERR_FILE   0x02
 File is for this device but fails some vendor specific verification test.
 
#define USB_DFU_STATUS_ERR_WRITE   0x03
 Device is unable to write memory.
 
#define USB_DFU_STATUS_ERR_ERASE   0x04
 Memory erase function failed.
 
#define USB_DFU_STATUS_ERR_CHECK_ERASED   0x05
 Memory erase check failed.
 
#define USB_DFU_STATUS_ERR_PROG   0x06
 Program memory function failed.
 
#define USB_DFU_STATUS_ERR_VERIFY   0x07
 Programmed memory failed verification.
 
#define USB_DFU_STATUS_ERR_ADDRESS   0x08
 Cannot program memory due to received address that is out of range.
 
#define USB_DFU_STATUS_ERR_NOTDONE   0x09
 Received DFU_DNLOAD with wLength = 0, but device does not think it has all of the data yet.
 
#define USB_DFU_STATUS_ERR_FIRMWARE   0x0A
 Device's firmware is corrupt. It cannot return to run-time (non-DFU) operations.
 
#define USB_DFU_STATUS_ERR_VENDOR   0x0B
 iString indicates a vendor-specific error.
 
#define USB_DFU_STATUS_ERR_USBR   0x0C
 Device detected unexpected USB reset signaling.
 
#define USB_DFU_STATUS_ERR_POR   0x0D
 Device detected unexpected power on reset.
 
#define USB_DFU_STATUS_ERR_UNKNOWN   0x0E
 Something went wrong, but the device does not know what it was.
 
#define USB_DFU_STATUS_ERR_STALLEDPKT   0x0F
 Device stalled an unexpected request.
 

USB DFU state codes

#define USB_DFU_STATE_APP_IDLE   0x00
 Device is running its normal application.
 
#define USB_DFU_STATE_APP_DETACH   0x01
 Device is running its normal application, has received the DFU_DETACH request, and is waiting for a USB reset.
 
#define USB_DFU_STATE_DFU_IDLE   0x02
 Device is operating in the DFU mode and is waiting for requests.
 
#define USB_DFU_STATE_DFU_DNLOADSYNC   0x03
 Device has received a block and is waiting for the host to solicit the status via DFU_GETSTATUS.
 
#define USB_DFU_STATE_DFU_DNBUSY   0x04
 Device is programming a control-write block into its nonvolatile memories.
 
#define USB_DFU_STATE_DFU_DNLOADIDLE   0x05
 Device is processing a download operation. Expecting DFU_DNLOAD requests.
 
#define USB_DFU_STATE_DFU_MANIFESTSYNC   0x06
 Device has received the final block of firmware from the host and is waiting for receipt of DFU_GETSTATUS to begin the Manifestation phase; or device has completed the Manifestation phase and is waiting for receipt of DFU_GETSTATUS. More...
 
#define USB_DFU_STATE_DFU_MANIFEST   0x07
 Device is in the Manifestation phase. More...
 
#define USB_DFU_STATE_DFU_MANIFESTWR   0x08
 Device has programmed its memories and is waiting for a USB reset or a power on reset. More...
 
#define USB_DFU_STATE_DFU_UPLOADIDLE   0x09
 The device is processing an upload operation.
 
#define USB_DFU_STATE_DFU_ERROR   0x0A
 An error has occurred.
 

Detailed Description

This module contains USB Device Firmware Upgrade class definitions.

This module based on

Macro Definition Documentation

◆ USB_DFU_STATE_DFU_MANIFESTSYNC

#define USB_DFU_STATE_DFU_MANIFESTSYNC   0x06

Device has received the final block of firmware from the host and is waiting for receipt of DFU_GETSTATUS to begin the Manifestation phase; or device has completed the Manifestation phase and is waiting for receipt of DFU_GETSTATUS.

Note
Devices that can enter this state after the Manifestation phase set bmAttributes bit bitManifestationTolerant to 1.

Definition at line 127 of file usb_dfu.h.

◆ USB_DFU_STATE_DFU_MANIFEST

#define USB_DFU_STATE_DFU_MANIFEST   0x07

Device is in the Manifestation phase.

Note
Not all devices will be able to respond to DFU_GETSTATUS when in this state.

Definition at line 142 of file usb_dfu.h.

◆ USB_DFU_STATE_DFU_MANIFESTWR

#define USB_DFU_STATE_DFU_MANIFESTWR   0x08

Device has programmed its memories and is waiting for a USB reset or a power on reset.

Note
Devices that must enter this state clear bitManifestationTolerant to 0.

Definition at line 147 of file usb_dfu.h.