Unit USBSTORAGE

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


Ultibo USB Mass Storage Driver unit

USB Mass Storage Devices

The USB Mass Storage Class Control/Bulk/Interrupt (CBI) Transport specification is approved for use only with full-speed floppy disk drives. CBI shall not be used in high-speed capable devices, or in devices other than floppy disk drives. CBI shall not be used in devices that implement LSDFS. Usage of CBI for any new design is discouraged.

Therefore the majority of USB Mass Storage devices use the Bulk only interface.

USB mass storage class devices normally use the SCSI command set and therefore the USB storage driver consumes the SCSI unit for the protocol and command definitions. USB mass storage devices are registered directly as Storage devices not as SCSI devices.

Constants



[Expand]
USB storage USB_STORAGE_*


Type definitions



USB command block

[Expand]

PUSBCommandBlock = ^TUSBCommandBlock;

TUSBCommandBlock = record

USB storage device

[Expand]

PUSBStorageDevice = ^TUSBStorageDevice;

TUSBStorageDevice = record

USB command block wrapper

[Expand]

PUSBCommandBlockWrapper = ^TUSBCommandBlockWrapper;

TUSBCommandBlockWrapper = record

USB command status wrapper

[Expand]

PUSBCommandStatusWrapper = ^TUSBCommandStatusWrapper;

TUSBCommandStatusWrapper = record


Function declarations



Initialization functions

[Expand]
procedure USBStorageInit;
Description: To be documented


USB storage functions

[Expand]
function USBStorageDeviceRead(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
Description: To be documented


[Expand]
function USBStorageDeviceWrite(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
Description: To be documented


[Expand]
function USBStorageDeviceControl(Storage:PStorageDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;
Description: To be documented


[Expand]
function USBStorageDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Bind the Storage driver to a USB device if it is suitable


[Expand]
function USBStorageDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Unbind the Storage driver from a USB device


[Expand]
procedure USBStorageReadComplete(Request:PUSBRequest);
Description: Called when a USB request from a USB storage bulk IN endpoint completes


[Expand]
procedure USBStorageWriteComplete(Request:PUSBRequest);
Description: Called when a USB request from a USB storage bulk OUT endpoint completes


[Expand]
procedure USBStorageInterruptComplete(Request:PUSBRequest);
Description: Called when a USB request from a USB storage IN interrupt endpoint completes


USB storage helper functions

[Expand]
function USBStorageCheckDevice(Device:PUSBDevice):Boolean;
Description: Check if the supplied USB device is suitable for detection as a Mass Storage Device


[Expand]
function USBStorageCheckSubclass(Subclass:Byte):Boolean;
Description: To be documented


[Expand]
function USBStorageCheckProtocol(Protocol:Byte):Boolean;
Description: To be documented


[Expand]
function USBStorageBlockSizeToBlockShift(BlockSize:LongWord):LongWord;
Description: To be documented


[Expand]
function USBStoragePatchDevice(Device:PUSBDevice; var Subclass,Protocol:Byte):LongWord;
Description: A function to adjust the subclass and protocol parameters of known defective devices


[Expand]
function USBStorageFixupDevice(Device:PUSBDevice; var Vendor,Product:String):LongWord;
Description: A function to adjust the vendor and product parameters of known defective devices


[Expand]
function USBStorageDeviceLock(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;
Description: Issue a Prevent Media Removal request to a storage device


[Expand]
function USBStorageDeviceUnlock(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;
Description: Issue a Allow Media Removal request to a storage device


[Expand]
function USBStorageDeviceLoad(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;
Description: Issue a Start Stop request to a storage device


[Expand]
function USBStorageDeviceEject(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;
Description: Issue a Start Stop request to a storage device


USB storage helper functions

[Expand]
function USBStorageDeviceReset(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;
Description: Issue a Storage Reset request to a storage device


[Expand]
function USBStorageDeviceGetInfo(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;
Description: Obtain basic information about a storage device (Type, Size, State, Product etc)


[Expand]
function USBStorageDeviceGetStatus(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;
Description: Supported by Subclass SCSI/UFI/SFF8070


[Expand]
function USBStorageDeviceGetMaxLUN(Device:PUSBDevice; Storage:PUSBStorageDevice; var MaxLUN:Byte):LongWord;
Description: Issue a Get Max LUN request to a storage device


[Expand]
function USBStorageDeviceClearStall(Device:PUSBDevice; Storage:PUSBStorageDevice; Endpoint:PUSBEndpointDescriptor):LongWord;
Description: Issue a USB Clear Feature (HALT) to the supplied endpoint on a storage device


[Expand]
function USBStorageDeviceInquiry(Device:PUSBDevice; Storage:PUSBStorageDevice; var DeviceType,DeviceFlags:LongWord; var Vendor,Product,Revision:PChar):LongWord;
Description: Issue a SCSI Inquiry command to a LUN on a storage device


[Expand]
function USBStorageDeviceRequestSense(Device:PUSBDevice; Storage:PUSBStorageDevice; var SenseKey,ASC,ASCQ:Byte):LongWord;
Description: Issue a SCSI Request Sense command to a LUN on a storage device


[Expand]
function USBStorageDeviceReadCapacity(Device:PUSBDevice; Storage:PUSBStorageDevice; var BlockSize,BlockShift:LongWord; var BlockCount:Int64):LongWord;
Description: Issue a SCSI Read Capacity command to a LUN on a storage device


[Expand]
function USBStorageDeviceTestUnitReady(Device:PUSBDevice; Storage:PUSBStorageDevice; var DeviceFlags:LongWord):LongWord;
Description: Issue a SCSI Test Unit Ready command to a LUN on a storage device


[Expand]
function USBStorageDeviceRead10(Device:PUSBDevice; Storage:PUSBStorageDevice; Start:LongWord; Count:Word;Buffer:Pointer):LongWord;
Description: Issue a SCSI Read10 command to a LUN on a storage device


[Expand]
function USBStorageDeviceWrite10(Device:PUSBDevice; Storage:PUSBStorageDevice; Start:LongWord;Count:Word; Buffer:Pointer):LongWord;
Description: Issue a SCSI Write10 command to a LUN on a storage device


[Expand]
function USBStorageDeviceRead16(Device:PUSBDevice; Storage:PUSBStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
Description: Issue a SCSI Read16 command to a LUN on a storage device


[Expand]
function USBStorageDeviceWrite16(Device:PUSBDevice; Storage:PUSBStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
Description: Issue a SCSI Write16 command to a LUN on a storage device


[Expand]
function USBStorageDeviceTransport(Device:PUSBDevice; Storage:PUSBStorageDevice; Command:PUSBCommandBlock):LongWord;
Description: Perform the appropriate transport sequence for the device based on subclass and protocol


Return to Unit Reference