Difference between revisions of "Unit USB"

From Ultibo.org
Jump to: navigation, search
 
(146 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''USB'''
+
'''Ultibo USB Interface unit'''
  
 
This unit implements the USB core software that does not depend on the specific host controller hardware and is not specific to any single USB device or platform.
 
This unit implements the USB core software that does not depend on the specific host controller hardware and is not specific to any single USB device or platform.
Line 11: Line 11:
 
Features and limitations:
 
Features and limitations:
  
* This driver is written to be compatible with USB 2.0. USB 3.0 devices work correctly when operating in USB 2.0 compatible mode, actual support for USB 3.0 host controllers and native super speed modes will require some modification to this driver.
+
* This driver is written to be compatible with USB 2.0. USB 3.0 devices work correctly when operating in USB 2.0 compatible mode, actual support for USB 3.0 host controllers and native super speed modes will require some modification to this driver.
 
   
 
   
* Not all USB transfer types and speeds are supported yet. This depends on the Host Controller Driver, see USBRequestSubmit.
+
* Not all USB transfer types and speeds are supported yet. This depends on the Host Controller Driver, see USBRequestSubmit.
 
    
 
    
* This driver does not attempt to do any intelligent power management, bandwidth allocation, or transfer scheduling. Devices are always set to their first listed configuration regardless of power requirements. Requests are simply passed to the Host Controller Driver in the order submitted, the Host Controller Driver is responsible for doing any more intelligent scheduling if desired.
+
* This driver does not attempt to do any intelligent power management, bandwidth allocation, or transfer scheduling. Devices are always set to their first listed configuration regardless of power requirements. Requests are simply passed to the Host Controller Driver in the order submitted, the Host Controller Driver is responsible for doing any more intelligent scheduling if desired.
 
    
 
    
 
* This driver does not support multiple configurations per USB device. If a device happens to have multiple configurations, the first one will be assigned (see devices below for more information).
 
* This driver does not support multiple configurations per USB device. If a device happens to have multiple configurations, the first one will be assigned (see devices below for more information).
Line 22: Line 22:
 
    
 
    
 
* By design, this driver has a hard-coded dependency on the USB hub driver because USB is useless without hubs.
 
* By design, this driver has a hard-coded dependency on the USB hub driver because USB is useless without hubs.
 
 
    
 
    
 
To initialize this core USB driver, USBInit must be called by the system startup code. See that function for details.
 
To initialize this core USB driver, USBInit must be called by the system startup code. See that function for details.
Line 33: Line 32:
  
 
Be careful when enabling USB debugging as the USB core can generate a lot of messages due to constant polling of interrupt endpoints on devices such as hubs, keyboards and mice.
 
Be careful when enabling USB debugging as the USB core can generate a lot of messages due to constant polling of interrupt endpoints on devices such as hubs, keyboards and mice.
 +
 +
'''USB Device'''
 +
 +
USB devices are the generic implementation of anything that can be connected to the USB bus. All USB devices require a driver to implement the specific behaviour of the device but at the generic level each device will have:
 +
 +
* One or more configurations available. The USB core will first offer the device to drivers without a configuration being selected, the driver may choose a specific configuration if required otherwise the core will simply select the first available configuration.
 +
 
 +
* One or more interfaces available. On devices with multiple interfaces, the USB core supports different drivers binding to different interfaces. This way combination devices are supported.
 +
 
 +
* One or more endpoints available. All devices must have a control endpoint and most devices will have one or more bulk, interrupt or isochronous endpoints as well. The USB core will only communicate with the control endpoint to perform generic operations like reading the descriptors and assigning a device address.
 +
 
 +
Drivers are expected to understand which endpoints they need to communicate with to provide the device specific functionality.
 +
 
 +
Devices are considered dynamic by the USB core and can be connected or disconnected at any time. The hub driver is responsible for attaching and detaching devices in response to hub status change events and for binding or unbinding drivers as devices are added or removed.
 +
 +
'''USB Driver'''
 +
 +
USB drivers implement support for specific devices or specific device classes and provide the interfaces to present those devices to other parts of the system. For example the USB Mass Storage driver accepts devices of the mass storage class and presents them to the file system as a disk device.
 +
 +
All drivers must implement the functions defined in TUSBDriver (Bind and Unbind) and must register themselves with the USB core by calling USBDriverRegister. When a new device is detected the hub driver will enumerate all drivers and call their Bind functions until either one of the drivers accepts the device or all drivers have rejected the device. The hub driver first attempts to bind each driver to the device itself and then offers each driver the option to bind to a single interface on the device. In this way devices that have multiple interfaces of different classes (such as a wireless mouse and keyboard dongle) can actually be bound to multiple drivers which each service a specific interface.
 +
 +
When a new driver is registered the USB core will call the drivers Bind function for each device already present to allow the driver an opportunity to bind to any existing devices that are not serviced by other drivers.
 +
 +
When a device is disconnected the hub driver will first call the Unbind function of any driver that is servicing the device to allow the driver to clean up allocated resources and cancel outstanding requests. Drivers must be careful not to block the hub driver during this process, for example trying to send a USB control message to the device at this time will likely be pointless as in many cases the device will have already been disconnected from the system.
 +
 +
'''USB Host'''
 +
 +
USB hosts implement the hardware level interface that supports sending USB requests to the hardware and receiving responses. All handling of interrupts, DMA, transaction sequence, errors and resubmitting/retrying requests is done by the USB host driver. All host drivers must implement the functions defined in TUSBHost (Start, Stop, Reset, Submit and Cancel) and must register themselves with the USB core by calling USBHostRegister. When the USB core is started each registered host driver will be called via the Start function so it can initialize itself and allocate locks, buffers and other resources required to interact with the hardware.
 +
 +
A host driver can also be registered after the USB core has been started and it will be given the opportunity to start itself immediately. In this way USB hosts can potentially be hot pluggable.
 +
 +
Each host driver must also implement a root hub which represents the port or ports that are directly connected to the controller hardware. In many cases this will not be a real hub but will be simulated in the host driver so that the hub driver can interact with it as though it was a standard hub device.
 +
 +
'''USB Hub'''
 +
 +
Hubs are one of the fundamental devices in USB and are used to provide connection points (ports) for additional devices. Note that even if no "external" hub is plugged in, the USB still will have at least one logical hub (the root hub) and usually additional "internal" hubs. That is, a USB is a tree of devices where the root node and all non-leaf nodes are hubs. A port on a USB hub may correspond to a port you can physically plug a device into or may correspond to an internal port. USB hubs are commonly based around a design that has 4 ports per hub, so a standard 7 port hub will most often appear as 2 hubs to this driver with one hub connected to a port on the other.
 +
 +
This hub driver is an example of a USB device driver, but it is somewhat special as it mandatory to include this driver if USB is supported at all. This is because it would be impossible to access any USB devices if a hub driver were not available. This hub driver also uses some interfaces in the core driver, such as USBDeviceAttach, that are not useful to any other USB device driver.
 +
 +
The initial entry point of this USB hub driver is USBHubDriverBind, which is called when the USB core has configured a newly attached USB device that may be a hub. USBHubDriverBind is responsible for checking if the device is a hub, and if so, doing hub-specific setup, reading the hub descriptor, powering on the ports, and submitting an asynchronous USB interrupt request to the hub's status change endpoint.
 +
 +
Everything else this hub driver does happens asynchronously as a response to a status change request being completed. Every USB hub has exactly one IN interrupt endpoint called the "status change endpoint". The hub responds on this endpoint whenever the status of the hub or one of the hub's ports has changed, for example when a USB device has been connected or disconnected from a port.
 +
 +
At the hardware level, when a hub has data to send on its status change endpoint, an interrupt will come in from the USB host controller. This eventually will result in the status change transfer being completed and USBHubStatusComplete being called. Thus, the detection of status changes is interrupt-driven and is not implemented by polling at the software level. (At the hardware level, USB is still a polled bus, but the host controller hardware handles that for us). Upon detecting a status change on one or more ports on a hub, the hub driver then must submit one or more control messages to the hub to determine exactly what changed on the affected ports.
  
 
=== Constants ===
 
=== Constants ===
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device, driver and host specific constants''' <code> USB_*_PREFIX  </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_DEVICE_PREFIX = 'USB';</code>
 +
| Name prefix for USB Devices
 +
|-
 +
| <code>USB_DRIVER_PREFIX = 'USB';</code>
 +
| Name prefix for USB Drivers
 +
|-
 +
| <code>USB_HOST_PREFIX = 'USBHost';</code>
 +
| Name prefix for USB Hosts
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device type''' <code> USB_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_TYPE_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_TYPE_MAX = 0;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device state''' <code> USB_STATE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_STATE_DETACHED = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_STATE_DETACHING = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_STATE_ATTACHING = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_STATE_ATTACHED = 3;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_STATE_MAX = 3;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device status''' <code> USB_STATUS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_STATUS_UNBOUND = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_STATUS_BOUND = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_STATUS_MAX = 1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device flag''' <code> USB_FLAG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_FLAG_NONE = $00000000;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB host type''' <code> USBHOST_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBHOST_TYPE_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USBHOST_TYPE_EHCI = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USBHOST_TYPE_OHCI = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USBHOST_TYPE_UHCI = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USBHOST_TYPE_XHCI = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USBHOST_TYPE_DWCOTG = 5;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USBHOST_TYPE_MAX = 5;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB host state''' <code> USBHOST_STATE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBHOST_STATE_DISABLED = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USBHOST_STATE_ENABLED = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USBHOST_STATE_MAX = 1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB host flag''' <code> USBHOST_FLAG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBHOST_FLAG_NONE = $00000000;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USBHOST_FLAG_SHARED = $00000001;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USBHOST_FLAG_NOCACHE = $00000002;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB status code''' <code> USB_STATUS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_STATUS_SUCCESS = 0;</code>
 +
| Function successful
 +
|-
 +
| <code>USB_STATUS_DEVICE_DETACHED = 1;</code>
 +
| USB device was detached
 +
|-
 +
| <code>USB_STATUS_DEVICE_UNSUPPORTED = 2;</code>
 +
| USB device is unsupported by the driver
 +
|-
 +
| <code>USB_STATUS_HARDWARE_ERROR = 3;</code>
 +
| Hardware error of some form occurred
 +
|-
 +
| <code>USB_STATUS_INVALID_DATA = 4;</code>
 +
| Invalid data was received
 +
|-
 +
| <code>USB_STATUS_INVALID_PARAMETER = 5;</code>
 +
| An invalid parameter was passed to the function
 +
|-
 +
| <code>USB_STATUS_NOT_PROCESSED = 6;</code>
 +
| The USB request has been submitted but not yet processed
 +
|-
 +
| <code>USB_STATUS_OUT_OF_MEMORY = 7;</code>
 +
| Failed to allocate memory
 +
|-
 +
| <code>USB_STATUS_TIMEOUT = 8;</code>
 +
| The operation timed out
 +
|-
 +
| <code>USB_STATUS_UNSUPPORTED_REQUEST = 9;</code>
 +
| The request is unsupported
 +
|-
 +
| <code>USB_STATUS_HARDWARE_STALL = 10;</code>
 +
| The device reported an endpoint STALL
 +
|-
 +
| <code>USB_STATUS_OPERATION_FAILED = 11;</code>
 +
| The operation was not able to be completed
 +
|-
 +
| <code>USB_STATUS_NOT_BOUND = 12;</code>
 +
| USB device is not bound to a driver
 +
|-
 +
| <code>USB_STATUS_ALREADY_BOUND = 13;</code>
 +
| USB device is already bound to a driver
 +
|-
 +
| <code>USB_STATUS_NOT_READY = 14;</code>
 +
| USB device is not in a ready state
 +
|-
 +
| <code>USB_STATUS_NOT_COMPLETED = 15;</code>
 +
| The USB request has been scheduled but not yet completed
 +
|-
 +
| <code>USB_STATUS_CANCELLED = 16;</code>
 +
| The USB request was cancelled
 +
|-
 +
| <code>USB_STATUS_NOT_VALID = 17;</code>
 +
| The USB request is not valid
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB request flag''' <code> USB_REQUEST_FLAG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_REQUEST_FLAG_NONE = $00000000;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_REQUEST_FLAG_ALLOCATED = $00000001;</code>
 +
| Request data has been allocated by USBBufferAllocate (and can be freed by USBBufferRelease)
 +
|-
 +
| <code>USB_REQUEST_FLAG_COMPATIBLE = $00000002;</code>
 +
| Request data is compatible with DMA requirements of host configuration (Can be passed directly to DMA)
 +
|-
 +
| <code>USB_REQUEST_FLAG_ALIGNED = $00000004;</code>
 +
| Request data is aligned according to host configuration
 +
|-
 +
| <code>USB_REQUEST_FLAG_SIZED = $00000008;</code>
 +
| Request data is sized according to host configuration
 +
|-
 +
| <code>USB_REQUEST_FLAG_SHARED = $00000010;</code>
 +
| Request data has been allocated from Shared memory
 +
|-
 +
| <code>USB_REQUEST_FLAG_NOCACHE = $00000020;</code>
 +
| Request data has been allocated from Non Cached memory
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB control phase''' <code> USB_CONTROL_PHASE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_CONTROL_PHASE_SETUP = 0;</code>
 +
| Setup phase of a Control request (Using SetupData)
 +
|-
 +
| <code>USB_CONTROL_PHASE_DATA = 1;</code>
 +
| Data phase of a Control request (Using Data buffer)
 +
|-
 +
| <code>USB_CONTROL_PHASE_STATUS = 2;</code>
 +
| Status phase of a Control request (Using StatusData)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB control timeout''' <code> USB_CONTROL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_CONTROL_GET_TIMEOUT = 5000;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_CONTROL_SET_TIMEOUT = 5000;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB packet size''' <code> USB_*_*_PACKET_SIZE </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_DEFAULT_MAX_PACKET_SIZE = 8;</code>
 +
| Default maximum packet size for unconfigured Endpoints
 +
|-
 +
| <code>USB_ALTERNATE_MAX_PACKET_SIZE = 64;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_MAX_PACKET_SIZE = 1024;</code>
 +
| Maximum packet size of any USB Endpoint (1024 is the maximum allowed by USB 2.0)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB frame''' <code> USB_FRAMES_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_FRAMES_PER_MS = 1;</code>
 +
| Number of USB frames per millisecond
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB microframe''' <code> USB_UFRAMES_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_UFRAMES_PER_MS = 8;</code>
 +
| Number of USB microframes per millisecond
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB configuration attribute''' <code> USB_CONFIGURATION_ATTRIBUTE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Values for bmAttributes in type TUSBConfigurationDescriptor
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_CONFIGURATION_ATTRIBUTE_RESERVED_HIGH = $80;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_CONFIGURATION_ATTRIBUTE_SELF_POWERED = $40;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_CONFIGURATION_ATTRIBUTE_REMOTE_WAKEUP = $20;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_CONFIGURATION_ATTRIBUTE_RESERVED_LOW = $1f;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device status''' <code> USB_DEVICE_STATUS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Figure 9-4 of Section 9.4 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for wStatus in type TUSBDeviceStatus (Device Recipient)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_DEVICE_STATUS_SELF_POWERED = (1 shl 0);</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_DEVICE_STATUS_REMOTE_WAKEUP = (1 shl 1);</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB endpoint status''' <code> USB_ENDPOINT_STATUS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Figure 9-6 of Section 9.4 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for vStatus in type TUSBDeviceStatus (Endpoint Recipient)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_ENDPOINT_STATUS_HALT = (1 shl 0);</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device speed''' <code> USB_SPEED_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_SPEED_HIGH = 0;</code>
 +
| 480 Mb/s
 +
|-
 +
| <code>USB_SPEED_FULL = 1;</code>
 +
| 12 Mb/s
 +
|-
 +
| <code>USB_SPEED_LOW = 2;</code>
 +
| 1.5 Mb/s
 +
|-
 +
| <code>USB_SPEED_SUPER = 3;</code>
 +
| 5 Gb/s
 +
|-
 +
| <code>USB_SPEED_SUPERPLUS = 4;</code>
 +
| 10 Gb/s
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB transfer type''' <code> USB_TRANSFER_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Values for bmAttributes (bits 1..0) in type TUSBEndpointDescriptor
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_TRANSFER_TYPE_CONTROL = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_TRANSFER_TYPE_ISOCHRONOUS = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_TRANSFER_TYPE_BULK = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_TRANSFER_TYPE_INTERRUPT = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_TRANSFER_TYPE_MASK = $03;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB transfer size''' <code> USB_TRANSFER_SIZE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_TRANSFER_SIZE_8_BIT = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_TRANSFER_SIZE_16_BIT = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_TRANSFER_SIZE_32_BIT = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_TRANSFER_SIZE_64_BIT = 3;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB descriptor type''' <code> USB_DESCRIPTOR_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 9-5 in Section 9.4 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for bDescriptorType in types TUSBDescriptorHeader and TUSBDeviceDescriptor
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_DEVICE = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_CONFIGURATION = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_STRING = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_INTERFACE = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_ENDPOINT = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER = 6;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_OTHER_SPEED_CONFIGURATION = 7;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_INTERFACE_POWER = 8;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_CLASS_DEVICE = $21;</code>
 +
| (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_DEVICE (See USB Device Class Definition for Audio Devices Specification)
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_CLASS_CONFIGURATION = $22;</code>
 +
| (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_CONFIGURATION
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_CLASS_STRING = $23;</code>
 +
| (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_STRING
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_CLASS_INTERFACE = $24;</code>
 +
| (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_INTERFACE
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_CLASS_ENDPOINT = $25;</code>
 +
| (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_ENDPOINT
 +
|-
 +
| <code>USB_DESCRIPTOR_TYPE_HUB = $29;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB transfer direction''' <code> USB_DIRECTION_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 9-2 of Section 9.3 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for bmRequestType (bit 7) in type TUSBControlSetupData
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_DIRECTION_OUT = 0;</code>
 +
| Host to Device
 +
|-
 +
| <code>USB_DIRECTION_IN = 1;</code>
 +
| Device to Host
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB request type''' <code> USB_REQUEST_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 9-2 of Section 9.3 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|bits 6..5 of bmRequestType in type TUSBControlSetupData
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_REQUEST_TYPE_STANDARD = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_REQUEST_TYPE_CLASS = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_REQUEST_TYPE_VENDOR = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_REQUEST_TYPE_RESERVED = 3;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB request recipient''' <code> USB_REQUEST_RECIPIENT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 9-2 of Section 9.3 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|bits 4..0 of bmRequestType in type TUSBControlSetupData
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_REQUEST_RECIPIENT_DEVICE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_REQUEST_RECIPIENT_INTERFACE = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_REQUEST_RECIPIENT_ENDPOINT = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_REQUEST_RECIPIENT_OTHER = 3;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB bmrequest type''' <code> USB_BMREQUESTTYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 9-2 of Section 9.3 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values of the bitfields within the bmRequestType member of TUSBControlSetupData
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_DIR_OUT = (USB_DIRECTION_OUT shl 7);</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_DIR_IN = (USB_DIRECTION_IN shl 7);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_DIR_MASK = ($01 shl 7);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_TYPE_STANDARD = (USB_REQUEST_TYPE_STANDARD shl 5);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_TYPE_CLASS = (USB_REQUEST_TYPE_CLASS shl 5);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_TYPE_VENDOR = (USB_REQUEST_TYPE_VENDOR shl 5);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_TYPE_RESERVED = (USB_REQUEST_TYPE_RESERVED shl 5);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_TYPE_MASK = ($03 shl 5);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_RECIPIENT_DEVICE = (USB_REQUEST_RECIPIENT_DEVICE shl 0);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_RECIPIENT_INTERFACE = (USB_REQUEST_RECIPIENT_INTERFACE shl 0);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_RECIPIENT_ENDPOINT = (USB_REQUEST_RECIPIENT_ENDPOINT shl 0);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_RECIPIENT_OTHER = (USB_REQUEST_RECIPIENT_OTHER shl 0);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_BMREQUESTTYPE_RECIPIENT_MASK = ($1f shl 0);</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device request''' <code> USB_DEVICE_REQUEST_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 9-3 in Section 9.4 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for bRequest in type TUSBControlSetupData
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_GET_STATUS = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_CLEAR_FEATURE = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_SET_FEATURE = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_SET_ADDRESS = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_GET_DESCRIPTOR = 6;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_SET_DESCRIPTOR = 7;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_GET_CONFIGURATION = 8;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_SET_CONFIGURATION = 9;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_GET_INTERFACE = 10;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_SET_INTERFACE = 11;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_SYNCH_FRAME = 12;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_SET_SEL = 48;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_REQUEST_SET_ISOC_DELAY = 49;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device feature''' <code> USB_DEVICE_FEATURE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 9-6 in Section 9.4 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for wValue in type TUSBControlSetupData
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_DEVICE_FEATURE_ENDPOINT_HALT = 0;</code>
 +
| Endpoint Only
 +
|-
 +
| <code>USB_DEVICE_FEATURE_REMOTE_WAKEUP = 1;</code>
 +
| Device Only
 +
|-
 +
| <code>USB_DEVICE_FEATURE_TEST_MODE = 2;</code>
 +
| Device Only
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB test mode''' <code> USB_DEVICE_TEST_MODE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 9-7 in Section 9.4 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for wIndex in type TUSBControlSetupData
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_DEVICE_TEST_MODE_J = $01;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_DEVICE_TEST_MODE_K = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_TEST_MODE_SE0_NAK = $03;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_TEST_MODE_PACKET = $04;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_DEVICE_TEST_MODE_FORCE_ENABLE = $05;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB packet Id value''' <code> USB_PACKETID_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_PACKETID_UNDEF_0 = $f0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_PACKETID_OUT = $e1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_ACK = $d2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_DATA0 = $c3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_UNDEF_4 = $b4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_SOF = $a5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_UNDEF_6 = $96;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_UNDEF_7 = $87;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_UNDEF_8 = $78;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_IN = $69;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_NAK = $5a;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_DATA1 = $4b;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_PREAMBLE = $3c;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_SETUP = $2d;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_STALL = $1e;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PACKETID_UNDEF_F = $0f;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB class code''' <code> USB_CLASS_CODE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|bDeviceClass/bInterfaceClass
 +
|-
 +
|colspan="2"|See: https://www.usb.org/defined-class-codes
 +
|-
 +
|colspan="2"|Note that only the hub class is defined in the USB 2.0 specification itself the other standard class codes are defined in additional specifications
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_CLASS_CODE_INTERFACE_SPECIFIC = $00;</code>
 +
| Use class code info from Interface Descriptors
 +
|-
 +
| <code>USB_CLASS_CODE_AUDIO = $01;</code>
 +
| Audio device
 +
|-
 +
| <code>USB_CLASS_CODE_COMMUNICATIONS_AND_CDC_CONTROL = $02;</code>
 +
| Communication device class
 +
|-
 +
| <code>USB_CLASS_CODE_COMMS = USB_CLASS_CODE_COMMUNICATIONS_AND_CDC_CONTROL;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_CLASS_CODE_HID = $03;</code>
 +
| HID device class
 +
|-
 +
| <code>USB_CLASS_CODE_PHYSICAL = $05;</code>
 +
| Physical device class
 +
|-
 +
| <code>USB_CLASS_CODE_IMAGE  = $06;</code>
 +
| Still Imaging device
 +
|-
 +
| <code>USB_CLASS_CODE_PRINTER = $07;</code>
 +
| Printer device
 +
|-
 +
| <code>USB_CLASS_CODE_MASS_STORAGE = $08;</code>
 +
| Mass Storage device
 +
|-
 +
| <code>USB_CLASS_CODE_HUB = $09;</code>
 +
| Hub Device
 +
|-
 +
| <code>USB_CLASS_CODE_CDC_DATA = $0a;</code>
 +
| CDC data device
 +
|-
 +
| <code>USB_CLASS_CODE_SMART_CARD = $0b;</code>
 +
| Smart Card device
 +
|-
 +
| <code>USB_CLASS_CODE_CONTENT_SECURITY = $0d;</code>
 +
| Content Security device
 +
|-
 +
| <code>USB_CLASS_CODE_VIDEO = $0e;</code>
 +
| Video device
 +
|-
 +
| <code>USB_CLASS_CODE_PERSONAL_HEALTHCARE = $0f;</code>
 +
| Personal Healthcare device
 +
|-
 +
| <code>USB_CLASS_CODE_AUDIO_VIDEO = $10;</code>
 +
| Audio/Video Devices
 +
|-
 +
| <code>USB_CLASS_CODE_BILLBOARD = $11;</code>
 +
| Billboard Device
 +
|-
 +
| <code>USB_CLASS_CODE_DIAGNOSTIC = $DC;</code>
 +
| Diagnostic Device
 +
|-
 +
| <code>USB_CLASS_CODE_WIRELESS_CONTROLLER = $e0;</code>
 +
| Wireless Controller
 +
|-
 +
| <code>USB_CLASS_CODE_MISCELLANEOUS = $ef;</code>
 +
| Miscellaneous
 +
|-
 +
| <code>USB_CLASS_CODE_APPLICATION_SPECIFIC = $fe;</code>
 +
| Application Specific
 +
|-
 +
| <code>USB_CLASS_CODE_VENDOR_SPECIFIC = $ff;</code>
 +
| Vendor Specific
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB subclass code''' <code> USB_SUBCLASS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|bDeviceSubClass/bInterfaceSubClass
 +
|-
 +
|colspan="2"|See: https://www.usb.org/defined-class-codes
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Communications Devices''
 +
|-
 +
| <code>USB_SUBCLASS_CDC_DLCM = $01;</code>
 +
| Direct Line Control Model (USBPSTN1.2)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_ACM = $02;</code>
 +
| Abstract Control Model (USBPSTN1.2)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_TCM = $03;</code>
 +
| Telephone Control Model (USBPSTN1.2)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_MCCM = $04;</code>
 +
| Multi-Channel Control Model (USBISDN1.2)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_CCM = $05;</code>
 +
| CAPI Control Model (USBISDN1.2)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_ETHERNET = $06;</code>
 +
| Ethernet Networking Control Model (USBECM1.2)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_WHCM = $08;</code>
 +
| Wireless Handset Control Model (USBWMC1.1)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_DMM = $09;</code>
 +
| Device Management Model (USBWMC1.1)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_MDLM = $0a;</code>
 +
| Mobile Direct Line Model (USBWMC1.1)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_OBEX  = $0b;</code>
 +
| OBEX (USBWMC1.1)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_EEM = $0c;</code>
 +
| Ethernet Emulation Model (USBEEM1.0)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_NCM = $0d;</code>
 +
| Network Control Model (USBNCM1.0)
 +
|-
 +
| <code>USB_SUBCLASS_CDC_MBIM = $0e;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Still Image Devices''
 +
|-
 +
| <code>USB_SUBCLASS_IMAGE_DEFAULT = $01;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Mass Storage Devices''
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_DEFAULT = $00;</code>
 +
| SCSI command set not reported, De facto use
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_RBC = $01;</code>
 +
| Reduced Block Commands (RBC), INCITS 330:2000, available at http://www.t10.org
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_MMC5 = $02;</code>
 +
| Multi-Media Command Set 5 (MMC-5), T10/1675-D available at http://www.t10.org
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_QIC157 = $03;</code>
 +
| Obsolete was QIC-157
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_UFI = $04;</code>
 +
| UFI Specifies how to interface Floppy Disk Drives to USB
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_SFF8070I = $05;</code>
 +
| Obsolete Was SFF-8070i
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_SCSI = $06;</code>
 +
| SCSI transparent command set
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_LSDFS = $07; {LSD FS }</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_IEEE1667 = $08;</code>
 +
| IEEE 1667 Standard Protocol for Authentication in Host Attachments of Transient Storage Devices (IEEE 1667) available at www.ieee1667.com
 +
|-
 +
| <code>USB_SUBCLASS_MASS_STORAGE_VENDOR_SPECIFIC = $ff;</code>
 +
| Specific to device vendor, De facto use
 +
|-
 +
|colspan="2"|''Content Security Devices''
 +
|-
 +
| <code>USB_SUBCLASS_CONTENT_SECURITY_DEFAULT = $00;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Audio/Video Devices''
 +
|-
 +
| <code>USB_SUBCLASS_AUDIO_VIDEO_CONTROL = $01;</code>
 +
| Audio/Video Device  AVControl Interface
 +
|-
 +
| <code>USB_SUBCLASS_AUDIO_VIDEO_DATA_VIDEO = $02;</code>
 +
| Audio/Video Device  AVData Video Streaming Interface
 +
|-
 +
| <code>USB_SUBCLASS_AUDIO_VIDEO_DATA_AUDIO = $03;</code>
 +
| Audio/Video Device  AVData Audio Streaming Interface
 +
|-
 +
|colspan="2"|''Billboard Devices''
 +
|-
 +
| <code>USB_SUBCLASS_BILLBOARD_DEFAULT = $00;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Diagnostic Device''
 +
|-
 +
| <code>USB_SUBCLASS_DIAGNOSTIC_DEFAULT = $01;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Wireless Controller''
 +
|-
 +
| <code>USB_SUBCLASS_WIRELESS_CONTROLLER_BLUETOOTH = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_SUBCLASS_WIRELESS_CONTROLLER_USB = $02;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Miscellaneous''
 +
|-
 +
| <code>USB_SUBCLASS_MISCELLANEOUS_SYNC = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_SUBCLASS_MISCELLANEOUS_IAD_WAMP = $02;</code>
 +
| Interface Association Descriptor/Wire Adapter Multifunction Peripheral
 +
|-
 +
| <code>USB_SUBCLASS_MISCELLANEOUS_CBAF = $03;</code>
 +
| Cable Based Association Framework
 +
|-
 +
| <code>USB_SUBCLASS_MISCELLANEOUS_RNDIS = $04;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_SUBCLASS_MISCELLANEOUS_USB3VISION = $05;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Application Specific''
 +
|-
 +
| <code>USB_SUBCLASS_APPLICATION_SPECIFIC_DFU = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_SUBCLASS_APPLICATION_SPECIFIC_IRDA = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_SUBCLASS_APPLICATION_SPECIFIC_TMC = $02;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Vendor Specific''
 +
|-
 +
| <code>USB_SUBCLASS_VENDOR_SPECIFIC = $ff;</code>
 +
| Vendor Specific
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB protocol code''' <code> USB_PROTOCOL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|bDeviceProtocol/bInterfaceProtocol
 +
|-
 +
|colspan="2"|See: https://www.usb.org/defined-class-codes
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Communications Devices''
 +
|-
 +
| <code>USB_PROTOCOL_CDC_ACM_NONE = 0;</code>
 +
| Abstract Control Model - No class specific protocol required
 +
|-
 +
| <code>USB_PROTOCOL_CDC_ACM_AT_V25TER = 1;</code>
 +
| Abstract Control Model - AT Commands: V.250 etc
 +
|-
 +
| <code>USB_PROTOCOL_CDC_ACM_AT_PCCA101 = 2;</code>
 +
| Abstract Control Model - AT Commands defined by PCCA-101
 +
|-
 +
| <code>USB_PROTOCOL_CDC_ACM_AT_PCCA101_WAKE = 3;</code>
 +
| Abstract Control Model - AT Commands defined by PCCA-101 & Annex O
 +
|-
 +
| <code>USB_PROTOCOL_CDC_ACM_AT_GSM  = 4;</code>
 +
| Abstract Control Model - AT Commands defined by GSM 07.07
 +
|-
 +
| <code>USB_PROTOCOL_CDC_ACM_AT_3G = 5;</code>
 +
| Abstract Control Model - AT Commands defined by 3GPP 27.007
 +
|-
 +
| <code>USB_PROTOCOL_CDC_ACM_AT_CDMA = 6;</code>
 +
| Abstract Control Model - AT Commands defined by TIA for CDMA
 +
|-
 +
| <code>USB_PROTOCOL_CDC_ACM_VENDOR = $ff;</code>
 +
| Abstract Control Model - Vendor-specific
 +
|-
 +
| <code>USB_PROTOCOL_CDC_EEM = 7;</code>
 +
| Ethernet Emulation Model
 +
|-
 +
| <code>USB_PROTOCOL_CDC_NCM_NTB = 1;</code>
 +
| Network Control Model - Network Transfer Block
 +
|-
 +
| <code>USB_PROTOCOL_CDC_MBIM_NTB = 2;</code>
 +
| Network Transfer Block
 +
|-
 +
|colspan="2"|''Still Image Devices''
 +
|-
 +
| <code>USB_PROTOCOL_IMAGE_DEFAULT = $01;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Mass Storage Devices''
 +
|-
 +
| <code>USB_PROTOCOL_MASS_STORAGE_CBI = $00;</code>
 +
| CBI (with command completion interrupt) USB Mass Storage Class Control/Bulk/Interrupt Transport
 +
|-
 +
| <code>USB_PROTOCOL_MASS_STORAGE_CB = $01;</code>
 +
| CBI (with no command completion interrupt) USB Mass Storage Class Control/Bulk/Interrupt Transport
 +
|-
 +
| <code>USB_PROTOCOL_MASS_STORAGE_BBB = $50;</code>
 +
| BBB USB Mass Storage Class Bulk-Only Transport
 +
|-
 +
| <code>USB_PROTOCOL_MASS_STORAGE_UAS = $62;</code>
 +
| UAS
 +
|-
 +
| <code>USB_PROTOCOL_MASS_STORAGE_VENDOR_SPECIFIC = $ff;</code>
 +
| Specific to device vendor, De facto use
 +
|-
 +
|colspan="2"|''Hub Devices''
 +
|-
 +
| <code>USB_PROTOCOL_HUB_FULLSPEED = $00;</code>
 +
| Full speed Hub
 +
|-
 +
| <code>USB_PROTOCOL_HUB_HIGHSPEED_SINGLE_TT = $01;</code>
 +
| Hi-speed hub with single Transaction Translator
 +
|-
 +
| <code>USB_PROTOCOL_HUB_HIGHSPEED_MULTI_TT = $02;</code>
 +
| Hi-speed hub with multiple Transaction Translators
 +
|-
 +
|colspan="2"|''Content Security Devices''
 +
|-
 +
| <code>USB_PROTOCOL_CONTENT_SECURITY_DEFAULT = $00;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Audio/Video Devices''
 +
|-
 +
| <code>USB_PROTOCOL_AUDIO_VIDEO_DEFAULT = $00;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Billboard Devices''
 +
|-
 +
| <code>USB_PROTOCOL_BILLBOARD_DEFAULT = $00;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Diagnostic Device''
 +
|-
 +
| <code>USB_PROTOCOL_DIAGNOSTIC_DEFAULT = $01;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Wireless Controller''
 +
|-
 +
| <code>USB_PROTOCOL_WIRELESS_CONTROLLER_BLUETOOTH = $01;</code>
 +
| See: http://www.bluetooth.com/
 +
|-
 +
| <code>USB_PROTOCOL_WIRELESS_CONTROLLER_UWB = $02;</code>
 +
| See: Wireless USB Specification in Chapter 8
 +
|-
 +
| <code>USB_PROTOCOL_WIRELESS_CONTROLLER_NDIS = $03;</code>
 +
| See: http://www.microsoft.com/windowsmobile/mobileoperators/default.mspx
 +
|-
 +
| <code>USB_PROTOCOL_WIRELESS_CONTROLLER_BLUETOOTH_AMP = $04;</code>
 +
| See: http://www.bluetooth.com/
 +
|-
 +
| <code>USB_PROTOCOL_WIRELESS_CONTROLLER_USB_HOST = $01;</code>
 +
| Host Wire Adapter Control/Data interface.  Definition can be found in the Wireless USB Specification in Chapter 8
 +
|-
 +
| <code>USB_PROTOCOL_WIRELESS_CONTROLLER_USB_DEVICE = $02;</code>
 +
| Device Wire Adapter Control/Data interface.  Definition can be found in the Wireless USB Specification in Chapter 8
 +
|-
 +
| <code>USB_PROTOCOL_WIRELESS_CONTROLLER_USB_DEVOCE_ISOC = $03;</code>
 +
| Device Wire Adapter Isochronous interface.  Definition can be found in the Wireless USB Specification in Chapter 8
 +
|-
 +
|colspan="2"|''Miscellaneous''
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_ACTIVESYNC = $01;</code>
 +
| Active Sync device
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_PALMSYNC = $02;</code>
 +
| Palm Sync
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_IAD = $01;</code>
 +
| Interface Association Descriptor. The usage of this class code triple is defined in the Interface Association Descriptor ECN
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_WAMP = $02;</code>
 +
| Wire Adapter Multifunction Peripheral programming interface. Definition can be found in the Wireless USB Specification in Chapter 8.
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_CBAF = $01;</code>
 +
| Cable Based Association Framework. This is defined in the Association Model addendum to the Wireless USB specification.
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_RNDIS_ETHERNET = $01;</code>
 +
| RNDIS over Ethernet
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_RNDIS_WIFI = $02;</code>
 +
| RNDIS over WiFi
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_RNDIS_WIMAX = $03;</code>
 +
| RNDIS over WiMAX
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_RNDIS_WWAN = $04;</code>
 +
| RNDIS over WWAN
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_RNDIS_IPV4 = $05;</code>
 +
| RNDIS for Raw IPv4
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_RNDIS_IPV6 = $06;</code>
 +
| RNDIS for Raw IPv6
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_RNDIS_GPRS = $07;</code>
 +
| RNDIS for GPRS
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_USB3VISION_CONTROL = $00;</code>
 +
| USB3 Vision Control Interface
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_USB3VISION_EVENT = $01;</code>
 +
| USB3 Vision Event Interface
 +
|-
 +
| <code>USB_PROTOCOL_MISCELLANEOUS_USB3VISION_STREAM = $02;</code>
 +
| USB3 Vision Streaming Interface
 +
|-
 +
|colspan="2"|''Application Specific''
 +
|-
 +
| <code>USB_PROTOCOL_APPLICATION_SPECIFIC_DFU_DEFAULT = $01;</code>
 +
| Device Firmware Upgrade
 +
|-
 +
| <code>USB_PROTOCOL_APPLICATION_SPECIFIC_IRDA_DEFAULT = $00;</code>
 +
| IRDA Bridge device
 +
|-
 +
| <code>USB_PROTOCOL_APPLICATION_SPECIFIC_TMC_DEFAULT = $00;</code>
 +
| USB Test and Measurement Device
 +
|-
 +
| <code>USB_PROTOCOL_APPLICATION_SPECIFIC_TMC_488 = $01;</code>
 +
| USB Test and Measurement Device conforming to the USBTMC USB488 Subclass Specification
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB primary language Id''' <code> USB_LANG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Language Identifiers supplement to the USB 2.0 specification
 +
|-
 +
|colspan="2"|These are the first 10 bits of the 16-bit language identifier
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Reserved $00''
 +
|-
 +
| <code>USB_LANG_ARABIC = $01;</code>
 +
| Arabic
 +
|-
 +
| <code>USB_LANG_BULGARIAN = $02;</code>
 +
| Bulgarian
 +
|-
 +
| <code>USB_LANG_CATALAN = $03;</code>
 +
| Catalan
 +
|-
 +
| <code>USB_LANG_CHINESE = $04;</code>
 +
| Chinese
 +
|-
 +
| <code>USB_LANG_CZECH = $05;</code>
 +
| Czech
 +
|-
 +
| <code>USB_LANG_DANISH = $06;</code>
 +
| Danish
 +
|-
 +
| <code>USB_LANG_GERMAN = $07;</code>
 +
| German
 +
|-
 +
| <code>USB_LANG_GREEK = $08;</code>
 +
| Greek
 +
|-
 +
| <code>USB_LANG_ENGLISH = $09;</code>
 +
| English
 +
|-
 +
| <code>USB_LANG_SPANISH = $0a;</code>
 +
| Spanish
 +
|-
 +
| <code>USB_LANG_FINNISH = $0b;</code>
 +
| Finnish
 +
|-
 +
| <code>USB_LANG_FRENCH = $0c;</code>
 +
| French
 +
|-
 +
| <code>USB_LANG_HEBREW = $0d;</code>
 +
| Hebrew
 +
|-
 +
| <code>USB_LANG_HUNGARIAN = $0e;</code>
 +
| Hungarian
 +
|-
 +
| <code>USB_LANG_ICELANDIC = $0f;</code>
 +
| Icelandic
 +
|-
 +
| <code>USB_LANG_ITALIAN = $10;</code>
 +
| Italian
 +
|-
 +
| <code>USB_LANG_JAPANESE = $11;</code>
 +
| Japanese
 +
|-
 +
| <code>USB_LANG_KOREAN = $12;</code>
 +
| Korean
 +
|-
 +
| <code>USB_LANG_DUTCH = $13;</code>
 +
| Dutch
 +
|-
 +
| <code>USB_LANG_NORWEGIAN = $14;</code>
 +
| Norwegian
 +
|-
 +
| <code>USB_LANG_POLISH = $15;</code>
 +
| Polish
 +
|-
 +
| <code>USB_LANG_PORTUGUESE = $16;</code>
 +
| Portuguese
 +
|-
 +
| <code>USB_LANG_ROMANIAN = $18;</code>
 +
| Romanian
 +
|-
 +
| <code>USB_LANG_RUSSIAN = $19;</code>
 +
| Russian
 +
|-
 +
| <code>USB_LANG_CROATIAN = $1a;</code>
 +
| Croatian
 +
|-
 +
| <code>USB_LANG_SERBIAN = $1a;</code>
 +
| Serbian
 +
|-
 +
| <code>USB_LANG_SLOVAK = $1b;</code>
 +
| Slovak
 +
|-
 +
| <code>USB_LANG_ALBANIAN = $1c;</code>
 +
| Albanian
 +
|-
 +
| <code>USB_LANG_SWEDISH = $1d;</code>
 +
| Swedish
 +
|-
 +
| <code>USB_LANG_THAI = $1e;</code>
 +
| Thai
 +
|-
 +
| <code>USB_LANG_TURKISH = $1f;</code>
 +
| Turkish
 +
|-
 +
| <code>USB_LANG_URDU = $20;</code>
 +
| Urdu
 +
|-
 +
| <code>USB_LANG_INDONESIAN = $21;</code>
 +
| Indonesian
 +
|-
 +
| <code>USB_LANG_UKRANIAN = $22;</code>
 +
| Ukrainian
 +
|-
 +
| <code>USB_LANG_BELARUSIAN = $23;</code>
 +
| Belarusian
 +
|-
 +
| <code>USB_LANG_SLOVENIAN = $24;</code>
 +
| Slovenian
 +
|-
 +
| <code>USB_LANG_ESTONIAN = $25;</code>
 +
| Estonian
 +
|-
 +
| <code>USB_LANG_LATVIAN = $26;</code>
 +
| Latvian
 +
|-
 +
| <code>USB_LANG_LITHUANIAN = $27;</code>
 +
| Lithuanian
 +
|-
 +
| <code>USB_LANG_FARSI = $29;</code>
 +
| Farsi
 +
|-
 +
| <code>USB_LANG_VIETNAMESE = $2a;</code>
 +
| Vietnamese
 +
|-
 +
| <code>USB_LANG_ARMENIAN = $2b;</code>
 +
| Armenian
 +
|-
 +
| <code>USB_LANG_AZERI = $2c;</code>
 +
| Azeri
 +
|-
 +
| <code>USB_LANG_BASQUE = $2d;</code>
 +
| Basque
 +
|-
 +
| <code>USB_LANG_MACEDONIAN = $2f;</code>
 +
| Macedonian
 +
|-
 +
| <code>USB_LANG_AFRIKAANS = $36;</code>
 +
| Afrikaans
 +
|-
 +
| <code>USB_LANG_GEORGIAN = $37;</code>
 +
| Georgian
 +
|-
 +
| <code>USB_LANG_FAEROESE = $38;</code>
 +
| Faeroese
 +
|-
 +
| <code>USB_LANG_HINDI = $39;</code>
 +
| Hindi
 +
|-
 +
| <code>USB_LANG_MALAY = $3e;</code>
 +
| Malay
 +
|-
 +
| <code>USB_LANG_KAZAK = $3f;</code>
 +
| Kazak
 +
|-
 +
| <code>USB_LANG_SWAHILI = $41;</code>
 +
| Swahili
 +
|-
 +
| <code>USB_LANG_UZBEK = $43;</code>
 +
| Uzbek
 +
|-
 +
| <code>USB_LANG_TATAR = $44;</code>
 +
| Tatar
 +
|-
 +
| <code>USB_LANG_BENGALI = $45;</code>
 +
| Bengali
 +
|-
 +
| <code>USB_LANG_PUNJABI = $46;</code>
 +
| Punjabi
 +
|-
 +
| <code>USB_LANG_GUJARATI = $47;</code>
 +
| Gujarati
 +
|-
 +
| <code>USB_LANG_ORIYA = $48;</code>
 +
| Oriya
 +
|-
 +
| <code>USB_LANG_TAMIL = $49;</code>
 +
| Tamil
 +
|-
 +
| <code>USB_LANG_TELUGU = $4a;</code>
 +
| Telugu
 +
|-
 +
| <code>USB_LANG_KANNADA = $4b;</code>
 +
| Kannada
 +
|-
 +
| <code>USB_LANG_MALAYALAM = $4c;</code>
 +
| Malayalam
 +
|-
 +
| <code>USB_LANG_ASSAMESE = $4d;</code>
 +
| Assamese
 +
|-
 +
| <code>USB_LANG_MARATHI = $4e;</code>
 +
| Marathi
 +
|-
 +
| <code>USB_LANG_SANSKRIT = $4f;</code>
 +
| Sanskrit
 +
|-
 +
| <code>USB_LANG_KONKANI = $57;</code>
 +
| Konkani
 +
|-
 +
| <code>USB_LANG_MANIPURI = $58;</code>
 +
| Manipuri
 +
|-
 +
| <code>USB_LANG_SINDHI = $59;</code>
 +
| Sindhi
 +
|-
 +
| <code>USB_LANG_KASHMIRI = $60;</code>
 +
| Kashmiri
 +
|-
 +
| <code>USB_LANG_NEPALI = $61;</code>
 +
| Nepali
 +
|-
 +
|colspan="2"|''Reserved $62-$fe''
 +
|-
 +
| <code>USB_LANG_HID = $ff;</code>
 +
| Reserved for USB HID Class use
 +
|-
 +
|colspan="2"|''Reserved $100-$3ff''
 +
|-
 +
| <code>USB_PRIMARY_LANGUAGE_MASK = $3ff;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB sublanguage Id''' <code> USB_SUBLANG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Language Identifiers supplement to the USB 2.0 specification
 +
|-
 +
|colspan="2"|These are the upper 6 bits of the 16-bit language identifier
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Reserved $00-$02''
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_SAUDI_ARABIA = $01;</code>
 +
| Arabic (Saudi Arabia)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_IRAQ = $02;</code>
 +
| Arabic (Iraq)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_EGYPT = $03;</code>
 +
| Arabic (Egypt)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_LIBYA = $04;</code>
 +
| Arabic (Libya)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_ALGERIA = $05;</code>
 +
| Arabic (Algeria)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_MOROCCO = $06;</code>
 +
| Arabic (Morocco)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_TUNISIA = $07;</code>
 +
| Arabic (Tunisia)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_OMAN = $08;</code>
 +
| Arabic (Oman)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_YEMEN = $09;</code>
 +
| Arabic (Yemen)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_SYRIA = $10;</code>
 +
| Arabic (Syria)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_JORDAN = $11;</code>
 +
| Arabic (Jordan)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_LEBANON = $12;</code>
 +
| Arabic (Lebanon)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_KUWAIT = $13;</code>
 +
| Arabic (Kuwait)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_UAE = $14;</code>
 +
| Arabic (U.A.E.)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_BAHRAIN = $15;</code>
 +
| Arabic (Bahrain)
 +
|-
 +
| <code>USB_SUBLANG_ARABIC_QATAR = $16;</code>
 +
| Arabic (Qatar)
 +
|-
 +
| <code>USB_SUBLANG_AZERI_CYRILLIC = $01;</code>
 +
| Azeri (Cyrillic)
 +
|-
 +
| <code>USB_SUBLANG_AZERI_LATIN = $02;</code>
 +
| Azeri (Latin)
 +
|-
 +
| <code>USB_SUBLANG_CHINESE_TRADITIONAL = $01;</code>
 +
| Chinese (Traditional)
 +
|-
 +
| <code>USB_SUBLANG_CHINESE_SIMPLIFIED = $02;</code>
 +
| Chinese (Simplified)
 +
|-
 +
| <code>USB_SUBLANG_CHINESE_HONGKONG = $03;</code>
 +
| Chinese (Hong Kong SAR, PRC)
 +
|-
 +
| <code>USB_SUBLANG_CHINESE_SINGAPORE = $04;</code>
 +
| Chinese (Singapore)
 +
|-
 +
| <code>USB_SUBLANG_CHINESE_MACAU = $05;</code>
 +
| Chinese (Macau SAR)
 +
|-
 +
| <code>USB_SUBLANG_DUTCH = $01;</code>
 +
| Dutch
 +
|-
 +
| <code>USB_SUBLANG_DUTCH_BELGIAN = $02;</code>
 +
| Dutch (Belgian)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_US = $01;</code>
 +
| English (US)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_UK = $02;</code>
 +
| English (UK)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_AUS = $03;</code>
 +
| English (Australian)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_CAN = $04;</code>
 +
| English (Canadian)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_NZ = $05;</code>
 +
| English (New Zealand)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_EIRE = $06;</code>
 +
| English (Ireland)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_SOUTH_AFRICA = $07;</code>
 +
| English (South Africa)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_JAMAICA = $08;</code>
 +
| English (Jamaica)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_CARIBBEAN = $09;</code>
 +
| English (Caribbean)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_BELIZE = $0a;</code>
 +
| English (Belize)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_TRINIDAD = $0b;</code>
 +
| English (Trinidad)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_PHILIPPINES = $0c;</code>
 +
| English (Zimbabwe)
 +
|-
 +
| <code>USB_SUBLANG_ENGLISH_ZIMBABWE  = $0d;</code>
 +
| English (Philippines)
 +
|-
 +
| <code>USB_SUBLANG_FRENCH  = $01;</code>
 +
| French
 +
|-
 +
| <code>USB_SUBLANG_FRENCH_BELGIAN = $02;</code>
 +
| French (Belgian)
 +
|-
 +
| <code>USB_SUBLANG_FRENCH_CANADIAN = $03;</code>
 +
| French (Canadian)
 +
|-
 +
| <code>USB_SUBLANG_FRENCH_SWISS = $04;</code>
 +
| French (Swiss)
 +
|-
 +
| <code>USB_SUBLANG_FRENCH_LUXEMBOURG = $05;</code>
 +
| French (Luxembourg)
 +
|-
 +
| <code>USB_SUBLANG_FRENCH_MONACO = $06;</code>
 +
| French (Monaco)
 +
|-
 +
| <code>USB_SUBLANG_GERMAN = $01;</code>
 +
| German
 +
|-
 +
| <code>USB_SUBLANG_GERMAN_SWISS = $02;</code>
 +
| German (Swiss)
 +
|-
 +
| <code>USB_SUBLANG_GERMAN_AUSTRIAN = $03;</code>
 +
| German (Austrian)
 +
|-
 +
| <code>USB_SUBLANG_GERMAN_LUXEMBOURG = $04;</code>
 +
| German (Luxembourg)
 +
|-
 +
| <code>USB_SUBLANG_GERMAN_LIECHTENSTEIN = $05;</code>
 +
| German (Liechtenstein)
 +
|-
 +
| <code>USB_SUBLANG_ITALIAN = $01;</code>
 +
| Italian
 +
|-
 +
| <code>USB_SUBLANG_ITALIAN_SWISS = $02;</code>
 +
| Italian (Swiss)
 +
|-
 +
| <code>USB_SUBLANG_KASHMIRI_INDIA = $02;</code>
 +
| Kashmiri (India)
 +
|-
 +
| <code>USB_SUBLANG_KOREAN = $01;</code>
 +
| Korean
 +
|-
 +
| <code>USB_SUBLANG_LITHUANIAN = $01;</code>
 +
| Lithuanian
 +
|-
 +
| <code>USB_SUBLANG_MALAY_MALAYSIA = $01;</code>
 +
| Malay (Malaysia)
 +
|-
 +
| <code>USB_SUBLANG_MALAY_BRUNEI_DARUSSALAM = $02;</code>
 +
| Malay (Brunei Darassalam)
 +
|-
 +
| <code>USB_SUBLANG_NEPALI_INDIA = $02;</code>
 +
| Nepali (India)
 +
|-
 +
| <code>USB_SUBLANG_NORWEGIAN_BOKMAL = $01;</code>
 +
| Norwegian (Bokmal)
 +
|-
 +
| <code>USB_SUBLANG_NORWEGIAN_NYNORSK = $02;</code>
 +
| Norwegian (Nynorsk)
 +
|-
 +
| <code>USB_SUBLANG_PORTUGUESE = $01;</code>
 +
| Portuguese (Brazilian)
 +
|-
 +
| <code>USB_SUBLANG_PORTUGUESE_BRAZILIAN = $02;</code>
 +
| Portuguese
 +
|-
 +
| <code>USB_SUBLANG_SERBIAN_LATIN = $02;</code>
 +
| Serbian (Latin)
 +
|-
 +
| <code>USB_SUBLANG_SERBIAN_CYRILLIC = $03;</code>
 +
| Serbian (Cyrillic)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH = $01;</code>
 +
| Spanish (Castilian)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_MEXICAN = $02;</code>
 +
| Spanish (Mexican)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_MODERN = $03;</code>
 +
| Spanish (Modern)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_GUATEMALA = $04;</code>
 +
| Spanish (Guatemala)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_COSTA_RICA = $05;</code>
 +
| Spanish (Costa Rica)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_PANAMA = $06;</code>
 +
| Spanish (Panama)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_DOMINICAN_REPUBLIC = $07;</code>
 +
| Spanish (Dominican Republic)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_VENEZUELA = $08;</code>
 +
| Spanish (Venezuela)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_COLOMBIA = $09;</code>
 +
| Spanish (Colombia)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_PERU = $0a;</code>
 +
| Spanish (Peru)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_ARGENTINA = $0b;</code>
 +
| Spanish (Argentina)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_ECUADOR = $0c;</code>
 +
| Spanish (Ecuador)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_CHILE = $0d;</code>
 +
| Spanish (Chile)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_URUGUAY = $0e;</code>
 +
| Spanish (Uruguay)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_PARAGUAY = $0f;</code>
 +
| Spanish (Paraguay)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_BOLIVIA = $10;</code>
 +
| Spanish (Bolivia)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_EL_SALVADOR = $11;</code>
 +
| Spanish (El Salvador)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_HONDURAS = $12;</code>
 +
| Spanish (Honduras)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_NICARAGUA = $13;</code>
 +
| Spanish (Nicaragua)
 +
|-
 +
| <code>USB_SUBLANG_SPANISH_PUERTO_RICO = $14;</code>
 +
| Spanish (Puerto Rico)
 +
|-
 +
| <code>USB_SUBLANG_SWEDISH = $01;</code>
 +
| Swedish
 +
|-
 +
| <code>USB_SUBLANG_SWEDISH_FINLAND = $02;</code>
 +
| Swedish (Finland)
 +
|-
 +
| <code>USB_SUBLANG_URDU_PAKISTAN = $01;</code>
 +
| Urdu (Pakistan)
 +
|-
 +
| <code>USB_SUBLANG_URDU_INDIA = $02;</code>
 +
| Urdu (India)
 +
|-
 +
| <code>USB_SUBLANG_UZBEK_LATIN = $01;</code>
 +
| Uzbek (Latin)
 +
|-
 +
| <code>USB_SUBLANG_UZBEK_CYRILLIC = $02;</code>
 +
| Uzbek (Cyrillic)
 +
|-
 +
| <code>USB_SUBLANG_HID_USAGE_DATA_DESCRIPTOR = $01;</code>
 +
| HID (Usage Data Descriptor)
 +
|-
 +
| <code>USB_SUBLANG_HID_VENDOR_DEFINED_1 = $3c;</code>
 +
| HID (Vendor Defined 1)
 +
|-
 +
| <code>USB_SUBLANG_HID_VENDOR_DEFINED_2 = $3d;</code>
 +
| HID (Vendor Defined 2)
 +
|-
 +
| <code>USB_SUBLANG_HID_VENDOR_DEFINED_3 = $3e;</code>
 +
| HID (Vendor Defined 3)
 +
|-
 +
| <code>USB_SUBLANG_HID_VENDOR_DEFINED_4 = $3f;</code>
 +
| HID (Vendor Defined 4)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB primary language identifier''' <code> USB_LANGID_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Language Identifiers supplement to the USB 2.0 specification
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_LANGID_US_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_US shl 10));</code>
 +
| English (US)
 +
|-
 +
| <code>USB_LANGID_UK_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_UK shl 10));</code>
 +
| English (UK)
 +
|-
 +
| <code>USB_LANGID_AUS_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_AUS shl 10));</code>
 +
| English (Australian)
 +
|-
 +
| <code>USB_LANGID_CAN_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_CAN shl 10));</code>
 +
| English (Canadian)
 +
|-
 +
| <code>USB_LANGID_NZ_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_NZ shl 10));</code>
 +
| English (New Zealand)
 +
|-
 +
| <code>USB_LANGID_EIRE_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_EIRE shl 10));</code>
 +
| English (Ireland)
 +
|-
 +
| <code>USB_LANGID_SOUTH_AFRICA_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_SOUTH_AFRICA shl 10));</code>
 +
| English (South Africa)
 +
|-
 +
| <code>USB_LANGID_JAMAICA_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_JAMAICA shl 10));</code>
 +
| English (Jamaica)
 +
|-
 +
| <code>USB_LANGID_CARIBBEAN_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_CARIBBEAN shl 10));</code>
 +
| English (Caribbean)
 +
|-
 +
| <code>USB_LANGID_BELIZE_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_BELIZE shl 10));</code>
 +
| English (Belize)
 +
|-
 +
| <code>USB_LANGID_TRINIDAD_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_TRINIDAD shl 10));</code>
 +
| English (Trinidad)
 +
|-
 +
| <code>USB_LANGID_PHILIPPINES_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_PHILIPPINES shl 10));</code>
 +
| English (Philippines)
 +
|-
 +
| <code>USB_LANGID_ZIMBABWE_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_ZIMBABWE shl 10));</code>
 +
| English (Zimbabwe)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_LANGID_USAGE_HID = (USB_LANG_HID or (USB_SUBLANG_HID_USAGE_DATA_DESCRIPTOR shl 10));</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_LANGID_VENDOR1_HID = (USB_LANG_HID or (USB_SUBLANG_HID_VENDOR_DEFINED_1 shl 10));</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_LANGID_VENDOR2_HID = (USB_LANG_HID or (USB_SUBLANG_HID_VENDOR_DEFINED_2 shl 10));</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_LANGID_VENDOR3_HID = (USB_LANG_HID or (USB_SUBLANG_HID_VENDOR_DEFINED_3 shl 10));</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_LANGID_VENDOR4_HID = (USB_LANG_HID or (USB_SUBLANG_HID_VENDOR_DEFINED_4 shl 10));</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB vendor Id''' <code> USB_VENDORID_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_VENDORID_REALTEK = $0BDA;</code>
 +
| Realtek
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB tree output''' <code> USB_TREE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_TREE_SPACES_PER_LEVEL = 6;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_TREE_LINES_PER_PORT = 2;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB logging''' <code> USB_LOG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;</code>
 +
| USB debugging messages
 +
|-
 +
| <code>USB_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 +
| USB informational messages, such as a device being attached or detached
 +
|-
 +
| <code>USB_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code>
 +
| USB warning messages
 +
|-
 +
| <code>USB_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
 +
| USB error messages
 +
|-
 +
| <code>USB_LOG_LEVEL_NONE = LOG_LEVEL_NONE;</code>
 +
| No USB messages
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub specific constants''' <code> USB_HUB_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_HUB_PREFIX = 'USBHub';</code>
 +
| Name prefix for USB Hubs
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub type''' <code> USBHUB_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBHUB_TYPE_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USBHUB_TYPE_MAX = 0;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub type name''' <code> USBHUB_TYPE_NAMES* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|<code>USBHUB_TYPE_NAMES:array[USBHUB_TYPE_NONE..USBHUB_TYPE_MAX] of String = (</code>
 +
|-
 +
| <code>'USBHUB_TYPE_NONE');</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub state''' <code> USBHUB_STATE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBHUB_STATE_DETACHED = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USBHUB_STATE_DETACHING = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USBHUB_STATE_ATTACHING = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USBHUB_STATE_ATTACHED = 3;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USBHUB_STATE_MAX = 3;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub state name''' <code> USBHUB_STATE_NAMES* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|<code>USBHUB_STATE_NAMES:array[USBHUB_STATE_DETACHED..USBHUB_STATE_MAX] of String = (</code>
 +
|-
 +
| <code>'USBHUB_STATE_DETACHED',</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>'USBHUB_STATE_DETACHING',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'USBHUB_STATE_ATTACHING',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'USBHUB_STATE_ATTACHED');</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub flag''' <code> USBHUB_FLAG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBHUB_FLAG_NONE = $00000000;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USBHUB_FLAG_COMPOUND = $00000001;</code>
 +
| The Hub is part of a compound device
 +
|-
 +
| <code>USBHUB_FLAG_PORT_POWER = $00000002;</code>
 +
| The Hub supports per port power switching
 +
|-
 +
| <code>USBHUB_FLAG_PORT_PROTECTION = $00000004;</code>
 +
| The Hub supports per port over current protection
 +
|-
 +
| <code>USBHUB_FLAG_MULTI_TRANSLATOR = $00000008;</code>
 +
| The Hub includes multiple transaction translators (1 per port)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub thread''' <code> USBHUB_THREAD_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBHUB_THREAD_STACK_SIZE = SIZE_32K;</code>
 +
| Stack size of USB hub thread
 +
|-
 +
| <code>USBHUB_THREAD_PRIORITY = THREAD_PRIORITY_HIGHEST;</code>
 +
| Priority of USB hub thread
 +
|-
 +
| <code>USBHUB_THREAD_NAME = 'USB Hub';</code>
 +
| Name of USB hub thread
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB device''' <code> USBHUB_DEVICE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBHUB_DEVICE_DESCRIPTION  = 'USB Hub';</code>
 +
| Description of USB hub device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub driver''' <code> USBHUB_DRIVER_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBHUB_DRIVER_NAME = 'USB Hub Driver';</code>
 +
| Name of USB hub driver
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB port reset''' <code> USB_PORT_RESET_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USB_PORT_RESET_TIMEOUT = 500;</code>
 +
| Maximum milliseconds to wait for a port to reset (500 is the same value that Linux uses)
 +
|-
 +
| <code>USB_PORT_RESET_RECOVERY = 30;</code>
 +
| Milliseconds to wait after port reset to allow the device attached to the port to recover before any data transfers (USB 2.0 spec says 10ms)
 +
|-
 +
| <code>USB_PORT_SHORT_RESET_DELAY = 10;</code>
 +
| Milliseconds between each status check on the port while waiting for it to finish being reset (Linux uses 10ms as the default value)
 +
|-
 +
| <code>USB_PORT_LONG_RESET_DELAY = 200;</code>
 +
| Milliseconds between each status check on the port while waiting for it to finish being reset (Linux uses 200ms for Low Speed devices)
 +
|-
 +
| <code>USB_PORT_ROOT_RESET_DELAY = 60;</code>
 +
| Milliseconds between each status check on the port while waiting for it to finish being reset (Linux uses 60ms for Root hub ports)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_ATTACH_DEBOUNCE_INTERVAL = 100;</code>
 +
| Milliseconds to wait after attachment for debounce (TATTDB)
 +
|-
 +
| <code>USB_ADDRESS_COMPLETION_TIME = 50;</code>
 +
| Milliseconds to wait for set address completion (TDSETADDR)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub characteristic''' <code> USB_HUB_CHARACTERISTIC_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Values for wHubCharacteristics in type TUSBHubDescriptor
 +
|-
 +
|colspan="2"|See Table 11-13 in Section 11.23.2.1 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_LPSM = (3 shl 0);</code>
 +
| Logical Power Switching Mode
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_LPSM_GANGED = (0 shl 0);</code>
 +
| Ganged power switching (all ports power at once)
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_LPSM_PORT = (1 shl 0);</code>
 +
| Individual port power switching
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_IS_COMPOUND_DEVICE = (1 shl 2);</code>
 +
| Identifies a Compound Device (0 = Hub is not part of a compound device / 1 = Hub is part of a compound device)
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_OCPM = (3 shl 3);</code>
 +
| Over-current Protection Mode
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_OCPM_GLOBAL = (0 shl 3);</code>
 +
| Global Over-current Protection
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_OCPM_PORT = (1 shl 3);</code>
 +
| Individual Port Over-current Protection
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_OCPM_NONE = (2 shl 3);</code>
 +
| No Over-current Protection
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_TTTT = (3 shl 5);</code>
 +
| TT Think Time
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_TTTT_8 = (0 shl 5);</code>
 +
| TT requires at most 8 FS bit times of inter transaction gap
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_TTTT_16 = (1 shl 5);</code>
 +
| TT requires at most 16 FS bit times of inter transaction gap
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_TTTT_24 = (2 shl 5);</code>
 +
| TT requires at most 24 FS bit times of inter transaction gap
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_TTTT_32 = (3 shl 5);</code>
 +
| TT requires at most 32 FS bit times of inter transaction gap
 +
|-
 +
| <code>USB_HUB_CHARACTERISTIC_PORT_INDICATOR = (1 shl 7);</code>
 +
| Port Indicators Supported (0 = Port Indicators are not supported / 1 =  Port Indicators are supported)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub feature''' <code> USB_C_HUB_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 11-17 in Section 11.24.2 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_C_HUB_LOCAL_POWER = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_C_HUB_OVER_CURRENT = 1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB port feature''' <code> USB_PORT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 11-17 in Section 11.24.2 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_PORT_CONNECTION = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_PORT_ENABLE = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_SUSPEND = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_OVER_CURRENT = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_RESET = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_POWER = 8;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_LOW_SPEED = 9;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_C_PORT_CONNECTION = 16;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_C_PORT_ENABLE = 17;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_C_PORT_SUSPEND = 18;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_C_PORT_OVER_CURRENT = 19;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_C_PORT_RESET = 20;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_TEST = 21;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_INDICATOR = 22;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub class request''' <code> USB_HUB_REQUEST_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 11-16 in Section 11.24.2 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_HUB_REQUEST_GET_STATUS = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_HUB_REQUEST_CLEAR_FEATURE = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HUB_REQUEST_SET_FEATURE = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HUB_REQUEST_GET_DESCRIPTOR = 6;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HUB_REQUEST_SET_DESCRIPTOR = 7;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HUB_REQUEST_CLEAR_TT_BUFFER = 8;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HUB_REQUEST_RESET_TT = 9;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HUB_REQUEST_GET_TT_STATE = 10;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HUB_REQUEST_STOP_TT = 11;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB port status''' <code> USB_PORT_STATUS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 11-21 in Section 11.24.2.7.1 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for wPortStatus in type TUSBPortStatus
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_CONNNECTED = (1 shl 0);</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_ENABLED = (1 shl 1);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_SUSPENDED = (1 shl 2);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_OVERCURRENT = (1 shl 3);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_RESET = (1 shl 4);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_POWERED = (1 shl 8);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_LOW_SPEED_ATTACHED = (1 shl 9);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_HIGH_SPEED_ATTACHED = (1 shl 10);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_TEST_MODE = (1 shl 11);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_STATUS_INDICATOR_CONTROL = (1 shl 12);</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB port change''' <code> USB_PORT_CHANGE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 11-20 in Section 11.24.2.6 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for wPortChange in type TUSBPortStatus
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_PORT_CHANGE_CONNECTED = (1 shl 0);</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_PORT_CHANGE_ENABLED = (1 shl 1);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_CHANGE_SUSPENDED = (1 shl 2);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_CHANGE_OVERCURRENT = (1 shl 3);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_PORT_CHANGE_RESET = (1 shl 4);</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub status''' <code> USB_HUB_STATUS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 11-19 in Section 11.24.2.6 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for wHubStatus in type TUSBHubStatus
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_HUB_STATUS_LOCAL_POWER = (1 shl 0);</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_HUB_STATUS_OVERCURRENT = (1 shl 1);</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''USB hub change''' <code> USB_HUB_CHANGE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Table 11-20 in Section 11.24.2.6 of the USB 2.0 specification
 +
|-
 +
|colspan="2"|Values for wHubChange in type TUSBHubStatus
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USB_HUB_CHANGE_LOCAL_POWER = (1 shl 0);</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>USB_HUB_CHANGE_OVERCURRENT = (1 shl 1);</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''USB device Id'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBDeviceId = ^TUSBDeviceId;</code>
 +
 
 +
<code>TUSBDeviceId = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: USB Device Id record for driver device identification (Not part of USB specification)
 +
|-
 +
| <code>idVendor:Word;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>idProduct:Word;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''USB interface Id''' 
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBInterfaceId = ^TUSBInterfaceId;</code>
 +
 
 +
<code>TUSBInterfaceId = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: USB Interface Id record for driver device identification (Not part of USB specification)
 +
|-
 +
| <code>bInterfaceClass:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>bInterfaceSubClass:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterfaceProtocol:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB device and interface Id'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBDeviceAndInterfaceId = ^TUSBDeviceAndInterfaceId;</code>
 +
 
 +
<code>TUSBDeviceAndInterfaceId = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: USB Device and Interface Id record for driver device identification (Not part of USB specification)
 +
|-
 +
| <code>idVendor:Word;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>idProduct:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterfaceClass:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterfaceSubClass:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterfaceProtocol:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB device and interface no'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBDeviceAndInterfaceNo = ^TUSBDeviceAndInterfaceNo;</code>
 +
 
 +
<code>TUSBDeviceAndInterfaceNo = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: USB Device and Interface No record for driver device identification (Not part of USB specification)
 +
|-
 +
| <code>idVendor:Word;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>idProduct:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterfaceNumber:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''USB control setup data'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBControlSetupData = ^TUSBControlSetupData;</code>
 +
 
 +
<code>TUSBControlSetupData = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Table 9-2 in Section 9.3 of the USB 2.0 specification
 +
|-
 +
| <code>bmRequestType:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>bRequest:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>wValue:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>wIndex:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>wLength:Word;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB descriptor header'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBDescriptorHeader = ^TUSBDescriptorHeader;</code>
 +
 
 +
<code>TUSBDescriptorHeader = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Table 9-8 in 9.6.1 of the USB 2.0 specification
 +
|-
 +
| <code>bLength:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>bDescriptorType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB device descriptor'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBDeviceDescriptor = ^TUSBDeviceDescriptor;</code>
 +
 
 +
<code>TUSBDeviceDescriptor = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Table 9-8 in 9.6.1 of the USB 2.0 specification
 +
|-
 +
| <code>bLength:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>bDescriptorType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bcdUSB:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bDeviceClass:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bDeviceSubClass:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bDeviceProtocol:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bMaxPacketSize0:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>idVendor:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>idProduct:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bcdDevice:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>iManufacturer:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>iProduct:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>iSerialNumber:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bNumConfigurations:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB configuration descriptor'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBConfigurationDescriptor = ^TUSBConfigurationDescriptor;</code>
 +
 
 +
<code>TUSBConfigurationDescriptor = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Table 9-10 in Section 9.6.3 of the USB 2.0 specification
 +
|-
 +
| <code>bLength:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>bDescriptorType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>wTotalLength:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bNumInterfaces:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bConfigurationValue:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>iConfiguration:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bmAttributes:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bMaxPower:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB interface descriptor'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBInterfaceDescriptor = ^TUSBInterfaceDescriptor;</code>
 +
 
 +
<code>TUSBInterfaceDescriptor = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Table 9-12 in Section 9.6.6 of the USB 2.0 specification
 +
|-
 +
| <code>bLength:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>bDescriptorType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterfaceNumber:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bAlternateSetting:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bNumEndpoints:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterfaceClass:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterfaceSubClass:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterfaceProtocol:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>iInterface:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB endpoint descriptor'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBEndpointDescriptor = ^TUSBEndpointDescriptor;</code>
 +
 
 +
<code>TUSBEndpointDescriptor = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Table 9-13 in Section 9.6.6 of the USB 2.0 specification
 +
|-
 +
| <code>bLength:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>bDescriptorType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bEndpointAddress:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bmAttributes:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>wMaxPacketSize:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bInterval:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''USB string descriptor'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBStringDescriptor = ^TUSBStringDescriptor;</code>
 +
 
 +
<code>TUSBStringDescriptor = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Table 9-16 in Section 9.7 of the USB 2.0 specification
 +
|-
 +
| <code>bLength:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bDescriptorType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bString:array[0..0] of Word;</code>
 +
| UTF-16LE encoded string (specification says "UNICODE")
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB string descriptor string'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBStringDescriptorString = ^TUSBStringDescriptorString;</code>
 +
 
 +
<code>TUSBStringDescriptorString = array[0..125] of Word;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Array type to allow typecasting of bString element in TUSBStringDescriptor (Maximum size of descriptor is 255) (126 x 2 + 2 = 254)
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''USB string descriptor LANGIDs'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBStringDescriptorLANGIDs = ^TUSBStringDescriptorLANGIDs;</code>
 +
 
 +
<code>TUSBStringDescriptorLANGIDs = array[0..125] of Word;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Array type to allow typecasting of bString element in TUSBStringDescriptor (Maximum size of descriptor is 255) (126 x 2 + 2 = 254)
 +
|}
 +
</div></div>
 +
 +
'''USB device status'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBDeviceStatus = ^TUSBDeviceStatus;</code>
 +
 
 +
<code>TUSBDeviceStatus = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Device status information returned by a USB_DEVICE_REQUEST_GET_STATUS control message (See Section 9.4.6 of the USB 2.0 specification)
 +
|-
 +
| <code>wStatus:Word;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''USB device bind callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBDeviceBind = function(Device:PUSBDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB device unbind callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBDeviceUnbind = function(Device:PUSBDevice; Driver:PUSBDriver):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB device enumeration callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBDeviceEnumerate = function(Device:PUSBDevice; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB device notification callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBDeviceNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB device'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBDevice = ^TUSBDevice;</code>
 +
 
 +
<code>TUSBDevice = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Device Properties''
 +
|-
 +
| <code>Device:TDevice;</code>
 +
| The Device entry for this USB device
 +
|-
 +
|colspan="2"|''USB Properties''
 +
|-
 +
| <code>USBId:LongWord;</code>
 +
| Unique Id of this USB in the USB device table
 +
|-
 +
| <code>USBState:LongWord;</code>
 +
| USB device state (eg USB_STATE_ATTACHED)
 +
|-
 +
| <code>USBStatus:LongWord;</code>
 +
| USB device status (eg USB_STATUS_BOUND)
 +
|-
 +
| <code>Host:PUSBHost;</code>
 +
| Host controller this USB device is connected to (Set by USB core)
 +
|-
 +
| <code>Parent:PUSBDevice;</code>
 +
| Hub this USB device is connected to, or nil if this is the Root Hub (Set by USB core)
 +
|-
 +
| <code>Driver:PUSBDriver;</code>
 +
| Driver this USB device is bound to, if any (Set by USB core)
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| USB device lock
 +
|-
 +
| <code>Address:LongWord;</code>
 +
| Address of this device (Set by USB core)
 +
|-
 +
| <code>Speed:LongWord;</code>
 +
| Speed at which this device is attached (Set by USB core)
 +
|-
 +
| <code>Depth:LongWord;</code>
 +
| Depth of this device (Root Hub is 0, next level hub is 1 etc) (Set by USB core)
 +
|-
 +
| <code>PortNumber:LongWord;</code>
 +
| 1 based index of the USB port on the parent hub this device is plugged into (0 for the Root Hub) (Set by USB core)
 +
|-
 +
| <code>ConfigurationValue:LongWord;</code>
 +
| The current configuration value of this USB device (Set by USB core)
 +
|-
 +
| <code>Descriptor:PUSBDeviceDescriptor;</code>
 +
| Device descriptor of this device (Set by USB core)
 +
|-
 +
| <code>Configuration:PUSBConfiguration;</code>
 +
| Currently selected configuration of this USB device (Set by USB core)
 +
|-
 +
| <code>Configurations:array of PUSBConfiguration;</code>
 +
| All available configurations on this device (Set by USB core)
 +
|-
 +
| <code>Product:array[0..127] of Char;</code>
 +
| Null terminated product string (ASCII encoded, English if available) of this device
 +
|-
 +
| <code>Manufacturer:array[0..127] of Char;</code>
 +
| Null terminated manufacturer string (ASCII encoded, English if available) of this device
 +
|-
 +
| <code>SerialNumber:array[0..127] of Char;</code>
 +
| Null terminated serial number string (ASCII encoded, English if available) of this device
 +
|-
 +
| <code>DriverData:Pointer;</code>
 +
| Private data for the driver of this USB device
 +
|-
 +
| <code>LastError:LongWord;</code>
 +
| Last error to occur on this device
 +
|-
 +
| <code>PendingCount:LongWord;</code>
 +
| Number of USB requests pending for this device (Set by USB core)
 +
|-
 +
| <code>WaiterThread:TThreadId;</code>
 +
| Thread waiting for pending requests to complete (for device detachment) (Set by USB core)
 +
|-
 +
|colspan="2"|''Statistics Properties''
 +
|-
 +
| <code>RequestCount:LongWord;</code>
 +
| Number of USB requests that have been submitted to this device
 +
|-
 +
| <code>RequestErrors:LongWord;</code>
 +
| Number of USB requests that have failed on this device
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PUSBDevice;</code>
 +
| Previous entry in USB device table
 +
|-
 +
| <code>Next:PUSBDevice;</code>
 +
| Next entry in USB device table
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB configuration'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBConfiguration = ^TUSBConfiguration;</code>
 +
 
 +
<code>TUSBConfiguration = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Forward declared to satisfy USBDevice
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Descriptor:PUSBConfigurationDescriptor;</code>
 +
| Configuration descriptor of this configuration (Set by USB core)
 +
|-
 +
| <code>Interfaces:array of PUSBInterface;</code>
 +
| All available interfaces in this configuration (Set by USB core)
 +
|-
 +
| <code>Description:array[0..127] of Char;</code>
 +
| Null terminated description string (ASCII encoded, English if available) of this configuration
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB interface'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBInterface = ^TUSBInterface;</code>
 +
 
 +
<code>TUSBInterface = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Forward declared to satisfy USBDevice
 +
|-
 +
|colspan="2"|''USB Properties''
 +
|-
 +
| <code>Driver:PUSBDriver;</code>
 +
| Driver this USB interface is bound to, if any (Set by USB core)
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>AlternateCount:LongWord;</code>
 +
| The number of alternate settings available for this interface (Set by USB core)
 +
|-
 +
| <code>AlternateSetting:LongWord;</code>
 +
| The currently selected alternate setting for this interface (Set by USB core)
 +
|-
 +
| <code>Descriptor:PUSBInterfaceDescriptor;</code>
 +
| Interface descriptor of this interface (Set by USB core)
 +
|-
 +
| <code>Endpoints:array of PUSBEndpointDescriptor;</code>
 +
| All available endpoint descriptors on this interface (Set by USB core)
 +
|-
 +
| <code>Alternates:array of PUSBAlternate;</code>
 +
| All available alternate settings for this interface (Set by USB core)
 +
|-
 +
| <code>Description:array[0..127] of Char;</code>
 +
| Null terminated description string (ASCII encoded, English if available) of this interface
 +
|-
 +
| <code>ClassData:PByte;</code>
 +
| Pointer to the start of any class specific descriptors for this interface (Set by USB core)
 +
|-
 +
| <code>ClassSize:LongWord;</code>
 +
| Size of any class specific descriptors for this interface (Set by USB core)
 +
|-
 +
| <code>DriverData:Pointer;</code>
 +
| Private data for the driver of this USB interface
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''USB alternate'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBAlternate = ^TUSBAlternate;</code>
 +
 
 +
<code>TUSBAlternate = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Forward declared to satisfy USBDevice
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Descriptor:PUSBInterfaceDescriptor;</code>
 +
| Interface descriptor of this alternate setting (Set by USB core)
 +
|-
 +
| <code>Endpoints:array of PUSBEndpointDescriptor;</code>
 +
| All available endpoint descriptors on this alternate setting (Set by USB core)
 +
|-
 +
| <code>Description:array[0..127] of Char;</code>
 +
| Null terminated description string (ASCII encoded, English if available) of this alternate setting
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''USB driver enumeration callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBDriverEnumerate = function(Driver:PUSBDriver; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB driver bind'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBDriverBind = function(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB driver unbind'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBDriverUnbind = function(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB driver'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBDriver = ^TUSBDriver;</code>
 +
 
 +
<code>TUSBDriver = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Forward declared to satisfy USBDevice
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Driver:TDriver;</code>
 +
| The Driver entry for this USB Driver
 +
|-
 +
|colspan="2"|''USB Properties''
 +
|-
 +
| <code>DriverBind:TUSBDriverBind;</code>
 +
| A Driver specific DriverBind method implementing the standard USB driver interface
 +
|-
 +
| <code>DriverUnbind:TUSBDriverUnbind;</code>
 +
| A Driver specific DriverUnbind method implementing the standard USB driver interface
 +
|-
 +
|colspan="2"|''Interface Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Driver lock
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PUSBDriver;</code>
 +
| Previous entry in Driver table
 +
|-
 +
| <code>Next:PUSBDriver;</code>
 +
| Next entry in Driver table
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB host enumeration callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBHostEnumerate = function(Host:PUSBHost; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB host notification callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBHostNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB host start'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBHostStart = function(Host:PUSBHost):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB host stop'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBHostStop = function(Host:PUSBHost):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB host reset'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBHostReset = function(Host:PUSBHost):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB host submit'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBHostSubmit = function(Host:PUSBHost; Request:PUSBRequest):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 +
'''USB host cancel'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBHostCancel = function(Host:PUSBHost; Request:PUSBRequest):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB host'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBHost = ^TUSBHost;</code>
 +
 
 +
<code>TUSBHost = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Forward declared to satisfy USBDevice
 +
|-
 +
|colspan="2"|''Device Properties''
 +
|-
 +
| <code>Device:TDevice;</code>
 +
| The Device entry for this USB Host
 +
|-
 +
|colspan="2"|''USB Properties''
 +
|-
 +
| <code>HostId:LongWord;</code>
 +
| Unique Id of this Host in the Host table
 +
|-
 +
| <code>HostState:LongWord;</code>
 +
| Host state (eg USBHOST_STATE_ENABLED)
 +
|-
 +
| <code>HostStart:TUSBHostStart;</code>
 +
| A Host specific HostStart method implementing the standard USB host interface
 +
|-
 +
| <code>HostStop:TUSBHostStop;</code>
 +
| A Host specific HostStop method implementing the standard USB host interface
 +
|-
 +
| <code>HostReset:TUSBHostReset;</code>
 +
| A Host specific HostReset method implementing the standard USB host interface
 +
|-
 +
| <code>HostSubmit:TUSBHostSubmit;</code>
 +
| A Host specific HostSubmit method implementing the standard USB host interface
 +
|-
 +
| <code>HostCancel:TUSBHostCancel;</code>
 +
| A Host specific HostCancel method implementing the standard USB host interface
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Host lock
 +
|-
 +
| <code>RootHub:PUSBDevice;</code>
 +
| The Root hub for this Host (or nil if the Host has not yet been started)
 +
|-
 +
| <code>Alignment:LongWord;</code>
 +
| Host data buffer alignment (for DMA requests etc)
 +
|-
 +
| <code>Multiplier:LongWord;</code>
 +
| Host data buffer multiplier (for DMA requests etc)
 +
|-
 +
| <code>MaxTransfer:LongWord;</code>
 +
| Host maximum transfer size
 +
|-
 +
|colspan="2"|''Statistics Properties''
 +
|-
 +
| <code>RequestCount:LongWord;</code>
 +
| Number of USB requests that have been submitted to this host
 +
|-
 +
| <code>RequestErrors:LongWord;</code>
 +
| Number of USB requests that have failed on this host
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PUSBHost;</code>
 +
| Previous entry in Host table
 +
|-
 +
| <code>Next:PUSBHost;</code>
 +
| Next entry in Host table
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB request completed'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBRequestCompleted = procedure(Request:PUSBRequest);</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB request'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBRequest = ^TUSBRequest;</code>
 +
 
 +
<code>TUSBRequest = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Forward declared to satisfy USBHost
 +
|-
 +
|colspan="2"|''Request Properties''
 +
|-
 +
| <code>Device:PUSBDevice;</code>
 +
| USB Device to send this request to
 +
|-
 +
| <code>Endpoint:PUSBEndpointDescriptor;</code>
 +
| Endpoint descriptor on the device to send this request to
 +
|-
 +
| <code>Data:Pointer;</code>
 +
| Data buffer for the request (IN or OUT)
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| Size of data buffer (For IN requests, the maximum number of bytes of data to receive) (For OUT requests, the exact number of bytes of data to send)
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| Flags for the request (eg USB_REQUEST_FLAG_ALIGNED)
 +
|-
 +
| <code>Callback:TUSBRequestCompleted;</code>
 +
| Callback function that will be called when this USB request has been successfully completed or has failed
 +
|-
 +
| <code>DriverData:Pointer;</code>
 +
| USB device driver private data for the completion callback (Optional)
 +
|-
 +
|colspan="2"|''Control Properties''
 +
|-
 +
| <code>SetupData:PUSBControlSetupData;</code>
 +
| Data for the Setup phase of a USB control request (Must be provided for control requests, ignored otherwise)
 +
|-
 +
| <code>StatusData:LongWord;</code>
 +
| Data for the Status phase of a USB control request (For safety only as no data is normally transferred in the status phase)
 +
|-
 +
|colspan="2"|''Result Properties''
 +
|-
 +
| <code>Status:LongWord;</code>
 +
| Status of the transfer (USB_STATUS_SUCCESS if successful, or another error code if the transfer failed)
 +
|-
 +
| <code>ActualSize:LongWord;</code>
 +
| Actual size of the data transferred (Should be checked after a successful IN request)
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
|colspan="2"|Note: Private variables for use by Host drivers (Do not use from device drivers)
 +
|-
 +
| <code>TransferData:Pointer;</code>
 +
| Host driver private data for transfer handling
 +
|-
 +
| <code>CurrentData:Pointer;</code>
 +
| Host driver data pointer during transaction processing
 +
|-
 +
| <code>IsPing:LongBool;</code>
 +
| Ping request in progress as part of request processing
 +
|-
 +
| <code>IsSplit:LongBool;</code>
 +
| Request is a split transaction due to full or low speed device
 +
|-
 +
| <code>CompleteSplit:LongBool;</code>
 +
| On a split transaction indicates if the request is on the start split or complete split phase
 +
|-
 +
| <code>ShortAttempt:LongBool;</code>
 +
| The current transaction for this request is a short read or write
 +
|-
 +
| <code>StartOfFrame:LongBool;</code>
 +
| The request needs to wait for the next start of frame to be started
 +
|-
 +
| <code>ControlPhase:LongWord;</code>
 +
| The currently processing phase of a control request
 +
|-
 +
| <code>NextDataPID:LongWord;</code>
 +
| The next Data PID for the data toggle during IN or OUT (Data0/Data1 etc)
 +
|-
 +
| <code>AttemptedPackets:LongWord;</code>
 +
| The number of packets attempted in the current transaction
 +
|-
 +
| <code>AttemptedBytes:LongWord;</code>
 +
| The number of bytes attempted in the current transaction
 +
|-
 +
| <code>AttemptedPacketsRemaining:LongWord;</code>
 +
| The number of packets remaining in the current transaction
 +
|-
 +
| <code>AttemptedBytesRemaining:LongWord;</code>
 +
| The number of bytes remaining in the current transaction
 +
|-
 +
| <code>TotalPacketsAttempted:LongWord;</code>
 +
| The total number of packets attempted for this request
 +
|-
 +
| <code>TotalBytesAttempted:LongWord;</code>
 +
| The total number of bytes attempted for this request
 +
|-
 +
| <code>PacketsTransferred:LongWord;</code>
 +
| The number of packets transferred for this request
 +
|-
 +
| <code>BytesTransferred:LongWord;</code>
 +
| The number of bytes transferred for this request
 +
|-
 +
| <code>SplitErrorCount:LongWord;</code>
 +
| The number of split transaction errors for this request
 +
|-
 +
| <code>CompleteSplitRetries:LongWord;</code>
 +
| The number of complete split retries for this request
 +
|-
 +
| <code>ResubmitThread:TThreadHandle;</code>
 +
| The handle of the thread performing resubmit for this request (or INVALID_HANDLE_VALUE)
 +
|-
 +
| <code>ResubmitSemaphore:TSemaphoreHandle;</code>
 +
| The handle of the semaphore used to signal the resubmit thread (or INVALID_HANDLE_VALUE)
 +
|-
 +
|colspan="2"|''Debug Statistics''
 +
|-
 +
| <code>StartSplitAttempts:LongWord;</code>
 +
| The number of start split attempts started for this request
 +
|-
 +
| <code>CompleteSplitAttempts:LongWord;</code>
 +
| The number of complete split attempts started for this request
 +
|-
 +
| <code>CompleteSplitRestarts:LongWord;</code>
 +
| The number of complete split restarts processed for this request
 +
|-
 +
| <code>StartSplitNAKs:LongWord;</code>
 +
| The number of start split NAK responses received for this request
 +
|-
 +
| <code>CompleteSplitNYETs:LongWord;</code>
 +
| The number of complete split NYET responses received for this request
 +
|-
 +
| <code>CompleteSplitNAKs:LongWord;</code>
 +
| The number of complete split NAK responses received for this request
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''USB hub descriptor'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBHubDescriptor = ^TUSBHubDescriptor;</code>
 +
 
 +
<code>TUSBHubDescriptor = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Table 11-13 in Section 11.23 of the USB 2.0 specification
 +
|-
 +
| <code>bDescLength:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bDescriptorType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bNbrPorts:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>wHubCharacteristics:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bPwrOn2PwrGood:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bHubContrCurrent:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>varData:array[0..0] of Byte;</code>
 +
| Variable length field, 64 should be the maximum possible length (255 ports = 2 x 32 bytes of data)
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''USB hub descriptor data'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBHubDescriptorData = ^TUSBHubDescriptorData;</code>
 +
 
 +
<code>TUSBHubDescriptorData = array[0..63] of Byte;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Array type to allow typecasting of varData element in TUSBHubDescriptor
 +
|-
 +
|}
 +
</div></div>
 +
 +
'''USB port status'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBPortStatus = ^TUSBPortStatus;</code>
 +
 
 +
<code>TUSBPortStatus = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Section 11.24.2.7 of the USB 2.0 specification
 +
|-
 +
| <code>wPortStatus:Word;</code>
 +
| See: USB_PORT_STATUS values above
 +
|-
 +
| <code>wPortChange:Word;</code>
 +
| See: USB_PORT_CHANGE values above
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''USB hub status'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBHubStatus = ^TUSBHubStatus;</code>
 +
 
 +
<code>TUSBHubStatus = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: See Section 11.24.2.6 of the USB 2.0 specification
 +
|-
 +
| <code>wHubStatus:Word;</code>
 +
| See: USB_HUB_STATUS values above
 +
|-
 +
| <code>wHubChange:Word;</code>
 +
| See: USB_HUB_CHANGE values above
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''USB hub data'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBHubData = ^TUSBHubData;</code>
 +
 
 +
<code>TUSBHubData = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Data:array[0..7] of Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''USB port'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBPort = ^TUSBPort;</code>
 +
 
 +
<code>TUSBPort = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Hub:PUSBHub;</code>
 +
| Pointer to the USB hub this port is attached to
 +
|-
 +
| <code>Number:Byte;</code>
 +
| Number of this port (1-based)
 +
|-
 +
| <code>Child:PUSBDevice;</code>
 +
| Pointer to the USB device attached to this port, or nil if there is none
 +
|-
 +
| <code>Status:TUSBPortStatus;</code>
 +
| Status of this port
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''USB hub enumeration callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBHubEnumerate = function(Hub:PUSBHub; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB hub notification callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBHubNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB hub'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUSBHub = ^TUSBHub;</code>
 +
 
 +
<code>TUSBHub = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Forward declared to satisfy USBPort
 +
|-
 +
|colspan="2"|''Device Properties''
 +
|-
 +
| <code>Device:TDevice;</code>
 +
| The Device entry for this Hub
 +
|-
 +
|colspan="2"|''Hub Properties''
 +
|-
 +
| <code>HubId:LongWord;</code>
 +
| Unique Id of this Hub in the Hub table
 +
|-
 +
| <code>HubState:LongWord;</code>
 +
| Hub state (eg USBHUB_STATE_ATTACHED)
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Hub lock
 +
|-
 +
| <code>Descriptor:PUSBHubDescriptor;</code>
 +
| Class specific Descriptor for this hub
 +
|-
 +
| <code>Ports:array of TUSBPort;</code>
 +
| Ports on this hub (Set by USBHubCreatePorts using the value in Descriptor.bNbrPorts)
 +
|-
 +
|colspan="2"|''Statistics Properties''
 +
|-
 +
| <code>ReceiveCount:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ReceiveErrors:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''USB Properties''
 +
|-
 +
| <code>StatusData:PUSBHubData;</code>
 +
| Hub status change data buffer
 +
|-
 +
| <code>StatusRequest:PUSBRequest;</code>
 +
| Hub status change request
 +
|-
 +
| <code>StatusEndpoint:PUSBEndpointDescriptor;</code>
 +
| Hub Interrupt IN Endpoint
 +
|-
 +
| <code>PendingCount:LongWord;</code>
 +
| Number of USB requests pending for this hub
 +
|-
 +
| <code>WaiterThread:TThreadId;</code>
 +
| Thread waiting for pending requests to complete (for hub detachment)
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PUSBHub;</code>
 +
| Previous entry in Hub table
 +
|-
 +
| <code>Next:PUSBHub;</code>
 +
| Next entry in Hub table
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''USB logging'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TUSBLogOutput = procedure(const AText:String; Data:Pointer);</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
 
 +
'''USB log device output'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>USB_LOG_ALL_CONFIGURATIONS:Boolean = True;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>USB_LOG_ALTERNATE_SETTINGS:Boolean = True;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB log tree output'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>USB_TREE_SPACES_PER_LEVEL:LongWord = 6;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>USB_TREE_LINES_PER_PORT:LongWord = 2;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''USB logging'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>USB_DEFAULT_LOG_LEVEL:LongWord = USB_LOG_LEVEL_DEBUG;</code>
 +
| style="width: 40%;"|Minimum level for USB messages. Only messages with level greater than or equal to this will be printed.
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>USB_LOG_ENABLED:Boolean;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Function declarations ===
 
=== Function declarations ===
 
----
 
----
  
''To be documented''
 
  
 +
'''Initialization 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;">procedure USBInit;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Performs basic initialization of the USB core driver, after this devices, hosts and drivers can be registered however nothing will work until USBStart is called</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBStart:LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Starts all registered USB hosts, starts the USB hub thread and begins the USB enumeration process. USB enumeration will continue after this function returns as devices are discovered by changes in hub status.</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBStop: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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBAsyncStart(Host:PUSBHost);</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
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''USB device, driver and host 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 USBDeviceGetAddress(Device:PUSBDevice):Byte;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the bus address for the specified 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 get the address for
 +
|-
 +
! Return
 +
| Device address or 0 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 USBDeviceSetAddress(Device:PUSBDevice; Address:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the bus address for the specified 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 set the address for
 +
|-
 +
! 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;">function USBDeviceGetDescriptor(Device:PUSBDevice; bRequest,bmRequestType:Byte; wValue,wIndex:Word; Data:Pointer; Length:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read any descriptor from the specified device using USBControlRequest</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 read the descriptor from
 +
|-
 +
! bRequest
 +
| See USBControlRequest
 +
|-
 +
! bmRequestType
 +
| See USBControlRequest
 +
|-
 +
! wValue
 +
| See USBControlRequest
 +
|-
 +
! wIndex
 +
| See USBControlRequest
 +
|-
 +
! Data
 +
| See USBControlRequest
 +
|-
 +
! Length
 +
| See USBControlRequest
 +
|-
 +
! 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;">function USBDeviceGetDeviceDescriptor(Device:PUSBDevice; Data:Pointer; Length:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read all or part of the device descriptor from the specified device using USBControlRequest</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 read the device descriptor from
 +
|-
 +
! Data
 +
| See USBControlRequest
 +
|-
 +
! Length
 +
| See USBControlRequest
 +
|-
 +
! 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;">function USBDeviceCreateDeviceDescriptor(Device:PUSBDevice; Length:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a device descriptor for the specified 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 create the device descriptor for
 +
|-
 +
! Length
 +
| The length of the descriptor to create
 +
|-
 +
! 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;">function USBDeviceReadDeviceDescriptor(Device:PUSBDevice; Length:Word):LongWord; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read all or part of the device descriptor from the specified device using USBControlRequest</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 read the device descriptor from
 +
|-
 +
! Length
 +
| The amount of the descriptor to read which may be less than the full size
 +
|-
 +
! 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;">function USBDeviceReadDeviceDescriptorEx(Device:PUSBDevice; Length:Word; AllowShort:Boolean):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read all or part of the device descriptor from the specified device using USBControlRequest</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 read the device descriptor from
 +
|-
 +
! Length
 +
| The amount of the descriptor to read which may be less than the full size
 +
|-
 +
! 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;">function USBDeviceCreateConfigurations(Device:PUSBDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate the available configurations for this 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 create the configurations for
 +
|-
 +
! 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;">function USBDeviceReadConfigurations(Device:PUSBDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read and parse the available configurations for this 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 read the configurations for
 +
|-
 +
! 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;">function USBDeviceCreateConfiguration(Device:PUSBDevice; Index:Byte; Size:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate the specified configuration for this 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 create the configuration for
 +
|-
 +
! Index
 +
| The index of the configuration to create
 +
|-
 +
! Size
 +
| The size of the configuration descriptor to create
 +
|-
 +
! 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;">function USBDeviceReadConfiguration(Device:PUSBDevice; Index:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read and parse the specified configuration for this 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 read the configuration for
 +
|-
 +
! Index
 +
| The index of the configuration to read
 +
|-
 +
! 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;">function USBDeviceGetStringDescriptor(Device:PUSBDevice; Index:Byte; Data:Pointer; Length:Word):LongWord; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read all or part of the specified string descriptor from the specified device using USBControlRequest</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 read the string descriptor from
 +
|-
 +
! Index
 +
| The index of the string descriptor to read
 +
|-
 +
! Data
 +
| See USBControlRequest
 +
|-
 +
! Length
 +
| See USBControlRequest
 +
|-
 +
! 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;">function USBDeviceGetStringDescriptorEx(Device:PUSBDevice; Index:Byte;LanguageId:Word; Data:Pointer; Length:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read all or part of the specified string descriptor from the specified device using USBControlRequest</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 read the string descriptor from
 +
|-
 +
! Index
 +
| The index of the string descriptor to read
 +
|-
 +
! LanguageId
 +
| The language identifier of the string descriptor to read (eg USB_LANGID_US_ENGLISH)
 +
|-
 +
! Data
 +
| See USBControlRequest
 +
|-
 +
! Length
 +
| See USBControlRequest
 +
|-
 +
! 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;">function USBDeviceReadStringLanguageIds(Device:PUSBDevice):TUSBStringDescriptorLANGIDs;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the list of supported string language identifiers from the specified 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 read the language identifiers from
 +
|-
 +
! Return
 +
| An array of supported language identifiers (Unused values are returned as zero)
 +
|-
 +
|}
 +
</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 USBDeviceReadStringDescriptor(Device:PUSBDevice; Index:Byte):String; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the content of the specified string descriptor from the specified 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 read the string descriptor from
 +
|-
 +
! Index
 +
| The index of the string descriptor to read
 +
|-
 +
! Return
 +
| The ANSI string content of the string descriptor or an empty string 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 USBDeviceReadStringDescriptorEx(Device:PUSBDevice;Index:Byte;LanguageId:Word):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the content of the specified string descriptor from the specified 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 read the string descriptor from
 +
|-
 +
! Index
 +
| The index of the string descriptor to read
 +
|-
 +
! Language Id
 +
| The language identifier of the string descriptor to read (eg USB_LANGID_US_ENGLISH)
 +
|-
 +
! Return
 +
| The ANSI string content of the string descriptor or an empty string 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 USBDeviceReadStringDescriptorW(Device:PUSBDevice; Index:Byte):UnicodeString; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the content of the specified string descriptor from the specified 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 read the string descriptor from
 +
|-
 +
! Index
 +
| The index of the string descriptor to read
 +
|-
 +
! Return
 +
| The Unicode string content of the string descriptor or an empty string 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 USBDeviceReadStringDescriptorExW(Device:PUSBDevice; Index:Byte; LanguageId:Word):UnicodeString;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the content of the specified string descriptor from the specified 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 read the string descriptor from
 +
|-
 +
! Index
 +
| The index of the string descriptor to read
 +
|-
 +
! LanguageId
 +
| The language identifier of the string descriptor to read (eg USB_LANGID_US_ENGLISH)
 +
|-
 +
! Return
 +
| The Unicode string content of the string descriptor or an empty string 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 USBDeviceGetConfigurationDescriptor(Device:PUSBDevice; Index:Byte;Data:Pointer; Length:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read all or part of the specified configuration descriptor from the specified device using USBControlRequest</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 read the configuration descriptor from
 +
|-
 +
! Index
 +
| The index of the configuration descriptor to read
 +
|-
 +
! Data
 +
| See USBControlRequest
 +
|-
 +
! Length
 +
| See USBControlRequest
 +
|-
 +
! 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;">function USBDeviceGetConfiguration(Device:PUSBDevice; var ConfigurationValue:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current configuration for the specified 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 get the current configuration for
 +
|-
 +
! ConfigurationValue
 +
| The current configuration (As per bConfigurationValue in the configuration descriptor)
 +
|-
 +
! 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;">function USBDeviceSetConfiguration(Device:PUSBDevice; ConfigurationValue:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the configuration for the specified 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 set the configuration for
 +
|-
 +
! ConfigurationValue
 +
| The configuration to set (As per bConfigurationValue in the configuration descriptor)
 +
|-
 +
! 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;">function USBDeviceFindConfigurationByValue(Device:PUSBDevice; ConfigurationValue:Byte):PUSBConfiguration;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the configuration represented by configuration value for the specified 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 find the configuration for
 +
|-
 +
! ConfigurationValue
 +
| The configuration value to find (As per bConfigurationValue in the configuration descriptor)
 +
|-
 +
! Return
 +
| USB Configuration if completed or nil 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 USBDeviceGetHub(Device:PUSBDevice):PUSBHub;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the USB Hub that the specified device is connected to</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 get the hub for
 +
|-
 +
! Return
 +
| USB Hub if successful or nil 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 USBDeviceGetPort(Device:PUSBDevice):PUSBPort;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the USB Port that the specified device is connected to</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 get the port for
 +
|-
 +
! Return
 +
| USB Port if successful or nil 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 USBDeviceGetInterface(Device:PUSBDevice; Index:Byte; var AlternateSetting:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the interface alternate setting for the specified 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 get the interface alternate setting for
 +
|-
 +
! Index
 +
| The index of the interface to get (As per bInterfaceNumber in the interface descriptor)
 +
|-
 +
! AlternateSetting
 +
| The current alternate setting of the specified interface (As per bAlternateSetting in the interface descriptor)
 +
|-
 +
! 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;">function USBDeviceSetInterface(Device:PUSBDevice; Index,AlternateSetting:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the interface alternate setting for the specified 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 set the interface alternate setting for
 +
|-
 +
! Index
 +
| The index of the interface to set (As per bInterfaceNumber in the interface descriptor)
 +
|-
 +
! AlternateSetting
 +
| The alternate setting to set on the specified interface (As per bAlternateSetting in the interface descriptor)
 +
|-
 +
! 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;">function USBDeviceFindInterfaceByIndex(Device:PUSBDevice; Index:Byte):PUSBInterface;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the interface with the specified index on the specified 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 find the interface from
 +
|-
 +
! Index
 +
| The index of the interface to find (As per bInterfaceNumber in the interface descriptor)
 +
|-
 +
! Return
 +
| The interface for the matching interface of nil if no interface matched
 +
|-
 +
|}
 +
</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 USBDeviceFindInterfaceByClass(Device:PUSBDevice; InterfaceClass:Byte):PUSBInterface; overload;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find an interface of the specified class on the specified 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 find the interface from
 +
|-
 +
! InterfaceClass
 +
| The interface class to match
 +
|-
 +
! Return
 +
| The matching interface or nil if no interface matched
 +
|-
 +
|}
 +
</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 USBDeviceFindInterfaceByClass(Device:PUSBDevice; InterfaceClass,InterfaceSubClass,InterfaceProtocol:Byte):PUSBInterface; overload;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find an interface of the specified class, subclass and protocol on the specified 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 find the interface from
 +
|-
 +
! InterrfaceClass
 +
| The interface class to match
 +
|-
 +
! InterfaceSubClass
 +
| The interface subclass to match
 +
|-
 +
! InterfaceProtocol
 +
| The interface protocol to match
 +
|-
 +
! Return
 +
|The matching interface or nil if no interface matched
 +
|-
 +
|}
 +
</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 USBDeviceFindEndpointByIndex(Device:PUSBDevice; Interrface:PUSBInterface; Index:Byte):PUSBEndpointDescriptor;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the endpoint with the specified index on the specified interface of the specified 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 find the endpoint from
 +
|-
 +
! Interrface
 +
| The interface to find the endpoint from
 +
|-
 +
! Index
 +
| The index of the endpoint to find (First endpoint is zero)
 +
|-
 +
! Return
 +
| The endpoint for the matching endpoint of nil if no endpoint matched
 +
|-
 +
|}
 +
</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 USBDeviceFindEndpointByType(Device:PUSBDevice; Interrface:PUSBInterface; Direction,TransferType:Byte):PUSBEndpointDescriptor;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find an endpoint of the specified type and direction on the specified interface of the specified 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 find the endpoint from
 +
|-
 +
! Interrface
 +
| The interface to find the endpoint from
 +
|-
 +
! Direction
 +
| The direction of the endpoint to find (eg USB_DIRECTION_OUT)
 +
|-
 +
! TransferType
 +
| The transfer type of the endpoint to find (eg USB_TRANSFER_TYPE_BULK)
 +
|-
 +
! Return
 +
| The endpoint for the matching endpoint of nil if no endpoint matched
 +
|-
 +
|}
 +
</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 USBDeviceFindEndpointByTypeEx(Device:PUSBDevice; Interrface:PUSBInterface; Direction,TransferType:Byte; var Index:Byte):PUSBEndpointDescriptor;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the next endpoint of the specified type and direction on the specified interface of the specified 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 find the endpoint from
 +
|-
 +
! Interrface
 +
| The interface to find the endpoint from
 +
|-
 +
! Direction
 +
| The direction of the endpoint to find (eg USB_DIRECTION_OUT)
 +
|-
 +
! TransferType
 +
| The transfer type of the endpoint to find (eg USB_TRANSFER_TYPE_BULK)
 +
|-
 +
! Index
 +
| The index returned from the last call, pass 0 on the first call
 +
|-
 +
! Return
 +
| The endpoint for the matching endpoint of nil if no endpoint matched
 +
|-
 +
|}
 +
</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 USBDeviceCountEndpointsByType(Device:PUSBDevice; Interrface:PUSBInterface; Direction,TransferType:Byte):Byte;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Count the number of endpoints of the specified type and direction on the specified interface of the specified 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 find the endpoint from
 +
|-
 +
! Interrface
 +
| The interface to find the endpoint from
 +
|-
 +
! Direction
 +
| The direction of the endpoint to find (eg USB_DIRECTION_OUT)
 +
|-
 +
! TransferType
 +
| The transfer type of the endpoint to find (eg USB_TRANSFER_TYPE_BULK)
 +
|-
 +
! Return
 +
| The number of matching endpoints on the specified interface
 +
|-
 +
|}
 +
</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 USBDeviceFindAlternateByIndex(Device:PUSBDevice; Interrface:PUSBInterface; Index:Byte):PUSBAlternate;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the alternate setting with the specified index on the specified interface of the specified 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 find the alternate setting from
 +
|-
 +
! Interrface
 +
| The interface to find the alternate setting from
 +
|-
 +
! Index
 +
| The index of the alternate setting to find (First alternate setting is zero)
 +
|-
 +
! Return
 +
| The alternate setting for the matching alternate setting of nil if no alternate setting matched
 +
|-
 +
|}
 +
</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 USBDeviceFindAlternateBySetting(Device:PUSBDevice; Interrface:PUSBInterface; AlternateSetting:Byte):PUSBAlternate;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the alternate setting with the specified value on the specified interface of the specified 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 find the alternate setting from
 +
|-
 +
! Interrface
 +
| The interface to find the alternate setting from
 +
|-
 +
! AlternateSetting
 +
| The value of the alternate setting to find
 +
|-
 +
! Return
 +
| The alternate setting for the matching alternate setting of nil if no alternate setting matched
 +
|-
 +
|}
 +
