Unit USB

From Ultibo.org
Revision as of 06:37, 15 September 2016 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


USB

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 desriptors and assigning a device addresss.

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 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 respresents 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.

Constants


To be documented

Type definitions


To be documented

Public variables


To be documented

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


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


procedure USBAsyncStart(Host:PUSBHost);
Description: To be documented
Note To be 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 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 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 USBDeviceReadStringDescriptor(Device:PUSBDevice; Index:Byte):String;
Description: To be documented
Note To be documented


function USBDeviceReadStringDescriptorW(Device:PUSBDevice; Index:Byte):UnicodeString;
Description: To be documented
Note To be documented


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 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 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
Status The new state to set and notify
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
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 registers drivers
Device The device to attempt to bind a driver to
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 USBDeviceFind(USBId:LongWord):PUSBDevice;
Description: To be documented
Note To be documented


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


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


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


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


function USBDriverCreate:PUSBDriver;
Description: Create a new 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 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 Driver entry
Note To be documented


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


function USBDriverFind(DriverId:LongWord):PUSBDriver;
Description: To be documented
Note To be documented


function USBDriverFindByName(const Name:String):PUSBDriver; inline;
Description: To be documented
Note To be documented


function USBDriverEnumerate(Callback:TUSBDriverEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note To be 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
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 To be documented


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


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


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


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


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


function USBHostNotification(Host:PUSBHost; Callback:TUSBHostNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note To be 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 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


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


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


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


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


function USBHubNotification(Hub:PUSBHub; Callback:TUSBHubNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note To be 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 enueration
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
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):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 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 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.


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


USB device, driver and host helper functions

function USBDeviceGetCount:LongWord; inline;
Description: Get the current device count
Note To be documented


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


function USBDriverGetCount:LongWord; inline;
Description: Get the current driver count
Note To be documented


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


function USBHostGetCount:LongWord; inline;
Description: Get the current host count
Note To be documented


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


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


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


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


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


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


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


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


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


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


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


function USBIsIsochronousEndpoint(Endpoint:PUSBEndpointDescriptor):Boolean;
Description: Returns True is Endpoint is a ISOCHRONOUS endpoint or False if not
Note To be 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 To be documented


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


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


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


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


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


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


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


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


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


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


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


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


Return to Unit Reference