windows_usbdk.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * windows UsbDk backend for libusb 1.0
  3. * Copyright © 2014 Red Hat, Inc.
  4. * Authors:
  5. * Dmitry Fleytman <dmitry@daynix.com>
  6. * Pavel Gurvich <pavel@daynix.com>
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #ifndef LIBUSB_WINDOWS_USBDK_H
  23. #define LIBUSB_WINDOWS_USBDK_H
  24. #include "windows_common.h"
  25. typedef struct USB_DK_CONFIG_DESCRIPTOR_REQUEST {
  26. USB_DK_DEVICE_ID ID;
  27. ULONG64 Index;
  28. } USB_DK_CONFIG_DESCRIPTOR_REQUEST, *PUSB_DK_CONFIG_DESCRIPTOR_REQUEST;
  29. typedef enum {
  30. TransferFailure = 0,
  31. TransferSuccess,
  32. TransferSuccessAsync
  33. } TransferResult;
  34. typedef enum {
  35. NoSpeed = 0,
  36. LowSpeed,
  37. FullSpeed,
  38. HighSpeed,
  39. SuperSpeed
  40. } USB_DK_DEVICE_SPEED;
  41. typedef enum {
  42. ControlTransferType,
  43. BulkTransferType,
  44. InterruptTransferType,
  45. IsochronousTransferType
  46. } USB_DK_TRANSFER_TYPE;
  47. typedef BOOL (__cdecl *USBDK_GET_DEVICES_LIST)(
  48. PUSB_DK_DEVICE_INFO *DeviceInfo,
  49. PULONG DeviceNumber
  50. );
  51. typedef void (__cdecl *USBDK_RELEASE_DEVICES_LIST)(
  52. PUSB_DK_DEVICE_INFO DeviceInfo
  53. );
  54. typedef HANDLE (__cdecl *USBDK_START_REDIRECT)(
  55. PUSB_DK_DEVICE_ID DeviceId
  56. );
  57. typedef BOOL (__cdecl *USBDK_STOP_REDIRECT)(
  58. HANDLE DeviceHandle
  59. );
  60. typedef BOOL (__cdecl *USBDK_GET_CONFIGURATION_DESCRIPTOR)(
  61. PUSB_DK_CONFIG_DESCRIPTOR_REQUEST Request,
  62. PUSB_CONFIGURATION_DESCRIPTOR *Descriptor,
  63. PULONG Length
  64. );
  65. typedef void (__cdecl *USBDK_RELEASE_CONFIGURATION_DESCRIPTOR)(
  66. PUSB_CONFIGURATION_DESCRIPTOR Descriptor
  67. );
  68. typedef TransferResult (__cdecl *USBDK_WRITE_PIPE)(
  69. HANDLE DeviceHandle,
  70. PUSB_DK_TRANSFER_REQUEST Request,
  71. LPOVERLAPPED lpOverlapped
  72. );
  73. typedef TransferResult (__cdecl *USBDK_READ_PIPE)(
  74. HANDLE DeviceHandle,
  75. PUSB_DK_TRANSFER_REQUEST Request,
  76. LPOVERLAPPED lpOverlapped
  77. );
  78. typedef BOOL (__cdecl *USBDK_ABORT_PIPE)(
  79. HANDLE DeviceHandle,
  80. ULONG64 PipeAddress
  81. );
  82. typedef BOOL (__cdecl *USBDK_RESET_PIPE)(
  83. HANDLE DeviceHandle,
  84. ULONG64 PipeAddress
  85. );
  86. typedef BOOL (__cdecl *USBDK_SET_ALTSETTING)(
  87. HANDLE DeviceHandle,
  88. ULONG64 InterfaceIdx,
  89. ULONG64 AltSettingIdx
  90. );
  91. typedef BOOL (__cdecl *USBDK_RESET_DEVICE)(
  92. HANDLE DeviceHandle
  93. );
  94. typedef HANDLE (__cdecl *USBDK_GET_REDIRECTOR_SYSTEM_HANDLE)(
  95. HANDLE DeviceHandle
  96. );
  97. #endif