pof_usb.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. void pof_usb_stop(PoFUsb* pof);
  15. PoFUsb* pof_usb_start_xbox360(VirtualPortal* virtual_portal);
  16. void pof_usb_stop_xbox360(PoFUsb* pof);
  17. /*descriptor type*/
  18. typedef enum {
  19. PoFDescriptorTypeDevice = 0x01,
  20. PoFDescriptorTypeConfig = 0x02,
  21. PoFDescriptorTypeString = 0x03,
  22. PoFDescriptorTypeInterface = 0x04,
  23. PoFDescriptorTypeEndpoint = 0x05,
  24. } PoFDescriptorType;
  25. /*endpoint direction*/
  26. typedef enum {
  27. PoFEndpointIn = 0x80,
  28. PoFEndpointOut = 0x00,
  29. } PoFEndpointDirection;
  30. /*endpoint type*/
  31. typedef enum {
  32. PoFEndpointTypeCtrl = 0x00,
  33. PoFEndpointTypeIso = 0x01,
  34. PoFEndpointTypeBulk = 0x02,
  35. PoFEndpointTypeIntr = 0x03,
  36. } PoFEndpointType;
  37. /*control request type*/
  38. typedef enum {
  39. PoFControlTypeStandard = (0 << 5),
  40. PoFControlTypeClass = (1 << 5),
  41. PoFControlTypeVendor = (2 << 5),
  42. PoFControlTypeReserved = (3 << 5),
  43. } PoFControlType;
  44. /*control request recipient*/
  45. typedef enum {
  46. PoFControlRecipientDevice = 0,
  47. PoFControlRecipientInterface = 1,
  48. PoFControlRecipientEndpoint = 2,
  49. PoFControlRecipientOther = 3,
  50. } PoFControlRecipient;
  51. /*control request direction*/
  52. typedef enum {
  53. PoFControlOut = 0x00,
  54. PoFControlIn = 0x80,
  55. } PoFControlDirection;
  56. /*endpoint address mask*/
  57. typedef enum {
  58. PoFEndpointAddrMask = 0x0f,
  59. PoFEndpointDirMask = 0x80,
  60. PoFEndpointTransferTypeMask = 0x03,
  61. PoFCtrlDirMask = 0x80,
  62. } PoFEndpointMask;
  63. /* USB control requests */
  64. typedef enum {
  65. PoFControlRequestsOut = (PoFControlTypeVendor | PoFControlRecipientDevice | PoFControlOut),
  66. PoFControlRequestsIn = (PoFControlTypeVendor | PoFControlRecipientDevice | PoFControlIn),
  67. } PoFControlRequests;