|
The Pedigree Project 0.1
|
Inheritance diagram for UsbDevice:
Collaboration diagram for UsbDevice:Classes | |
| struct | ConfigDescriptor |
| struct | DeviceDescriptor |
| struct | DeviceQualifier |
| struct | Endpoint |
| struct | Interface |
| struct | Setup |
| struct | UnknownDescriptor |
Public Types | |
| enum | UsbState { Connected = 0 , Addressed , HasDescriptors , Configured , HasInterface , HasDriver } |
| Possible states for an USB device. More... | |
Public Member Functions | |
| UsbDevice (UsbHub *pHub, uint8_t nPort, UsbSpeed speed) | |
| Default constructor. | |
| UsbDevice (UsbDevice *pDev) | |
| Copy constructor. | |
| virtual | ~UsbDevice () |
| Destructor. | |
| void | initialise (uint8_t nAddress) |
| Initialises the device at the given address. | |
| virtual void | initialiseDriver () |
| Implemented by the driver class, initialises driver-specific stuff. | |
| virtual void | getUsbDeviceName (String &str) |
| uint8_t | getAddress () |
| Returns the current address of the device. | |
| uint8_t | getPort () |
| Returns the number of the port on which the device is connected. | |
| UsbHub * | getHub () const |
| UsbSpeed | getSpeed () |
| Returns the speed at which the device operates. | |
| UsbState | getUsbState () |
| Returns the current state of the device. | |
| DeviceDescriptor * | getDescriptor () |
| Returns the device descriptor of the device. | |
| ConfigDescriptor * | getConfiguration () |
| Returns the configuration in use. | |
| Interface * | getInterface () |
| Returns the interface in use. | |
| void | useConfiguration (uint8_t nConfig) |
| Switches to the given configuration. | |
| void | useInterface (uint8_t nInterface) |
| Switches to the given interface. | |
| UsbDeviceContainer * | getContainer () const |
| Gets our Device container, for replacing parents on hubs etc. | |
| virtual bool | hasSubtree () const |
| Do we expose our own Device tree? | |
| virtual Device * | getDevice () |
| virtual void | prepareForDriverRetirement () |
| virtual void | quiesceForRetirement () |
| virtual void | prepareForDisconnection () |
Public Attributes | |
| struct UsbDevice::Setup | PACKED |
| struct UsbDevice::DeviceQualifier | PACKED |
Protected Member Functions | |
| ssize_t | doSync (Endpoint *pEndpoint, UsbPid pid, uintptr_t pBuffer, size_t nBytes, size_t timeout) |
| ssize_t | syncIn (Endpoint *pEndpoint, uintptr_t pBuffer, size_t nBytes, size_t timeout=5000) |
| ssize_t | syncOut (Endpoint *pEndpoint, uintptr_t pBuffer, size_t nBytes, size_t timeout=5000) |
| MUST_USE_RESULT bool | addInterruptInHandler (Endpoint *pEndpoint, uintptr_t pBuffer, uint16_t nBytes, void(*pCallback)(uintptr_t, ssize_t), UsbInterruptInHandle &handle, uintptr_t pParam=0) |
| bool | controlRequest (uint8_t nRequestType, uint8_t nRequest, uint16_t nValue, uint16_t nIndex, uint16_t nLength=0, uintptr_t pBuffer=0, uint32_t timeout=5000) |
| Performs an USB control request. | |
| ssize_t | controlRequestResult (uint8_t nRequestType, uint8_t nRequest, uint16_t nValue, uint16_t nIndex, uint16_t nLength=0, uintptr_t pBuffer=0, uint32_t timeout=5000) |
| Returns data bytes transferred, or a negative UsbError. | |
| uint16_t | getStatus () |
| Gets device's current status. | |
| bool | clearEndpointHalt (Endpoint *pEndpoint) |
| Clears a halt on the given endpoint. | |
| void * | getDescriptor (uint8_t nDescriptorType, uint8_t nDescriptorIndex, uint16_t nBytes, uint8_t requestType=0) |
| Gets a descriptor from the device. | |
| uint8_t | getDescriptorLength (uint8_t nDescriptorType, uint8_t nDescriptorIndex, uint8_t requestType=0) |
| Gets a descriptor's length from the device. | |
| String | getString (uint8_t nString) |
| Gets a string. | |
Protected Attributes | |
| uint8_t | m_nAddress |
| The current address of the device. | |
| uint16_t | m_ControlPacketSize |
| uint8_t | m_nPort |
| The number of the port on which the device is connected. | |
| uint8_t | m_nRootPort |
| Root-controller connection which owns this device generation. | |
| size_t | m_nRootPortGeneration |
| UsbSpeed | m_Speed |
| The speed at which the device operates. | |
| UsbState | m_UsbState |
| The current state of the device. | |
| DeviceDescriptor * | m_pDescriptor |
| Device descriptor for this device. | |
| ConfigDescriptor * | m_pConfiguration |
| Configuration in use. | |
| Interface * | m_pInterface |
| Interface in use. | |
| UsbHub * | m_pHub |
| Parent USB hub. | |
| UsbDeviceContainer * | m_pContainer |
| Our current container. | |
Private Member Functions | |
| UsbDevice (const UsbDevice &d) | |
| const UsbDevice & | operator= (const UsbDevice &d) |
Friends | |
| class | UsbDeviceContainer |
| class | UsbPnP |
Definition at line 44 of file UsbDevice.h.
| enum UsbDevice::UsbState |
Possible states for an USB device.
Definition at line 170 of file UsbDevice.h.
| UsbDevice::UsbDevice | ( | UsbHub * | pHub, |
| uint8_t | nPort, | ||
| UsbSpeed | speed | ||
| ) |
Default constructor.
Definition at line 39 of file UsbDevice.cc.
References m_nRootPort, and UsbHub::rootConnectionForChild().
| UsbDevice::UsbDevice | ( | UsbDevice * | pDev | ) |
|
virtual |
|
protected |
Definition at line 449 of file UsbDevice.cc.
|
protected |
Clears a halt on the given endpoint.
Definition at line 573 of file UsbDevice.cc.
References controlRequest(), m_nAddress, m_nPort, m_nRootPort, m_pHub, and m_Speed.
|
protected |
Performs an USB control request.
Definition at line 558 of file UsbDevice.cc.
References controlRequestResult().
Referenced by clearEndpointHalt(), UsbHubDevice::executeRequest(), getDescriptor(), getDescriptorLength(), UsbHubDevice::getPortStatus(), getStatus(), initialise(), FtdiSerialDevice::initialiseDriver(), UsbHumanInterfaceDevice::initialiseDriver(), Dm9601::readMemory(), Dm9601::readRegister(), useConfiguration(), useInterface(), Dm9601::writeMemory(), Dm9601::writeMemory(), Dm9601::writeRegister(), and Dm9601::writeRegister().
Here is the caller graph for this function:
|
protected |
Returns data bytes transferred, or a negative UsbError.
Definition at line 487 of file UsbDevice.cc.
References UsbHub::addTransferToTransaction(), UsbHub::createTransaction(), UsbHub::doSync(), m_nAddress, m_nPort, m_nRootPort, m_pHub, and m_Speed.
Referenced by controlRequest(), and UsbMassStorageDevice::initialiseDriver().
Here is the caller graph for this function:
|
protected |
Definition at line 378 of file UsbDevice.cc.
|
inline |
Returns the current address of the device.
Definition at line 192 of file UsbDevice.h.
|
inline |
Returns the configuration in use.
Definition at line 221 of file UsbDevice.h.
|
inline |
Gets our Device container, for replacing parents on hubs etc.
Definition at line 237 of file UsbDevice.h.
|
inline |
Returns the device descriptor of the device.
Definition at line 216 of file UsbDevice.h.
Referenced by getString(), initialise(), UsbHumanInterfaceDevice::initialiseDriver(), and UsbHubDevice::initialiseDriver().
Here is the caller graph for this function:
|
protected |
Gets a descriptor from the device.
Definition at line 622 of file UsbDevice.cc.
References controlRequest(), and m_pInterface.
|
protected |
Gets a descriptor's length from the device.
Definition at line 643 of file UsbDevice.cc.
References controlRequest(), and m_pInterface.
Referenced by getString(), and UsbHubDevice::initialiseDriver().
Here is the caller graph for this function:
|
inlinevirtual |
Get a usable Device for this particular UsbDevice, if it has a subtree.
Reimplemented in UsbMassStorageDevice, and UsbHubDevice.
Definition at line 248 of file UsbDevice.h.
Referenced by UsbDeviceContainer::replaceUsbDevice().
Here is the caller graph for this function:
|
inline |
Definition at line 201 of file UsbDevice.h.
|
inline |
Returns the interface in use.
Definition at line 226 of file UsbDevice.h.
Referenced by UsbPnP::doProbe().
Here is the caller graph for this function:
|
inline |
Returns the number of the port on which the device is connected.
Definition at line 197 of file UsbDevice.h.
|
inline |
Returns the speed at which the device operates.
Definition at line 206 of file UsbDevice.h.
|
protected |
Gets device's current status.
Definition at line 565 of file UsbDevice.cc.
References controlRequest().
|
protected |
Gets a string.
Definition at line 662 of file UsbDevice.cc.
References getDescriptor(), and getDescriptorLength().
Referenced by initialise().
Here is the caller graph for this function:
|
inlinevirtual |
Definition at line 187 of file UsbDevice.h.
|
inline |
Returns the current state of the device.
Definition at line 211 of file UsbDevice.h.
Referenced by UsbPnP::doProbe().
Here is the caller graph for this function:
|
inlinevirtual |
Do we expose our own Device tree?
Reimplemented in UsbMassStorageDevice, and UsbHubDevice.
Definition at line 242 of file UsbDevice.h.
Referenced by UsbDeviceContainer::replaceUsbDevice().
Here is the caller graph for this function:| void UsbDevice::initialise | ( | uint8_t | nAddress | ) |
Initialises the device at the given address.
Definition at line 239 of file UsbDevice.cc.
References controlRequest(), Dec, EMIT_IF, getDescriptor(), getString(), Hex, m_nAddress, m_nPort, m_nRootPort, m_pDescriptor, m_pHub, m_Speed, m_UsbState, and useConfiguration().
|
inlinevirtual |
Implemented by the driver class, initialises driver-specific stuff.
Reimplemented in Dm9601, FtdiSerialDevice, UsbHumanInterfaceDevice, UsbHubDevice, and UsbMassStorageDevice.
Definition at line 185 of file UsbDevice.h.
Referenced by UsbPnP::doProbe().
Here is the caller graph for this function:
|
inlinevirtual |
Prepares a driver after its physical device has disappeared.
Reimplemented in UsbHubDevice, and UsbMassStorageDevice.
Definition at line 259 of file UsbDevice.h.
|
inlinevirtual |
Quiesces driver-specific ownership before replacing this binding.
Reimplemented in UsbHubDevice.
Definition at line 253 of file UsbDevice.h.
|
inlinevirtual |
Stops producers which can add or replace devices in this subtree.
Reimplemented in UsbHubDevice.
Definition at line 256 of file UsbDevice.h.
|
protected |
Definition at line 441 of file UsbDevice.cc.
|
protected |
Definition at line 445 of file UsbDevice.cc.
| void UsbDevice::useConfiguration | ( | uint8_t | nConfig | ) |
Switches to the given configuration.
Definition at line 590 of file UsbDevice.cc.
References controlRequest(), m_pConfiguration, m_pDescriptor, and m_UsbState.
Referenced by initialise().
Here is the caller graph for this function:| void UsbDevice::useInterface | ( | uint8_t | nInterface | ) |
Switches to the given interface.
Definition at line 599 of file UsbDevice.cc.
References controlRequest(), m_pConfiguration, m_pInterface, and m_UsbState.
|
friend |
Definition at line 45 of file UsbDevice.h.
|
friend |
Definition at line 46 of file UsbDevice.h.
|
protected |
Definition at line 298 of file UsbDevice.h.
|
protected |
The current address of the device.
Definition at line 297 of file UsbDevice.h.
Referenced by UsbHubDevice::addInterruptInHandler(), clearEndpointHalt(), controlRequestResult(), UsbHubDevice::createTransaction(), initialise(), UsbHumanInterfaceDevice::initialiseDriver(), and UsbHubDevice::initialiseDriver().
|
protected |
The number of the port on which the device is connected.
Definition at line 301 of file UsbDevice.h.
Referenced by UsbHubDevice::addInterruptInHandler(), clearEndpointHalt(), controlRequestResult(), UsbHubDevice::createTransaction(), and initialise().
|
protected |
Root-controller connection which owns this device generation.
Definition at line 304 of file UsbDevice.h.
Referenced by clearEndpointHalt(), controlRequestResult(), initialise(), and UsbDevice().
|
protected |
Definition at line 305 of file UsbDevice.h.
|
protected |
Configuration in use.
Definition at line 317 of file UsbDevice.h.
Referenced by useConfiguration(), and useInterface().
|
protected |
Our current container.
Definition at line 326 of file UsbDevice.h.
Referenced by UsbDeviceContainer::replaceUsbDevice().
|
protected |
Device descriptor for this device.
Definition at line 314 of file UsbDevice.h.
Referenced by initialise(), UsbHumanInterfaceDevice::initialiseDriver(), UsbDevice(), useConfiguration(), and ~UsbDevice().
|
protected |
Parent USB hub.
Definition at line 323 of file UsbDevice.h.
Referenced by UsbHubDevice::addInterruptInHandler(), UsbHubDevice::addTransferToTransaction(), UsbHubDevice::cancelAsyncAndDrain(), clearEndpointHalt(), controlRequestResult(), UsbHubDevice::createTransaction(), UsbHubDevice::doAsync(), and initialise().
|
protected |
Interface in use.
Definition at line 320 of file UsbDevice.h.
Referenced by getDescriptor(), getDescriptorLength(), Dm9601::initialiseDriver(), FtdiSerialDevice::initialiseDriver(), UsbHumanInterfaceDevice::initialiseDriver(), UsbHubDevice::initialiseDriver(), UsbMassStorageDevice::initialiseDriver(), and useInterface().
|
protected |
The speed at which the device operates.
Definition at line 308 of file UsbDevice.h.
Referenced by UsbHubDevice::addInterruptInHandler(), clearEndpointHalt(), controlRequestResult(), UsbHubDevice::createTransaction(), and initialise().
|
protected |
The current state of the device.
Definition at line 311 of file UsbDevice.h.
Referenced by initialise(), Dm9601::initialiseDriver(), FtdiSerialDevice::initialiseDriver(), UsbHumanInterfaceDevice::initialiseDriver(), UsbHubDevice::initialiseDriver(), UsbMassStorageDevice::initialiseDriver(), useConfiguration(), and useInterface().