Difference between revisions of "Unit Storage"

From Ultibo.org
Jump to: navigation, search
Line 45: Line 45:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 60: Line 60:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 72: Line 72:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 84: Line 84:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 96: Line 96:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 186: Line 186:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 198: Line 198:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 210: Line 210:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 222: Line 222:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 234: Line 234:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 246: Line 246:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 258: Line 258:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 270: Line 270:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 405: Line 405:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 417: Line 417:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 429: Line 429:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 441: Line 441:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 453: Line 453:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 465: Line 465:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 477: Line 477:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 489: Line 489:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 501: Line 501:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 513: Line 513:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 528: Line 528:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 540: Line 540:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 552: Line 552:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 564: Line 564:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 576: Line 576:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 588: Line 588:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 600: Line 600:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 612: Line 612:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 624: Line 624:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 648: Line 648:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 672: Line 672:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 684: Line 684:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}

Revision as of 05:52, 27 September 2016

Return to Unit Reference


Description


Storage Devices

This unit provides both the Storage device interface and the generic USB mass storage driver.

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


To be documented

Type definitions


To be documented

Public variables


To be documented

Function declarations



Initialization functions

[Expand]
procedure StorageInit;
Description: To be documented


Storage functions

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


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


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


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


[Expand]
function StorageDeviceSetState(Storage:PStorageDevice; State:LongWord):LongWord;
Description: Set the state of the specified storage and send a notification


[Expand]
function StorageDeviceStartStatus(Storage:PStorageDevice; Interval:LongWord):LongWord;
Description: Start status monitoring on the specified storage for insert/eject notifications


[Expand]
function StorageDeviceStopStatus(Storage:PStorageDevice):LongWord;
Description: Stop status monitoring on the specified storage for insert/eject notifications


[Expand]
function StorageDeviceCreate:PStorageDevice;
Description: Create a new Storage entry


[Expand]
function StorageDeviceCreateEx(Size:LongWord):PStorageDevice;
Description: Create a new Storage entry


[Expand]
function StorageDeviceDestroy(Storage:PStorageDevice):LongWord;
Description: Destroy an existing Storage entry


[Expand]
function StorageDeviceRegister(Storage:PStorageDevice):LongWord;
Description: Register a new Storage in the Storage table


[Expand]
function StorageDeviceDeregister(Storage:PStorageDevice):LongWord;
Description: Deregister a Storage from the Storage table


[Expand]
function StorageDeviceFind(StorageId:LongWord):PStorageDevice;
Description: To be documented


[Expand]
function StorageDeviceFindByName(const Name:String):PStorageDevice; inline;
Description: To be documented


[Expand]
function StorageDeviceFindByDescription(const Description:String):PStorageDevice; inline;
Description: To be documented


[Expand]
function StorageDeviceEnumerate(Callback:TStorageEnumerate; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function StorageDeviceNotification(Storage:PStorageDevice; Callback:TStorageNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
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:LongWord; var Argument2:LongWord):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


Storage helper functions

[Expand]
function StorageGetCount:LongWord; inline;
Description: Get the current storage count


[Expand]
function StorageDeviceCheck(Storage:PStorageDevice):PStorageDevice;
Description: Check if the supplied Storage is in the storage table


[Expand]
function StorageDeviceTypeToString(StorageType:LongWord):String;
Description: To be documented


[Expand]
function StorageDeviceStateToString(StorageState:LongWord):String;
Description: To be documented


[Expand]
function StorageDeviceStateToNotification(State:LongWord):LongWord;
Description: Convert a Storage state value into the notification code for device notifications


[Expand]
procedure StorageLog(Level:LongWord; Storage:PStorageDevice; const AText:String);
Description: To be documented


[Expand]
procedure StorageLogInfo(Storage:PStorageDevice; const AText:String);
Description: To be documented


[Expand]
procedure StorageLogError(Storage:PStorageDevice; const AText:String);
Description: To be documented


[Expand]
procedure StorageLogDebug(Storage:PStorageDevice; const AText:String);
Description: To be documented


[Expand]
procedure StorageStatusTimer(Storage:PStorageDevice);
Description: To be documented


USB storage helper functions

[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


[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: To be documented


[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;v ar 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