USBLibAPIGuide  1.00.00.01
Data Structures | Macros | Functions | Variables
Dfu_device_class_api

Data Structures

struct  tDFUInstance
 
struct  tUSBDDFUDevice
 

Macros

#define NUM_DFU_SECTIONS
 
#define DFUINTERFACE_SIZE   (9)
 
#define DFUFUNCTIONALDESC_SIZE   (9)
 
#define COMPOSITE_DDFU_SIZE   (DFUINTERFACE_SIZE + DFUFUNCTIONALDESC_SIZE)
 
#define USBD_DFU_EVENT_DETACH   (USBD_DFU_EVENT_BASE + 0)
 

Functions

void * USBDDFUCompositeInit (uint32_t ui32Index, tUSBDDFUDevice *psDFUDevice, tCompositeEntry *psCompEntry)
 
void USBDDFUCompositeTerm (void *pvDFUInstance)
 
void USBDDFUUpdateBegin (void)
 

Variables

const uint8_t g_pui8DFUDeviceDescriptor []
 
uint8_t g_pui8DFUConfigDescriptor []
 
uint8_t g_pui8DFUInterface [DFUINTERFACE_SIZE]
 
uint8_t g_pui8DFUFunctionalDesc [DFUFUNCTIONALDESC_SIZE]
 
const tConfigSection g_sDFUConfigSection
 
const tConfigSection g_sDFUInterfaceSection
 
const tConfigSection g_sDFUFunctionalDescSection
 
const tConfigSectiong_psDFUSections []
 
tConfigHeader g_sDFUConfigHeader
 
const tConfigHeader *const g_ppsDFUConfigDescriptors []
 

Detailed Description

Macro Definition Documentation

§ NUM_DFU_SECTIONS

#define NUM_DFU_SECTIONS
Value:
(sizeof(g_psDFUSections) / \
sizeof(g_psDFUSections[0]))
const tConfigSection * g_psDFUSections[]
Definition: usbddfu-rt.c:170

§ DFUINTERFACE_SIZE

#define DFUINTERFACE_SIZE   (9)

§ DFUFUNCTIONALDESC_SIZE

#define DFUFUNCTIONALDESC_SIZE   (9)

§ COMPOSITE_DDFU_SIZE

#define COMPOSITE_DDFU_SIZE   (DFUINTERFACE_SIZE + DFUFUNCTIONALDESC_SIZE)

The size of the memory that should be allocated to create a configuration descriptor for a single instance of the DFU runtime device. This does not include the configuration descriptor which is automatically ignored by the composite device class.

This label is used to compute the value which will be passed to the USBDCompositeInit function in the ui32Size parameter.

§ USBD_DFU_EVENT_DETACH

#define USBD_DFU_EVENT_DETACH   (USBD_DFU_EVENT_BASE + 0)

This value is passed to the client via the callback function provided in the tUSBDDFUDevice structure and indicates that the host has sent a DETACH request to the DFU interface. This request indicates that the device detach from the USB bus and reattach in DFU mode in preparation for a firmware upgrade. Currently, this is the only event that the DFU runtime class reports to the client.

When this event is received, the client should call USBDDFUUpdateBegin() from a non-interrupt context at its earliest opportunity.

Function Documentation

§ USBDDFUCompositeInit()

void * USBDDFUCompositeInit ( uint32_t  ui32Index,
tUSBDDFUDevice psDFUDevice,
tCompositeEntry psCompEntry 
)

Initializes DFU device operation for a given USB controller.

Parameters
ui32Indexis the index of the USB controller which is to be initialized for DFU runtime device operation.
psDFUDevicepoints to a structure containing parameters customizing the operation of the DFU device.
psCompEntryis the composite device entry to initialize when creating a composite device.

The psCompEntry should point to the composite device entry to initialize. This is part of the array that is passed to the USBDCompositeInit() function.

Returns
Returns zero on failure or a non-zero instance value that should be used with the remaining USB DFU APIs.

References tDeviceInfo::psCallbacks, tCompositeEntry::psDevInfo, tCompositeEntry::pvInstance, tDFUInstance::sDevInfo, and tUSBDDFUDevice::sPrivateData.

§ USBDDFUCompositeTerm()

void USBDDFUCompositeTerm ( void *  pvDFUInstance)

Shuts down the DFU device.

Parameters
pvDFUInstanceis the pointer to the device instance structure as returned by USBDDFUCompositeInit().

This function terminates DFU operation for the instance supplied and removes the device from the USB bus.

Following this call, the pvDFUInstance instance should not me used in any other calls.

Returns
None.

References tDFUInstance::ui32USBBase, and USBDCDTerm().