</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 USBDeviceFindAlternateEndpointByIndex(Device:PUSBDevice; Interrface:PUSBInterface; Alternate:PUSBAlternate; Index:Byte):PUSBEndpointDescriptor;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the endpoint with the specified index on the specified alternate setting interface of the specified 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 find the endpoint from
 +
|-
 +
! Interrface
 +
| The interface to find the endpoint from
 +
|-
 +
! Alternate
 +
| The alternate setting to find the endpoint from
 +
|-
 +
! Index
 +
| The index of the endpoint to find (First endpoint is zero)
 +
|-
 +
! Return
 +
| The endpoint for the matching endpoint of nil if no endpoint matched
 +
|-
 +
|}
 +
</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 USBDeviceFindAlternateEndpointByType(Device:PUSBDevice; Interrface:PUSBInterface; Alternate:PUSBAlternate; Direction,TransferType:Byte):PUSBEndpointDescriptor;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find an endpoint of the specified type and direction on the specified alternate setting interface of the specified 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 find the endpoint from
 +
|-
 +
! Interrface
 +
| The interface to find the endpoint from
 +
|-
 +
! Alternate
 +
| The alternate setting to find the endpoint from
 +
|-
 +
! Direction
 +
| The direction of the endpoint to find (eg USB_DIRECTION_OUT)
 +
