|
The Pedigree Project 0.1
|
Inheritance diagram for UsbHubDevice:
Collaboration diagram for UsbHubDevice:Classes | |
| struct | HubDescriptor |
Public Member Functions | |
| UsbHubDevice (UsbDevice *dev) | |
| virtual void | initialiseDriver () |
| Implemented by the driver class, initialises driver-specific stuff. | |
| virtual void | getName (String &str) |
| bool | hasSubtree () const override |
| Do we expose our own Device tree? | |
| Device * | getDevice () override |
| void | prepareForDriverRetirement () override |
| virtual void | addTransferToTransaction (uintptr_t pTransaction, bool bToggle, UsbPid pid, uintptr_t pBuffer, size_t nBytes) |
| Adds a new transfer to an existent transaction. | |
| virtual uintptr_t | createTransaction (UsbEndpoint endpointInfo) |
| Creates a new transaction with the given endpoint data. | |
| virtual MUST_USE_RESULT bool | doAsync (uintptr_t pTransaction, void(*pCallback)(uintptr_t, ssize_t)=0, uintptr_t pParam=0) |
| virtual MUST_USE_RESULT bool | addInterruptInHandler (UsbEndpoint endpointInfo, uintptr_t pBuffer, uint16_t nBytes, void(*pCallback)(uintptr_t, ssize_t), UsbInterruptInHandle &handle, uintptr_t pParam=0) |
| Adds an owned recurring interrupt-IN transaction. | |
| virtual bool | portReset (uint8_t nPort, bool bErrorResponse=false) |
| Gets a UsbDevice from a given vendor:product pair. | |
Public Member Functions inherited from UsbDevice | |
| 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 | 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. | |
Public Member Functions inherited from UsbHub | |
| UsbHub (Device *p) | |
| RootConnection | rootConnectionForChild (uint8_t childPort) const |
| virtual bool | controllerAssignsAddresses () const |
| virtual bool | supportsHubDevices () const |
| virtual bool | prepareDevice (uint8_t, const UsbEndpoint &) |
| virtual bool | addressDevice (uint8_t, const UsbEndpoint &) |
| virtual bool | resetEndpoint (const UsbEndpoint &) |
| virtual Type | getType () |
| bool | deviceConnected (uint8_t nPort, UsbSpeed speed) |
| Called when a device is connected to a port on the hub. | |
| void | deviceDisconnected (uint8_t nPort) |
| Called when a device is disconnected from a port on the hub. | |
| ssize_t | doSync (uintptr_t nTransaction, uint32_t timeout=5000) |
Public Member Functions inherited from Device | |
| Device (Device *p) | |
| Device * | getParent () const |
| void | setParent (Device *p) |
| virtual const String & | getSpecificType () |
| virtual void | setSpecificType (String str) |
| void | setPciPosition (uint32_t bus, uint32_t device, uint32_t func) |
| void | setPciIdentifiers (uint8_t classCode, uint8_t subclassCode, uint16_t vendorId, uint16_t deviceId, uint8_t progIf) |
| void | setPciConfigHeader (const PciBus::ConfigSpace &space) |
| PciBus::ConfigSpace | getPciConfigHeader () const |
| uint8_t | getPciClassCode () |
| uint8_t | getPciSubclassCode () |
| uint16_t | getPciVendorId () |
| uint16_t | getPciDeviceId () |
| uint8_t | getPciProgInterface () |
| uint32_t | getPciBusPosition () |
| uint32_t | getPciDevicePosition () |
| uint32_t | getPciFunctionNumber () |
| virtual void | dump (String &str) |
| virtual Vector< Address * > & | addresses () |
| virtual uintptr_t | getInterruptNumber () |
| virtual void | setInterruptNumber (uintptr_t n) |
| void | addChild (Device *pDevice) |
| Device * | getChild (size_t n) |
| size_t | getNumChildren () |
| void | removeChild (size_t n) |
| void | removeChild (Device *d) |
| void | replaceChild (Device *src, Device *dest) |
Protected Member Functions | |
| virtual void | cancelAsyncAndDrain (uintptr_t pTransaction, void(*pCallback)(uintptr_t, ssize_t), uintptr_t pParam) |
| MUST_USE_RESULT bool | cancelInterruptInAndDrain (const UsbInterruptInToken &token, void(*callback)(uintptr_t, ssize_t), uintptr_t parameter, bool producerAlreadyStopped) override |
Protected Member Functions inherited from UsbDevice | |
| 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 Member Functions inherited from UsbHub | |
| virtual bool | beginStartupActivity () |
| virtual void | endStartupActivity (UsbStartup::Outcome) |
| virtual void | releaseDeviceAddress (uint8_t) |
| MUST_USE_RESULT bool | publishInterruptInHandle (UsbInterruptInHandle &handle, const UsbInterruptInToken &token, void(*callback)(uintptr_t, ssize_t), uintptr_t parameter) |
| virtual bool | inInterruptCallbackContext () const |
| void | disconnectAllDevices () |
| void | retainDisconnectedAddressesUntilControllerTeardown () |
| void | attachToUpstreamHub (UsbHub *upstream, const RootConnection &connection) |
| UsbHub * | rootHub () const |
| MUST_USE_RESULT bool | suppressConnectionChanges (size_t port, ConnectionChangeSuppression &suppression) |
| MUST_USE_RESULT bool | deferConnectionChangeIfSuppressed (size_t port) |
| virtual void | replaySuppressedConnectionChange (size_t port) |
| virtual size_t | currentRootPortGeneration (size_t port) const |
Protected Member Functions inherited from Device | |
| NOT_COPYABLE_OR_ASSIGNABLE (Device) | |
Private Member Functions | |
| bool | setPortFeature (size_t port, PortFeatureSelectors feature) |
| bool | clearPortFeature (size_t port, PortFeatureSelectors feature) |
| bool | getPortStatus (size_t port, uint32_t &status) |
| Top 16 bits of status hold the port-change flags. | |
Private Attributes | |
| size_t | m_nPorts |
Additional Inherited Members | |
Public Types inherited from UsbDevice | |
| enum | UsbState { Connected = 0 , Addressed , HasDescriptors , Configured , HasInterface , HasDriver } |
| Possible states for an USB device. More... | |
Public Types inherited from Device | |
| enum | Type { Generic , Root , Disk , Bus , Display , Network , Sound , Console , Mouse , Controller , UsbController , UsbGeneric , UsbContainer } |
| typedef Device *(* | Callback) (Device *) |
Static Public Member Functions inherited from Device | |
| static void | foreach (Callback callback, Device *root=0) |
| template<class F , class... Args> | |
| static void | foreach (pedigree_std::Callable< F > &callback, Device *root, Args... args) |
| static void | addToRoot (Device *device) |
| static void | searchByVendorId (uint16_t vendorId, void(*callback)(Device *), Device *root=0) |
| static void | searchByVendorIdAndDeviceId (uint16_t vendorId, uint16_t deviceId, void(*callback)(Device *), Device *root=0) |
| static void | searchByClass (uint16_t classCode, void(*callback)(Device *), Device *root=0) |
| static void | searchByClassAndSubclass (uint16_t classCode, uint16_t subclassCode, void(*callback)(Device *), Device *root=0) |
| static void | searchByClassSubclassAndProgInterface (uint16_t classCode, uint16_t subclassCode, uint8_t progInterface, void(*callback)(Device *), Device *root=0) |
Public Attributes inherited from UsbDevice | |
| struct UsbDevice::Setup | PACKED |
| struct UsbDevice::DeviceQualifier | PACKED |
Static Protected Member Functions inherited from Device | |
| static Device & | root () |
Protected Attributes inherited from UsbDevice | |
| 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. | |
Protected Attributes inherited from Device | |
| Vector< Address * > | m_Addresses |
| Vector< Device * > | m_Children |
| Device * | m_pParent |
| uintptr_t | m_InterruptNumber |
| String | m_SpecificType |
| PciBus::ConfigSpace | m_ConfigHeader |
| uint8_t | m_ClassCode |
| uint8_t | m_SubclassCode |
| uint16_t | m_VendorId |
| uint16_t | m_DeviceId |
| uint8_t | m_ProgInterface |
| uint32_t | m_PciBusPos |
| uint32_t | m_PciDevicePos |
| uint32_t | m_PciFunctionNum |
Static Protected Attributes inherited from Device | |
| static Device | m_Root |
| static Mutex | m_TreeLock |
Definition at line 32 of file UsbHubDevice.h.
|
private |
Definition at line 76 of file UsbHubDevice.h.
|
private |
Definition at line 98 of file UsbHubDevice.h.
|
private |
Definition at line 81 of file UsbHubDevice.h.
| UsbHubDevice::UsbHubDevice | ( | UsbDevice * | dev | ) |
Definition at line 32 of file UsbHubDevice.cc.
|
virtual |
Definition at line 36 of file UsbHubDevice.cc.
|
virtual |
Adds an owned recurring interrupt-IN transaction.
Implements UsbHub.
Definition at line 214 of file UsbHubDevice.cc.
References UsbHub::addInterruptInHandler(), UsbDevice::m_nAddress, UsbDevice::m_nPort, UsbDevice::m_pHub, and UsbDevice::m_Speed.
|
virtual |
Adds a new transfer to an existent transaction.
Implements UsbHub.
Definition at line 188 of file UsbHubDevice.cc.
References UsbHub::addTransferToTransaction(), and UsbDevice::m_pHub.
|
protectedvirtual |
Cancels an accepted transaction or drains a completion which won the race. On return, the matching callback has run exactly once and the controller can no longer access any transfer buffer.
The callback and parameter identify the original transaction generation, preventing a stale numeric transaction handle from cancelling a reused controller slot.
Implements UsbHub.
Definition at line 209 of file UsbHubDevice.cc.
References UsbHub::cancelAsyncAndDrain(), and UsbDevice::m_pHub.
|
overrideprotectedvirtual |
Stops and drains one exact recurring interrupt-IN subscription.
Implements UsbHub.
Definition at line 228 of file UsbHubDevice.cc.
References panic().
|
private |
Definition at line 176 of file UsbHubDevice.cc.
|
virtual |
Creates a new transaction with the given endpoint data.
Implements UsbHub.
Definition at line 193 of file UsbHubDevice.cc.
References UsbHub::createTransaction(), UsbDevice::m_nAddress, UsbDevice::m_nPort, UsbDevice::m_pHub, and UsbDevice::m_Speed.
|
virtual |
Performs a transaction asynchronously.
Returning true transfers one completion obligation to the controller: it must call the callback exactly once, and only after it can no longer access any transfer buffer. Returning false guarantees that the callback was not and will not be called, and that the rejected transaction no longer owns controller or transfer-buffer state.
Implements UsbHub.
Definition at line 204 of file UsbHubDevice.cc.
References UsbHub::doAsync(), and UsbDevice::m_pHub.
|
inlineoverridevirtual |
Get a usable Device for this particular UsbDevice, if it has a subtree.
Reimplemented from UsbDevice.
Definition at line 47 of file UsbHubDevice.h.
|
inlinevirtual |
Stores the device's name in str.
Reimplemented from Device.
Definition at line 39 of file UsbHubDevice.h.
|
private |
Top 16 bits of status hold the port-change flags.
Definition at line 180 of file UsbHubDevice.cc.
References UsbDevice::controlRequest().
Referenced by initialiseDriver(), and portReset().
Here is the caller graph for this function:
|
inlineoverridevirtual |
Do we expose our own Device tree?
Reimplemented from UsbDevice.
Definition at line 43 of file UsbHubDevice.h.
|
virtual |
Implemented by the driver class, initialises driver-specific stuff.
Reimplemented from UsbDevice.
Definition at line 44 of file UsbHubDevice.cc.
References Dec, UsbHub::deviceConnected(), UsbDevice::getDescriptor(), UsbDevice::getDescriptorLength(), getPortStatus(), Hex, UsbDevice::m_UsbState, and portReset().
|
virtual |
Gets a UsbDevice from a given vendor:product pair.
Performs a port reset for the given port. Should only be used in situations where a device cannot recover from an error without a complete reset.
| bErrorResponse | true if this is a reset as a response to an error. Error responses are allowed to use significantly longer delays in their reset logic. |
Implements UsbHub.
Definition at line 136 of file UsbHubDevice.cc.
References Dec, getPortStatus(), and Hex.
Referenced by initialiseDriver().
Here is the caller graph for this function:
|
overridevirtual |
Quiesces driver-specific ownership before replacing this binding.
Reimplemented from UsbDevice.
Definition at line 40 of file UsbHubDevice.cc.
References UsbHub::retainDisconnectedAddressesUntilControllerTeardown().
|
private |
Definition at line 172 of file UsbHubDevice.cc.
|
private |
Definition at line 130 of file UsbHubDevice.h.