Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USB Device Interface (UDI) for Vendor Class Device

USB Device Interface (UDI) for Vendor Class Device provides an interface for the configuration and management of USB Vendor Device.

The outline of this documentation is as follows:

For more details for Atmel® Software Framework (ASF) USB Device Stack, and USB Device Vendor, refer to following application notes:

API Overview

Data Structures

struct  udi_vendor_desc_t
 Interface descriptor structure for vendor Class interface. More...
 

Interface with USB Device Core (UDC)

Variable required by UDC.

UDC_DESC_STORAGE udi_api_t udi_api_vendor
 Global structure which contains standard UDI interface for UDC. More...
 

USB Interface Descriptors

The following structures provide predefined USB interface descriptors.

It must be used to define the final USB descriptors.

#define UDI_VENDOR_EPS_INT_DESC
 Endpoint descriptors. More...
 
#define UDI_VENDOR_EPS_INT_DESC_FS
 
#define UDI_VENDOR_EPS_INT_DESC_HS
 
#define UDI_VENDOR_EPS_BULK_DESC
 
#define UDI_VENDOR_EPS_BULK_DESC_FS
 
#define UDI_VENDOR_EPS_BULK_DESC_HS
 
#define UDI_VENDOR_EPS_ISO_DESC
 
#define UDI_VENDOR_EPS_ISO_DESC_FS
 
#define UDI_VENDOR_EPS_ISO_DESC_HS
 
#define UDI_VENDOR_STRING_ID   0
 By default no string is associated to this interface. More...
 
#define UDI_VENDOR_EP_NB_INT   ((UDI_VENDOR_EPS_SIZE_INT_FS)?2:0)
 Maximum six endpoints used by vendor interface. More...
 
#define UDI_VENDOR_EP_NB_BULK   ((UDI_VENDOR_EPS_SIZE_BULK_FS)?2:0)
 
#define UDI_VENDOR_EP_NB_ISO   ((UDI_VENDOR_EPS_SIZE_ISO_FS)?2:0)
 
#define UDI_VENDOR_EP_NB   (UDI_VENDOR_EP_NB_INT+UDI_VENDOR_EP_NB_BULK+UDI_VENDOR_EP_NB_ISO)
 
#define UDI_VENDOR_DESC
 Content of vendor interface descriptor for all speeds. More...
 
#define UDI_VENDOR_DESC_FS
 Content of vendor interface descriptor for full speed only. More...
 
#define UDI_VENDOR_DESC_HS
 Content of vendor interface descriptor for high speed only. More...
 

USB Device Interface (UDI) for Vendor Class

Common APIs used by high level application to use this USB class.

These routines are used to transfer data to/from USB VENDOR endpoints.

See Quick start guide for USB Device vendor module.

bool udi_vendor_interrupt_in_run (uint8_t *buf, iram_size_t buf_size, udd_callback_trans_t callback)
 Start a transfer on interrupt IN. More...
 
bool udi_vendor_interrupt_out_run (uint8_t *buf, iram_size_t buf_size, udd_callback_trans_t callback)
 Start a transfer on interrupt OUT. More...
 
bool udi_vendor_bulk_in_run (uint8_t *buf, iram_size_t buf_size, udd_callback_trans_t callback)
 Start a transfer on bulk IN. More...
 
bool udi_vendor_bulk_out_run (uint8_t *buf, iram_size_t buf_size, udd_callback_trans_t callback)
 Start a transfer on bulk OUT. More...
 
bool udi_vendor_iso_in_run (uint8_t *buf, iram_size_t buf_size, udd_callback_trans_t callback)
 Start a transfer on isochronous IN. More...
 
bool udi_vendor_iso_out_run (uint8_t *buf, iram_size_t buf_size, udd_callback_trans_t callback)
 Start a transfer on isochronous OUT. More...
 