|-
 +
! TransferType
 +
| The transfer type of the endpoint to find (eg USB_TRANSFER_TYPE_BULK)
 +
|-
 +
! Return
 +
| The endpoint for the matching endpoint of nil if no endpoint matched
 +
|-
 +
|}
 +
</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 USBDeviceSetFeature(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Feature,Index:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enable a feature on the specified endpoint on the specified 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 enable the feature for
 +
|-
 +
! Endpoint
 +
| The endpoint to enable the feature on
 +
|-
 +
! Feature
 +
| The feature to enable
 +
|-
 +
! Index
 +
| To be documented
 +
|-
 +
! 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;">function USBDeviceClearFeature(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Feature:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Disable a feature on the specified endpoint on the specified 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 disable the feature for
 +
|-
 +
! Endpoint
 +
| The endpoint to disable the feature on
 +
|-
 +
! Feature''
 +
| The feature to disable
 +
|-
 +
! Index
 +
| To be documented
 +
|-
 +
! 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;">function USBDeviceSetState(Device:PUSBDevice; State:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the specified device and send a notification</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 set the state for
 +
|-
 +
! State
 +
| The new state to set and notify (eg USB_STATE_ATTACHED)
 +
|-
 +
! 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;">function USBDeviceSetStatus(Device:PUSBDevice; Status:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the status of the specified device and send a notification</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 set the status for
 +
|-
 +
! Status
 +
| The new status to set and notify (eg USB_STATUS_BOUND)
 +
|-
 +
! 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;">function USBDeviceBind(Device:PUSBDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Attempt to bind a device to one of the registered drivers</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The device to attempt to bind a driver to
 +
|-
 +
! 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;">function USBDeviceUnbind(Device:PUSBDevice; Driver:PUSBDriver):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind a device from a driver</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The device to unbind a driver from
 +
|-
 +
! Driver
 +
| The driver to unbind the device from (nil to unbind from current driver)
 +
|-
 +
! 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;">function USBDeviceAttach(Device:PUSBDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Configure and initialize a newly attached USB device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| New USB device to configure and initialize
 +
|-
 +
! 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;">function USBDeviceDetach(Device:PUSBDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Shutdown and detach 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 shutdown and detach
 +
|-
 +
! 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;">function USBDeviceAllocate(Host:PUSBHost; Parent:PUSBDevice):PUSBDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create and Register a new Device entry in the Device table}</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Host
 +
| The Host this device is attached to
 +
|-
 +
! Parent
 +
| The Parent device (Hub) this device is attached to (nil if this device is a root hub)
 +
|-
 +
! Return
 +
| Pointer to new Device entry or nil if device could not be created
 +
|-
 +
|}
 +
