Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USB interface descriptors

The following structures provide predefined USB interface descriptors.

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

It must be used to define the final USB descriptors.

These routines are used by memory to transfer its data to/from USB MSC endpoints.

See Quick start guide for USB device Mass Storage module (UDI MSC).

Modules

 
 Quick Start Guide(s)
 In this section you can find a list of all Quick Start guides related to the USB interface descriptors.
 
 Interface with USB Device Core (UDC)
 Structures and functions required by UDC.
 
 Implementation of UDI MSC
 Class internal implementation.
 

Data Structures

struct  udi_msc_desc_t
 Interface descriptor structure for MSC. More...
 

Macros

#define UDI_MSC_DESC
 Content of MSC interface descriptor for all speeds. More...
 
#define UDI_MSC_DESC_FS
 Content of MSC interface descriptor for full speed only. More...
 
#define UDI_MSC_DESC_HS
 Content of MSC interface descriptor for high speed only. More...
 
#define UDI_MSC_EPS_SIZE_FS   64
 MSC endpoints size for full speed. More...
 
#define UDI_MSC_EPS_SIZE_HS   512
 MSC endpoints size for high speed. More...
 
#define UDI_MSC_STRING_ID   0
 By default no string associated to this interface. More...
 

Functions

bool udi_msc_process_trans (void)
 Process the background read/write commands. More...
 
bool udi_msc_trans_block (bool b_read, uint8_t *block, iram_size_t block_size, void(*callback)(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep))
 Transfers data to/from USB MSC endpoints. More...
 

#define UDI_MSC_DESC
Value:
.iface.bLength = sizeof(usb_iface_desc_t),\
.iface.bDescriptorType = USB_DT_INTERFACE,\
.iface.bInterfaceNumber = UDI_MSC_IFACE_NUMBER,\
.iface.bAlternateSetting = 0,\
.iface.bNumEndpoints = 2,\
.iface.bInterfaceClass = MSC_CLASS,\
.iface.bInterfaceSubClass = MSC_SUBCLASS_TRANSPARENT,\
.iface.bInterfaceProtocol = MSC_PROTOCOL_BULK,\
.iface.iInterface = UDI_MSC_STRING_ID,\
.ep_in.bLength = sizeof(usb_ep_desc_t),\
.ep_in.bDescriptorType = USB_DT_ENDPOINT,\
.ep_in.bEndpointAddress = UDI_MSC_EP_IN,\
.ep_in.bmAttributes = USB_EP_TYPE_BULK,\
.ep_in.bInterval = 0,\
.ep_out.bLength = sizeof(usb_ep_desc_t),\
.ep_out.bDescriptorType = USB_DT_ENDPOINT,\
.ep_out.bEndpointAddress = UDI_MSC_EP_OUT,\
.ep_out.bmAttributes = USB_EP_TYPE_BULK,\
.ep_out.bInterval = 0,
#define UDI_MSC_EP_IN
Endpoint numbers used by MSC interface.
Definition: udi_msc_conf.h:50
#define MSC_CLASS
Definition: usb_protocol_msc.h:52
#define UDI_MSC_EP_OUT
Definition: udi_msc_conf.h:51
#define UDI_MSC_STRING_ID
By default no string associated to this interface.
Definition: udi_msc.h:77
Definition: usb_protocol.h:194
Definition: usb_protocol.h:193
#define MSC_PROTOCOL_BULK
Bulk-only.
Definition: usb_protocol_msc.h:79
Standard USB interface descriptor structure.
Definition: usb_protocol.h:446
Definition: usb_protocol.h:251
Standard USB endpoint descriptor structure.
Definition: usb_protocol.h:461
#define UDI_MSC_IFACE_NUMBER
Interface number is 0 because it is the unique interface.
Definition: udi_msc_conf.h:54
#define MSC_SUBCLASS_TRANSPARENT
Determined by INQUIRY.
Definition: usb_protocol_msc.h:69

Content of MSC interface descriptor for all speeds.

#define UDI_MSC_DESC_FS
Value:
{\
.ep_in.wMaxPacketSize = LE16(UDI_MSC_EPS_SIZE_FS),\
.ep_out.wMaxPacketSize = LE16(UDI_MSC_EPS_SIZE_FS),\
}
#define UDI_MSC_DESC
Content of MSC interface descriptor for all speeds.
Definition: udi_msc.h:86
#define LE16(x)
Definition: compiler.h:886
#define UDI_MSC_EPS_SIZE_FS
MSC endpoints size for full speed.
Definition: udi_msc.h:81

Content of MSC interface descriptor for full speed only.

#define UDI_MSC_DESC_HS
Value:
{\
.ep_in.wMaxPacketSize = LE16(UDI_MSC_EPS_SIZE_HS),\
.ep_out.wMaxPacketSize = LE16(UDI_MSC_EPS_SIZE_HS),\
}
#define UDI_MSC_EPS_SIZE_HS
MSC endpoints size for high speed.
Definition: udi_msc.h:83
#define UDI_MSC_DESC
Content of MSC interface descriptor for all speeds.
Definition: udi_msc.h:86
#define LE16(x)
Definition: compiler.h:886

Content of MSC interface descriptor for high speed only.

#define UDI_MSC_EPS_SIZE_FS   64

MSC endpoints size for full speed.

#define UDI_MSC_EPS_SIZE_HS   512

MSC endpoints size for high speed.

#define UDI_MSC_STRING_ID   0

By default no string associated to this interface.

Referenced by main_extra_string().

bool udi_msc_process_trans ( void  )
bool udi_msc_trans_block ( bool  b_read,
uint8_t *  block,
iram_size_t  block_size,
void(*)(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)  callback 
)

Transfers data to/from USB MSC endpoints.

Parameters
b_readMemory to USB, if true
blockBuffer on Internal RAM to send or fill
block_sizeBuffer size to send or fill
callbackFunction to call at the end of transfer. If NULL then the routine exit when transfer is finish.
Returns
1 if function was successfully done, otherwise 0.

References callback, NULL, UDI_MSC_EP_IN, UDI_MSC_EP_OUT, and udi_msc_trans_ack().

Referenced by at45dbx_usb_read_10(), at45dbx_usb_write_10(), sd_mmc_usb_read_10(), sd_mmc_usb_write_10(), and virtual_usb_trans().