#define UDI_VENDOR_DESC
Value:
.iface0.bLength = sizeof(usb_iface_desc_t),\
.iface0.bDescriptorType = USB_DT_INTERFACE,\
.iface0.bInterfaceNumber = UDI_VENDOR_IFACE_NUMBER,\
.iface0.bAlternateSetting = 0,\
.iface0.bNumEndpoints = 0,\
.iface0.bInterfaceClass = VENDOR_CLASS,\
.iface0.bInterfaceSubClass = VENDOR_SUBCLASS,\
.iface0.bInterfaceProtocol = VENDOR_PROTOCOL,\
.iface0.iInterface = UDI_VENDOR_STRING_ID,\
.iface1.bLength = sizeof(usb_iface_desc_t),\
.iface1.bDescriptorType = USB_DT_INTERFACE,\
.iface1.bInterfaceNumber = UDI_VENDOR_IFACE_NUMBER,\
.iface1.bAlternateSetting = 1,\
.iface1.bNumEndpoints = UDI_VENDOR_EP_NB,\
.iface1.bInterfaceClass = VENDOR_CLASS,\
.iface1.bInterfaceSubClass = VENDOR_SUBCLASS,\
.iface1.bInterfaceProtocol = VENDOR_PROTOCOL,\
.iface1.iInterface = UDI_VENDOR_STRING_ID,\
#define UDI_VENDOR_EPS_ISO_DESC
Definition: udi_vendor_doc.h:160
#define VENDOR_PROTOCOL
Definition: usb_protocol_vendor.h:53
#define UDI_VENDOR_EP_NB
Definition: udi_vendor_doc.h:200
Definition: usb_protocol.h:193
Standard USB interface descriptor structure.
Definition: usb_protocol.h:446
#define UDI_VENDOR_IFACE_NUMBER
Interface number is 0 because it is the unique interface.
Definition: udi_vendor_conf.h:96
#define VENDOR_CLASS
Definition: usb_protocol_vendor.h:51
#define VENDOR_SUBCLASS
Definition: usb_protocol_vendor.h:52
#define UDI_VENDOR_STRING_ID
By default no string is associated to this interface.
Definition: udi_vendor_doc.h:193

Content of vendor interface descriptor for all speeds.

#define UDI_VENDOR_DESC_FS
Value:

Content of vendor interface descriptor for full speed only.

#define UDI_VENDOR_DESC_HS
Value:

Content of vendor interface descriptor for high speed only.

#define UDI_VENDOR_EP_NB_BULK   ((UDI_VENDOR_EPS_SIZE_BULK_FS)?2:0)
#define UDI_VENDOR_EP_NB_INT   ((UDI_VENDOR_EPS_SIZE_INT_FS)?2:0)

Maximum six endpoints used by vendor interface.

#define UDI_VENDOR_EP_NB_ISO   ((UDI_VENDOR_EPS_SIZE_ISO_FS)?2:0)
#define UDI_VENDOR_EPS_BULK_DESC
#define UDI_VENDOR_EPS_BULK_DESC_FS
#define UDI_VENDOR_EPS_BULK_DESC_HS
#define UDI_VENDOR_EPS_INT_DESC

Endpoint descriptors.

Support and FAQ: visit Microchip Support

#define UDI_VENDOR_EPS_INT_DESC_FS
#define UDI_VENDOR_EPS_INT_DESC_HS
#define UDI_VENDOR_EPS_ISO_DESC
#define UDI_VENDOR_EPS_ISO_DESC_FS
#define UDI_VENDOR_EPS_ISO_DESC_HS
#define UDI_VENDOR_STRING_ID   0

By default no string is associated to this interface.

bool udi_vendor_bulk_in_run ( uint8_t *  buf,
iram_size_t  buf_size,
udd_callback_trans_t  callback 
)

Start a transfer on bulk IN.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool udi_vendor_bulk_out_run ( uint8_t *  buf,
iram_size_t  buf_size,
udd_callback_trans_t  callback 
)

Start a transfer on bulk OUT.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool udi_vendor_interrupt_in_run ( uint8_t *  buf,
iram_size_t  buf_size,
udd_callback_trans_t  callback 
)

Start a transfer on interrupt IN.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool udi_vendor_interrupt_out_run ( uint8_t *  buf,
iram_size_t  buf_size,
udd_callback_trans_t  callback 
)

Start a transfer on interrupt OUT.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool udi_vendor_iso_in_run ( uint8_t *  buf,
iram_size_t  buf_size,
udd_callback_trans_t  callback 
)

Start a transfer on isochronous IN.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool udi_vendor_iso_out_run ( uint8_t *  buf,
iram_size_t  buf_size,
udd_callback_trans_t  callback 
)

Start a transfer on isochronous OUT.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.

UDC_DESC_STORAGE udi_api_t udi_api_vendor

Global structure which contains standard UDI interface for UDC.

Global structure which contains standard UDI interface for UDC.