</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 USBDeviceRelease(Device:PUSBDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister and Destroy a Device from the Device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The device to deregister and destroy
 +
|-
 +
! Return
 +
| ERROR_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;">function USBDeviceFind(USBId:LongWord):PUSBDevice;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceFindById(VendorId,ProductId:Word):PUSBDevice;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceFindByName(const Name:String):PUSBDevice; inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceFindByDescription(const Description:String):PUSBDevice; inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceEnumerate(Callback:TUSBDeviceEnumerate; Data: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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceNotification(Device:PUSBDevice; Callback:TUSBDeviceNotification; Data:Pointer; Notification,Flags: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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDriverCreate:PUSBDriver;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new USB Driver entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Return
 +
| Pointer to new Driver entry or nil if driver could not be created
 +
|-
 +
|}
 +
</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 USBDriverCreateEx(Size:LongWord):PUSBDriver;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new USB Driver entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Size
 +
| Size in bytes to allocate for new driver (Including the driver entry)
 +
|-
 +
! Return
 +
| Pointer to new Driver entry or nil if driver could not be created
 +
|-
 +
|}
 +
</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 USBDriverDestroy(Driver:PUSBDriver):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing USB Driver entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDriverRegister(Driver:PUSBDriver):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new USB Driver in the Driver table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDriverDeregister(Driver:PUSBDriver):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a USB Driver from the Driver table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDriverFind(DriverId:LongWord):PUSBDriver;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a driver by Id in the USB Driver table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDriverFindByName(const Name:String):PUSBDriver; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a driver by name in the Driver table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDriverEnumerate(Callback:TUSBDriverEnumerate; Data:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate all drivers in the USB Driver table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostSetState(Host:PUSBHost; State:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the specified host and send a notification}</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Host
 +
| The USB host to set the state for
 +
|-
 +
! State
 +
| The new state to set and notify (eg USBHOST_STATE_ENABLED)
 +
|-
 +
! 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;">function USBHostCreate:PUSBHost;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Host entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Return
 +
| Pointer to new Host entry or nil if host could not be created
 +
|-
 +
|}
 +
</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 USBHostCreateEx(Size:LongWord):PUSBHost;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Host entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Size
 +
| Size in bytes to allocate for new host (Including the host entry)
 +
|-
 +
! Return
 +
| Pointer to new Host entry or nil if host could not be created
 +
|-
 +
|}
 +
</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 USBHostDestroy(Host:PUSBHost):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing Host entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostRegister(Host:PUSBHost):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new Host in the Host table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostDeregister(Host:PUSBHost):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a Host from the Host table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostFind(HostId:LongWord):PUSBHost;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostFindByName(const Name:String):PUSBHost; inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostFindByDescription(const Description:String):PUSBHost; inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostEnumerate(Callback:TUSBHostEnumerate; Data: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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostNotification(Host:PUSBHost; Callback:TUSBHostNotification; Data:Pointer; Notification,Flags: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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBBufferAllocate(Device:PUSBDevice; Size:LongWord):Pointer; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a data buffer for a USB request</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The device that the request will be sent to
 +
|-
 +
! Size
 +
| The size of the data buffer to allocate
 +
|-
 +
! Return
 +
| The newly allocated buffer or nil 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 USBBufferAllocateEx(Device:PUSBDevice; Size:LongWord; var Flags:LongWord):Pointer;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a data buffer for a USB request</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The device that the request will be sent to
 +
|-
 +
! Size
 +
| The size of the data buffer to allocate
 +
|-
 +
! Flags
 +
| The returned flags for the allocated buffer (eg USB_REQUEST_FLAG_SHARED)
 +
|-
 +
! Return
 +
| The newly allocated buffer or nil 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 USBBufferValidate(Device:PUSBDevice; Buffer:Pointer; Size:LongWord; var Flags:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Validate a data buffer for a USB request against the USB host requirements</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The device that the request will be sent to
 +
|-
 +
! Buffer
 +
| The data buffer to validate
 +
|-
 +
! Size
 +
| The size of the data buffer
 +
|-
 +
! Flags
 +
| The returned flags for the validated buffer (eg USB_REQUEST_FLAG_SHARED)
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS on success 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 USBBufferRelease(Buffer:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Release a data buffer from a USB request</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Data
 +
| The buffer to be released
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS on success 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 USBRequestAllocate(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Callback:TUSBRequestCompleted; Size:LongWord; DriverData:Pointer):PUSBRequest; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a new USB request</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 this request will be sent to
 +
|-
 +
! Endpoint
 +
| The Endpoint descriptor this request will be sent to (Or nil for the default control endpoint)
 +
|-
 +
! Callback
 +
| The callback function to be called on completion of the request
 +
|-
 +
! Size
 +
| The size of the data buffer for the request
 +
|-
 +
! DriverData
 +
| Device driver private data for the callback (Optional)
 +
|-
 +
! Return
 +
| The newly allocated request or nil 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 USBRequestAllocateEx(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Callback:TUSBRequestCompleted; var Data:Pointer; Size:LongWord; DriverData:Pointer):PUSBRequest;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a new USB request</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 this request will be sent to
 +
|-
 +
! Endpoint
 +
| The Endpoint descriptor this request will be sent to (Or nil for the default control endpoint)
 +
|-
 +
! Callback
 +
| The callback function to be called on completion of the request
 +
|-
 +
! Data
 +
| The returned data buffer allocated for the request (Or nil if size is zero)(Pass an existing buffer to prevent allocation)
 +
|-
 +
! Size
 +
| The size of the data buffer for the request
 +
|-
 +
! DriverData
 +
| Device driver private data for the callback (Optional)
 +
|-
 +
! Return
 +
| The newly allocated request or nil 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 USBRequestRelease(Request:PUSBRequest):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Release and destroy a USB request</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The request to be released
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS on success 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 USBRequestInitialize(Request:PUSBRequest; Callback:TUSBRequestCompleted; Data:Pointer; Size:LongWord; DriverData:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize or Reinitialize an existing USB request</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The request to be initialized
 +
|-
 +
! Callback
 +
| The callback function to be called on completion of the request
 +
|-
 +
! Data
 +
| The returned data buffer allocated for the request (Or nil if size is zero)
 +
|-
 +
! Size
 +
| The size of the data buffer for the request
 +
|-
 +
! DriverData
 +
| Device driver private data for the callback (Optional)
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS on success 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 USBRequestSubmit(Request:PUSBRequest):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Submit a USB request to a host controller for execution</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The request to be submitted
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| The request will be completed asynchronously by the host controller and the completion callback will be called when the request has either succeeded or failed
 +
|-
 +
|}
 +
</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 USBRequestCancel(Request:PUSBRequest):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Cancel a USB request previously submitted to a host controller</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The request to be cancelled
 +
|-
 +
! 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 USBRequestComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called by a host controller when a USB request 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
 +
| Not intended to be called directly by applications
 +
|-
 +
|}
 +
</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 USBControlRequest(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; bRequest,bmRequestType:Byte; wValue,wIndex:Word; Data:Pointer; wLength:Word):LongWord; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Send a USB control request to the specified device and wait for the request to complete</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 send the control request to
 +
|-
 +
! Endpoint
 +
| The Endpoint to use for the control request (or nil for the default control endpoint)
 +
|-
 +
! bRequest
 +
| The request to send
 +
(See Section 9.4 of the USB 2.0 specification for Standard requests)
 +
|-
 +
! bmRequest
 +
| Type of request to send
 +
(See Section 9.3.1 of the USB 2.0 specification for Standard request types)
 +
|-
 +
! wValue
 +
| Request specific data
 +
|-
 +
! wIndex
 +
| Request specific data
 +
|-
 +
! Data
 +
| Buffer for the data to be sent or received from the request (Ignored if wLength is 0)
 +
|-
 +
! wLength
 +
| Length of the Data buffer in bytes
 +
|-
 +
! 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;">function USBControlRequestEx(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; bRequest,bmRequestType:Byte; wValue,wIndex:Word; Data:Pointer; wLength:Word; Timeout:LongWord; AllowShort:Boolean):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Send a USB control request to the specified device and wait for the request to complete</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 send the control request to
 +
|-
 +
! Endpoint
 +
| The Endpoint to use for the control request (or nil for the default control endpoint)
 +
|-
 +
! bRequest
 +
| The request to send
 +
(See Section 9.4 of the USB 2.0 specification for Standard requests)
 +
|-
 +
! bmRequest
 +
| Type of request to send
 +
(See Section 9.3.1 of the USB 2.0 specification for Standard request types)
 +
|-
 +
! wValue
 +
| Request specific data
 +
|-
 +
! wIndex
 +
| Request specific data
 +
|-
 +
! Data
 +
| Buffer for the data to be sent or received from the request (Ignored if wLength is 0)
 +
|-
 +
! wLength
 +
| Length of the Data buffer in bytes
 +
|-
 +
! Timeout
 +
| Milliseconds to wait for request to complete (INFINITE to wait forever)
 +
|-
 +
! AllowShort
 +
| Allow the return size to be less than the requested size
 +
|-
 +
! 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 USBControlRequestComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from a USB control 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
 +
| Not intended to be called directly by applications
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''USB synchronous transfer methods'''
 +
 +
<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 USBTransfer(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Data:Pointer; Size:LongWord; var Count:LongWord; Timeout:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a synchronous bulk or interrupt transfer to a USB device and endpoint</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 send the request to
 +
|-
 +
! Endpoint
 +
| The Endpoint to use for the request
 +
|-
 +
! Data
 +
| Buffer for the data to be sent or received from the request (Ignored if Size is 0)
 +
|-
 +
! Size
 +
| Size of the Data buffer in bytes
 +
|-
 +
! Count
 +
| The actual number of bytes transferred on completion (May apply even on failure or timeout)
 +
|-
 +
! Timeout
 +
| Milliseconds to wait for request to complete (INFINITE to wait forever)
 +
|-
 +
! 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 USBTransferComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB control, bulk or interrupt transfer (scheduled by USBTransfer or USBControlTransfer) 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
 +
| Not intended to be called directly by applications
 +
|-
 +
|}
 +
</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 USBControlTransfer(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; bRequest,bmRequestType:Byte; wValue,wIndex:Word; Data:Pointer; wLength:Word; var Count:LongWord; Timeout:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a synchronous control transfer to a USB device and endpoint</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 send the control request to
 +
|-
 +
! Endpoint
 +
| The Endpoint to use for the control request (or nil for the default control endpoint)
 +
|-
 +
! bRequest
 +
| The request to send
 +
(See Section 9.4 of the USB 2.0 specification for Standard requests)
 +
|-
 +
! bmRequestType
 +
| Type of request to send
 +
(See Section 9.3.1 of the USB 2.0 specification for Standard request types)
 +
|-
 +
! wValue
 +
| Request specific data
 +
|-
 +
! wIndex
 +
| Request specific data
 +
|-
 +
! Data
 +
| Buffer for the data to be sent or received from the request (Ignored if wLength is 0)
 +
|-
 +
! wLength
 +
| Length of the Data buffer in bytes
 +
|-
 +
! Count
 +
| The actual number of bytes transferred on completion (May apply even on failure or timeout)
 +
|-
 +
! Timeout
 +
| Milliseconds to wait for request to complete (INFINITE to wait forever)
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| This function is very similar to USBControlRequest(Ex) but also returns the actual number of bytes transferred
 +
|-
 +
|}
 +
</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 USBBulkTransfer(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Data:Pointer; Size:LongWord; var Count:LongWord; Timeout:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a synchronous bulk transfer to a USB device and endpoint</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 send the bulk request to
 +
|-
 +
! Endpoint
 +
| The Endpoint to use for the bulk request
 +
|-
 +
! Data
 +
| Buffer for the data to be sent or received from the request (Ignored if Size is 0)
 +
|-
 +
! Size
 +
| Size of the Data buffer in bytes
 +
|-
 +
! Count
 +
| The actual number of bytes transferred on completion (May apply even on failure or timeout)
 +
|-
 +
! Timeout
 +
| Milliseconds to wait for request to complete (INFINITE to wait forever)
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| The type and direction of the transfer is determined from the type and direction of the endpoint
 +
|-
 +
|}
 +
</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 USBInterruptTransfer(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Data:Pointer; Size:LongWord; var Count:LongWord; Timeout:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a synchronous interrupt transfer to a USB device and endpoint</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 send the interrupt request to
 +
|-
 +
! Endpoint
 +
| The Endpoint to use for the interrupt request
 +
|-
 +
! Data
 +
| Buffer for the data to be sent or received from the request (Ignored if Size is 0)
 +
|-
 +
! Size
 +
| Size of the Data buffer in bytes
 +
|-
 +
! Count
 +
| The actual number of bytes transferred on completion (May apply even on failure or timeout)
 +
|-
 +
! Timeout
 +
| Milliseconds to wait for request to complete (INFINITE to wait forever)
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| The type and direction of the transfer is determined from the type and direction of the endpoint
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''USB hub 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 USBHubCreatePorts(Hub:PUSBHub):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create and initialize the ports for a Hub</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Hub
 +
| The hub to initialize ports for
 +
|-
 +
! 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;">function USBHubPowerOnPorts(Hub:PUSBHub):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Power on all ports on a Hub</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Hub
 +
| The hub to power on ports for
 +
|-
 +
! 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;">function USBHubCreateHubDescriptor(Hub:PUSBHub):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate the hub descriptor for the specified hub</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Hub
 +
| The hub to create the descriptor for
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| The class specific hub descriptor is not the same as the device descriptor
 +
|-
 +
|}
 +
</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 USBHubReadHubDescriptor(Hub:PUSBHub):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read the hub descriptor for the specified hub</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Hub
 +
| The hub to read the descriptor for
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| The class specific hub descriptor is not the same as the device descriptor
 +
|-
 +
|}
 +
</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 USBHubLock(Hub:PUSBHub):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Lock the specified Hub to prevent changes</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Hub
 +
| The hub to lock
 +
|-
 +
! Return
 +
| ERROR_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;">function USBHubUnlock(Hub:PUSBHub):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unlock the specified Hub to allow changes</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Hub
 +
| The hub to unlock
 +
|-
 +
! Return
 +
| ERROR_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;">function USBHubSetState(Hub:PUSBHub; State:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the specified hub and send a notification</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Hub
 +
| The hub to set the state for
 +
|-
 +
! State
 +
| The new state to set and notify
 +
|-
 +
! Return
 +
| ERROR_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;">function USBHubAllocate(Device:PUSBDevice):PUSBHub;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create and Register a new Hub 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 that represents this hub
 +
|-
 +
! Return
 +
| Pointer to new Hub entry or nil if hub could not be created
 +
|-
 +
|}
 +
</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 USBHubRelease(Hub:PUSBHub):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister and Destroy a Hub device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Hub
 +
| The hub to deregister and destroy
 +
|-
 +
! Return
 +
| ERROR_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;">function USBHubFind(HubId:LongWord):PUSBHub;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubFindByName(const Name:String):PUSBHub; inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubFindByDescription(const Description:String):PUSBHub; inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubEnumerate(Callback:TUSBHubEnumerate; Data: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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubNotification(Hub:PUSBHub; Callback:TUSBHubNotification; Data:Pointer; Notification,Flags: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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubBindDevices(Device:PUSBDevice; Callback:TUSBDeviceBind);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate each device in the USB tree and call a bind callback for each one</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| USB device at which to start the enumeration
 +
|-
 +
! Callback
 +
| Bind callback function to execute for each 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;">procedure USBHubUnbindDevices(Device:PUSBDevice; Driver:PUSBDriver; Callback:TUSBDeviceUnbind);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate each device in the USB tree and call an unbind callback for each one</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| USB device at which to start the enumeration
 +
|-
 +
! Driver
 +
| The driver to unbind the device from (nil to unbind from current driver)
 +
|-
 +
! Callback
 +
| Unbind callback function to execute for each 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;">procedure USBHubEnumerateDevices(Device:PUSBDevice; Callback:TUSBDeviceEnumerate; Data:Pointer);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate each device in the USB tree and call an enumerate callback for each one</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| USB device at which to start the enumeration
 +
|-
 +
! Callback
 +
| Enumerate callback function to execute for each 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 USBHubPortReset(Port:PUSBPort; Delay:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Reset a the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to reset
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub 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;">function USBHubPortDisable(Port:PUSBPort):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Disable the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to disable
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub lock
 +
A port cannot be enabled in software, only disabled.
 +
|-
 +
|}
 +
</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 USBHubPortPowerOn(Port:PUSBPort):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Power on the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to power on
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub lock
 +
Not all hubs support powering on and off individual ports, you must check if the hub includes the USB_HUB_CHARACTERISTIC_LPSM_PORT in its descriptor.
 +
|-
 +
|}
 +
</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 USBHubPortPowerOff(Port:PUSBPort):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Power off the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to power off
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub lock
 +
Not all hubs support powering on and off individual ports, you must check if the hub includes the USB_HUB_CHARACTERISTIC_LPSM_PORT in its descriptor.
 +
|-
 +
|}
 +
</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 USBHubPortGetStatus(Port:PUSBPort):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read the status of the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to read status for
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub 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;">function USBHubPortSetFeature(Port:PUSBPort; Feature:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enable a feature on the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to enable the feature on
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub 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;">function USBHubPortClearFeature(Port:PUSBPort; Feature:Word):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Disable a feature on the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to disable the feature on
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub 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;">function USBHubPortChangeFeature(Port:PUSBPort; Feature:Word; Enable:Boolean):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enable or disable a feature on the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to enable or disable the feature on
 +
|-
 +
! Feature
 +
| The feature to enable or disable
 +
|-
 +
! Enable
 +
| True to enable the feature or False to disable the feature
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub 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;">function USBHubPortAttachDevice(Port:PUSBPort):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Attach a newly connected USB device to the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to attach the new device to
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub lock
 +
Only called in response to a status change on the hub
 +
|-
 +
|}
 +
</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 USBHubPortDetachDevice(Port:PUSBPort):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Detach a disconnected USB device from the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to detach the device from
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub lock
 +
Only called in response to a status change on the hub
 +
|-
 +
|}
 +
</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 USBHubPortStatusChanged(Port:PUSBPort):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Process a status change for the specified USB port</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Port
 +
| USB port to process the status change for
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the hub lock
 +
Only called in response to a status change on the hub
 +
|-
 +
|}
 +
</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 USBHubExecute(Parameter:Pointer):PtrInt;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' The Hub thread procedure which is responsible for receiving completed hub status change requests, processing them for changes and then resubmitting the request</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| One status change request exists for each hub currently connected and is created and submitted by the hub driver when it binds to a new hub device. When a hub is disconnected the hub driver will remove the request when the hub is detached and destroyed.
 +
|-
 +
|}
 +
</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 USBHubStatusComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when the USB request from a USB hub 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
 +
|-
 +
|}
 +
</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 USBHubDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Bind the Hub 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 USBHubDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind the Hub 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 />
 +
 +
'''USB device, driver and host helper 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 USBDeviceGetCount:LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current device count</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceCheck(Device:PUSBDevice):PUSBDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied Device is in the device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDriverGetCount:LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current USB driver count</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDriverCheck(Driver:PUSBDriver):PUSBDriver;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied USB Driver is in the driver table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostGetCount:LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current host count</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostCheck(Host:PUSBHost):PUSBHost;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied Host is in the host table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsHub(Device:PUSBDevice):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True if Device is a Hub or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsRootHub(Device:PUSBDevice):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True if Device is a Root Hub or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsControlRequest(Request:PUSBRequest):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True if Request is a control request or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsBulkRequest(Request:PUSBRequest):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True if Request is a bulk request or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsInterruptRequest(Request:PUSBRequest):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True if Request is an interrupt request or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsIsochronousRequest(Request:PUSBRequest):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True if Request is an isochronous request or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsInEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True is Endpoint is an IN endpoint or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsOutEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True is Endpoint is an OUT endpoint or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsBulkEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True is Endpoint is a BULK endpoint or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsInterruptEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True is Endpoint is a INTERRUPT endpoint or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBIsIsochronousEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Returns True is Endpoint is a ISOCHRONOUS endpoint or False if not</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceToString(Device:PUSBDevice):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a description of 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
 +
| USB device to get a description of
 +
|-
 +
! Return
 +
| A string describing the 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 USBStatusToString(Status:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translates a USB status code into a string</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBClassCodeToString(ClassCode:Integer):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translates a USB class code into a string</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBSubClassCodeToString(ClassCode,SubClassCode:Integer):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translates a USB sub class code into a string</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBProtocolCodeToString(ClassCode,ProtocolCode:Integer):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translates a USB protocol code into a string</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBSpeedToString(Speed:Integer):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translates a USB speed constant into a string</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBSpeedToStringAlt(Speed:Integer):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translates a USB speed constant into a string (Alternate version)</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBTransferTypeToString(TransferType:Integer):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translates a USB transfer type constant into a string</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDirectionToString(Direction:Integer):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translates a USB direction constant into a string</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBBCDVersionToString(BCDVersion:Word):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translates a bcdUSB (binary-coded-decimal USB version) value into a human-readable string</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! BCDVersion
 +
| The bcdUSB value (e.g. from a USB device descriptor) to translate
 +
|-
 +
! Return
 +
| String describing the USB version
 +
|-
 +
|}
 +
</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 USBPortStatusConnectedToString(Status:Word):String;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubCharacteristicsToString(HubCharacteristics:Word):String;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceTypeToString(USBType:LongWord):String;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceStateToString(USBState:LongWord):String;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceStatusToString(USBStatus:LongWord):String;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceStateToNotification(State:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Device state value into the notification code for device notifications</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBDeviceStatusToNotification(Status:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Device status value into the notification code for device notifications</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostTypeToString(HostType:LongWord):String;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostStateToString(HostState:LongWord):String;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHostStateToNotification(State:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Host state value into the notification code for device notifications</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLog(Level:LongWord; Device:PUSBDevice; const AText:String);</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogInfo(Device:PUSBDevice; const AText:String); inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogWarn(Device:PUSBDevice; const AText:String); inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogError(Device:PUSBDevice; const AText:String); inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogDebug(Device:PUSBDevice; const AText:String); inline;</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogDeviceConfiguration(Device:PUSBDevice; Output:TUSBLogOutput = nil; Data:Pointer = nil);</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogDeviceDescriptor(Device:PUSBDevice; Descriptor:PUSBDeviceDescriptor; Output:TUSBLogOutput = nil; Data:Pointer = nil);</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogConfigurationDescriptor(Device:PUSBDevice; Descriptor:PUSBConfigurationDescriptor; Output:TUSBLogOutput = nil; Data:Pointer = nil);</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogInterfaceDescriptor(Device:PUSBDevice; Descriptor:PUSBInterfaceDescriptor; Output:TUSBLogOutput = nil; Data:Pointer = nil);</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogEndpointDescriptor(Device:PUSBDevice; Descriptor:PUSBEndpointDescriptor; Output:TUSBLogOutput = nil; Data:Pointer = nil);</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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogDevices:LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Print information about all devices attached to the USB</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Return
 +
| ERROR_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;">function USBLogDevicesEx(Device:PUSBDevice; Output:TUSBLogOutput; DeviceCallback,TreeCallback:TUSBDeviceEnumerate; Data:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Print information about one or all devices attached to the USB with custom output and callbacks</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The device to print information about (nil for all devices)
 +
|-
 +
! Output
 +
| The log output callback to print information to (nil to use the default output)
 +
|-
 +
! Device Callback
 +
| The callback to print device information (nil if no device information should be printed)
 +
|-
 +
! Tree Callback
 +
| The callback to print tree information (nil if no tree information should be printed)
 +
|-
 +
! Data
 +
| A pointer to caller specific data which should be passed to the callbacks (Optional)
 +
|-
 +
! Return
 +
| ERROR_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;">function USBLogDeviceCallback(Device:PUSBDevice; Data: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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogTreeCallback(Device:PUSBDevice; Data: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
 +
| None documented
 +
|-
 +
|}
 +
</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 USBLogOutput(const AText:String; Data:Pointer);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Default log output procedure for USBLogDevices etc</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''USB hub helper 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 USBHubGetCount:LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current hub count</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubCheck(Hub:PUSBHub):PUSBHub;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied Hub is in the hub table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubIsMultiTT(Hub:PUSBHub):Boolean;</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;"
 +
|-
 +
! Return
 +
| Returns True if Hub has multiple Transaction Translators or False if not
 +
|-
 +
|}
 +
</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 USBHubIsCompound(Hub:PUSBHub):Boolean;</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;"
 +
|-
 +
! Return
 +
| Returns True if Hub is part of a Compound Device or False if not
 +
|-
 +
|}
 +
</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 USBHubHasPortIndicator(Hub:PUSBHub):Boolean;</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;"
 +
|-
 +
! Return
 +
| Returns True if Hub supports Port Indicators or False if not
 +
|-
 +
|}
 +
</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 USBHubHasPortPowerSwitching(Hub:PUSBHub):Boolean;</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;"
 +
|-
 +
! Return
 +
| Returns True if Hub supports per port Power Switching or False if not
 +
|-
 +
|}
 +
</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 USBHubHasPortCurrentProtection(Hub:PUSBHub):Boolean;</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;"
 +
|-
 +
! Return
 +
| Returns True if Hub supports per port Over Current Power Protection or False if not
 +
|-
 +
|}
 +
