summaryrefslogtreecommitdiff
path: root/Kernel/Bus/USB/USBRequest.h
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-06-25 09:51:22 +0300
committerAndreas Kling <kling@serenityos.org>2021-07-02 13:16:12 +0200
commit5073bf8e75a1e71be8bbcdc96c10c3711e8ae22c (patch)
tree218a5a824a781bc1dd7f32c09ec135b1bbab0f0e /Kernel/Bus/USB/USBRequest.h
parent6568bb47cb6b3ad7ca0c15948ce1a279792d92de (diff)
downloadserenity-5073bf8e75a1e71be8bbcdc96c10c3711e8ae22c.zip
Kernel/USB: Move the USB components as a subfolder to the Bus directory
Diffstat (limited to 'Kernel/Bus/USB/USBRequest.h')
-rw-r--r--Kernel/Bus/USB/USBRequest.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/Kernel/Bus/USB/USBRequest.h b/Kernel/Bus/USB/USBRequest.h
new file mode 100644
index 0000000000..38f184de1f
--- /dev/null
+++ b/Kernel/Bus/USB/USBRequest.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Types.h>
+
+//
+// USB Request directions
+//
+// As per Section 9.4 of the USB Specification, it is noted that Requeset Types that
+// Device to Host have bit 7 of `bmRequestType` set. These are here as a convenience,
+// as we construct the request at the call-site to make reading transfers easier.
+//
+static constexpr u8 USB_DEVICE_REQUEST_DEVICE_TO_HOST = 0x80;
+static constexpr u8 USB_DEVICE_REQUEST_HOST_TO_DEVICE = 0x00;
+static constexpr u8 USB_INTERFACE_REQUEST_DEVICE_TO_HOST = 0x81;
+static constexpr u8 USB_INTERFACE_REQUEST_HOST_TO_DEVICE = 0x01;
+static constexpr u8 USB_ENDPOINT_REQUEST_DEVICE_TO_HOST = 0x82;
+static constexpr u8 USB_ENDPOINT_REQUEST_HOST_TO_DEVICE = 0x02;
+
+//
+// Standard USB request types
+//
+// These are found in Section 9.4 of the USB Spec
+//
+static constexpr u8 USB_REQUEST_GET_STATUS = 0x00;
+static constexpr u8 USB_REQUEST_CLEAR_FEATURE = 0x01;
+static constexpr u8 USB_REQUEST_SET_FEATURE = 0x03;
+static constexpr u8 USB_REQUEST_SET_ADDRESS = 0x05;
+static constexpr u8 USB_REQUEST_GET_DESCRIPTOR = 0x06;
+static constexpr u8 USB_REQUEST_SET_DESCRIPTOR = 0x07;
+static constexpr u8 USB_REQUEST_GET_CONFIGURATION = 0x08;
+static constexpr u8 USB_REQUEST_SET_CONFIGURATION = 0x09;