USBRequest.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #pragma once
  8. #include <AK/Types.h>
  9. //
  10. // bmRequestType fields
  11. //
  12. // As per Section 9.3 of the USB 2.0 Specification.
  13. // Note that while some of these values are zero, there are here for convenience.
  14. // This is because it makes reading the request type easier to read when constructing a USB request.
  15. //
  16. static constexpr u8 USB_REQUEST_TRANSFER_DIRECTION_DEVICE_TO_HOST = 0x80;
  17. static constexpr u8 USB_REQUEST_TRANSFER_DIRECTION_HOST_TO_DEVICE = 0x00;
  18. static constexpr u8 USB_REQUEST_TYPE_STANDARD = 0x00;
  19. static constexpr u8 USB_REQUEST_TYPE_CLASS = 0x20;
  20. static constexpr u8 USB_REQUEST_TYPE_VENDOR = 0x40;
  21. static constexpr u8 USB_REQUEST_RECIPIENT_DEVICE = 0x00;
  22. static constexpr u8 USB_REQUEST_RECIPIENT_INTERFACE = 0x01;
  23. static constexpr u8 USB_REQUEST_RECIPIENT_ENDPOINT = 0x02;
  24. static constexpr u8 USB_REQUEST_RECIPIENT_OTHER = 0x03;
  25. //
  26. // Standard USB request types
  27. //
  28. // These are found in Section 9.4 of the USB Spec
  29. //
  30. static constexpr u8 USB_REQUEST_GET_STATUS = 0x00;
  31. static constexpr u8 USB_REQUEST_CLEAR_FEATURE = 0x01;
  32. static constexpr u8 USB_REQUEST_SET_FEATURE = 0x03;
  33. static constexpr u8 USB_REQUEST_SET_ADDRESS = 0x05;
  34. static constexpr u8 USB_REQUEST_GET_DESCRIPTOR = 0x06;
  35. static constexpr u8 USB_REQUEST_SET_DESCRIPTOR = 0x07;
  36. static constexpr u8 USB_REQUEST_GET_CONFIGURATION = 0x08;
  37. static constexpr u8 USB_REQUEST_SET_CONFIGURATION = 0x09;