</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 USBHubGetTTThinkTime(Hub:PUSBHub):Byte;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the TT Think Time from a Hub</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubTypeToString(HubType:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the supplied Hub type value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubStateToString(HubState:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the supplied Hub state value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</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 USBHubStateToNotification(State:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Hub state value into the notification code for device notifications</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Latest revision as of 04:07, 28 March 2024

Return to Unit Reference


Description


Ultibo USB Interface unit

This unit implements the USB core software that does not depend on the specific host controller hardware and is not specific to any single USB device or platform.

Features and limitations:

  • This driver is written to be compatible with USB 2.0. USB 3.0 devices work correctly when operating in USB 2.0 compatible mode, actual support for USB 3.0 host controllers and native super speed modes will require some modification to this driver.
  • Not all USB transfer types and speeds are supported yet. This depends on the Host Controller Driver, see USBRequestSubmit.
  • This driver does not attempt to do any intelligent power management, bandwidth allocation, or transfer scheduling. Devices are always set to their first listed configuration regardless of power requirements. Requests are simply passed to the Host Controller Driver in the order submitted, the Host Controller Driver is responsible for doing any more intelligent scheduling if desired.
  • This driver does not support multiple configurations per USB device. If a device happens to have multiple configurations, the first one will be assigned (see devices below for more information).
  • By design, it is possible to implement a host controller driver for different host controller hardware without changing any of this code, as long as the host controller driver provides the functions declared in TUSBHost (Start, Stop, Reset, Submit and Cancel).
  • By design, this driver has a hard-coded dependency on the USB hub driver because USB is useless without hubs.

To initialize this core USB driver, USBInit must be called by the system startup code. See that function for details.

If the flag USB_AUTOSTART is not set then USBStart must be called to start the USB core. See that function for details.

The other functions exported by this core USB driver are mostly intended to be used by USB device drivers.

Debugging messages in this driver can be enabled by changing the value of USB_DEFAULT_LOG_LEVEL and by enabling the USB_DEBUG define in GlobalDefines.

Be careful when enabling USB debugging as the USB core can generate a lot of messages due to constant polling of interrupt endpoints on devices such as hubs, keyboards and mice.

USB Device

USB devices are the generic implementation of anything that can be connected to the USB bus. All USB devices require a driver to implement the specific behaviour of the device but at the generic level each device will have:

  • One or more configurations available. The USB core will first offer the device to drivers without a configuration being selected, the driver may choose a specific configuration if required otherwise the core will simply select the first available configuration.
  • One or more interfaces available. On devices with multiple interfaces, the USB core supports different drivers binding to different interfaces. This way combination devices are supported.
  • One or more endpoints available. All devices must have a control endpoint and most devices will have one or more bulk, interrupt or isochronous endpoints as well. The USB core will only communicate with the control endpoint to perform generic operations like reading the descriptors and assigning a device address.

Drivers are expected to understand which endpoints they need to communicate with to provide the device specific functionality.

Devices are considered dynamic by the USB core and can be connected or disconnected at any time. The hub driver is responsible for attaching and detaching devices in response to hub status change events and for binding or unbinding drivers as devices are added or removed.

USB Driver

USB drivers implement support for specific devices or specific device classes and provide the interfaces to present those devices to other parts of the system. For example the USB Mass Storage driver accepts devices of the mass storage class and presents them to the file system as a disk device.

All drivers must implement the functions defined in TUSBDriver (Bind and Unbind) and must register themselves with the USB core by calling USBDriverRegister. When a new device is detected the hub driver will enumerate all drivers and call their Bind functions until either one of the drivers accepts the device or all drivers have rejected the device. The hub driver first attempts to bind each driver to the device itself and then offers each driver the option to bind to a single interface on the device. In this way devices that have multiple interfaces of different classes (such as a wireless mouse and keyboard dongle) can actually be bound to multiple drivers which each service a specific interface.

When a new driver is registered the USB core will call the drivers Bind function for each device already present to allow the driver an opportunity to bind to any existing devices that are not serviced by other drivers.

When a device is disconnected the hub driver will first call the Unbind function of any driver that is servicing the device to allow the driver to clean up allocated resources and cancel outstanding requests. Drivers must be careful not to block the hub driver during this process, for example trying to send a USB control message to the device at this time will likely be pointless as in many cases the device will have already been disconnected from the system.

USB Host

USB hosts implement the hardware level interface that supports sending USB requests to the hardware and receiving responses. All handling of interrupts, DMA, transaction sequence, errors and resubmitting/retrying requests is done by the USB host driver. All host drivers must implement the functions defined in TUSBHost (Start, Stop, Reset, Submit and Cancel) and must register themselves with the USB core by calling USBHostRegister. When the USB core is started each registered host driver will be called via the Start function so it can initialize itself and allocate locks, buffers and other resources required to interact with the hardware.

A host driver can also be registered after the USB core has been started and it will be given the opportunity to start itself immediately. In this way USB hosts can potentially be hot pluggable.

Each host driver must also implement a root hub which represents the port or ports that are directly connected to the controller hardware. In many cases this will not be a real hub but will be simulated in the host driver so that the hub driver can interact with it as though it was a standard hub device.

USB Hub

Hubs are one of the fundamental devices in USB and are used to provide connection points (ports) for additional devices. Note that even if no "external" hub is plugged in, the USB still will have at least one logical hub (the root hub) and usually additional "internal" hubs. That is, a USB is a tree of devices where the root node and all non-leaf nodes are hubs. A port on a USB hub may correspond to a port you can physically plug a device into or may correspond to an internal port. USB hubs are commonly based around a design that has 4 ports per hub, so a standard 7 port hub will most often appear as 2 hubs to this driver with one hub connected to a port on the other.

This hub driver is an example of a USB device driver, but it is somewhat special as it mandatory to include this driver if USB is supported at all. This is because it would be impossible to access any USB devices if a hub driver were not available. This hub driver also uses some interfaces in the core driver, such as USBDeviceAttach, that are not useful to any other USB device driver.

The initial entry point of this USB hub driver is USBHubDriverBind, which is called when the USB core has configured a newly attached USB device that may be a hub. USBHubDriverBind is responsible for checking if the device is a hub, and if so, doing hub-specific setup, reading the hub descriptor, powering on the ports, and submitting an asynchronous USB interrupt request to the hub's status change endpoint.

Everything else this hub driver does happens asynchronously as a response to a status change request being completed. Every USB hub has exactly one IN interrupt endpoint called the "status change endpoint". The hub responds on this endpoint whenever the status of the hub or one of the hub's ports has changed, for example when a USB device has been connected or disconnected from a port.

At the hardware level, when a hub has data to send on its status change endpoint, an interrupt will come in from the USB host controller. This eventually will result in the status change transfer being completed and USBHubStatusComplete being called. Thus, the detection of status changes is interrupt-driven and is not implemented by polling at the software level. (At the hardware level, USB is still a polled bus, but the host controller hardware handles that for us). Upon detecting a status change on one or more ports on a hub, the hub driver then must submit one or more control messages to the hub to determine exactly what changed on the affected ports.

Constants



USB device, driver and host specific constants USB_*_PREFIX
USB_DEVICE_PREFIX = 'USB'; Name prefix for USB Devices
USB_DRIVER_PREFIX = 'USB'; Name prefix for USB Drivers
USB_HOST_PREFIX = 'USBHost'; Name prefix for USB Hosts


USB device type USB_TYPE_*
USB_TYPE_NONE = 0;  
 
USB_TYPE_MAX = 0;  


USB device state USB_STATE_*
USB_STATE_DETACHED = 0;  
USB_STATE_DETACHING = 1;  
USB_STATE_ATTACHING = 2;  
USB_STATE_ATTACHED = 3;  
 
USB_STATE_MAX = 3;  


USB device status USB_STATUS_*
USB_STATUS_UNBOUND = 0;  
USB_STATUS_BOUND = 1;  
 
USB_STATUS_MAX = 1;  


USB device flag USB_FLAG_*
USB_FLAG_NONE = $00000000;  


USB host type USBHOST_TYPE_*
USBHOST_TYPE_NONE = 0;  
USBHOST_TYPE_EHCI = 1;  
USBHOST_TYPE_OHCI = 2;  
USBHOST_TYPE_UHCI = 3;  
USBHOST_TYPE_XHCI = 4;  
USBHOST_TYPE_DWCOTG = 5;  
 
USBHOST_TYPE_MAX = 5;  


USB host state USBHOST_STATE_*
USBHOST_STATE_DISABLED = 0;  
USBHOST_STATE_ENABLED = 1;  
 
USBHOST_STATE_MAX = 1;  


USB host flag USBHOST_FLAG_*
USBHOST_FLAG_NONE = $00000000;  
USBHOST_FLAG_SHARED = $00000001;  
USBHOST_FLAG_NOCACHE = $00000002;  


USB status code USB_STATUS_*
USB_STATUS_SUCCESS = 0; Function successful
USB_STATUS_DEVICE_DETACHED = 1; USB device was detached
USB_STATUS_DEVICE_UNSUPPORTED = 2; USB device is unsupported by the driver
USB_STATUS_HARDWARE_ERROR = 3; Hardware error of some form occurred
USB_STATUS_INVALID_DATA = 4; Invalid data was received
USB_STATUS_INVALID_PARAMETER = 5; An invalid parameter was passed to the function
USB_STATUS_NOT_PROCESSED = 6; The USB request has been submitted but not yet processed
USB_STATUS_OUT_OF_MEMORY = 7; Failed to allocate memory
USB_STATUS_TIMEOUT = 8; The operation timed out
USB_STATUS_UNSUPPORTED_REQUEST = 9; The request is unsupported
USB_STATUS_HARDWARE_STALL = 10; The device reported an endpoint STALL
USB_STATUS_OPERATION_FAILED = 11; The operation was not able to be completed
USB_STATUS_NOT_BOUND = 12; USB device is not bound to a driver
USB_STATUS_ALREADY_BOUND = 13; USB device is already bound to a driver
USB_STATUS_NOT_READY = 14; USB device is not in a ready state
USB_STATUS_NOT_COMPLETED = 15; The USB request has been scheduled but not yet completed
USB_STATUS_CANCELLED = 16; The USB request was cancelled
USB_STATUS_NOT_VALID = 17; The USB request is not valid


USB request flag USB_REQUEST_FLAG_*
USB_REQUEST_FLAG_NONE = $00000000;  
USB_REQUEST_FLAG_ALLOCATED = $00000001; Request data has been allocated by USBBufferAllocate (and can be freed by USBBufferRelease)
USB_REQUEST_FLAG_COMPATIBLE = $00000002; Request data is compatible with DMA requirements of host configuration (Can be passed directly to DMA)
USB_REQUEST_FLAG_ALIGNED = $00000004; Request data is aligned according to host configuration
USB_REQUEST_FLAG_SIZED = $00000008; Request data is sized according to host configuration
USB_REQUEST_FLAG_SHARED = $00000010; Request data has been allocated from Shared memory
USB_REQUEST_FLAG_NOCACHE = $00000020; Request data has been allocated from Non Cached memory


USB control phase USB_CONTROL_PHASE_*
USB_CONTROL_PHASE_SETUP = 0; Setup phase of a Control request (Using SetupData)
USB_CONTROL_PHASE_DATA = 1; Data phase of a Control request (Using Data buffer)
USB_CONTROL_PHASE_STATUS = 2; Status phase of a Control request (Using StatusData)


USB control timeout USB_CONTROL_*
USB_CONTROL_GET_TIMEOUT = 5000;  
USB_CONTROL_SET_TIMEOUT = 5000;  


USB packet size USB_*_*_PACKET_SIZE
USB_DEFAULT_MAX_PACKET_SIZE = 8; Default maximum packet size for unconfigured Endpoints
USB_ALTERNATE_MAX_PACKET_SIZE = 64;  
 
USB_MAX_PACKET_SIZE = 1024; Maximum packet size of any USB Endpoint (1024 is the maximum allowed by USB 2.0)


USB frame USB_FRAMES_*
USB_FRAMES_PER_MS = 1; Number of USB frames per millisecond


USB microframe USB_UFRAMES_*
USB_UFRAMES_PER_MS = 8; Number of USB microframes per millisecond


USB configuration attribute USB_CONFIGURATION_ATTRIBUTE_*
Values for bmAttributes in type TUSBConfigurationDescriptor
 
USB_CONFIGURATION_ATTRIBUTE_RESERVED_HIGH = $80;  
USB_CONFIGURATION_ATTRIBUTE_SELF_POWERED = $40;  
USB_CONFIGURATION_ATTRIBUTE_REMOTE_WAKEUP = $20;  
USB_CONFIGURATION_ATTRIBUTE_RESERVED_LOW = $1f;  


USB device status USB_DEVICE_STATUS_*
See Figure 9-4 of Section 9.4 of the USB 2.0 specification
Values for wStatus in type TUSBDeviceStatus (Device Recipient)
 
USB_DEVICE_STATUS_SELF_POWERED = (1 shl 0);  
USB_DEVICE_STATUS_REMOTE_WAKEUP = (1 shl 1);  


USB endpoint status USB_ENDPOINT_STATUS_*
See Figure 9-6 of Section 9.4 of the USB 2.0 specification
Values for vStatus in type TUSBDeviceStatus (Endpoint Recipient)
 
USB_ENDPOINT_STATUS_HALT = (1 shl 0);  


USB device speed USB_SPEED_*
USB_SPEED_HIGH = 0; 480 Mb/s
USB_SPEED_FULL = 1; 12 Mb/s
USB_SPEED_LOW = 2; 1.5 Mb/s
USB_SPEED_SUPER = 3; 5 Gb/s
USB_SPEED_SUPERPLUS = 4; 10 Gb/s


USB transfer type USB_TRANSFER_TYPE_*
Values for bmAttributes (bits 1..0) in type TUSBEndpointDescriptor
 
USB_TRANSFER_TYPE_CONTROL = 0;  
USB_TRANSFER_TYPE_ISOCHRONOUS = 1;  
USB_TRANSFER_TYPE_BULK = 2;  
USB_TRANSFER_TYPE_INTERRUPT = 3;  
USB_TRANSFER_TYPE_MASK = $03;  


USB transfer size USB_TRANSFER_SIZE_*
USB_TRANSFER_SIZE_8_BIT = 0;  
USB_TRANSFER_SIZE_16_BIT = 1;  
USB_TRANSFER_SIZE_32_BIT = 2;  
USB_TRANSFER_SIZE_64_BIT = 3;  


USB descriptor type USB_DESCRIPTOR_TYPE_*
See Table 9-5 in Section 9.4 of the USB 2.0 specification
Values for bDescriptorType in types TUSBDescriptorHeader and TUSBDeviceDescriptor
 
USB_DESCRIPTOR_TYPE_DEVICE = 1;  
USB_DESCRIPTOR_TYPE_CONFIGURATION = 2;  
USB_DESCRIPTOR_TYPE_STRING = 3;  
USB_DESCRIPTOR_TYPE_INTERFACE = 4;  
USB_DESCRIPTOR_TYPE_ENDPOINT = 5;  
USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER = 6;  
USB_DESCRIPTOR_TYPE_OTHER_SPEED_CONFIGURATION = 7;  
USB_DESCRIPTOR_TYPE_INTERFACE_POWER = 8;  
USB_DESCRIPTOR_TYPE_CLASS_DEVICE = $21; (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_DEVICE (See USB Device Class Definition for Audio Devices Specification)
USB_DESCRIPTOR_TYPE_CLASS_CONFIGURATION = $22; (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_CONFIGURATION
USB_DESCRIPTOR_TYPE_CLASS_STRING = $23; (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_STRING
USB_DESCRIPTOR_TYPE_CLASS_INTERFACE = $24; (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_INTERFACE
USB_DESCRIPTOR_TYPE_CLASS_ENDPOINT = $25; (USB_REQUEST_TYPE_CLASS shl 5) or USB_DESCRIPTOR_TYPE_ENDPOINT
USB_DESCRIPTOR_TYPE_HUB = $29;  


USB transfer direction USB_DIRECTION_*
See Table 9-2 of Section 9.3 of the USB 2.0 specification
Values for bmRequestType (bit 7) in type TUSBControlSetupData
 
USB_DIRECTION_OUT = 0; Host to Device
USB_DIRECTION_IN = 1; Device to Host


USB request type USB_REQUEST_TYPE_*
See Table 9-2 of Section 9.3 of the USB 2.0 specification
bits 6..5 of bmRequestType in type TUSBControlSetupData
 
USB_REQUEST_TYPE_STANDARD = 0;  
USB_REQUEST_TYPE_CLASS = 1;  
USB_REQUEST_TYPE_VENDOR = 2;  
USB_REQUEST_TYPE_RESERVED = 3;  


USB request recipient USB_REQUEST_RECIPIENT_*
See Table 9-2 of Section 9.3 of the USB 2.0 specification
bits 4..0 of bmRequestType in type TUSBControlSetupData
 
USB_REQUEST_RECIPIENT_DEVICE = 0;  
USB_REQUEST_RECIPIENT_INTERFACE = 1;  
USB_REQUEST_RECIPIENT_ENDPOINT = 2;  
USB_REQUEST_RECIPIENT_OTHER = 3;  


USB bmrequest type USB_BMREQUESTTYPE_*
See Table 9-2 of Section 9.3 of the USB 2.0 specification
Values of the bitfields within the bmRequestType member of TUSBControlSetupData
 
USB_BMREQUESTTYPE_DIR_OUT = (USB_DIRECTION_OUT shl 7);  
USB_BMREQUESTTYPE_DIR_IN = (USB_DIRECTION_IN shl 7);  
USB_BMREQUESTTYPE_DIR_MASK = ($01 shl 7);  
USB_BMREQUESTTYPE_TYPE_STANDARD = (USB_REQUEST_TYPE_STANDARD shl 5);  
USB_BMREQUESTTYPE_TYPE_CLASS = (USB_REQUEST_TYPE_CLASS shl 5);  
USB_BMREQUESTTYPE_TYPE_VENDOR = (USB_REQUEST_TYPE_VENDOR shl 5);  
USB_BMREQUESTTYPE_TYPE_RESERVED = (USB_REQUEST_TYPE_RESERVED shl 5);  
USB_BMREQUESTTYPE_TYPE_MASK = ($03 shl 5);  
USB_BMREQUESTTYPE_RECIPIENT_DEVICE = (USB_REQUEST_RECIPIENT_DEVICE shl 0);  
USB_BMREQUESTTYPE_RECIPIENT_INTERFACE = (USB_REQUEST_RECIPIENT_INTERFACE shl 0);  
USB_BMREQUESTTYPE_RECIPIENT_ENDPOINT = (USB_REQUEST_RECIPIENT_ENDPOINT shl 0);  
USB_BMREQUESTTYPE_RECIPIENT_OTHER = (USB_REQUEST_RECIPIENT_OTHER shl 0);  
USB_BMREQUESTTYPE_RECIPIENT_MASK = ($1f shl 0);  


USB device request USB_DEVICE_REQUEST_*
See Table 9-3 in Section 9.4 of the USB 2.0 specification
Values for bRequest in type TUSBControlSetupData
 
USB_DEVICE_REQUEST_GET_STATUS = 0;  
USB_DEVICE_REQUEST_CLEAR_FEATURE = 1;  
USB_DEVICE_REQUEST_SET_FEATURE = 3;  
USB_DEVICE_REQUEST_SET_ADDRESS = 5;  
USB_DEVICE_REQUEST_GET_DESCRIPTOR = 6;  
USB_DEVICE_REQUEST_SET_DESCRIPTOR = 7;  
USB_DEVICE_REQUEST_GET_CONFIGURATION = 8;  
USB_DEVICE_REQUEST_SET_CONFIGURATION = 9;  
USB_DEVICE_REQUEST_GET_INTERFACE = 10;  
USB_DEVICE_REQUEST_SET_INTERFACE = 11;  
USB_DEVICE_REQUEST_SYNCH_FRAME = 12;  
USB_DEVICE_REQUEST_SET_SEL = 48;  
USB_DEVICE_REQUEST_SET_ISOC_DELAY = 49;  


USB device feature USB_DEVICE_FEATURE_*
See Table 9-6 in Section 9.4 of the USB 2.0 specification
Values for wValue in type TUSBControlSetupData
 
USB_DEVICE_FEATURE_ENDPOINT_HALT = 0; Endpoint Only
USB_DEVICE_FEATURE_REMOTE_WAKEUP = 1; Device Only
USB_DEVICE_FEATURE_TEST_MODE = 2; Device Only


USB test mode USB_DEVICE_TEST_MODE_*
See Table 9-7 in Section 9.4 of the USB 2.0 specification
Values for wIndex in type TUSBControlSetupData
 
USB_DEVICE_TEST_MODE_J = $01;  
USB_DEVICE_TEST_MODE_K = $02;  
USB_DEVICE_TEST_MODE_SE0_NAK = $03;  
USB_DEVICE_TEST_MODE_PACKET = $04;  
USB_DEVICE_TEST_MODE_FORCE_ENABLE = $05;  


USB packet Id value USB_PACKETID_*
USB_PACKETID_UNDEF_0 = $f0;  
USB_PACKETID_OUT = $e1;  
USB_PACKETID_ACK = $d2;  
USB_PACKETID_DATA0 = $c3;  
USB_PACKETID_UNDEF_4 = $b4;  
USB_PACKETID_SOF = $a5;  
USB_PACKETID_UNDEF_6 = $96;  
USB_PACKETID_UNDEF_7 = $87;  
USB_PACKETID_UNDEF_8 = $78;  
USB_PACKETID_IN = $69;  
USB_PACKETID_NAK = $5a;  
USB_PACKETID_DATA1 = $4b;  
USB_PACKETID_PREAMBLE = $3c;  
USB_PACKETID_SETUP = $2d;  
USB_PACKETID_STALL = $1e;  
USB_PACKETID_UNDEF_F = $0f;  


USB class code USB_CLASS_CODE_*
bDeviceClass/bInterfaceClass
See: https://www.usb.org/defined-class-codes
Note that only the hub class is defined in the USB 2.0 specification itself the other standard class codes are defined in additional specifications
 
USB_CLASS_CODE_INTERFACE_SPECIFIC = $00; Use class code info from Interface Descriptors
USB_CLASS_CODE_AUDIO = $01; Audio device
USB_CLASS_CODE_COMMUNICATIONS_AND_CDC_CONTROL = $02; Communication device class
USB_CLASS_CODE_COMMS = USB_CLASS_CODE_COMMUNICATIONS_AND_CDC_CONTROL;  
USB_CLASS_CODE_HID = $03; HID device class
USB_CLASS_CODE_PHYSICAL = $05; Physical device class
USB_CLASS_CODE_IMAGE = $06; Still Imaging device
USB_CLASS_CODE_PRINTER = $07; Printer device
USB_CLASS_CODE_MASS_STORAGE = $08; Mass Storage device
USB_CLASS_CODE_HUB = $09; Hub Device
USB_CLASS_CODE_CDC_DATA = $0a; CDC data device
USB_CLASS_CODE_SMART_CARD = $0b; Smart Card device
USB_CLASS_CODE_CONTENT_SECURITY = $0d; Content Security device
USB_CLASS_CODE_VIDEO = $0e; Video device
USB_CLASS_CODE_PERSONAL_HEALTHCARE = $0f; Personal Healthcare device
USB_CLASS_CODE_AUDIO_VIDEO = $10; Audio/Video Devices
USB_CLASS_CODE_BILLBOARD = $11; Billboard Device
USB_CLASS_CODE_DIAGNOSTIC = $DC; Diagnostic Device
USB_CLASS_CODE_WIRELESS_CONTROLLER = $e0; Wireless Controller
USB_CLASS_CODE_MISCELLANEOUS = $ef; Miscellaneous
USB_CLASS_CODE_APPLICATION_SPECIFIC = $fe; Application Specific
USB_CLASS_CODE_VENDOR_SPECIFIC = $ff; Vendor Specific


USB subclass code USB_SUBCLASS_*
bDeviceSubClass/bInterfaceSubClass
See: https://www.usb.org/defined-class-codes
 
Communications Devices
USB_SUBCLASS_CDC_DLCM = $01; Direct Line Control Model (USBPSTN1.2)
USB_SUBCLASS_CDC_ACM = $02; Abstract Control Model (USBPSTN1.2)
USB_SUBCLASS_CDC_TCM = $03; Telephone Control Model (USBPSTN1.2)
USB_SUBCLASS_CDC_MCCM = $04; Multi-Channel Control Model (USBISDN1.2)
USB_SUBCLASS_CDC_CCM = $05; CAPI Control Model (USBISDN1.2)
USB_SUBCLASS_CDC_ETHERNET = $06; Ethernet Networking Control Model (USBECM1.2)
USB_SUBCLASS_CDC_WHCM = $08; Wireless Handset Control Model (USBWMC1.1)
USB_SUBCLASS_CDC_DMM = $09; Device Management Model (USBWMC1.1)
USB_SUBCLASS_CDC_MDLM = $0a; Mobile Direct Line Model (USBWMC1.1)
USB_SUBCLASS_CDC_OBEX = $0b; OBEX (USBWMC1.1)
USB_SUBCLASS_CDC_EEM = $0c; Ethernet Emulation Model (USBEEM1.0)
USB_SUBCLASS_CDC_NCM = $0d; Network Control Model (USBNCM1.0)
USB_SUBCLASS_CDC_MBIM = $0e;  
Still Image Devices
USB_SUBCLASS_IMAGE_DEFAULT = $01;  
Mass Storage Devices
USB_SUBCLASS_MASS_STORAGE_DEFAULT = $00; SCSI command set not reported, De facto use
USB_SUBCLASS_MASS_STORAGE_RBC = $01; Reduced Block Commands (RBC), INCITS 330:2000, available at http://www.t10.org
USB_SUBCLASS_MASS_STORAGE_MMC5 = $02; Multi-Media Command Set 5 (MMC-5), T10/1675-D available at http://www.t10.org
USB_SUBCLASS_MASS_STORAGE_QIC157 = $03; Obsolete was QIC-157
USB_SUBCLASS_MASS_STORAGE_UFI = $04; UFI Specifies how to interface Floppy Disk Drives to USB
USB_SUBCLASS_MASS_STORAGE_SFF8070I = $05; Obsolete Was SFF-8070i
USB_SUBCLASS_MASS_STORAGE_SCSI = $06; SCSI transparent command set
USB_SUBCLASS_MASS_STORAGE_LSDFS = $07; {LSD FS }  
USB_SUBCLASS_MASS_STORAGE_IEEE1667 = $08; IEEE 1667 Standard Protocol for Authentication in Host Attachments of Transient Storage Devices (IEEE 1667) available at www.ieee1667.com
USB_SUBCLASS_MASS_STORAGE_VENDOR_SPECIFIC = $ff; Specific to device vendor, De facto use
Content Security Devices
USB_SUBCLASS_CONTENT_SECURITY_DEFAULT = $00;  
Audio/Video Devices
USB_SUBCLASS_AUDIO_VIDEO_CONTROL = $01; Audio/Video Device AVControl Interface
USB_SUBCLASS_AUDIO_VIDEO_DATA_VIDEO = $02; Audio/Video Device AVData Video Streaming Interface
USB_SUBCLASS_AUDIO_VIDEO_DATA_AUDIO = $03; Audio/Video Device AVData Audio Streaming Interface
Billboard Devices
USB_SUBCLASS_BILLBOARD_DEFAULT = $00;  
Diagnostic Device
USB_SUBCLASS_DIAGNOSTIC_DEFAULT = $01;  
Wireless Controller
USB_SUBCLASS_WIRELESS_CONTROLLER_BLUETOOTH = $01;  
USB_SUBCLASS_WIRELESS_CONTROLLER_USB = $02;  
Miscellaneous
USB_SUBCLASS_MISCELLANEOUS_SYNC = $01;  
USB_SUBCLASS_MISCELLANEOUS_IAD_WAMP = $02; Interface Association Descriptor/Wire Adapter Multifunction Peripheral
USB_SUBCLASS_MISCELLANEOUS_CBAF = $03; Cable Based Association Framework
USB_SUBCLASS_MISCELLANEOUS_RNDIS = $04;  
USB_SUBCLASS_MISCELLANEOUS_USB3VISION = $05;  
Application Specific
USB_SUBCLASS_APPLICATION_SPECIFIC_DFU = $01;  
USB_SUBCLASS_APPLICATION_SPECIFIC_IRDA = $02;  
USB_SUBCLASS_APPLICATION_SPECIFIC_TMC = $02;  
Vendor Specific
USB_SUBCLASS_VENDOR_SPECIFIC = $ff; Vendor Specific


USB protocol code USB_PROTOCOL_*
bDeviceProtocol/bInterfaceProtocol
See: https://www.usb.org/defined-class-codes
 
Communications Devices
USB_PROTOCOL_CDC_ACM_NONE = 0; Abstract Control Model - No class specific protocol required
USB_PROTOCOL_CDC_ACM_AT_V25TER = 1; Abstract Control Model - AT Commands: V.250 etc
USB_PROTOCOL_CDC_ACM_AT_PCCA101 = 2; Abstract Control Model - AT Commands defined by PCCA-101
USB_PROTOCOL_CDC_ACM_AT_PCCA101_WAKE = 3; Abstract Control Model - AT Commands defined by PCCA-101 & Annex O
USB_PROTOCOL_CDC_ACM_AT_GSM = 4; Abstract Control Model - AT Commands defined by GSM 07.07
USB_PROTOCOL_CDC_ACM_AT_3G = 5; Abstract Control Model - AT Commands defined by 3GPP 27.007
USB_PROTOCOL_CDC_ACM_AT_CDMA = 6; Abstract Control Model - AT Commands defined by TIA for CDMA
USB_PROTOCOL_CDC_ACM_VENDOR = $ff; Abstract Control Model - Vendor-specific
USB_PROTOCOL_CDC_EEM = 7; Ethernet Emulation Model
USB_PROTOCOL_CDC_NCM_NTB = 1; Network Control Model - Network Transfer Block
USB_PROTOCOL_CDC_MBIM_NTB = 2; Network Transfer Block
Still Image Devices
USB_PROTOCOL_IMAGE_DEFAULT = $01;  
Mass Storage Devices
USB_PROTOCOL_MASS_STORAGE_CBI = $00; CBI (with command completion interrupt) USB Mass Storage Class Control/Bulk/Interrupt Transport
USB_PROTOCOL_MASS_STORAGE_CB = $01; CBI (with no command completion interrupt) USB Mass Storage Class Control/Bulk/Interrupt Transport
USB_PROTOCOL_MASS_STORAGE_BBB = $50; BBB USB Mass Storage Class Bulk-Only Transport
USB_PROTOCOL_MASS_STORAGE_UAS = $62; UAS
USB_PROTOCOL_MASS_STORAGE_VENDOR_SPECIFIC = $ff; Specific to device vendor, De facto use
Hub Devices
USB_PROTOCOL_HUB_FULLSPEED = $00; Full speed Hub
USB_PROTOCOL_HUB_HIGHSPEED_SINGLE_TT = $01; Hi-speed hub with single Transaction Translator
USB_PROTOCOL_HUB_HIGHSPEED_MULTI_TT = $02; Hi-speed hub with multiple Transaction Translators
Content Security Devices
USB_PROTOCOL_CONTENT_SECURITY_DEFAULT = $00;  
Audio/Video Devices
USB_PROTOCOL_AUDIO_VIDEO_DEFAULT = $00;  
Billboard Devices
USB_PROTOCOL_BILLBOARD_DEFAULT = $00;  
Diagnostic Device
USB_PROTOCOL_DIAGNOSTIC_DEFAULT = $01;  
Wireless Controller
USB_PROTOCOL_WIRELESS_CONTROLLER_BLUETOOTH = $01; See: http://www.bluetooth.com/
USB_PROTOCOL_WIRELESS_CONTROLLER_UWB = $02; See: Wireless USB Specification in Chapter 8
USB_PROTOCOL_WIRELESS_CONTROLLER_NDIS = $03; See: http://www.microsoft.com/windowsmobile/mobileoperators/default.mspx
USB_PROTOCOL_WIRELESS_CONTROLLER_BLUETOOTH_AMP = $04; See: http://www.bluetooth.com/
USB_PROTOCOL_WIRELESS_CONTROLLER_USB_HOST = $01; Host Wire Adapter Control/Data interface. Definition can be found in the Wireless USB Specification in Chapter 8
USB_PROTOCOL_WIRELESS_CONTROLLER_USB_DEVICE = $02; Device Wire Adapter Control/Data interface. Definition can be found in the Wireless USB Specification in Chapter 8
USB_PROTOCOL_WIRELESS_CONTROLLER_USB_DEVOCE_ISOC = $03; Device Wire Adapter Isochronous interface. Definition can be found in the Wireless USB Specification in Chapter 8
Miscellaneous
USB_PROTOCOL_MISCELLANEOUS_ACTIVESYNC = $01; Active Sync device
USB_PROTOCOL_MISCELLANEOUS_PALMSYNC = $02; Palm Sync
USB_PROTOCOL_MISCELLANEOUS_IAD = $01; Interface Association Descriptor. The usage of this class code triple is defined in the Interface Association Descriptor ECN
USB_PROTOCOL_MISCELLANEOUS_WAMP = $02; Wire Adapter Multifunction Peripheral programming interface. Definition can be found in the Wireless USB Specification in Chapter 8.
USB_PROTOCOL_MISCELLANEOUS_CBAF = $01; Cable Based Association Framework. This is defined in the Association Model addendum to the Wireless USB specification.
USB_PROTOCOL_MISCELLANEOUS_RNDIS_ETHERNET = $01; RNDIS over Ethernet
USB_PROTOCOL_MISCELLANEOUS_RNDIS_WIFI = $02; RNDIS over WiFi
USB_PROTOCOL_MISCELLANEOUS_RNDIS_WIMAX = $03; RNDIS over WiMAX
USB_PROTOCOL_MISCELLANEOUS_RNDIS_WWAN = $04; RNDIS over WWAN
USB_PROTOCOL_MISCELLANEOUS_RNDIS_IPV4 = $05; RNDIS for Raw IPv4
USB_PROTOCOL_MISCELLANEOUS_RNDIS_IPV6 = $06; RNDIS for Raw IPv6
USB_PROTOCOL_MISCELLANEOUS_RNDIS_GPRS = $07; RNDIS for GPRS
USB_PROTOCOL_MISCELLANEOUS_USB3VISION_CONTROL = $00; USB3 Vision Control Interface
USB_PROTOCOL_MISCELLANEOUS_USB3VISION_EVENT = $01; USB3 Vision Event Interface
USB_PROTOCOL_MISCELLANEOUS_USB3VISION_STREAM = $02; USB3 Vision Streaming Interface
Application Specific
USB_PROTOCOL_APPLICATION_SPECIFIC_DFU_DEFAULT = $01; Device Firmware Upgrade
USB_PROTOCOL_APPLICATION_SPECIFIC_IRDA_DEFAULT = $00; IRDA Bridge device
USB_PROTOCOL_APPLICATION_SPECIFIC_TMC_DEFAULT = $00; USB Test and Measurement Device
USB_PROTOCOL_APPLICATION_SPECIFIC_TMC_488 = $01; USB Test and Measurement Device conforming to the USBTMC USB488 Subclass Specification


USB primary language Id USB_LANG_*
See Language Identifiers supplement to the USB 2.0 specification
These are the first 10 bits of the 16-bit language identifier
 
Reserved $00
USB_LANG_ARABIC = $01; Arabic
USB_LANG_BULGARIAN = $02; Bulgarian
USB_LANG_CATALAN = $03; Catalan
USB_LANG_CHINESE = $04; Chinese
USB_LANG_CZECH = $05; Czech
USB_LANG_DANISH = $06; Danish
USB_LANG_GERMAN = $07; German
USB_LANG_GREEK = $08; Greek
USB_LANG_ENGLISH = $09; English
USB_LANG_SPANISH = $0a; Spanish
USB_LANG_FINNISH = $0b; Finnish
USB_LANG_FRENCH = $0c; French
USB_LANG_HEBREW = $0d; Hebrew
USB_LANG_HUNGARIAN = $0e; Hungarian
USB_LANG_ICELANDIC = $0f; Icelandic
USB_LANG_ITALIAN = $10; Italian
USB_LANG_JAPANESE = $11; Japanese
USB_LANG_KOREAN = $12; Korean
USB_LANG_DUTCH = $13; Dutch
USB_LANG_NORWEGIAN = $14; Norwegian
USB_LANG_POLISH = $15; Polish
USB_LANG_PORTUGUESE = $16; Portuguese
USB_LANG_ROMANIAN = $18; Romanian
USB_LANG_RUSSIAN = $19; Russian
USB_LANG_CROATIAN = $1a; Croatian
USB_LANG_SERBIAN = $1a; Serbian
USB_LANG_SLOVAK = $1b; Slovak
USB_LANG_ALBANIAN = $1c; Albanian
USB_LANG_SWEDISH = $1d; Swedish
USB_LANG_THAI = $1e; Thai
USB_LANG_TURKISH = $1f; Turkish
USB_LANG_URDU = $20; Urdu
USB_LANG_INDONESIAN = $21; Indonesian
USB_LANG_UKRANIAN = $22; Ukrainian
USB_LANG_BELARUSIAN = $23; Belarusian
USB_LANG_SLOVENIAN = $24; Slovenian
USB_LANG_ESTONIAN = $25; Estonian
USB_LANG_LATVIAN = $26; Latvian
USB_LANG_LITHUANIAN = $27; Lithuanian
USB_LANG_FARSI = $29; Farsi
USB_LANG_VIETNAMESE = $2a; Vietnamese
USB_LANG_ARMENIAN = $2b; Armenian
USB_LANG_AZERI = $2c; Azeri
USB_LANG_BASQUE = $2d; Basque
USB_LANG_MACEDONIAN = $2f; Macedonian
USB_LANG_AFRIKAANS = $36; Afrikaans
USB_LANG_GEORGIAN = $37; Georgian
USB_LANG_FAEROESE = $38; Faeroese
USB_LANG_HINDI = $39; Hindi
USB_LANG_MALAY = $3e; Malay
USB_LANG_KAZAK = $3f; Kazak
USB_LANG_SWAHILI = $41; Swahili
USB_LANG_UZBEK = $43; Uzbek
USB_LANG_TATAR = $44; Tatar
USB_LANG_BENGALI = $45; Bengali
USB_LANG_PUNJABI = $46; Punjabi
USB_LANG_GUJARATI = $47; Gujarati
USB_LANG_ORIYA = $48; Oriya
USB_LANG_TAMIL = $49; Tamil
USB_LANG_TELUGU = $4a; Telugu
USB_LANG_KANNADA = $4b; Kannada
USB_LANG_MALAYALAM = $4c; Malayalam
USB_LANG_ASSAMESE = $4d; Assamese
USB_LANG_MARATHI = $4e; Marathi
USB_LANG_SANSKRIT = $4f; Sanskrit
USB_LANG_KONKANI = $57; Konkani
USB_LANG_MANIPURI = $58; Manipuri
USB_LANG_SINDHI = $59; Sindhi
USB_LANG_KASHMIRI = $60; Kashmiri
USB_LANG_NEPALI = $61; Nepali
Reserved $62-$fe
USB_LANG_HID = $ff; Reserved for USB HID Class use
Reserved $100-$3ff
USB_PRIMARY_LANGUAGE_MASK = $3ff;  


USB sublanguage Id USB_SUBLANG_*
See Language Identifiers supplement to the USB 2.0 specification
These are the upper 6 bits of the 16-bit language identifier
 
Reserved $00-$02
USB_SUBLANG_ARABIC_SAUDI_ARABIA = $01; Arabic (Saudi Arabia)
USB_SUBLANG_ARABIC_IRAQ = $02; Arabic (Iraq)
USB_SUBLANG_ARABIC_EGYPT = $03; Arabic (Egypt)
USB_SUBLANG_ARABIC_LIBYA = $04; Arabic (Libya)
USB_SUBLANG_ARABIC_ALGERIA = $05; Arabic (Algeria)
USB_SUBLANG_ARABIC_MOROCCO = $06; Arabic (Morocco)
USB_SUBLANG_ARABIC_TUNISIA = $07; Arabic (Tunisia)
USB_SUBLANG_ARABIC_OMAN = $08; Arabic (Oman)
USB_SUBLANG_ARABIC_YEMEN = $09; Arabic (Yemen)
USB_SUBLANG_ARABIC_SYRIA = $10; Arabic (Syria)
USB_SUBLANG_ARABIC_JORDAN = $11; Arabic (Jordan)
USB_SUBLANG_ARABIC_LEBANON = $12; Arabic (Lebanon)
USB_SUBLANG_ARABIC_KUWAIT = $13; Arabic (Kuwait)
USB_SUBLANG_ARABIC_UAE = $14; Arabic (U.A.E.)
USB_SUBLANG_ARABIC_BAHRAIN = $15; Arabic (Bahrain)
USB_SUBLANG_ARABIC_QATAR = $16; Arabic (Qatar)
USB_SUBLANG_AZERI_CYRILLIC = $01; Azeri (Cyrillic)
USB_SUBLANG_AZERI_LATIN = $02; Azeri (Latin)
USB_SUBLANG_CHINESE_TRADITIONAL = $01; Chinese (Traditional)
USB_SUBLANG_CHINESE_SIMPLIFIED = $02; Chinese (Simplified)
USB_SUBLANG_CHINESE_HONGKONG = $03; Chinese (Hong Kong SAR, PRC)
USB_SUBLANG_CHINESE_SINGAPORE = $04; Chinese (Singapore)
USB_SUBLANG_CHINESE_MACAU = $05; Chinese (Macau SAR)
USB_SUBLANG_DUTCH = $01; Dutch
USB_SUBLANG_DUTCH_BELGIAN = $02; Dutch (Belgian)
USB_SUBLANG_ENGLISH_US = $01; English (US)
USB_SUBLANG_ENGLISH_UK = $02; English (UK)
USB_SUBLANG_ENGLISH_AUS = $03; English (Australian)
USB_SUBLANG_ENGLISH_CAN = $04; English (Canadian)
USB_SUBLANG_ENGLISH_NZ = $05; English (New Zealand)
USB_SUBLANG_ENGLISH_EIRE = $06; English (Ireland)
USB_SUBLANG_ENGLISH_SOUTH_AFRICA = $07; English (South Africa)
USB_SUBLANG_ENGLISH_JAMAICA = $08; English (Jamaica)
USB_SUBLANG_ENGLISH_CARIBBEAN = $09; English (Caribbean)
USB_SUBLANG_ENGLISH_BELIZE = $0a; English (Belize)
USB_SUBLANG_ENGLISH_TRINIDAD = $0b; English (Trinidad)
USB_SUBLANG_ENGLISH_PHILIPPINES = $0c; English (Zimbabwe)
USB_SUBLANG_ENGLISH_ZIMBABWE = $0d; English (Philippines)
USB_SUBLANG_FRENCH = $01; French
USB_SUBLANG_FRENCH_BELGIAN = $02; French (Belgian)
USB_SUBLANG_FRENCH_CANADIAN = $03; French (Canadian)
USB_SUBLANG_FRENCH_SWISS = $04; French (Swiss)
USB_SUBLANG_FRENCH_LUXEMBOURG = $05; French (Luxembourg)
USB_SUBLANG_FRENCH_MONACO = $06; French (Monaco)
USB_SUBLANG_GERMAN = $01; German
USB_SUBLANG_GERMAN_SWISS = $02; German (Swiss)
USB_SUBLANG_GERMAN_AUSTRIAN = $03; German (Austrian)
USB_SUBLANG_GERMAN_LUXEMBOURG = $04; German (Luxembourg)
USB_SUBLANG_GERMAN_LIECHTENSTEIN = $05; German (Liechtenstein)
USB_SUBLANG_ITALIAN = $01; Italian
USB_SUBLANG_ITALIAN_SWISS = $02; Italian (Swiss)
USB_SUBLANG_KASHMIRI_INDIA = $02; Kashmiri (India)
USB_SUBLANG_KOREAN = $01; Korean
USB_SUBLANG_LITHUANIAN = $01; Lithuanian
USB_SUBLANG_MALAY_MALAYSIA = $01; Malay (Malaysia)
USB_SUBLANG_MALAY_BRUNEI_DARUSSALAM = $02; Malay (Brunei Darassalam)
USB_SUBLANG_NEPALI_INDIA = $02; Nepali (India)
USB_SUBLANG_NORWEGIAN_BOKMAL = $01; Norwegian (Bokmal)
USB_SUBLANG_NORWEGIAN_NYNORSK = $02; Norwegian (Nynorsk)
USB_SUBLANG_PORTUGUESE = $01; Portuguese (Brazilian)
USB_SUBLANG_PORTUGUESE_BRAZILIAN = $02; Portuguese
USB_SUBLANG_SERBIAN_LATIN = $02; Serbian (Latin)
USB_SUBLANG_SERBIAN_CYRILLIC = $03; Serbian (Cyrillic)
USB_SUBLANG_SPANISH = $01; Spanish (Castilian)
USB_SUBLANG_SPANISH_MEXICAN = $02; Spanish (Mexican)
USB_SUBLANG_SPANISH_MODERN = $03; Spanish (Modern)
USB_SUBLANG_SPANISH_GUATEMALA = $04; Spanish (Guatemala)
USB_SUBLANG_SPANISH_COSTA_RICA = $05; Spanish (Costa Rica)
USB_SUBLANG_SPANISH_PANAMA = $06; Spanish (Panama)
USB_SUBLANG_SPANISH_DOMINICAN_REPUBLIC = $07; Spanish (Dominican Republic)
USB_SUBLANG_SPANISH_VENEZUELA = $08; Spanish (Venezuela)
USB_SUBLANG_SPANISH_COLOMBIA = $09; Spanish (Colombia)
USB_SUBLANG_SPANISH_PERU = $0a; Spanish (Peru)
USB_SUBLANG_SPANISH_ARGENTINA = $0b; Spanish (Argentina)
USB_SUBLANG_SPANISH_ECUADOR = $0c; Spanish (Ecuador)
USB_SUBLANG_SPANISH_CHILE = $0d; Spanish (Chile)
USB_SUBLANG_SPANISH_URUGUAY = $0e; Spanish (Uruguay)
USB_SUBLANG_SPANISH_PARAGUAY = $0f; Spanish (Paraguay)
USB_SUBLANG_SPANISH_BOLIVIA = $10; Spanish (Bolivia)
USB_SUBLANG_SPANISH_EL_SALVADOR = $11; Spanish (El Salvador)
USB_SUBLANG_SPANISH_HONDURAS = $12; Spanish (Honduras)
USB_SUBLANG_SPANISH_NICARAGUA = $13; Spanish (Nicaragua)
USB_SUBLANG_SPANISH_PUERTO_RICO = $14; Spanish (Puerto Rico)
USB_SUBLANG_SWEDISH = $01; Swedish
USB_SUBLANG_SWEDISH_FINLAND = $02; Swedish (Finland)
USB_SUBLANG_URDU_PAKISTAN = $01; Urdu (Pakistan)
USB_SUBLANG_URDU_INDIA = $02; Urdu (India)
USB_SUBLANG_UZBEK_LATIN = $01; Uzbek (Latin)
USB_SUBLANG_UZBEK_CYRILLIC = $02; Uzbek (Cyrillic)
USB_SUBLANG_HID_USAGE_DATA_DESCRIPTOR = $01; HID (Usage Data Descriptor)
USB_SUBLANG_HID_VENDOR_DEFINED_1 = $3c; HID (Vendor Defined 1)
USB_SUBLANG_HID_VENDOR_DEFINED_2 = $3d; HID (Vendor Defined 2)
USB_SUBLANG_HID_VENDOR_DEFINED_3 = $3e; HID (Vendor Defined 3)
USB_SUBLANG_HID_VENDOR_DEFINED_4 = $3f; HID (Vendor Defined 4)


USB primary language identifier USB_LANGID_*
See Language Identifiers supplement to the USB 2.0 specification
 
USB_LANGID_US_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_US shl 10)); English (US)
USB_LANGID_UK_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_UK shl 10)); English (UK)
USB_LANGID_AUS_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_AUS shl 10)); English (Australian)
USB_LANGID_CAN_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_CAN shl 10)); English (Canadian)
USB_LANGID_NZ_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_NZ shl 10)); English (New Zealand)
USB_LANGID_EIRE_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_EIRE shl 10)); English (Ireland)
USB_LANGID_SOUTH_AFRICA_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_SOUTH_AFRICA shl 10)); English (South Africa)
USB_LANGID_JAMAICA_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_JAMAICA shl 10)); English (Jamaica)
USB_LANGID_CARIBBEAN_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_CARIBBEAN shl 10)); English (Caribbean)
USB_LANGID_BELIZE_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_BELIZE shl 10)); English (Belize)
USB_LANGID_TRINIDAD_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_TRINIDAD shl 10)); English (Trinidad)
USB_LANGID_PHILIPPINES_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_PHILIPPINES shl 10)); English (Philippines)
USB_LANGID_ZIMBABWE_ENGLISH = (USB_LANG_ENGLISH or (USB_SUBLANG_ENGLISH_ZIMBABWE shl 10)); English (Zimbabwe)
 
