Difference between revisions of "Unit Storage"

From Ultibo.org
Jump to: navigation, search
Line 271: Line 271:
 
! '''Note'''
 
! '''Note'''
 
| To be documented
 
| To be documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''USB storage functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceRead(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| According to 3.4 of USB Mass Storage Bulk Only 1.0, requests must be queued one at a time to a device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceWrite(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| According to 3.4 of USB Mass Storage Bulk Only 1.0, requests must be queued one at a time to a device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceControl(Storage:PStorageDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| According to 3.4 of USB Mass Storage Bulk Only 1.0, requests must be queued one at a time to a device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function USBStorageDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Bind the Storage driver to a USB device if it is suitable</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Device'''
 +
| The USB device to attempt to bind to
 +
|-
 +
! '''Interrface'''
 +
| The USB interface to attempt to bind to (or nil for whole device)
 +
|-
 +
!'''Return'''
 +
| USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function USBStorageDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind the Storage driver from a USB device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Device'''
 +
| The USB device to unbind from
 +
|-
 +
! '''Interrface'''
 +
| The USB interface to unbind from (or nil for whole device)
 +
|-
 +
!'''Return'''
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure USBStorageReadComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from a USB storage bulk IN endpoint completes</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Request'''
 +
| The USB request which has completed
 +
|-
 +
!'''Note'''
 +
| The thread that submitted the read request will hold the storage lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure USBStorageWriteComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from a USB storage bulk OUT endpoint completes</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Request'''
 +
| The USB request which has completed
 +
|-
 +
!'''Note'''
 +
| The thread that submitted the write request will hold the storage lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure USBStorageInterruptComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from a USB storage IN interrupt endpoint completes</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Request'''
 +
| The USB request which has completed
 +
|-
 +
!'''Note'''
 +
| The thread that submitted the interrupt request will hold the storage lock
 
|-
 
|-
 
|}
 
|}

Revision as of 05:14, 2 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


Return to Unit Reference