90 likes | 105 Views
Explore the USB Mass Storage Architecture and learn how the C library interfaces with the FAT file system. Discover the supported C library file I/O functions and the features of the FAT file system. Get insights into the USB Mass Storage Driver and recommended readings.
E N D
USB Mass Storage • USB Mass Storage Architecture • C Library to FAT File System Interface • FAT File System • USB Mass Storage Driver • Recommended Readings
C Library to File System Interface • Interfaces the supported C library file I/O functions to the FAT file system and native file system. • Supported C library file I/O functions are: mkdir, rename, remove, fopen, fclose, fread, fwrite, fseek. • All FAT volumes are referenced with a single letter.
C Library to File System Interface – cont. • All native file system volumes are referenced with anything other than a single letter. • If FAT volume is drive A, do fopen(“A/dir1/dir2/filename”, “w+”) • If native FS RAM volume is drive RAM0, do fopen(“RAM0/dir1/dir2/filename”, “w+)
FAT File System • Sourced from HCC-Embedded in Hungary. • Supports FAT12/16/32 depending on size of the media. • Supports long file names, multiple FAT volumes, multiple open files per volume and is thread safe. • Features a API similar to the C library file I/O functions, but with more functionality.
FAT File System – cont. • The FAT file system is limited to 8.3 file names, 1 FAT volume and 1 open file per volume and is thread safe. • FAT file system is version 2.62. Current versions have additional features such as thread context for current working directory (cwd) and a semaphore to synchronize access to each FAT volume.
USB Mass Storage Driver • Tested with USB 2.0 and 1.1 full speed Flash memory sticks. • Creates FAT volume on device insertion and removes FAT volume on device removal (just like Windows). • Uses the lowest drive letter to reference the newly created FAT volume.
USB Mass Storage Driver – cont. • Supports up to 4 devices • Driver initialization function usb_ms_init() allows specifying event notification or polling to notify user that a device was inserted and a FAT volume was created.
Recommended Readings • HCC-Embedded FAT12/16/32 manual in /netos/src/examples/nafatfs