USB_LANGID_USAGE_HID = (USB_LANG_HID or (USB_SUBLANG_HID_USAGE_DATA_DESCRIPTOR shl 10));  
USB_LANGID_VENDOR1_HID = (USB_LANG_HID or (USB_SUBLANG_HID_VENDOR_DEFINED_1 shl 10));  
USB_LANGID_VENDOR2_HID = (USB_LANG_HID or (USB_SUBLANG_HID_VENDOR_DEFINED_2 shl 10));  
USB_LANGID_VENDOR3_HID = (USB_LANG_HID or (USB_SUBLANG_HID_VENDOR_DEFINED_3 shl 10));  
USB_LANGID_VENDOR4_HID = (USB_LANG_HID or (USB_SUBLANG_HID_VENDOR_DEFINED_4 shl 10));  


USB vendor Id USB_VENDORID_*
USB_VENDORID_REALTEK = $0BDA; Realtek


USB tree output USB_TREE_*
USB_TREE_SPACES_PER_LEVEL = 6;  
USB_TREE_LINES_PER_PORT = 2;  


USB logging USB_LOG_*
USB_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG; USB debugging messages
USB_LOG_LEVEL_INFO = LOG_LEVEL_INFO; USB informational messages, such as a device being attached or detached
USB_LOG_LEVEL_WARN = LOG_LEVEL_WARN; USB warning messages
USB_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR; USB error messages
USB_LOG_LEVEL_NONE = LOG_LEVEL_NONE; No USB messages


USB hub specific constants USB_HUB_*
USB_HUB_PREFIX = 'USBHub'; Name prefix for USB Hubs


USB hub type USBHUB_TYPE_*
USBHUB_TYPE_NONE = 0;  
 
USBHUB_TYPE_MAX = 0;  


USB hub type name USBHUB_TYPE_NAMES*
USBHUB_TYPE_NAMES:array[USBHUB_TYPE_NONE..USBHUB_TYPE_MAX] of String = (
'USBHUB_TYPE_NONE');  


USB hub state USBHUB_STATE_*
USBHUB_STATE_DETACHED = 0;  
USBHUB_STATE_DETACHING = 1;  
USBHUB_STATE_ATTACHING = 2;  
USBHUB_STATE_ATTACHED = 3;  
 
USBHUB_STATE_MAX = 3;  


USB hub state name USBHUB_STATE_NAMES*
USBHUB_STATE_NAMES:array[USBHUB_STATE_DETACHED..USBHUB_STATE_MAX] of String = (
'USBHUB_STATE_DETACHED',  
'USBHUB_STATE_DETACHING',  
'USBHUB_STATE_ATTACHING',  
'USBHUB_STATE_ATTACHED');  


USB hub flag USBHUB_FLAG_*
USBHUB_FLAG_NONE = $00000000;  
USBHUB_FLAG_COMPOUND = $00000001; The Hub is part of a compound device
USBHUB_FLAG_PORT_POWER = $00000002; The Hub supports per port power switching
USBHUB_FLAG_PORT_PROTECTION = $00000004; The Hub supports per port over current protection
USBHUB_FLAG_MULTI_TRANSLATOR = $00000008; The Hub includes multiple transaction translators (1 per port)


USB hub thread USBHUB_THREAD_*
USBHUB_THREAD_STACK_SIZE = SIZE_32K; Stack size of USB hub thread
USBHUB_THREAD_PRIORITY = THREAD_PRIORITY_HIGHEST; Priority of USB hub thread
USBHUB_THREAD_NAME = 'USB Hub'; Name of USB hub thread


USB device USBHUB_DEVICE_*
USBHUB_DEVICE_DESCRIPTION = 'USB Hub'; Description of USB hub device


USB hub driver USBHUB_DRIVER_*
USBHUB_DRIVER_NAME = 'USB Hub Driver'; Name of USB hub driver


USB port reset USB_PORT_RESET_*
USB_PORT_RESET_TIMEOUT = 500; Maximum milliseconds to wait for a port to reset (500 is the same value that Linux uses)
USB_PORT_RESET_RECOVERY = 30; Milliseconds to wait after port reset to allow the device attached to the port to recover before any data transfers (USB 2.0 spec says 10ms)
USB_PORT_SHORT_RESET_DELAY = 10; Milliseconds between each status check on the port while waiting for it to finish being reset (Linux uses 10ms as the default value)
USB_PORT_LONG_RESET_DELAY = 200; Milliseconds between each status check on the port while waiting for it to finish being reset (Linux uses 200ms for Low Speed devices)
USB_PORT_ROOT_RESET_DELAY = 60; Milliseconds between each status check on the port while waiting for it to finish being reset (Linux uses 60ms for Root hub ports)
 
USB_ATTACH_DEBOUNCE_INTERVAL = 100; Milliseconds to wait after attachment for debounce (TATTDB)
USB_ADDRESS_COMPLETION_TIME = 50; Milliseconds to wait for set address completion (TDSETADDR)


USB hub characteristic USB_HUB_CHARACTERISTIC_*
Values for wHubCharacteristics in type TUSBHubDescriptor
See Table 11-13 in Section 11.23.2.1 of the USB 2.0 specification
 
USB_HUB_CHARACTERISTIC_LPSM = (3 shl 0); Logical Power Switching Mode
USB_HUB_CHARACTERISTIC_LPSM_GANGED = (0 shl 0); Ganged power switching (all ports power at once)
USB_HUB_CHARACTERISTIC_LPSM_PORT = (1 shl 0); Individual port power switching
USB_HUB_CHARACTERISTIC_IS_COMPOUND_DEVICE = (1 shl 2); Identifies a Compound Device (0 = Hub is not part of a compound device / 1 = Hub is part of a compound device)
USB_HUB_CHARACTERISTIC_OCPM = (3 shl 3); Over-current Protection Mode
USB_HUB_CHARACTERISTIC_OCPM_GLOBAL = (0 shl 3); Global Over-current Protection
USB_HUB_CHARACTERISTIC_OCPM_PORT = (1 shl 3); Individual Port Over-current Protection
USB_HUB_CHARACTERISTIC_OCPM_NONE = (2 shl 3); No Over-current Protection
USB_HUB_CHARACTERISTIC_TTTT = (3 shl 5); TT Think Time
USB_HUB_CHARACTERISTIC_TTTT_8 = (0 shl 5); TT requires at most 8 FS bit times of inter transaction gap
USB_HUB_CHARACTERISTIC_TTTT_16 = (1 shl 5); TT requires at most 16 FS bit times of inter transaction gap
USB_HUB_CHARACTERISTIC_TTTT_24 = (2 shl 5); TT requires at most 24 FS bit times of inter transaction gap
USB_HUB_CHARACTERISTIC_TTTT_32 = (3 shl 5); TT requires at most 32 FS bit times of inter transaction gap
USB_HUB_CHARACTERISTIC_PORT_INDICATOR = (1 shl 7); Port Indicators Supported (0 = Port Indicators are not supported / 1 = Port Indicators are supported)


USB hub feature USB_C_HUB_*
See Table 11-17 in Section 11.24.2 of the USB 2.0 specification
 
