Home |
The ISO 9660 File System Structure The exFAT File System Structure RTFiles-32 in Embedded Applications USB Disk Driver |
USB Disk DriverThe USB disk driver requires RTUSB-32 and supports all USB disks which adhere to the USB Mass Storage Device Specification, class code 8, subclass 2 (MMC-2), 4 (UFI), 5 (FDD), or 6 (SCSI), protocols 0 (Control/Bulk/Interrupt), 1 (Control/Bulk/Interrupt, no Interrupt status), or 50h (Bulk only). Any number of devices with up to 232 sectors each are supported. Before the USB disk driver can be used, the RTUSB-32 attachment/detachment callback USBDisk must be registered using RTUSB-32 API function RTURegisterCallback. RTFDevice.DeviceTypeRTFDevice.DeviceType must be set to RTF_DEVICE_FDISK for USB hard disks, flash disks, memory sticks, etc. For USB floppy disk drives, it must be RTF_DEVICE_FLOPPY. RTFDevice.DeviceNumberThis field is the LUN (Logical disk Unit) on the USB device to access. Most USB mass storage devices contain just one disk with a LUN of 0, so this value should usually be 0. However, card readers or similar devices may implement several LUNs. To use a multi-LUN device with n LUNs, consecutive device list entries are required with device numbers starting from 0 up to n-1. The device list entries must be ordered by ascending DeviceNumbers. The respective RTFDrvUSBData of each entry must be contiguous in memory, allocated in an array. RTFDevice.DeviceFlagsThe USB disk driver does not define any device dependent device flags. Flag RTF_DEVICE_NEW_LOCK is supported and recommended for each USB disk with device number 0. All other device independent flags documented in section Device List are supported. RTFDevice.DriverThis field must point to RTFDrvUSB. RTFDevice.DriverDataThe USB disk driver requires a pointer to a structure of type RTFDrvUSBData. The structure should be left uninitialized or initialized to 0. Example:static RTFDrvFLPYData FLPYDriveA = {0}; static RTFDrvUSBData USBFloppy = {0}; static RTFDrvIDEData IDEDriveC = {0}; static RTFDrvUSBData USBDisk1 = {0}; static RTFDrvUSBData USBCardReader[4] = {0}; RTFDevice RTFDeviceList[] = { { RTF_DEVICE_FLOPPY, 0, 0, &RTFDrvFloppy, &FLPYDriveA}, { RTF_DEVICE_FLOPPY, 0, 0, &RTFDrvUSB, &USBFloppy}, { RTF_DEVICE_FDISK , 0, 0, &RTFDrvIDE, &IDEDriveC }, { RTF_DEVICE_FDISK , 0, RTF_DEVICE_NEW_LOCK, &RTFDrvUSB, &USBDisk1}, { RTF_DEVICE_FDISK , 0, RTF_DEVICE_NEW_LOCK, &RTFDrvUSB, USBCardReader + 0}, { RTF_DEVICE_FDISK , 1, 0, &RTFDrvUSB, USBCardReader + 1}, { RTF_DEVICE_FDISK , 2, 0, &RTFDrvUSB, USBCardReader + 2}, { RTF_DEVICE_FDISK , 3, 0, &RTFDrvUSB, USBCardReader + 3}, { 0 } }; The device list above supports a legacy floppy disk, a USB floppy, an IDE disk on the primary/master channel, one USB disk, and a USB card reader with up to 4 card slots.
|