summaryrefslogtreecommitdiff
path: root/Kernel/Devices
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-04 18:58:37 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-04 21:21:46 +0200
commit1254447bd7a3f5b36bae85824b2ba68caaf3b9b5 (patch)
tree5485ccd698e62bb1847d8e1aca4c9bb22d043f5e /Kernel/Devices
parente834c24eea2ca87e35f4c0f8c9bbdf007d859372 (diff)
downloadserenity-1254447bd7a3f5b36bae85824b2ba68caaf3b9b5.zip
Kernel/USB: Add some constants for the USBCMD and USBSTS bits
Diffstat (limited to 'Kernel/Devices')
-rw-r--r--Kernel/Devices/UHCIController.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/Kernel/Devices/UHCIController.cpp b/Kernel/Devices/UHCIController.cpp
index 5b1b118cb1..192eab8829 100644
--- a/Kernel/Devices/UHCIController.cpp
+++ b/Kernel/Devices/UHCIController.cpp
@@ -28,7 +28,21 @@
namespace Kernel {
-static constexpr u16 UHCI_HOST_CONTROLLER_RESET = 0x0002;
+static constexpr u16 UHCI_USBCMD_RUN = 0x0001;
+static constexpr u16 UHCI_USBCMD_HOST_CONTROLLER_RESET = 0x0002;
+static constexpr u16 UHCI_USBCMD_GLOBAL_RESET = 0x0004;
+static constexpr u16 UHCI_USBCMD_ENTER_GLOBAL_SUSPEND_MODE = 0x0008;
+static constexpr u16 UHCI_USBCMD_FORCE_GLOBAL_RESUME = 0x0010;
+static constexpr u16 UHCI_USBCMD_SOFTWARE_DEBUG = 0x0020;
+static constexpr u16 UHCI_USBCMD_CONFIGURE_FLAG = 0x0040;
+static constexpr u16 UHCI_USBCMD_MAX_PACKET = 0x0080;
+
+static constexpr u16 UHCI_USBSTS_HOST_CONTROLLER_HALTED = 0x0020;
+static constexpr u16 UHCI_USBSTS_HOST_CONTROLLER_PROCESS_ERROR = 0x0010;
+static constexpr u16 UHCI_USBSTS_PCI_BUS_ERROR = 0x0008;
+static constexpr u16 UHCI_USBSTS_RESUME_RECEIVED = 0x0004;
+static constexpr u16 UHCI_USBSTS_USB_ERROR_INTERRUPT = 0x0002;
+static constexpr u16 UHCI_USBSTS_USB_INTERRUPT = 0x0001;
void UHCIController::detect()
{
@@ -59,10 +73,11 @@ UHCIController::~UHCIController()
void UHCIController::reset()
{
- write_usbcmd(UHCI_HOST_CONTROLLER_RESET);
+ write_usbcmd(UHCI_USBCMD_HOST_CONTROLLER_RESET);
+ // FIXME: Timeout
for (;;) {
- if (read_usbcmd() & UHCI_HOST_CONTROLLER_RESET)
+ if (read_usbcmd() & UHCI_USBCMD_HOST_CONTROLLER_RESET)
continue;
break;
}