USB_C_HUB_LOCAL_POWER = 0;  
USB_C_HUB_OVER_CURRENT = 1;  


USB port feature USB_PORT_*
See Table 11-17 in Section 11.24.2 of the USB 2.0 specification
 
USB_PORT_CONNECTION = 0;  
USB_PORT_ENABLE = 1;  
USB_PORT_SUSPEND = 2;  
USB_PORT_OVER_CURRENT = 3;  
USB_PORT_RESET = 4;  
USB_PORT_POWER = 8;  
USB_PORT_LOW_SPEED = 9;  
USB_C_PORT_CONNECTION = 16;  
USB_C_PORT_ENABLE = 17;  
USB_C_PORT_SUSPEND = 18;  
USB_C_PORT_OVER_CURRENT = 19;  
USB_C_PORT_RESET = 20;  
USB_PORT_TEST = 21;  
USB_PORT_INDICATOR = 22;  


USB hub class request USB_HUB_REQUEST_*
See Table 11-16 in Section 11.24.2 of the USB 2.0 specification
 
USB_HUB_REQUEST_GET_STATUS = 0;  
USB_HUB_REQUEST_CLEAR_FEATURE = 1;  
USB_HUB_REQUEST_SET_FEATURE = 3;  
USB_HUB_REQUEST_GET_DESCRIPTOR = 6;  
USB_HUB_REQUEST_SET_DESCRIPTOR = 7;  
USB_HUB_REQUEST_CLEAR_TT_BUFFER = 8;  
USB_HUB_REQUEST_RESET_TT = 9;  
USB_HUB_REQUEST_GET_TT_STATE = 10;  
USB_HUB_REQUEST_STOP_TT = 11;  


USB port status USB_PORT_STATUS_*
See Table 11-21 in Section 11.24.2.7.1 of the USB 2.0 specification
Values for wPortStatus in type TUSBPortStatus
 
USB_PORT_STATUS_CONNNECTED = (1 shl 0);  
USB_PORT_STATUS_ENABLED = (1 shl 1);  
USB_PORT_STATUS_SUSPENDED = (1 shl 2);  
USB_PORT_STATUS_OVERCURRENT = (1 shl 3);  
USB_PORT_STATUS_RESET = (1 shl 4);  
USB_PORT_STATUS_POWERED = (1 shl 8);  
USB_PORT_STATUS_LOW_SPEED_ATTACHED = (1 shl 9);  
USB_PORT_STATUS_HIGH_SPEED_ATTACHED = (1 shl 10);  
USB_PORT_STATUS_TEST_MODE = (1 shl 11);  
USB_PORT_STATUS_INDICATOR_CONTROL = (1 shl 12);  


USB port change USB_PORT_CHANGE_*
See Table 11-20 in Section 11.24.2.6 of the USB 2.0 specification
Values for wPortChange in type TUSBPortStatus
 
USB_PORT_CHANGE_CONNECTED = (1 shl 0);  
USB_PORT_CHANGE_ENABLED = (1 shl 1);  
USB_PORT_CHANGE_SUSPENDED = (1 shl 2);  
USB_PORT_CHANGE_OVERCURRENT = (1 shl 3);  
USB_PORT_CHANGE_RESET = (1 shl 4);  


USB hub status USB_HUB_STATUS_*
See Table 11-19 in Section 11.24.2.6 of the USB 2.0 specification
Values for wHubStatus in type TUSBHubStatus
 
USB_HUB_STATUS_LOCAL_POWER = (1 shl 0);  
USB_HUB_STATUS_OVERCURRENT = (1 shl 1);  


USB hub change USB_HUB_CHANGE_*
See Table 11-20 in Section 11.24.2.6 of the USB 2.0 specification
Values for wHubChange in type TUSBHubStatus
 
USB_HUB_CHANGE_LOCAL_POWER = (1 shl 0);  
USB_HUB_CHANGE_OVERCURRENT = (1 shl 1);  


Type definitions



USB device Id

PUSBDeviceId = ^TUSBDeviceId;

TUSBDeviceId = record

Note: USB Device Id record for driver device identification (Not part of USB specification)
idVendor:Word;  
idProduct:Word;  

USB interface Id

PUSBInterfaceId = ^TUSBInterfaceId;

TUSBInterfaceId = record

Note: USB Interface Id record for driver device identification (Not part of USB specification)
bInterfaceClass:Byte;  
bInterfaceSubClass:Byte;  
bInterfaceProtocol:Byte;  

USB device and interface Id

PUSBDeviceAndInterfaceId = ^TUSBDeviceAndInterfaceId;

TUSBDeviceAndInterfaceId = record

Note: USB Device and Interface Id record for driver device identification (Not part of USB specification)
idVendor:Word;  
idProduct:Word;  
bInterfaceClass:Byte;  
bInterfaceSubClass:Byte;  
bInterfaceProtocol:Byte;  

USB device and interface no

PUSBDeviceAndInterfaceNo = ^TUSBDeviceAndInterfaceNo;

TUSBDeviceAndInterfaceNo = record

Note: USB Device and Interface No record for driver device identification (Not part of USB specification)
idVendor:Word;  
idProduct:Word;  
bInterfaceNumber:Byte;  

USB control setup data

PUSBControlSetupData = ^TUSBControlSetupData;

TUSBControlSetupData = packed record

Note: See Table 9-2 in Section 9.3 of the USB 2.0 specification
bmRequestType:Byte;  
bRequest:Byte;  
wValue:Word;  
wIndex:Word;  
wLength:Word;  

USB descriptor header

PUSBDescriptorHeader = ^TUSBDescriptorHeader;

TUSBDescriptorHeader = packed record

Note: See Table 9-8 in 9.6.1 of the USB 2.0 specification
bLength:Byte;  
bDescriptorType:Byte;  

USB device descriptor

PUSBDeviceDescriptor = ^TUSBDeviceDescriptor;

TUSBDeviceDescriptor = packed record

Note: See Table 9-8 in 9.6.1 of the USB 2.0 specification
bLength:Byte;  
bDescriptorType:Byte;  
bcdUSB:Word;  
bDeviceClass:Byte;  
bDeviceSubClass:Byte;  
bDeviceProtocol:Byte;  
bMaxPacketSize0:Byte;  
idVendor:Word;  
idProduct:Word;  
bcdDevice:Word;  
iManufacturer:Byte;  
iProduct:Byte;  
iSerialNumber:Byte;  
bNumConfigurations:Byte;  

USB configuration descriptor

PUSBConfigurationDescriptor = ^TUSBConfigurationDescriptor;

TUSBConfigurationDescriptor = packed record

Note: See Table 9-10 in Section 9.6.3 of the USB 2.0 specification
bLength:Byte;  
bDescriptorType:Byte;  
wTotalLength:Word;  
bNumInterfaces:Byte;  
bConfigurationValue:Byte;  
iConfiguration:Byte;  
bmAttributes:Byte;  
bMaxPower:Byte;  

USB interface descriptor

PUSBInterfaceDescriptor = ^TUSBInterfaceDescriptor;

TUSBInterfaceDescriptor = packed record

Note: See Table 9-12 in Section 9.6.6 of the USB 2.0 specification
bLength:Byte;  
bDescriptorType:Byte;  
bInterfaceNumber:Byte;  
bAlternateSetting:Byte;  
bNumEndpoints:Byte;  
bInterfaceClass:Byte;  
bInterfaceSubClass:Byte;  
bInterfaceProtocol:Byte;  
iInterface:Byte;  

USB endpoint descriptor

PUSBEndpointDescriptor = ^TUSBEndpointDescriptor;

TUSBEndpointDescriptor = packed record

Note: See Table 9-13 in Section 9.6.6 of the USB 2.0 specification
bLength:Byte;  
bDescriptorType:Byte;  
bEndpointAddress:Byte;  
bmAttributes:Byte;  
wMaxPacketSize:Word;  
bInterval:Byte;  

USB string descriptor

PUSBStringDescriptor = ^TUSBStringDescriptor;

TUSBStringDescriptor = packed record

Note: See Table 9-16 in Section 9.7 of the USB 2.0 specification
bLength:Byte;  
bDescriptorType:Byte;  
bString:array[0..0] of Word; UTF-16LE encoded string (specification says "UNICODE")

USB string descriptor string

PUSBStringDescriptorString = ^TUSBStringDescriptorString;

TUSBStringDescriptorString = array[0..125] of Word;

Note: Array type to allow typecasting of bString element in TUSBStringDescriptor (Maximum size of descriptor is 255) (126 x 2 + 2 = 254)

USB string descriptor LANGIDs

PUSBStringDescriptorLANGIDs = ^TUSBStringDescriptorLANGIDs;

TUSBStringDescriptorLANGIDs = array[0..125] of Word;

Note: Array type to allow typecasting of bString element in TUSBStringDescriptor (Maximum size of descriptor is 255) (126 x 2 + 2 = 254)

USB device status

PUSBDeviceStatus = ^TUSBDeviceStatus;

TUSBDeviceStatus = packed record

Note: Device status information returned by a USB_DEVICE_REQUEST_GET_STATUS control message (See Section 9.4.6 of the USB 2.0 specification)
wStatus:Word;  

USB device bind callback

TUSBDeviceBind = function(Device:PUSBDevice):LongWord;

USB device unbind callback

TUSBDeviceUnbind = function(Device:PUSBDevice; Driver:PUSBDriver):LongWord;

USB device enumeration callback

TUSBDeviceEnumerate = function(Device:PUSBDevice; Data:Pointer):LongWord;

USB device notification callback

TUSBDeviceNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

USB device

PUSBDevice = ^TUSBDevice;

TUSBDevice = record

Device Properties
Device:TDevice; The Device entry for this USB device
USB Properties
USBId:LongWord; Unique Id of this USB in the USB device table
USBState:LongWord; USB device state (eg USB_STATE_ATTACHED)
USBStatus:LongWord; USB device status (eg USB_STATUS_BOUND)
Host:PUSBHost; Host controller this USB device is connected to (Set by USB core)
Parent:PUSBDevice; Hub this USB device is connected to, or nil if this is the Root Hub (Set by USB core)
Driver:PUSBDriver; Driver this USB device is bound to, if any (Set by USB core)
Driver Properties
Lock:TMutexHandle; USB device lock
Address:LongWord; Address of this device (Set by USB core)
Speed:LongWord; Speed at which this device is attached (Set by USB core)
Depth:LongWord; Depth of this device (Root Hub is 0, next level hub is 1 etc) (Set by USB core)
PortNumber:LongWord; 1 based index of the USB port on the parent hub this device is plugged into (0 for the Root Hub) (Set by USB core)
ConfigurationValue:LongWord; The current configuration value of this USB device (Set by USB core)
Descriptor:PUSBDeviceDescriptor; Device descriptor of this device (Set by USB core)
Configuration:PUSBConfiguration; Currently selected configuration of this USB device (Set by USB core)
Configurations:array of PUSBConfiguration; All available configurations on this device (Set by USB core)
Product:array[0..127] of Char; Null terminated product string (ASCII encoded, English if available) of this device
Manufacturer:array[0..127] of Char; Null terminated manufacturer string (ASCII encoded, English if available) of this device
SerialNumber:array[0..127] of Char; Null terminated serial number string (ASCII encoded, English if available) of this device
DriverData:Pointer; Private data for the driver of this USB device
LastError:LongWord; Last error to occur on this device
PendingCount:LongWord; Number of USB requests pending for this device (Set by USB core)
WaiterThread:TThreadId; Thread waiting for pending requests to complete (for device detachment) (Set by USB core)
Statistics Properties
RequestCount:LongWord; Number of USB requests that have been submitted to this device
RequestErrors:LongWord; Number of USB requests that have failed on this device
Internal Properties
Prev:PUSBDevice; Previous entry in USB device table
Next:PUSBDevice; Next entry in USB device table

USB configuration

PUSBConfiguration = ^TUSBConfiguration;

TUSBConfiguration = record

Note: Forward declared to satisfy USBDevice
Driver Properties
Descriptor:PUSBConfigurationDescriptor; Configuration descriptor of this configuration (Set by USB core)
Interfaces:array of PUSBInterface; All available interfaces in this configuration (Set by USB core)
Description:array[0..127] of Char; Null terminated description string (ASCII encoded, English if available) of this configuration

USB interface

PUSBInterface = ^TUSBInterface;

TUSBInterface = record

Note: Forward declared to satisfy USBDevice
USB Properties
Driver:PUSBDriver; Driver this USB interface is bound to, if any (Set by USB core)
Driver Properties
AlternateCount:LongWord; The number of alternate settings available for this interface (Set by USB core)
AlternateSetting:LongWord; The currently selected alternate setting for this interface (Set by USB core)
Descriptor:PUSBInterfaceDescriptor; Interface descriptor of this interface (Set by USB core)
Endpoints:array of PUSBEndpointDescriptor; All available endpoint descriptors on this interface (Set by USB core)
Alternates:array of PUSBAlternate; All available alternate settings for this interface (Set by USB core)
Description:array[0..127] of Char; Null terminated description string (ASCII encoded, English if available) of this interface
ClassData:PByte; Pointer to the start of any class specific descriptors for this interface (Set by USB core)
ClassSize:LongWord; Size of any class specific descriptors for this interface (Set by USB core)
DriverData:Pointer; Private data for the driver of this USB interface

USB alternate

PUSBAlternate = ^TUSBAlternate;

TUSBAlternate = record

Note: Forward declared to satisfy USBDevice
Driver Properties
Descriptor:PUSBInterfaceDescriptor; Interface descriptor of this alternate setting (Set by USB core)
Endpoints:array of PUSBEndpointDescriptor; All available endpoint descriptors on this alternate setting (Set by USB core)
Description:array[0..127] of Char; Null terminated description string (ASCII encoded, English if available) of this alternate setting

USB driver enumeration callback

TUSBDriverEnumerate = function(Driver:PUSBDriver; Data:Pointer):LongWord;

USB driver bind

