pof_usb.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #pragma once
  2. #include <furi_hal.h>
  3. #include <furi_hal_version.h>
  4. #include <furi_hal_usb.h>
  5. #include <furi_hal_usb_hid.h>
  6. #include "usb.h"
  7. #include "usb_hid.h"
  8. #include "virtual_portal.h"
  9. #define HID_REPORT_TYPE_INPUT 1
  10. #define HID_REPORT_TYPE_OUTPUT 2
  11. #define HID_REPORT_TYPE_FEATURE 3
  12. typedef struct PoFUsb PoFUsb;
  13. PoFUsb* pof_usb_start(VirtualPortal* virtual_portal);
  14. PoFUsb* pof_usb_start_xbox_360(VirtualPortal* virtual_portal);
  15. void pof_usb_stop(PoFUsb* pof);
  16. /*descriptor type*/
  17. typedef enum {
  18. PoFDescriptorTypeDevice = 0x01,
  19. PoFDescriptorTypeConfig = 0x02,
  20. PoFDescriptorTypeString = 0x03,
  21. PoFDescriptorTypeInterface = 0x04,
  22. PoFDescriptorTypeEndpoint = 0x05,
  23. } PoFDescriptorType;
  24. /*endpoint direction*/
  25. typedef enum {
  26. PoFEndpointIn = 0x80,
  27. PoFEndpointOut = 0x00,
  28. } PoFEndpointDirection;
  29. /*endpoint type*/
  30. typedef enum {
  31. PoFEndpointTypeCtrl = 0x00,
  32. PoFEndpointTypeIso = 0x01,
  33. PoFEndpointTypeBulk = 0x02,
  34. PoFEndpointTypeIntr = 0x03,
  35. } PoFEndpointType;
  36. /*control request type*/
  37. typedef enum {
  38. PoFControlTypeStandard = (0 << 5),
  39. PoFControlTypeClass = (1 << 5),
  40. PoFControlTypeVendor = (2 << 5),
  41. PoFControlTypeReserved = (3 << 5),
  42. } PoFControlType;
  43. /*control request recipient*/
  44. typedef enum {
  45. PoFControlRecipientDevice = 0,
  46. PoFControlRecipientInterface = 1,
  47. PoFControlRecipientEndpoint = 2,
  48. PoFControlRecipientOther = 3,
  49. } PoFControlRecipient;
  50. /*control request direction*/
  51. typedef enum {
  52. PoFControlOut = 0x00,
  53. PoFControlIn = 0x80,
  54. } PoFControlDirection;
  55. /*endpoint address mask*/
  56. typedef enum {
  57. PoFEndpointAddrMask = 0x0f,
  58. PoFEndpointDirMask = 0x80,
  59. PoFEndpointTransferTypeMask = 0x03,
  60. PoFCtrlDirMask = 0x80,
  61. } PoFEndpointMask;
  62. /* USB control requests */
  63. typedef enum {
  64. PoFControlRequestsOut = (PoFControlTypeVendor | PoFControlRecipientDevice | PoFControlOut),
  65. PoFControlRequestsIn = (PoFControlTypeVendor | PoFControlRecipientDevice | PoFControlIn),
  66. } PoFControlRequests;