mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +00:00
Kernel/USB: Create controller base class and introduce USBManagement
This removes Pipes dependency on the UHCIController by introducing a controller base class. This will be used to implement other controllers such as OHCI. Additionally, there can be multiple instances of a UHCI controller. For example, multiple UHCI instances can be required for systems with EHCI controllers. EHCI relies on using multiple of either UHCI or OHCI controllers to drive USB 1.x devices. This means UHCIController can no longer be a singleton. Multiple instances of it can now be created and passed to the device and then to the pipe. To handle finding and creating these instances, USBManagement has been introduced. It has the same pattern as the other management classes such as NetworkManagement.
This commit is contained in:
parent
c5974d3518
commit
7a86a8df90
14 changed files with 261 additions and 74 deletions
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace Kernel::USB {
|
||||
|
||||
class USBController;
|
||||
|
||||
//
|
||||
// Some nice info from FTDI on device enumeration and how some of this
|
||||
// glues together:
|
||||
|
@ -30,9 +32,9 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
static KResultOr<NonnullRefPtr<Device>> try_create(PortNumber, DeviceSpeed);
|
||||
static KResultOr<NonnullRefPtr<Device>> try_create(USBController const&, PortNumber, DeviceSpeed);
|
||||
|
||||
Device(PortNumber, DeviceSpeed, NonnullOwnPtr<Pipe> default_pipe);
|
||||
Device(USBController const&, PortNumber, DeviceSpeed, NonnullOwnPtr<Pipe> default_pipe);
|
||||
~Device();
|
||||
|
||||
KResult enumerate();
|
||||
|
@ -54,6 +56,7 @@ private:
|
|||
u16 m_product_id { 0 }; // This device's product ID assigned by the USB group
|
||||
USBDeviceDescriptor m_device_descriptor; // Device Descriptor obtained from USB Device
|
||||
|
||||
NonnullRefPtr<USBController> m_controller;
|
||||
NonnullOwnPtr<Pipe> m_default_pipe; // Default communication pipe (endpoint0) used during enumeration
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue