The mass storage class (MSC) driver implements the bulk-only protocol as outined in the USB MSC specification. With this class driver, and a file system, you can access files on connected USB flash drives, hard drives, DVD drives, etc. A file system is necessary, since the MSC driver only implements the USB protocol, which provides an interface for reading and writing sectors from a device. The MSC driver does not interpret that data as would be necessary to read or write files; this is the responsibility of file system software. The MSC driver can be used with Micrium's file system, µC/FS, or another file system.
To use the mass storage class, the application first initializes µC/USB-Host, registers the MSC driver with it and registers for event notifications (so it can know when a device is connected or disconnected). A demo application which performs this is distributed with the MSC driver, so that you can get up and running quickly.
When a device is connected or disconnected, the application receives an event notification. If a device has been connected, then the application should initialize it (by calling a MSC interface function) and notify the file system (e.g., the add the device to the file system or mount the volume).
You should then be able to use your file system software's interface funtions (its equivalents of fopen(), fread(), fwrite(), etc.) to read and write files on the device. At the lowest file system level, a driver for your file system will read and write sectors from the device using MSC read and write interface functions. The sample driver for Micrium's file system, µC/FS, demonstrates how simple this is to do.
|
|