Microchip® Advanced Software Framework

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

USB Device Interface (UDI) for Mass Storage Class (MSC) provides an interface for the configuration and management of USB MSC storage device.

The outline of this documentation is as follows:

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

API Overview

Data Structures

struct  udi_msc_desc_t
 Interface descriptor structure for MSC. 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...
 

UDI MSC Interface for UDC

UDC_DESC_STORAGE udi_api_t udi_api_msc
 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_MSC_STRING_ID   0
 By default no string is associated to this interface. 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_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_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_STRING_ID
By default no string is associated to this interface.
Definition: udi_msc_doc.h:89
#define MSC_CLASS
Definition: usb_protocol_msc.h:52
#define MSC_PROTOCOL_BULK
Bulk-only.
Definition: usb_protocol_msc.h:79
#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_EPS_SIZE_FS
MSC endpoints size for full speed.
Definition: udi_msc_doc.h:93
#define UDI_MSC_DESC
Content of MSC interface descriptor for all speeds.
Definition: udi_msc_doc.h:98

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_doc.h:95
#define UDI_MSC_DESC
Content of MSC interface descriptor for all speeds.
Definition: udi_msc_doc.h:98

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 is associated to this interface.

bool udi_msc_process_trans ( void  )

Process the background read/write commands.

Routine called by the main loop.

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
[in]b_readMemory to USB, if true
[in,out]blockBuffer on Internal RAM to send or fill
[in]block_sizeBuffer size to send or fill
[in]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.

UDC_DESC_STORAGE udi_api_t udi_api_msc

Global structure which contains standard UDI interface for UDC.