Serenity Operating System
1/*
2 * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
3 * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
4 *
5 * SPDX-License-Identifier: BSD-2-Clause
6 */
7
8#pragma once
9
10#include <AK/Types.h>
11
12namespace Kernel::USB {
13
14//
15// bmRequestType fields
16//
17// As per Section 9.3 of the USB 2.0 Specification.
18// Note that while some of these values are zero, there are here for convenience.
19// This is because it makes reading the request type easier to read when constructing a USB request.
20//
21static constexpr u8 USB_REQUEST_TRANSFER_DIRECTION_DEVICE_TO_HOST = 0x80;
22static constexpr u8 USB_REQUEST_TRANSFER_DIRECTION_HOST_TO_DEVICE = 0x00;
23static constexpr u8 USB_REQUEST_TYPE_STANDARD = 0x00;
24static constexpr u8 USB_REQUEST_TYPE_CLASS = 0x20;
25static constexpr u8 USB_REQUEST_TYPE_VENDOR = 0x40;
26static constexpr u8 USB_REQUEST_RECIPIENT_DEVICE = 0x00;
27static constexpr u8 USB_REQUEST_RECIPIENT_INTERFACE = 0x01;
28static constexpr u8 USB_REQUEST_RECIPIENT_ENDPOINT = 0x02;
29static constexpr u8 USB_REQUEST_RECIPIENT_OTHER = 0x03;
30
31//
32// Standard USB request types
33//
34// These are found in Section 9.4 of the USB Spec
35//
36static constexpr u8 USB_REQUEST_GET_STATUS = 0x00;
37static constexpr u8 USB_REQUEST_CLEAR_FEATURE = 0x01;
38static constexpr u8 USB_REQUEST_SET_FEATURE = 0x03;
39static constexpr u8 USB_REQUEST_SET_ADDRESS = 0x05;
40static constexpr u8 USB_REQUEST_GET_DESCRIPTOR = 0x06;
41static constexpr u8 USB_REQUEST_SET_DESCRIPTOR = 0x07;
42static constexpr u8 USB_REQUEST_GET_CONFIGURATION = 0x08;
43static constexpr u8 USB_REQUEST_SET_CONFIGURATION = 0x09;
44
45}