The Pedigree Project  0.1
Classes | Public Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes | List of all members
UsbHub Class Referenceabstract
+ Inheritance diagram for UsbHub:
+ Collaboration diagram for UsbHub:

Classes

struct  SyncParam
 Structure used synchronous transactions. More...
 

Public Member Functions

 UsbHub (Device *p)
 
virtual Type getType ()
 
virtual void addTransferToTransaction (uintptr_t pTransaction, bool bToggle, UsbPid pid, uintptr_t pBuffer, size_t nBytes)=0
 Adds a new transfer to an existent transaction.
 
virtual uintptr_t createTransaction (UsbEndpoint endpointInfo)=0
 Creates a new transaction with the given endpoint data.
 
virtual void doAsync (uintptr_t pTransaction, void(*pCallback)(uintptr_t, ssize_t)=0, uintptr_t pParam=0)=0
 
virtual void addInterruptInHandler (UsbEndpoint endpointInfo, uintptr_t pBuffer, uint16_t nBytes, void(*pCallback)(uintptr_t, ssize_t), uintptr_t pParam=0)=0
 Adds a new handler for an interrupt IN transaction.
 
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)
 
virtual bool portReset (uint8_t nPort, bool bErrorResponse=false)=0
 Gets a UsbDevice from a given vendor:product pair. More...
 
void ignoreConnectionChanges (uint8_t nPort, bool bIgnore=true)
 
- Public Member Functions inherited from Device
 Device (Device *p)
 
DevicegetParent () const
 
void setParent (Device *p)
 
virtual void getName (String &str)
 
virtual 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)
 
DevicegetChild (size_t n)
 
size_t getNumChildren ()
 
void removeChild (size_t n)
 
void removeChild (Device *d)
 
void replaceChild (Device *src, Device *dest)
 

Protected Attributes

ExtensibleBitmap m_IgnoredPorts
 Bitmap of ports to ignore connection changes on.
 
- Protected Attributes inherited from Device
Vector< Address * > m_Addresses
 
Vector< Device * > m_Children
 
Devicem_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 Private Member Functions

static void syncCallback (uintptr_t pParam, ssize_t ret)
 Callback used by synchronous transactions.
 

Private Attributes

ExtensibleBitmap m_UsedAddresses
 

Additional Inherited Members

- 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)
 
- Protected Member Functions inherited from Device
 NOT_COPYABLE_OR_ASSIGNABLE (Device)
 
- Static Protected Member Functions inherited from Device
static Deviceroot ()
 
- Static Protected Attributes inherited from Device
static Device m_Root
 
static Mutex m_TreeLock
 

Detailed Description

Definition at line 30 of file UsbHub.h.

Member Function Documentation

virtual void UsbHub::doAsync ( uintptr_t  pTransaction,
void(*)(uintptr_t, ssize_t)  pCallback = 0,
uintptr_t  pParam = 0 
)
pure virtual

Performs a transaction asynchronously, calling the given callback on completion

Implemented in Ohci, Ehci, Uhci, and UsbHubDevice.

ssize_t UsbHub::doSync ( uintptr_t  nTransaction,
uint32_t  timeout = 5000 
)

Performs a transaction, blocks until it's completed and returns the result

Bug:
Transaction is never deleted here - which makes pParam in the syncCallback above invalid, causing an assertion failure in Semaphore if this times out.

Definition at line 234 of file UsbHub.cc.

References Semaphore::acquire(), and WARNING.

Referenced by UsbDevice::controlRequest(), and UsbDevice::initialise().

+ Here is the caller graph for this function:

Device::Type UsbHub::getType ( )
virtual

Returns the (abstract) type of the device.

Reimplemented from Device.

Definition at line 42 of file UsbHub.cc.

References Device::UsbController.

void UsbHub::ignoreConnectionChanges ( uint8_t  nPort,
bool  bIgnore = true 
)
inline

Tells the hub to IGNORE a specific port's connect state changes for a short while.

Parameters
bIgnorepass true to stop ignoring a port.

Definition at line 85 of file UsbHub.h.

Referenced by deviceConnected().

+ Here is the caller graph for this function:

virtual bool UsbHub::portReset ( uint8_t  nPort,
bool  bErrorResponse = false 
)
pure 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.

Note
Assumes the port is at CONNECTED with a VALID DEVICE attached.
Parameters
bErrorResponsetrue if this is a reset as a response to an error. Error responses are allowed to use significantly longer delays in their reset logic.

Implemented in Ohci, Ehci, Uhci, and UsbHubDevice.

Referenced by deviceConnected(), and UsbHubDevice::initialiseDriver().

+ Here is the caller graph for this function:

Member Data Documentation

ExtensibleBitmap UsbHub::m_UsedAddresses
private

Bitmap of used addresses under this hub

Note
valid only for root hubs

Definition at line 112 of file UsbHub.h.

Referenced by deviceConnected(), and deviceDisconnected().


The documentation for this class was generated from the following files: