Code Confidencebuild 3.0.0.201402161939

Configuration

Name

Configuration -- Configuration USB Mass Storage Peripherals

Configuration

The USB Mass Storage Device interface uses the bulk transfer mode. It needs three endpoints for the communication with the host to be complete. The control endpoint (commonly EP0), the transmission and reception endpoints. The default CDL file contains configuration for the USB-Mass Storage Device 0. While it is uncommon to have several USB ports on a device, it is not impossible, hence user can update the package and create a second device .e.g. MSD1.

Endpoints

Each endpoint shall be configured according to the underlying hardware. The endpoints configuration includes, the structure name, endpoint number and buffer size according to the USB chip specification. The control endpoint is selected with CYGDAT_IO_USB_SLAVE_MSD0_EP0. The default values is set to "usbs_at91_ep0". This is the control endpoint for the Atmel AT91 USB device driver. The TX and RX endpoints can be assigned statically or dynamically (assuming the USB device driver supports it). In case of static configuration, the bulk IN and bulk OUT endpoints are configured with CYGDAT_IO_USB_SLAVE_MSD0_TX_EP and CYGDAT_IO_USB_SLAVE_MSD0_RX_EP respectively. In addition, the TX and RX enpoints number must be provided by the user. They are configured with CYGNUM_IO_USB_SLAVE_MSD0_TX_EP_NUM and CYGNUM_IO_USB_SLAVE_MSD0_RX_EP_NUM In case of dynamic endpoints configuration, only the endpoint number is mandatory.

The last endpoints configuration parameters are the entpoints buffer size. They are set with:

      CYGNUM_IO_USB_SLAVE_MSD0_EP0_MAX_PACKET_SIZE
      CYGNUM_IO_USB_SLAVE_MSD0_TX_EP_MAX_PACKET_SIZE
      CYGNUM_IO_USB_SLAVE_MSD0_RX_EP_MAX_PACKET_SIZE
      
A mass storage device must stall one or both bulk endpoints in several situations. However, not all eCos USB device drivers seems to implement this functionality correctly. Hence, this option is disable by default. Testing shows that both Linux and Windows can handle mass storage device with stall disable as long as all data transfer phase are handled correctly. Enpoint stall can be enable with CYGSEM_IO_USB_SLAVE_MSD_STALL_ENABLE.

Enumeration

The USB MSD device will make its vendor:product ID known to the host. This should be configured with CYGNUM_IO_USB_SLAVE_MSD0_VENDOR_ID and CYGNUM_IO_USB_SLAVE_MSD0_PRODUCT_ID NOTE: The default configurations are not valid for commercial products, but should work for testing.

The USB enumeration also contains text strings to describe the device. The manufacturer string can be set with CYGDAT_IO_USB_SLAVE_MSD0_MFG_STR. The product name can be set with CYGDAT_IO_USB_SLAVE_MSD0_MFG_STR, finally, the serial number can be set with CYGDAT_IO_USB_SLAVE_MSD0_SERIAL_STR.

Storage

To access the storage media, the USB MSD package requires the storage media to use the eCos disk interface. The disk sector size is assumed to be 512 bytes. Multiple logical units are supported by the package (2 by default). More logical units can be supported by changing the USBS_MSD_CBW_MAX_LUN definition according to the user needs. Two logical units can be either 2 partitions on the same disk or 2 partitions on 2 different physical disks. The first logical unit can be set with CYGDAT_IO_USB_SLAVE_MSD0_LUN0_NAME. The default value is assigned to "/dev/ramdisk0/1", the first partition of the ramdisk used by the test application.