Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview

shows the general architecture of a USB Host and a USB MSC Device.

On the host side, the application communicates with the MSC device by interacting with the native mass storage drivers and SCSI drivers. In compliance with the BOT specification, the host utilizes the default control endpoint to enumerate the device and the Bulk IN/OUT endpoints to communicate with the device.

SCSI Commands

The host sends SCSI commands to the device via the Command Descriptor Block (CDB). These commands set specific requests for transfer of blocks of data and status, and control information such as a device’s capacity and readiness to exchange data. The μC/USB MSC Device supports the following subset of SCSI Primary and Block Commands listed in .

Storage Layer and Storage Medium

The storage layer shown in  is the interface between the MSC and the storage medium. The storage layer is responsible for initializing the storage medium, performing read / write operations on it, as well as obtaining information regarding its capacity and status. The storage medium could be:

  • RAM
  • SD/CF card
  • NAND flash
  • NOR flash
  • IDE hard disk drive

The MSC can interface with three types of storage layer:

  • RAM disk
  • µC/FS
  • Vendor-specific file system

By default, Micrium will provide a storage layer implementation (named RAMDisk) by utilizing the hardware’s platform memory as storage medium. Aside from this implementation, you have the option to use Micrium’s µC/FS or even utilize your own file system referred as vendor-specific file system storage layer. In the event you use your own file system, you will need to create a storage layer port to communicate with the storage medium. Please refer to the Porting MSC to a Storage Layer page to learn how to implement this storage layer.

shows how the µC/FS storage layer interfaces with µC/FS.

µC/FS storage layer implementation has two main characteristics:

  • High-level lock mechanism.
  • Insertion/removal detection of removable media.

The high-level lock mechanism protects the storage medium from concurrent accesses that could occur between a host computer and an embedded µC/FS application. On one hand, if a mass storage device is connected to a host computer and the storage medium is available, the host computer has the exclusive control of the storage medium. No embedded µC/FS application can access the storage medium. The µC/FS application will wait until the lock has been released. The lock is released upon device disconnection from the host or by a software eject done on the medium from the host side. On the other hand, if a µC/FS application has already the lock on the storage medium, upon device connection, the host won’t have access. Each time the host requests the storage medium presence status, the mass storage device will indicate that the medium is not present. This status is returned as long as µC/FS application holds the lock. As soon as the lock is released, the host takes it and no more µC/FS operations on the storage medium are possible.

µC/FS storage layer is able to detect the insertion or removal of a removable media such as SD card. A task is used to detect the insertion or removal. The task checks periodically the presence or absence of a removable media. When the mass storage device is connected and the removable media is not present, the mass storage device indicates to the host that the storage medium is not present. As soon as the removable media is inserted in its slot, the task in µC/FS storage layer updates the removable media presence status. Next time the host requests the presence status, the mass storage device returns a good status and the host can access the content of the removable media. The opposite reasoning applies to media removal. If your product uses only fixed media, the task in µC/FS storage layer can be disabled. You can also configure the task’s period. Refer to the General Configuration section for more details about µC/FS storage layer configuration.

Multiple Logical Units

The MSC class supports multiple logical units. A logical unit designates usually an entire media type or a partition within the same media type.  illustrates the different multiple logical units configurations supported.

Configurations #1 and #2 are supported by the RAMDisk storage layer. Configurations #1 and #3 are supported by the µC/FS storage layer. The configuration #2 is currently not supported by the µC/FS storage layer.

Each logical unit is added to the MSC at initialization. Refer to the Class Instance Configuration section for more details about the multiple logical units initialization and to the MSC Host Application section for a Windows example of multiple logical units.

  • No labels