TUSBDriverBind = function(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;

USB driver unbind

TUSBDriverUnbind = function(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;

USB driver

PUSBDriver = ^TUSBDriver;

TUSBDriver = record

Note: Forward declared to satisfy USBDevice
Driver Properties
Driver:TDriver; The Driver entry for this USB Driver
USB Properties
DriverBind:TUSBDriverBind; A Driver specific DriverBind method implementing the standard USB driver interface
DriverUnbind:TUSBDriverUnbind; A Driver specific DriverUnbind method implementing the standard USB driver interface
Interface Properties
Lock:TMutexHandle; Driver lock
Internal Properties
Prev:PUSBDriver; Previous entry in Driver table
Next:PUSBDriver; Next entry in Driver table

USB host enumeration callback

TUSBHostEnumerate = function(Host:PUSBHost; Data:Pointer):LongWord;

USB host notification callback

TUSBHostNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

USB host start

TUSBHostStart = function(Host:PUSBHost):LongWord;

USB host stop

TUSBHostStop = function(Host:PUSBHost):LongWord;

USB host reset

TUSBHostReset = function(Host:PUSBHost):LongWord;

USB host submit

TUSBHostSubmit = function(Host:PUSBHost; Request:PUSBRequest):LongWord;

USB host cancel

TUSBHostCancel = function(Host:PUSBHost; Request:PUSBRequest):LongWord;

USB host

PUSBHost = ^TUSBHost;

TUSBHost = record

Note: Forward declared to satisfy USBDevice
Device Properties
Device:TDevice; The Device entry for this USB Host
USB Properties
HostId:LongWord; Unique Id of this Host in the Host table
HostState:LongWord; Host state (eg USBHOST_STATE_ENABLED)
HostStart:TUSBHostStart; A Host specific HostStart method implementing the standard USB host interface
HostStop:TUSBHostStop; A Host specific HostStop method implementing the standard USB host interface
HostReset:TUSBHostReset; A Host specific HostReset method implementing the standard USB host interface
HostSubmit:TUSBHostSubmit; A Host specific HostSubmit method implementing the standard USB host interface
HostCancel:TUSBHostCancel; A Host specific HostCancel method implementing the standard USB host interface
Driver Properties
Lock:TMutexHandle; Host lock
RootHub:PUSBDevice; The Root hub for this Host (or nil if the Host has not yet been started)
Alignment:LongWord; Host data buffer alignment (for DMA requests etc)
Multiplier:LongWord; Host data buffer multiplier (for DMA requests etc)
MaxTransfer:LongWord; Host maximum transfer size
Statistics Properties
RequestCount:LongWord; Number of USB requests that have been submitted to this host
RequestErrors:LongWord; Number of USB requests that have failed on this host
Internal Properties
Prev:PUSBHost; Previous entry in Host table
Next:PUSBHost; Next entry in Host table

USB request completed

TUSBRequestCompleted = procedure(Request:PUSBRequest);

USB request

PUSBRequest = ^TUSBRequest;

TUSBRequest = record

Note: Forward declared to satisfy USBHost
Request Properties
Device:PUSBDevice; USB Device to send this request to
Endpoint:PUSBEndpointDescriptor; Endpoint descriptor on the device to send this request to
Data:Pointer; Data buffer for the request (IN or OUT)
Size:LongWord; Size of data buffer (For IN requests, the maximum number of bytes of data to receive) (For OUT requests, the exact number of bytes of data to send)
Flags:LongWord; Flags for the request (eg USB_REQUEST_FLAG_ALIGNED)
Callback:TUSBRequestCompleted; Callback function that will be called when this USB request has been successfully completed or has failed
DriverData:Pointer; USB device driver private data for the completion callback (Optional)
Control Properties
SetupData:PUSBControlSetupData; Data for the Setup phase of a USB control request (Must be provided for control requests, ignored otherwise)
StatusData:LongWord; Data for the Status phase of a USB control request (For safety only as no data is normally transferred in the status phase)
Result Properties
Status:LongWord; Status of the transfer (USB_STATUS_SUCCESS if successful, or another error code if the transfer failed)
ActualSize:LongWord; Actual size of the data transferred (Should be checked after a successful IN request)
Driver Properties
Note: Private variables for use by Host drivers (Do not use from device drivers)
TransferData:Pointer; Host driver private data for transfer handling
CurrentData:Pointer; Host driver data pointer during transaction processing
IsPing:LongBool; Ping request in progress as part of request processing
IsSplit:LongBool; Request is a split transaction due to full or low speed device
CompleteSplit:LongBool; On a split transaction indicates if the request is on the start split or complete split phase
ShortAttempt:LongBool; The current transaction for this request is a short read or write
StartOfFrame:LongBool; The request needs to wait for the next start of frame to be started
ControlPhase:LongWord; The currently processing phase of a control request
NextDataPID:LongWord; The next Data PID for the data toggle during IN or OUT (Data0/Data1 etc)
AttemptedPackets:LongWord; The number of packets attempted in the current transaction
AttemptedBytes:LongWord; The number of bytes attempted in the current transaction
AttemptedPacketsRemaining:LongWord; The number of packets remaining in the current transaction
AttemptedBytesRemaining:LongWord; The number of bytes remaining in the current transaction
TotalPacketsAttempted:LongWord; The total number of packets attempted for this request
TotalBytesAttempted:LongWord; The total number of bytes attempted for this request
PacketsTransferred:LongWord; The number of packets transferred for this request
BytesTransferred:LongWord; The number of bytes transferred for this request
SplitErrorCount:LongWord; The number of split transaction errors for this request
CompleteSplitRetries:LongWord; The number of complete split retries for this request
ResubmitThread:TThreadHandle; The handle of the thread performing resubmit for this request (or INVALID_HANDLE_VALUE)
ResubmitSemaphore:TSemaphoreHandle; The handle of the semaphore used to signal the resubmit thread (or INVALID_HANDLE_VALUE)
Debug Statistics
StartSplitAttempts:LongWord; The number of start split attempts started for this request
CompleteSplitAttempts:LongWord; The number of complete split attempts started for this request
CompleteSplitRestarts:LongWord; The number of complete split restarts processed for this request
StartSplitNAKs:LongWord; The number of start split NAK responses received for this request
CompleteSplitNYETs:LongWord; The number of complete split NYET responses received for this request
CompleteSplitNAKs:LongWord; The number of complete split NAK responses received for this request

USB hub descriptor

PUSBHubDescriptor = ^TUSBHubDescriptor;

TUSBHubDescriptor = packed record

Note: See Table 11-13 in Section 11.23 of the USB 2.0 specification
bDescLength:Byte;  
bDescriptorType:Byte;  
bNbrPorts:Byte;  
wHubCharacteristics:Word;  
bPwrOn2PwrGood:Byte;  
bHubContrCurrent:Byte;  
varData:array[0..0] of Byte; Variable length field, 64 should be the maximum possible length (255 ports = 2 x 32 bytes of data)

USB hub descriptor data

PUSBHubDescriptorData = ^TUSBHubDescriptorData;

TUSBHubDescriptorData = array[0..63] of Byte;

Note: Array type to allow typecasting of varData element in TUSBHubDescriptor

USB port status

PUSBPortStatus = ^TUSBPortStatus;

TUSBPortStatus = packed record

Note: See Section 11.24.2.7 of the USB 2.0 specification
wPortStatus:Word; See: USB_PORT_STATUS values above
wPortChange:Word; See: USB_PORT_CHANGE values above

USB hub status

PUSBHubStatus = ^TUSBHubStatus;

TUSBHubStatus = packed record

Note: See Section 11.24.2.6 of the USB 2.0 specification
wHubStatus:Word; See: USB_HUB_STATUS values above
wHubChange:Word; See: USB_HUB_CHANGE values above

USB hub data

PUSBHubData = ^TUSBHubData;

TUSBHubData = record

Data:array[0..7] of Byte;  

USB port

PUSBPort = ^TUSBPort;

TUSBPort = record

Hub:PUSBHub; Pointer to the USB hub this port is attached to
Number:Byte; Number of this port (1-based)
Child:PUSBDevice; Pointer to the USB device attached to this port, or nil if there is none
Status:TUSBPortStatus; Status of this port

USB hub enumeration callback

TUSBHubEnumerate = function(Hub:PUSBHub; Data:Pointer):LongWord;

USB hub notification callback

TUSBHubNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

USB hub

PUSBHub = ^TUSBHub;

TUSBHub = record

Note: Forward declared to satisfy USBPort
Device Properties
Device:TDevice; The Device entry for this Hub
Hub Properties
HubId:LongWord; Unique Id of this Hub in the Hub table
HubState:LongWord; Hub state (eg USBHUB_STATE_ATTACHED)
Driver Properties
Lock:TMutexHandle; Hub lock
Descriptor:PUSBHubDescriptor; Class specific Descriptor for this hub
Ports:array of TUSBPort; Ports on this hub (Set by USBHubCreatePorts using the value in Descriptor.bNbrPorts)
Statistics Properties
ReceiveCount:LongWord;  
ReceiveErrors:LongWord;  
USB Properties
StatusData:PUSBHubData; Hub status change data buffer
StatusRequest:PUSBRequest; Hub status change request
StatusEndpoint:PUSBEndpointDescriptor; Hub Interrupt IN Endpoint
PendingCount:LongWord; Number of USB requests pending for this hub
WaiterThread:TThreadId; Thread waiting for pending requests to complete (for hub detachment)
Internal Properties
Prev:PUSBHub; Previous entry in Hub table
Next:PUSBHub; Next entry in Hub table

USB logging

TUSBLogOutput = procedure(const AText:String; Data:Pointer);


Public variables



USB log device output

USB_LOG_ALL_CONFIGURATIONS:Boolean = True;
USB_LOG_ALTERNATE_SETTINGS:Boolean = True;

USB log tree output

USB_TREE_SPACES_PER_LEVEL:LongWord = 6;
USB_TREE_LINES_PER_PORT:LongWord = 2;

USB logging

USB_DEFAULT_LOG_LEVEL:LongWord = USB_LOG_LEVEL_DEBUG; Minimum level for USB messages. Only messages with level greater than or equal to this will be printed.
USB_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

procedure USBInit;
Description: Performs basic initialization of the USB core driver, after this devices, hosts and drivers can be registered however nothing will work until USBStart is called
Note None documented


function USBStart:LongWord;
Description: Starts all registered USB hosts, starts the USB hub thread and begins the USB enumeration process. USB enumeration will continue after this function returns as devices are discovered by changes in hub status.
Note None documented


function USBStop:LongWord;
Description: To be documented
Note None documented


procedure USBAsyncStart(Host:PUSBHost);
Description: To be documented
Note None documented


USB device, driver and host functions

function USBDeviceGetAddress(Device:PUSBDevice):Byte;
Description: Get the bus address for the specified device
Device The USB device to get the address for
Return Device address or 0 on failure


function USBDeviceSetAddress(Device:PUSBDevice; Address:Byte):LongWord;
Description: Set the bus address for the specified device
Device The USB device to set the address for
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceGetDescriptor(Device:PUSBDevice; bRequest,bmRequestType:Byte; wValue,wIndex:Word; Data:Pointer; Length:Word):LongWord;
Description: Read any descriptor from the specified device using USBControlRequest
Device The USB device to read the descriptor from
bRequest See USBControlRequest
bmRequestType See USBControlRequest
wValue See USBControlRequest
wIndex See USBControlRequest
Data See USBControlRequest
Length See USBControlRequest
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceGetDeviceDescriptor(Device:PUSBDevice; Data:Pointer; Length:Word):LongWord;
Description: Read all or part of the device descriptor from the specified device using USBControlRequest
Device The USB device to read the device descriptor from
Data See USBControlRequest
Length See USBControlRequest
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceCreateDeviceDescriptor(Device:PUSBDevice; Length:Word):LongWord;
Description: Allocate a device descriptor for the specified device
Device The USB device to create the device descriptor for
Length The length of the descriptor to create
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceReadDeviceDescriptor(Device:PUSBDevice; Length:Word):LongWord; inline;
Description: Read all or part of the device descriptor from the specified device using USBControlRequest
Device The USB device to read the device descriptor from
Length The amount of the descriptor to read which may be less than the full size
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceReadDeviceDescriptorEx(Device:PUSBDevice; Length:Word; AllowShort:Boolean):LongWord;
Description: Read all or part of the device descriptor from the specified device using USBControlRequest
Device The USB device to read the device descriptor from
Length The amount of the descriptor to read which may be less than the full size
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceCreateConfigurations(Device:PUSBDevice):LongWord;
Description: Allocate the available configurations for this device
Device The USB device to create the configurations for
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceReadConfigurations(Device:PUSBDevice):LongWord;
Description: Read and parse the available configurations for this device
Device The USB device to read the configurations for
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceCreateConfiguration(Device:PUSBDevice; Index:Byte; Size:Word):LongWord;
Description: Allocate the specified configuration for this device
Device The USB device to create the configuration for
Index The index of the configuration to create
Size The size of the configuration descriptor to create
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceReadConfiguration(Device:PUSBDevice; Index:Byte):LongWord;
Description: Read and parse the specified configuration for this device
Device The USB device to read the configuration for
Index The index of the configuration to read
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceGetStringDescriptor(Device:PUSBDevice; Index:Byte; Data:Pointer; Length:Word):LongWord; inline;
Description: Read all or part of the specified string descriptor from the specified device using USBControlRequest
Device The USB device to read the string descriptor from
Index The index of the string descriptor to read
Data See USBControlRequest
Length See USBControlRequest
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceGetStringDescriptorEx(Device:PUSBDevice; Index:Byte;LanguageId:Word; Data:Pointer; Length:Word):LongWord;
Description: Read all or part of the specified string descriptor from the specified device using USBControlRequest
Device The USB device to read the string descriptor from
Index The index of the string descriptor to read
LanguageId The language identifier of the string descriptor to read (eg USB_LANGID_US_ENGLISH)
Data See USBControlRequest
Length See USBControlRequest
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceReadStringLanguageIds(Device:PUSBDevice):TUSBStringDescriptorLANGIDs;
Description: Get the list of supported string language identifiers from the specified device
Device The USB device to read the language identifiers from
Return An array of supported language identifiers (Unused values are returned as zero)


function USBDeviceReadStringDescriptor(Device:PUSBDevice; Index:Byte):String; inline;
Description: Get the content of the specified string descriptor from the specified device
Device The USB device to read the string descriptor from
Index The index of the string descriptor to read
Return The ANSI string content of the string descriptor or an empty string on failure


function USBDeviceReadStringDescriptorEx(Device:PUSBDevice;Index:Byte;LanguageId:Word):String;
Description: Get the content of the specified string descriptor from the specified device
Device The USB device to read the string descriptor from
Index The index of the string descriptor to read
Language Id The language identifier of the string descriptor to read (eg USB_LANGID_US_ENGLISH)
Return The ANSI string content of the string descriptor or an empty string on failure


function USBDeviceReadStringDescriptorW(Device:PUSBDevice; Index:Byte):UnicodeString; inline;
Description: Get the content of the specified string descriptor from the specified device
Device The USB device to read the string descriptor from
Index The index of the string descriptor to read
Return The Unicode string content of the string descriptor or an empty string on failure


function USBDeviceReadStringDescriptorExW(Device:PUSBDevice; Index:Byte; LanguageId:Word):UnicodeString;
Description: Get the content of the specified string descriptor from the specified device
Device The USB device to read the string descriptor from
Index The index of the string descriptor to read
LanguageId The language identifier of the string descriptor to read (eg USB_LANGID_US_ENGLISH)
Return The Unicode string content of the string descriptor or an empty string on failure


function USBDeviceGetConfigurationDescriptor(Device:PUSBDevice; Index:Byte;Data:Pointer; Length:Word):LongWord;
Description: Read all or part of the specified configuration descriptor from the specified device using USBControlRequest
Device The USB device to read the configuration descriptor from
Index The index of the configuration descriptor to read
Data See USBControlRequest
Length See USBControlRequest
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceGetConfiguration(Device:PUSBDevice; var ConfigurationValue:Byte):LongWord;
Description: Get the current configuration for the specified device
Device The USB device to get the current configuration for
ConfigurationValue The current configuration (As per bConfigurationValue in the configuration descriptor)
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceSetConfiguration(Device:PUSBDevice; ConfigurationValue:Byte):LongWord;
Description: Set the configuration for the specified device
Device The USB device to set the configuration for
ConfigurationValue The configuration to set (As per bConfigurationValue in the configuration descriptor)
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceFindConfigurationByValue(Device:PUSBDevice; ConfigurationValue:Byte):PUSBConfiguration;
Description: Find the configuration represented by configuration value for the specified device
Device The USB device to find the configuration for
ConfigurationValue The configuration value to find (As per bConfigurationValue in the configuration descriptor)
Return USB Configuration if completed or nil on failure


function USBDeviceGetHub(Device:PUSBDevice):PUSBHub;
Description: Get the USB Hub that the specified device is connected to
Device The USB device to get the hub for
Return USB Hub if successful or nil on failure


function USBDeviceGetPort(Device:PUSBDevice):PUSBPort;
Description: Get the USB Port that the specified device is connected to
Device The USB device to get the port for
Return USB Port if successful or nil on failure


function USBDeviceGetInterface(Device:PUSBDevice; Index:Byte; var AlternateSetting:Byte):LongWord;
Description: Get the interface alternate setting for the specified device
Device The USB device to get the interface alternate setting for
Index The index of the interface to get (As per bInterfaceNumber in the interface descriptor)
AlternateSetting The current alternate setting of the specified interface (As per bAlternateSetting in the interface descriptor)
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceSetInterface(Device:PUSBDevice; Index,AlternateSetting:Byte):LongWord;
Description: Set the interface alternate setting for the specified device
Device The USB device to set the interface alternate setting for
Index The index of the interface to set (As per bInterfaceNumber in the interface descriptor)
AlternateSetting The alternate setting to set on the specified interface (As per bAlternateSetting in the interface descriptor)
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceFindInterfaceByIndex(Device:PUSBDevice; Index:Byte):PUSBInterface;
Description: Find the interface with the specified index on the specified device
Device The USB device to find the interface from
Index The index of the interface to find (As per bInterfaceNumber in the interface descriptor)
Return The interface for the matching interface of nil if no interface matched


function USBDeviceFindInterfaceByClass(Device:PUSBDevice; InterfaceClass:Byte):PUSBInterface; overload;
Description: Find an interface of the specified class on the specified device
Device The USB device to find the interface from
InterfaceClass The interface class to match
Return The matching interface or nil if no interface matched


function USBDeviceFindInterfaceByClass(Device:PUSBDevice; InterfaceClass,InterfaceSubClass,InterfaceProtocol:Byte):PUSBInterface; overload;
Description: Find an interface of the specified class, subclass and protocol on the specified device
Device The USB device to find the interface from
InterrfaceClass The interface class to match
InterfaceSubClass The interface subclass to match
InterfaceProtocol The interface protocol to match
Return The matching interface or nil if no interface matched


function USBDeviceFindEndpointByIndex(Device:PUSBDevice; Interrface:PUSBInterface; Index:Byte):PUSBEndpointDescriptor;
Description: Find the endpoint with the specified index on the specified interface of the specified device
Device The USB device to find the endpoint from
Interrface The interface to find the endpoint from
Index The index of the endpoint to find (First endpoint is zero)
Return The endpoint for the matching endpoint of nil if no endpoint matched


function USBDeviceFindEndpointByType(Device:PUSBDevice; Interrface:PUSBInterface; Direction,TransferType:Byte):PUSBEndpointDescriptor;
Description: Find an endpoint of the specified type and direction on the specified interface of the specified device
Device The USB device to find the endpoint from
Interrface The interface to find the endpoint from
Direction The direction of the endpoint to find (eg USB_DIRECTION_OUT)
TransferType The transfer type of the endpoint to find (eg USB_TRANSFER_TYPE_BULK)
Return The endpoint for the matching endpoint of nil if no endpoint matched


function USBDeviceFindEndpointByTypeEx(Device:PUSBDevice; Interrface:PUSBInterface; Direction,TransferType:Byte; var Index:Byte):PUSBEndpointDescriptor;
Description: Find the next endpoint of the specified type and direction on the specified interface of the specified device
Device The USB device to find the endpoint from
Interrface The interface to find the endpoint from
Direction The direction of the endpoint to find (eg USB_DIRECTION_OUT)
TransferType The transfer type of the endpoint to find (eg USB_TRANSFER_TYPE_BULK)
Index The index returned from the last call, pass 0 on the first call
Return The endpoint for the matching endpoint of nil if no endpoint matched


function USBDeviceCountEndpointsByType(Device:PUSBDevice; Interrface:PUSBInterface; Direction,TransferType:Byte):Byte;
Description: Count the number of endpoints of the specified type and direction on the specified interface of the specified device
Device The USB device to find the endpoint from
Interrface The interface to find the endpoint from
Direction The direction of the endpoint to find (eg USB_DIRECTION_OUT)
TransferType The transfer type of the endpoint to find (eg USB_TRANSFER_TYPE_BULK)
Return The number of matching endpoints on the specified interface


function USBDeviceFindAlternateByIndex(Device:PUSBDevice; Interrface:PUSBInterface; Index:Byte):PUSBAlternate;
Description: Find the alternate setting with the specified index on the specified interface of the specified device
Device The USB device to find the alternate setting from
Interrface The interface to find the alternate setting from
Index The index of the alternate setting to find (First alternate setting is zero)
Return The alternate setting for the matching alternate setting of nil if no alternate setting matched


function USBDeviceFindAlternateBySetting(Device:PUSBDevice; Interrface:PUSBInterface; AlternateSetting:Byte):PUSBAlternate;
Description: Find the alternate setting with the specified value on the specified interface of the specified device
Device The USB device to find the alternate setting from
Interrface The interface to find the alternate setting from
AlternateSetting The value of the alternate setting to find
Return The alternate setting for the matching alternate setting of nil if no alternate setting matched


function USBDeviceFindAlternateEndpointByIndex(Device:PUSBDevice; Interrface:PUSBInterface; Alternate:PUSBAlternate; Index:Byte):PUSBEndpointDescriptor;
Description: Find the endpoint with the specified index on the specified alternate setting interface of the specified device
Device The USB device to find the endpoint from
Interrface The interface to find the endpoint from
Alternate The alternate setting to find the endpoint from
Index The index of the endpoint to find (First endpoint is zero)
Return The endpoint for the matching endpoint of nil if no endpoint matched


function USBDeviceFindAlternateEndpointByType(Device:PUSBDevice; Interrface:PUSBInterface; Alternate:PUSBAlternate; Direction,TransferType:Byte):PUSBEndpointDescriptor;
Description: Find an endpoint of the specified type and direction on the specified alternate setting interface of the specified device
Device The USB device to find the endpoint from
Interrface The interface to find the endpoint from
Alternate The alternate setting to find the endpoint from
Direction The direction of the endpoint to find (eg USB_DIRECTION_OUT)
TransferType The transfer type of the endpoint to find (eg USB_TRANSFER_TYPE_BULK)
Return The endpoint for the matching endpoint of nil if no endpoint matched


function USBDeviceSetFeature(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Feature,Index:Word):LongWord;
Description: Enable a feature on the specified endpoint on the specified device
Device The USB device to enable the feature for
Endpoint The endpoint to enable the feature on
Feature The feature to enable
Index To be documented
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceClearFeature(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Feature:Word):LongWord;
Description: Disable a feature on the specified endpoint on the specified device
Device The USB device to disable the feature for
Endpoint The endpoint to disable the feature on
Feature The feature to disable
Index To be documented
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceSetState(Device:PUSBDevice; State:LongWord):LongWord;
Description: Set the state of the specified device and send a notification
Device The USB device to set the state for
State The new state to set and notify (eg USB_STATE_ATTACHED)
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceSetStatus(Device:PUSBDevice; Status:LongWord):LongWord;
Description: Set the status of the specified device and send a notification
Device The USB device to set the status for
Status The new status to set and notify (eg USB_STATUS_BOUND)
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceBind(Device:PUSBDevice):LongWord;
Description: Attempt to bind a device to one of the registered drivers
Device The device to attempt to bind a driver to
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceUnbind(Device:PUSBDevice; Driver:PUSBDriver):LongWord;
Description: Unbind a device from a driver
Device The device to unbind a driver from
Driver The driver to unbind the device from (nil to unbind from current driver)
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceAttach(Device:PUSBDevice):LongWord;
Description: Configure and initialize a newly attached USB device
Device New USB device to configure and initialize
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceDetach(Device:PUSBDevice):LongWord;
Description: Shutdown and detach a USB device
Device The USB device to shutdown and detach
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBDeviceAllocate(Host:PUSBHost; Parent:PUSBDevice):PUSBDevice;
Description: Create and Register a new Device entry in the Device table}
Host The Host this device is attached to
Parent The Parent device (Hub) this device is attached to (nil if this device is a root hub)
Return Pointer to new Device entry or nil if device could not be created


function USBDeviceRelease(Device:PUSBDevice):LongWord;
Description: Deregister and Destroy a Device from the Device table
Device The device to deregister and destroy
Return ERROR_SUCCESS if completed or another error code on failure


function USBDeviceFind(USBId:LongWord):PUSBDevice;
Description: To be documented
Note None documented


function USBDeviceFindById(VendorId,ProductId:Word):PUSBDevice;
Description: To be documented
Note None documented


function USBDeviceFindByName(const Name:String):PUSBDevice; inline;
Description: To be documented
Note None documented


function USBDeviceFindByDescription(const Description:String):PUSBDevice; inline;
Description: To be documented
Note None documented


function USBDeviceEnumerate(Callback:TUSBDeviceEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function USBDeviceNotification(Device:PUSBDevice; Callback:TUSBDeviceNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note None documented


function USBDriverCreate:PUSBDriver;
Description: Create a new USB Driver entry
Return Pointer to new Driver entry or nil if driver could not be created


function USBDriverCreateEx(Size:LongWord):PUSBDriver;
Description: Create a new USB Driver entry
Size Size in bytes to allocate for new driver (Including the driver entry)
Return Pointer to new Driver entry or nil if driver could not be created


function USBDriverDestroy(Driver:PUSBDriver):LongWord;
Description: Destroy an existing USB Driver entry
Note None documented


function USBDriverRegister(Driver:PUSBDriver):LongWord;
Description: Register a new USB Driver in the Driver table
Note None documented


function USBDriverDeregister(Driver:PUSBDriver):LongWord;
Description: Deregister a USB Driver from the Driver table
Note None documented


function USBDriverFind(DriverId:LongWord):PUSBDriver;
Description: Find a driver by Id in the USB Driver table
Note None documented


function USBDriverFindByName(const Name:String):PUSBDriver; inline;
Description: Find a driver by name in the Driver table
Note None documented


function USBDriverEnumerate(Callback:TUSBDriverEnumerate; Data:Pointer):LongWord;
Description: Enumerate all drivers in the USB Driver table
Note None documented


function USBHostSetState(Host:PUSBHost; State:LongWord):LongWord;
Description: Set the state of the specified host and send a notification}
Host The USB host to set the state for
State The new state to set and notify (eg USBHOST_STATE_ENABLED)
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBHostCreate:PUSBHost;
Description: Create a new Host entry
Return Pointer to new Host entry or nil if host could not be created


function USBHostCreateEx(Size:LongWord):PUSBHost;
Description: Create a new Host entry
Size Size in bytes to allocate for new host (Including the host entry)
Return Pointer to new Host entry or nil if host could not be created


function USBHostDestroy(Host:PUSBHost):LongWord;
Description: Destroy an existing Host entry
Note None documented


function USBHostRegister(Host:PUSBHost):LongWord;
Description: Register a new Host in the Host table
Note None documented


function USBHostDeregister(Host:PUSBHost):LongWord;
Description: Deregister a Host from the Host table
Note None documented


function USBHostFind(HostId:LongWord):PUSBHost;
Description: To be documented
Note None documented


function USBHostFindByName(const Name:String):PUSBHost; inline;
Description: To be documented
Note None documented


function USBHostFindByDescription(const Description:String):PUSBHost; inline;
Description: To be documented
Note None documented


function USBHostEnumerate(Callback:TUSBHostEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function USBHostNotification(Host:PUSBHost; Callback:TUSBHostNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note None documented


function USBBufferAllocate(Device:PUSBDevice; Size:LongWord):Pointer; inline;
Description: Allocate a data buffer for a USB request
Device The device that the request will be sent to
Size The size of the data buffer to allocate
Return The newly allocated buffer or nil on failure


function USBBufferAllocateEx(Device:PUSBDevice; Size:LongWord; var Flags:LongWord):Pointer;
Description: Allocate a data buffer for a USB request
Device The device that the request will be sent to
Size The size of the data buffer to allocate
Flags The returned flags for the allocated buffer (eg USB_REQUEST_FLAG_SHARED)
Return The newly allocated buffer or nil on failure


function USBBufferValidate(Device:PUSBDevice; Buffer:Pointer; Size:LongWord; var Flags:LongWord):LongWord;
Description: Validate a data buffer for a USB request against the USB host requirements
Device The device that the request will be sent to
Buffer The data buffer to validate
Size The size of the data buffer
Flags The returned flags for the validated buffer (eg USB_REQUEST_FLAG_SHARED)
Return USB_STATUS_SUCCESS on success or another error code on failure


function USBBufferRelease(Buffer:Pointer):LongWord;
Description: Release a data buffer from a USB request
Data The buffer to be released
Return USB_STATUS_SUCCESS on success or another error code on failure


function USBRequestAllocate(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Callback:TUSBRequestCompleted; Size:LongWord; DriverData:Pointer):PUSBRequest; inline;
Description: Allocate a new USB request
Device The USB device this request will be sent to
Endpoint The Endpoint descriptor this request will be sent to (Or nil for the default control endpoint)
Callback The callback function to be called on completion of the request
Size The size of the data buffer for the request
DriverData Device driver private data for the callback (Optional)
Return The newly allocated request or nil on failure


function USBRequestAllocateEx(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Callback:TUSBRequestCompleted; var Data:Pointer; Size:LongWord; DriverData:Pointer):PUSBRequest;
Description: Allocate a new USB request
Device The USB device this request will be sent to
Endpoint The Endpoint descriptor this request will be sent to (Or nil for the default control endpoint)
Callback The callback function to be called on completion of the request
Data The returned data buffer allocated for the request (Or nil if size is zero)(Pass an existing buffer to prevent allocation)
Size The size of the data buffer for the request
DriverData Device driver private data for the callback (Optional)
Return The newly allocated request or nil on failure


function USBRequestRelease(Request:PUSBRequest):LongWord;
Description: Release and destroy a USB request
Request The request to be released
Return USB_STATUS_SUCCESS on success or another error code on failure


function USBRequestInitialize(Request:PUSBRequest; Callback:TUSBRequestCompleted; Data:Pointer; Size:LongWord; DriverData:Pointer):LongWord;
Description: Initialize or Reinitialize an existing USB request
Request The request to be initialized
Callback The callback function to be called on completion of the request
Data The returned data buffer allocated for the request (Or nil if size is zero)
Size The size of the data buffer for the request
DriverData Device driver private data for the callback (Optional)
Return USB_STATUS_SUCCESS on success or another error code on failure


function USBRequestSubmit(Request:PUSBRequest):LongWord;
Description: Submit a USB request to a host controller for execution
Request The request to be submitted
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note The request will be completed asynchronously by the host controller and the completion callback will be called when the request has either succeeded or failed


function USBRequestCancel(Request:PUSBRequest):LongWord;
Description: Cancel a USB request previously submitted to a host controller
Request The request to be cancelled
Return USB_STATUS_SUCCESS if completed or another error code on failure


procedure USBRequestComplete(Request:PUSBRequest);
Description: Called by a host controller when a USB request completes
Request The USB request which has completed
Note Not intended to be called directly by applications


function USBControlRequest(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; bRequest,bmRequestType:Byte; wValue,wIndex:Word; Data:Pointer; wLength:Word):LongWord; inline;
Description: Send a USB control request to the specified device and wait for the request to complete
Device The USB device to send the control request to
Endpoint The Endpoint to use for the control request (or nil for the default control endpoint)
bRequest The request to send

(See Section 9.4 of the USB 2.0 specification for Standard requests)

bmRequest Type of request to send

(See Section 9.3.1 of the USB 2.0 specification for Standard request types)

wValue Request specific data
wIndex Request specific data
Data Buffer for the data to be sent or received from the request (Ignored if wLength is 0)
wLength Length of the Data buffer in bytes
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBControlRequestEx(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; bRequest,bmRequestType:Byte; wValue,wIndex:Word; Data:Pointer; wLength:Word; Timeout:LongWord; AllowShort:Boolean):LongWord;
Description: Send a USB control request to the specified device and wait for the request to complete
Device The USB device to send the control request to
Endpoint The Endpoint to use for the control request (or nil for the default control endpoint)
bRequest The request to send

(See Section 9.4 of the USB 2.0 specification for Standard requests)

bmRequest Type of request to send

(See Section 9.3.1 of the USB 2.0 specification for Standard request types)

wValue Request specific data
wIndex Request specific data
Data Buffer for the data to be sent or received from the request (Ignored if wLength is 0)
wLength Length of the Data buffer in bytes
Timeout Milliseconds to wait for request to complete (INFINITE to wait forever)
AllowShort Allow the return size to be less than the requested size
Return USB_STATUS_SUCCESS if completed or another error code on failure


procedure USBControlRequestComplete(Request:PUSBRequest);
Description: Called when a USB request from a USB control endpoint completes
Request The USB request which has completed
Note Not intended to be called directly by applications


USB synchronous transfer methods

function USBTransfer(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Data:Pointer; Size:LongWord; var Count:LongWord; Timeout:LongWord):LongWord;
Description: Perform a synchronous bulk or interrupt transfer to a USB device and endpoint
Device The USB device to send the request to
Endpoint The Endpoint to use for the request
Data Buffer for the data to be sent or received from the request (Ignored if Size is 0)
Size Size of the Data buffer in bytes
Count The actual number of bytes transferred on completion (May apply even on failure or timeout)
Timeout Milliseconds to wait for request to complete (INFINITE to wait forever)
Return USB_STATUS_SUCCESS if completed or another error code on failure


procedure USBTransferComplete(Request:PUSBRequest);
Description: Called when a USB control, bulk or interrupt transfer (scheduled by USBTransfer or USBControlTransfer) completes
Request The USB request which has completed
Note Not intended to be called directly by applications


function USBControlTransfer(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; bRequest,bmRequestType:Byte; wValue,wIndex:Word; Data:Pointer; wLength:Word; var Count:LongWord; Timeout:LongWord):LongWord;
Description: Perform a synchronous control transfer to a USB device and endpoint
Device The USB device to send the control request to
Endpoint The Endpoint to use for the control request (or nil for the default control endpoint)
bRequest The request to send

(See Section 9.4 of the USB 2.0 specification for Standard requests)

bmRequestType Type of request to send

(See Section 9.3.1 of the USB 2.0 specification for Standard request types)

wValue Request specific data
wIndex Request specific data
Data Buffer for the data to be sent or received from the request (Ignored if wLength is 0)
wLength Length of the Data buffer in bytes
Count The actual number of bytes transferred on completion (May apply even on failure or timeout)
Timeout Milliseconds to wait for request to complete (INFINITE to wait forever)
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note This function is very similar to USBControlRequest(Ex) but also returns the actual number of bytes transferred


function USBBulkTransfer(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Data:Pointer; Size:LongWord; var Count:LongWord; Timeout:LongWord):LongWord;
Description: Perform a synchronous bulk transfer to a USB device and endpoint
Device The USB device to send the bulk request to
Endpoint The Endpoint to use for the bulk request
Data Buffer for the data to be sent or received from the request (Ignored if Size is 0)
Size Size of the Data buffer in bytes
Count The actual number of bytes transferred on completion (May apply even on failure or timeout)
Timeout Milliseconds to wait for request to complete (INFINITE to wait forever)
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note The type and direction of the transfer is determined from the type and direction of the endpoint


function USBInterruptTransfer(Device:PUSBDevice; Endpoint:PUSBEndpointDescriptor; Data:Pointer; Size:LongWord; var Count:LongWord; Timeout:LongWord):LongWord;
Description: Perform a synchronous interrupt transfer to a USB device and endpoint
Device The USB device to send the interrupt request to
Endpoint The Endpoint to use for the interrupt request
Data Buffer for the data to be sent or received from the request (Ignored if Size is 0)
Size Size of the Data buffer in bytes
Count The actual number of bytes transferred on completion (May apply even on failure or timeout)
Timeout Milliseconds to wait for request to complete (INFINITE to wait forever)
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note The type and direction of the transfer is determined from the type and direction of the endpoint


USB hub functions

function USBHubCreatePorts(Hub:PUSBHub):LongWord;
Description: Create and initialize the ports for a Hub
Hub The hub to initialize ports for
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBHubPowerOnPorts(Hub:PUSBHub):LongWord;
Description: Power on all ports on a Hub
Hub The hub to power on ports for
Return USB_STATUS_SUCCESS if completed or another error code on failure


function USBHubCreateHubDescriptor(Hub:PUSBHub):LongWord;
Description: Allocate the hub descriptor for the specified hub
Hub The hub to create the descriptor for
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note The class specific hub descriptor is not the same as the device descriptor


function USBHubReadHubDescriptor(Hub:PUSBHub):LongWord;
Description: Read the hub descriptor for the specified hub
Hub The hub to read the descriptor for
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note The class specific hub descriptor is not the same as the device descriptor


function USBHubLock(Hub:PUSBHub):LongWord;
Description: Lock the specified Hub to prevent changes
Hub The hub to lock
Return ERROR_SUCCESS if completed or another error code on failure


function USBHubUnlock(Hub:PUSBHub):LongWord;
Description: Unlock the specified Hub to allow changes
Hub The hub to unlock
Return ERROR_SUCCESS if completed or another error code on failure


function USBHubSetState(Hub:PUSBHub; State:LongWord):LongWord;
Description: Set the state of the specified hub and send a notification
Hub The hub to set the state for
State The new state to set and notify
Return ERROR_SUCCESS if completed or another error code on failure


function USBHubAllocate(Device:PUSBDevice):PUSBHub;
Description: Create and Register a new Hub device
Device The USB device that represents this hub
Return Pointer to new Hub entry or nil if hub could not be created


function USBHubRelease(Hub:PUSBHub):LongWord;
Description: Deregister and Destroy a Hub device
Hub The hub to deregister and destroy
Return ERROR_SUCCESS if completed or another error code on failure


function USBHubFind(HubId:LongWord):PUSBHub;
Description: To be documented
Note None documented


function USBHubFindByName(const Name:String):PUSBHub; inline;
Description: To be documented
Note None documented


function USBHubFindByDescription(const Description:String):PUSBHub; inline;
Description: To be documented
Note None documented


function USBHubEnumerate(Callback:TUSBHubEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function USBHubNotification(Hub:PUSBHub; Callback:TUSBHubNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note None documented


procedure USBHubBindDevices(Device:PUSBDevice; Callback:TUSBDeviceBind);
Description: Enumerate each device in the USB tree and call a bind callback for each one
Device USB device at which to start the enumeration
Callback Bind callback function to execute for each device


procedure USBHubUnbindDevices(Device:PUSBDevice; Driver:PUSBDriver; Callback:TUSBDeviceUnbind);
Description: Enumerate each device in the USB tree and call an unbind callback for each one
Device USB device at which to start the enumeration
Driver The driver to unbind the device from (nil to unbind from current driver)
Callback Unbind callback function to execute for each device


procedure USBHubEnumerateDevices(Device:PUSBDevice; Callback:TUSBDeviceEnumerate; Data:Pointer);
Description: Enumerate each device in the USB tree and call an enumerate callback for each one
Device USB device at which to start the enumeration
Callback Enumerate callback function to execute for each device


function USBHubPortReset(Port:PUSBPort; Delay:LongWord):LongWord;
Description: Reset a the specified USB port
Port USB port to reset
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock


function USBHubPortDisable(Port:PUSBPort):LongWord;
Description: Disable the specified USB port
Port USB port to disable
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock

A port cannot be enabled in software, only disabled.


function USBHubPortPowerOn(Port:PUSBPort):LongWord;
Description: Power on the specified USB port
Port USB port to power on
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock

Not all hubs support powering on and off individual ports, you must check if the hub includes the USB_HUB_CHARACTERISTIC_LPSM_PORT in its descriptor.


function USBHubPortPowerOff(Port:PUSBPort):LongWord;
Description: Power off the specified USB port
Port USB port to power off
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock

Not all hubs support powering on and off individual ports, you must check if the hub includes the USB_HUB_CHARACTERISTIC_LPSM_PORT in its descriptor.


function USBHubPortGetStatus(Port:PUSBPort):LongWord;
Description: Read the status of the specified USB port
Port USB port to read status for
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock


function USBHubPortSetFeature(Port:PUSBPort; Feature:Word):LongWord;
Description: Enable a feature on the specified USB port
Port USB port to enable the feature on
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock


function USBHubPortClearFeature(Port:PUSBPort; Feature:Word):LongWord;
Description: Disable a feature on the specified USB port
Port USB port to disable the feature on
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock


function USBHubPortChangeFeature(Port:PUSBPort; Feature:Word; Enable:Boolean):LongWord;
Description: Enable or disable a feature on the specified USB port
Port USB port to enable or disable the feature on
Feature The feature to enable or disable
Enable True to enable the feature or False to disable the feature
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock


function USBHubPortAttachDevice(Port:PUSBPort):LongWord;
Description: Attach a newly connected USB device to the specified USB port
Port USB port to attach the new device to
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock

Only called in response to a status change on the hub


function USBHubPortDetachDevice(Port:PUSBPort):LongWord;
Description: Detach a disconnected USB device from the specified USB port
Port USB port to detach the device from
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock

Only called in response to a status change on the hub


function USBHubPortStatusChanged(Port:PUSBPort):LongWord;
Description: Process a status change for the specified USB port
Port USB port to process the status change for
Return USB_STATUS_SUCCESS if completed or another error code on failure
Note Caller must hold the hub lock

Only called in response to a status change on the hub


function USBHubExecute(Parameter:Pointer):PtrInt;
Description: The Hub thread procedure which is responsible for receiving completed hub status change requests, processing them for changes and then resubmitting the request
Note One status change request exists for each hub currently connected and is created and submitted by the hub driver when it binds to a new hub device. When a hub is disconnected the hub driver will remove the request when the hub is detached and destroyed.


procedure USBHubStatusComplete(Request:PUSBRequest);
Description: Called when the USB request from a USB hub IN interrupt endpoint completes
Request The USB request which has completed


function USBHubDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Bind the Hub driver to a USB device if it is suitable}
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.


function USBHubDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Unbind the Hub driver from a USB device
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


USB device, driver and host helper functions

function USBDeviceGetCount:LongWord;
Description: Get the current device count
Note None documented


function USBDeviceCheck(Device:PUSBDevice):PUSBDevice;
Description: Check if the supplied Device is in the device table
Note None documented


function USBDriverGetCount:LongWord;
Description: Get the current USB driver count
Note None documented


function USBDriverCheck(Driver:PUSBDriver):PUSBDriver;
Description: Check if the supplied USB Driver is in the driver table
Note None documented


function USBHostGetCount:LongWord;
Description: Get the current host count
Note None documented


function USBHostCheck(Host:PUSBHost):PUSBHost;
Description: Check if the supplied Host is in the host table
Note None documented


function USBIsHub(Device:PUSBDevice):Boolean;
Description: Returns True if Device is a Hub or False if not
Note None documented


function USBIsRootHub(Device:PUSBDevice):Boolean;
Description: Returns True if Device is a Root Hub or False if not
Note None documented


function USBIsControlRequest(Request:PUSBRequest):Boolean;
Description: Returns True if Request is a control request or False if not
Note None documented


function USBIsBulkRequest(Request:PUSBRequest):Boolean;
Description: Returns True if Request is a bulk request or False if not
Note None documented


function USBIsInterruptRequest(Request:PUSBRequest):Boolean;
Description: Returns True if Request is an interrupt request or False if not
Note None documented


function USBIsIsochronousRequest(Request:PUSBRequest):Boolean;
Description: Returns True if Request is an isochronous request or False if not
Note None documented


function USBIsInEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;
Description: Returns True is Endpoint is an IN endpoint or False if not
Note None documented


function USBIsOutEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;
Description: Returns True is Endpoint is an OUT endpoint or False if not
Note None documented


function USBIsBulkEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;
Description: Returns True is Endpoint is a BULK endpoint or False if not
Note None documented


function USBIsInterruptEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;
Description: Returns True is Endpoint is a INTERRUPT endpoint or False if not
Note None documented


function USBIsIsochronousEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;
Description: Returns True is Endpoint is a ISOCHRONOUS endpoint or False if not
Note None documented


function USBDeviceToString(Device:PUSBDevice):String;
Description: Return a description of a USB device
Device USB device to get a description of
Return A string describing the device


function USBStatusToString(Status:LongWord):String;
Description: Translates a USB status code into a string
Note None documented


function USBClassCodeToString(ClassCode:Integer):String;
Description: Translates a USB class code into a string
Note None documented


function USBSubClassCodeToString(ClassCode,SubClassCode:Integer):String;
Description: Translates a USB sub class code into a string
Note None documented


function USBProtocolCodeToString(ClassCode,ProtocolCode:Integer):String;
Description: Translates a USB protocol code into a string
Note None documented


function USBSpeedToString(Speed:Integer):String;
Description: Translates a USB speed constant into a string
Note None documented


function USBSpeedToStringAlt(Speed:Integer):String;
Description: Translates a USB speed constant into a string (Alternate version)
Note None documented


function USBTransferTypeToString(TransferType:Integer):String;
Description: Translates a USB transfer type constant into a string
Note None documented


function USBDirectionToString(Direction:Integer):String;
Description: Translates a USB direction constant into a string
Note None documented


function USBBCDVersionToString(BCDVersion:Word):String;
Description: Translates a bcdUSB (binary-coded-decimal USB version) value into a human-readable string
BCDVersion The bcdUSB value (e.g. from a USB device descriptor) to translate
Return String describing the USB version


function USBPortStatusConnectedToString(Status:Word):String;
Description: To be documented
Note None documented


function USBHubCharacteristicsToString(HubCharacteristics:Word):String;
Description: To be documented
Note None documented


function USBDeviceTypeToString(USBType:LongWord):String;
Description: To be documented
Note None documented


function USBDeviceStateToString(USBState:LongWord):String;
Description: To be documented
Note None documented


function USBDeviceStatusToString(USBStatus:LongWord):String;
Description: To be documented
Note None documented


function USBDeviceStateToNotification(State:LongWord):LongWord;
Description: Convert a Device state value into the notification code for device notifications
Note None documented


function USBDeviceStatusToNotification(Status:LongWord):LongWord;
Description: Convert a Device status value into the notification code for device notifications
Note None documented


function USBHostTypeToString(HostType:LongWord):String;
Description: To be documented
Note None documented


function USBHostStateToString(HostState:LongWord):String;
Description: To be documented
Note None documented


function USBHostStateToNotification(State:LongWord):LongWord;
Description: Convert a Host state value into the notification code for device notifications
Note None documented


procedure USBLog(Level:LongWord; Device:PUSBDevice; const AText:String);
Description: To be documented
Note None documented


procedure USBLogInfo(Device:PUSBDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure USBLogWarn(Device:PUSBDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure USBLogError(Device:PUSBDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure USBLogDebug(Device:PUSBDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure USBLogDeviceConfiguration(Device:PUSBDevice; Output:TUSBLogOutput = nil; Data:Pointer = nil);
Description: To be documented
Note None documented


procedure USBLogDeviceDescriptor(Device:PUSBDevice; Descriptor:PUSBDeviceDescriptor; Output:TUSBLogOutput = nil; Data:Pointer = nil);
Description: To be documented
Note None documented


procedure USBLogConfigurationDescriptor(Device:PUSBDevice; Descriptor:PUSBConfigurationDescriptor; Output:TUSBLogOutput = nil; Data:Pointer = nil);
Description: To be documented
Note None documented


procedure USBLogInterfaceDescriptor(Device:PUSBDevice; Descriptor:PUSBInterfaceDescriptor; Output:TUSBLogOutput = nil; Data:Pointer = nil);
Description: To be documented
Note None documented


procedure USBLogEndpointDescriptor(Device:PUSBDevice; Descriptor:PUSBEndpointDescriptor; Output:TUSBLogOutput = nil; Data:Pointer = nil);
Description: To be documented
Note None documented


function USBLogDevices:LongWord;
Description: Print information about all devices attached to the USB
Return ERROR_SUCCESS if completed or another error code on failure


function USBLogDevicesEx(Device:PUSBDevice; Output:TUSBLogOutput; DeviceCallback,TreeCallback:TUSBDeviceEnumerate; Data:Pointer):LongWord;
Description: Print information about one or all devices attached to the USB with custom output and callbacks
Device The device to print information about (nil for all devices)
Output The log output callback to print information to (nil to use the default output)
Device Callback The callback to print device information (nil if no device information should be printed)
Tree Callback The callback to print tree information (nil if no tree information should be printed)
Data A pointer to caller specific data which should be passed to the callbacks (Optional)
Return ERROR_SUCCESS if completed or another error code on failure


function USBLogDeviceCallback(Device:PUSBDevice; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function USBLogTreeCallback(Device:PUSBDevice; Data:Pointer):LongWord;
Description: To be documented
Note None documented


procedure USBLogOutput(const AText:String; Data:Pointer);
Description: Default log output procedure for USBLogDevices etc
Note None documented


USB hub helper functions

function USBHubGetCount:LongWord;
Description: Get the current hub count
Note None documented


function USBHubCheck(Hub:PUSBHub):PUSBHub;
Description: Check if the supplied Hub is in the hub table
Note None documented


function USBHubIsMultiTT(Hub:PUSBHub):Boolean;
Description: To be documented
Return Returns True if Hub has multiple Transaction Translators or False if not


function USBHubIsCompound(Hub:PUSBHub):Boolean;
Description: To be documented
Return Returns True if Hub is part of a Compound Device or False if not


function USBHubHasPortIndicator(Hub:PUSBHub):Boolean;
Description: To be documented
Return Returns True if Hub supports Port Indicators or False if not


function USBHubHasPortPowerSwitching(Hub:PUSBHub):Boolean;
Description: To be documented
Return Returns True if Hub supports per port Power Switching or False if not


function USBHubHasPortCurrentProtection(Hub:PUSBHub):Boolean;
Description: To be documented
Return Returns True if Hub supports per port Over Current Power Protection or False if not


function USBHubGetTTThinkTime(Hub:PUSBHub):Byte;
Description: Get the TT Think Time from a Hub
Note None documented


function USBHubTypeToString(HubType:LongWord):String;
Description: Return a string describing the supplied Hub type value
Note None documented


function USBHubStateToString(HubState:LongWord):String;
Description: Return a string describing the supplied Hub state value
Note None documented


function USBHubStateToNotification(State:LongWord):LongWord;
Description: Convert a Hub state value into the notification code for device notifications
Note None documented


Return to Unit Reference