§ USBDDFUUpdateBegin()

void USBDDFUUpdateBegin ( void  )

Removes the current USB device from the bus and transfers control to the DFU boot loader.

This function should be called from the application's main loop (i.e. not in interrupt context) following a callback to the USB DFU callback function notifying the application of a DETACH request from the host. The function will prepare the system to switch to DFU mode and transfer control to the boot loader in preparation for a firmware upgrade from the host.

The application must ensure that it has completed all necessary shutdown activities (saved any required data, etc.) before making this call since the function will not return.

Returns
This function does not return.

References USBDCDTerm().

Variable Documentation

§ g_pui8DFUDeviceDescriptor

const uint8_t g_pui8DFUDeviceDescriptor[]
Initial value:
=
{
18,
USBShort(0x110),
0,
0,
64,
USBShort(0),
USBShort(0),
USBShort(0),
0,
0,
0,
1
}
#define USBShort(ui16Value)
Definition: usblib.h:834
#define USB_CLASS_VEND_SPECIFIC
Definition: usblib.h:437
#define USB_DTYPE_DEVICE
Definition: usblib.h:280

§ g_pui8DFUConfigDescriptor

uint8_t g_pui8DFUConfigDescriptor[]
Initial value:
=
{
9,
USBShort(27),
1,
1,
0,
250,
}
#define USB_DTYPE_CONFIGURATION
Definition: usblib.h:281
#define USBShort(ui16Value)
Definition: usblib.h:834
#define USB_CONF_ATTR_SELF_PWR
Definition: usblib.h:602

§ g_pui8DFUInterface

uint8_t g_pui8DFUInterface[DFUINTERFACE_SIZE]
Initial value:
=
{
9,
0,
0,
0,
0,
}
#define USB_DFU_RUNTIME_PROTOCOL
Definition: usbdfu.h:109
#define USB_DFU_SUBCLASS
Definition: usbdfu.h:100
#define USB_CLASS_APP_SPECIFIC
Definition: usblib.h:436
#define USB_DTYPE_INTERFACE
Definition: usblib.h:283

§ g_pui8DFUFunctionalDesc

uint8_t g_pui8DFUFunctionalDesc[DFUFUNCTIONALDESC_SIZE]
Initial value:
=
{
9,
USBShort(0xFFFF),
USBShort(0x0110)
}
#define DFU_ATTR_CAN_UPLOAD
Definition: usbdfu.h:34
#define DFU_ATTR_CAN_DOWNLOAD
Definition: usbdfu.h:35
#define DFU_ATTR_WILL_DETACH
Definition: usbdfu.h:31
#define USBShort(ui16Value)
Definition: usblib.h:834
#define DFU_ATTR_MANIFEST_TOLERANT
Definition: usbdfu.h:32
#define DFU_TRANSFER_SIZE
Definition: usbdfu.h:134
#define USB_DFU_FUNC_DESCRIPTOR_TYPE
Definition: usbdfu.h:91

§ g_sDFUConfigSection

const tConfigSection g_sDFUConfigSection
Initial value:
=
{
}
uint8_t g_pui8DFUConfigDescriptor[]
Definition: usbddfu-rt.c:76

§ g_sDFUInterfaceSection

const tConfigSection g_sDFUInterfaceSection
Initial value:
=
{
}
uint8_t g_pui8DFUInterface[DFUINTERFACE_SIZE]
Definition: usbddfu-rt.c:99

§ g_sDFUFunctionalDescSection

const tConfigSection g_sDFUFunctionalDescSection
Initial value:
=
{
}
uint8_t g_pui8DFUFunctionalDesc[DFUFUNCTIONALDESC_SIZE]
Definition: usbddfu-rt.c:121

§ g_psDFUSections

const tConfigSection* g_psDFUSections[]
Initial value:
=
{
}
const tConfigSection g_sDFUInterfaceSection
Definition: usbddfu-rt.c:152
const tConfigSection g_sDFUConfigSection
Definition: usbddfu-rt.c:146
const tConfigSection g_sDFUFunctionalDescSection
Definition: usbddfu-rt.c:158

§ g_sDFUConfigHeader

tConfigHeader g_sDFUConfigHeader
Initial value:
=
{
}
const tConfigSection * g_psDFUSections[]
Definition: usbddfu-rt.c:170
#define NUM_DFU_SECTIONS
Definition: usbddfu-rt.c:177

§ g_ppsDFUConfigDescriptors

const tConfigHeader* const g_ppsDFUConfigDescriptors[]
Initial value:
=
{
}
tConfigHeader g_sDFUConfigHeader
Definition: usbddfu-rt.c:187
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale