usbdfu.h

The usbdfu.h header contains USB Device Firmware Upgrade interface class request and descriptor definitions. See the USB Device Class Specification for Device Firmware Upgrade document for details.

Reference

Defines

USB_DFU_STATUS_NAMES

Typedefs

typedef const struct usb_dfu_desc_functional usb_dfu_desc_functional_c
typedef enum usb_dfu_status usb_dfu_status_t

Enums

enum [anonymous]

Values:

enumerator USB_DESC_DFU_FUNCTIONAL
enum usb_dfu_attributes

Values:

enumerator USB_DFU_ATTR_CAN_DNLOAD
enumerator USB_DFU_ATTR_CAN_UPLOAD
enumerator USB_DFU_ATTR_MANIFESTATION_TOLERANT
enumerator USB_DFU_ATTR_WILL_DETACH
enum [anonymous]

Values:

enumerator USB_IFACE_SUBCLASS_DFU
enumerator USB_IFACE_PROTOCOL_DFU_RUNTIME
enumerator USB_IFACE_PROTOCOL_DFU_UPGRADE
enum usb_dfu_request

Values:

enumerator USB_DFU_REQ_DETACH
enumerator USB_DFU_REQ_DNLOAD
enumerator USB_DFU_REQ_UPLOAD
enumerator USB_DFU_REQ_GETSTATUS
enumerator USB_DFU_REQ_CLRSTATUS
enumerator USB_DFU_REQ_GETSTATE
enumerator USB_DFU_REQ_ABORT
enum usb_dfu_state

Values:

enumerator USB_DFU_STATE_appIDLE

Device is running its normal application.

enumerator USB_DFU_STATE_appDETACH

Device is running its normal application, has received the DFU_DETACH request, and is waiting for a USB reset.

enumerator USB_DFU_STATE_dfuIDLE

Device is operating in the DFU mode and is waiting for requests.

enumerator USB_DFU_STATE_dfuDNLOAD_SYNC

Device has received a block and is waiting for the host to solicit the status via DFU_GETSTATUS.

enumerator USB_DFU_STATE_dfuDNBUSY

Device is programming a control-write block into its nonvolatile memories.

enumerator USB_DFU_STATE_dfuDNLOAD_IDLE

Device is processing a download operation. Expecting DFU_DNLOAD requests.

enumerator USB_DFU_STATE_dfuMANIFEST_SYNC

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. (Devices that can enter this state after the Manifestation phase set bmAttributes bit bitManifestationTolerant to 1.)

enumerator USB_DFU_STATE_dfuMANIFEST

Device is in the Manifestation phase. (Not all devices will be able to respond to DFU_GETSTATUS when in this state.)

enumerator USB_DFU_STATE_dfuMANIFEST_WAIT_RESET

Device has programmed its memories and is waiting for a USB reset or a power on reset. (Devices that must enter this state clear bitManifestationTolerant to 0.)

enumerator USB_DFU_STATE_dfuUPLOAD_IDLE

The device is processing an upload operation. Expecting DFU_UPLOAD requests.

enumerator USB_DFU_STATE_dfuERROR

An error has occurred. Awaiting the DFU_CLRSTATUS request.

enum usb_dfu_status

Values:

enumerator USB_DFU_STATUS_OK

No error condition is present.

enumerator USB_DFU_STATUS_errTARGET

File is not targeted for use by this device.

enumerator USB_DFU_STATUS_errFILE

File is for this device but fails some vendor-specific verification test.

enumerator USB_DFU_STATUS_errWRITE

Device is unable to write memory.

enumerator USB_DFU_STATUS_errERASE

Memory erase function failed.

enumerator USB_DFU_STATUS_errCHECK_ERASED

Memory erase check failed.

enumerator USB_DFU_STATUS_errPROG

Program memory function failed.

enumerator USB_DFU_STATUS_errVERIFY

Programmed memory failed verification.

enumerator USB_DFU_STATUS_errADDRESS

Cannot program memory due to received address that is out of range.

enumerator USB_DFU_STATUS_errNOTDONE

Received DFU_DNLOAD with wLength = 0, but device does not think it has all of the data yet.

enumerator USB_DFU_STATUS_errFIRMWARE

Device’s firmware is corrupt. It cannot return to run-time (non-DFU) operations.

enumerator USB_DFU_STATUS_errVENDOR

iString indicates a vendor-specific error.

enumerator USB_DFU_STATUS_errUSBR

Device detected unexpected USB reset signaling.

enumerator USB_DFU_STATUS_errPOR

Device detected unexpected power on reset.

enumerator USB_DFU_STATUS_errUNKNOWN

Something went wrong, but the device does not know what it was.

enumerator USB_DFU_STATUS_errSTALLEDPKT

Device stalled an unexpected request.

struct usb_dfu_desc_functional
#include <usbdfu.h>

Public Members

uint8_t bLength
uint8_t bDescriptorType
uint8_t bmAttributes
uint16_t wDetachTimeOut
uint16_t wTransferSize
uint16_t bcdDFUVersion
struct usb_dfu_req_get_status
#include <usbdfu.h>

Public Members

uint8_t bStatus
uint8_t bwPollTimeout
uint16_t bwPollTimeoutHigh
uint8_t bState
uint8_t iString