Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

349 lines
7.0 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. usbbusif.h
  5. Abstract:
  6. Environment:
  7. Kernel mode
  8. Revision History:
  9. 6-20-99 : created
  10. --*/
  11. #ifndef __USBBUSIF_H__
  12. #define __USBBUSIF_H__
  13. typedef PVOID PUSB_DEVICE_HANDLE;
  14. #ifndef USB_BUSIFFN
  15. #define USB_BUSIFFN __stdcall
  16. #endif
  17. /****************************************************************************
  18. Bus interfce for USB CLIENT DRIVERS
  19. *****************************************************************************/
  20. /*
  21. The following bus interface is defined for client drivers
  22. as an alternative to linking directly with USBD
  23. It provides interfaces that may be called at Raised IRQL
  24. without allocating an IRP
  25. */
  26. /*
  27. NTSTATUS
  28. USBPORT_SubmitIsoOutUrb(
  29. IN PVOID BusContext,
  30. IN PURB Urb
  31. );
  32. Routine Description:
  33. Service exported for Real-Time Thread support. Allows a driver
  34. to submit a request without going thru IoCallDriver or allocating
  35. an Irp.
  36. Additionally the request is scheduled while at high IRQL. The driver
  37. forfeits any packet level error information when calling this function.
  38. IRQL = ANY
  39. Arguments:
  40. BusContext - Handle returned from get_bus_interface
  41. Urb -
  42. */
  43. typedef NTSTATUS
  44. (USB_BUSIFFN *PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB) (
  45. IN PVOID,
  46. IN PURB
  47. );
  48. /*
  49. VOID
  50. USBPORT_GetUSBDIVersion(
  51. IN PVOID BusContext,
  52. IN OUT PUSBD_VERSION_INFORMATION VersionInformation,
  53. IN OUT PULONG HcdCapabilities
  54. );
  55. Routine Description:
  56. Service Returns the Highest USBDI Interface Version supported
  57. by the port driver.
  58. Released Interface Vesrions are:
  59. Win98Gold,usbd 0x00000102
  60. Win98SE,usbd 0x00000200
  61. Win2K,usbd 0x00000300
  62. Win98M (Millenium),usbd 0x00000400
  63. Usbport 0x00000500
  64. IRQL = ANY
  65. Arguments:
  66. VersionInformation - Ptr to USBD_VERSION_INFORMATION
  67. HcdCapabilities - Ptr to ULONG that will be filled in with
  68. the Host controller (port) driver capability flags.
  69. */
  70. /*
  71. Host Controller 'Port' driver capabilities flags
  72. */
  73. #define USB_HCD_CAPS_SUPPORTS_RT_THREADS 0x00000001
  74. typedef VOID
  75. (USB_BUSIFFN *PUSB_BUSIFFN_GETUSBDI_VERSION) (
  76. IN PVOID,
  77. IN OUT PUSBD_VERSION_INFORMATION,
  78. IN OUT PULONG
  79. );
  80. /*
  81. NTSTATUS
  82. USBPORT_QueryBusTime(
  83. IN PVOID BusContext,
  84. IN OUT PULONG CurrentUsbFrame
  85. );
  86. Routine Description:
  87. Returns the current 32 bit USB frame number. The function
  88. replaces the USBD_QueryBusTime Service.
  89. IRQL = ANY
  90. Arguments:
  91. */
  92. typedef NTSTATUS
  93. (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_TIME) (
  94. IN PVOID,
  95. IN PULONG
  96. );
  97. /*
  98. NTSTATUS
  99. USBPORT_BusEnumLogEntry(
  100. PVOID BusContext,
  101. ULONG DriverTag,
  102. ULONG EnumTag,
  103. ULONG P1,
  104. ULONG P2
  105. );
  106. Routine Description:
  107. IRQL = ANY
  108. Arguments:
  109. */
  110. typedef NTSTATUS
  111. (USB_BUSIFFN *PUSB_BUSIFFN_ENUM_LOG_ENTRY) (
  112. IN PVOID,
  113. IN ULONG,
  114. IN ULONG,
  115. IN ULONG,
  116. IN ULONG
  117. );
  118. /*
  119. NTSTATUS
  120. USBPORT_QueryBusInformation(
  121. IN PVOID BusContext,
  122. IN ULONG Level,
  123. IN OUT PVOID BusInformationBuffer,
  124. IN OUT PULONG BusInformationBufferLength,
  125. OUT PULONG BusInformationActualLength
  126. );
  127. Routine Description:
  128. IRQL = ANY
  129. Arguments:
  130. */
  131. typedef struct _USB_BUS_INFORMATION_LEVEL_0 {
  132. /* bandwidth in bits/sec */
  133. ULONG TotalBandwidth;
  134. /* mean bandwidth consumed in bits/sec */
  135. ULONG ConsumedBandwidth;
  136. } USB_BUS_INFORMATION_LEVEL_0, *PUSB_BUS_INFORMATION_LEVEL_0;
  137. typedef struct _USB_BUS_INFORMATION_LEVEL_1 {
  138. /* bandwidth in bits/sec */
  139. ULONG TotalBandwidth;
  140. /* mean bandwidth consumed in bits/sec */
  141. ULONG ConsumedBandwidth;
  142. /*
  143. controller 'unicode' symbolic name
  144. */
  145. ULONG ControllerNameLength;
  146. WCHAR ControllerNameUnicodeString[1];
  147. } USB_BUS_INFORMATION_LEVEL_1, *PUSB_BUS_INFORMATION_LEVEL_1;
  148. typedef NTSTATUS
  149. (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_INFORMATION) (
  150. IN PVOID,
  151. IN ULONG,
  152. IN OUT PVOID,
  153. IN OUT PULONG,
  154. OUT PULONG
  155. );
  156. /*
  157. BOOLEAN
  158. USBPORT_IsDeviceHighSpeed(
  159. IN PVOID BusContext
  160. );
  161. Routine Description:
  162. Returns true if device is high speed
  163. IRQL = ANY
  164. Arguments:
  165. */
  166. typedef BOOLEAN
  167. (USB_BUSIFFN *PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED) (
  168. IN PVOID
  169. );
  170. #define USB_BUSIF_USBDI_VERSION_0 0x0000
  171. #define USB_BUSIF_USBDI_VERSION_1 0x0001
  172. #define USB_BUSIF_USBDI_VERSION_2 0x0002
  173. // {B1A96A13-3DE0-4574-9B01-C08FEAB318D6}
  174. DEFINE_GUID(USB_BUS_INTERFACE_USBDI_GUID,
  175. 0xb1a96a13, 0x3de0, 0x4574, 0x9b, 0x1, 0xc0, 0x8f, 0xea, 0xb3, 0x18, 0xd6);
  176. /*
  177. Note: that this version must remain unchanged, this is the
  178. version that is supported by USBD in Win2k and WinMe
  179. */
  180. typedef struct _USB_BUS_INTERFACE_USBDI_V0 {
  181. USHORT Size;
  182. USHORT Version;
  183. PVOID BusContext;
  184. PINTERFACE_REFERENCE InterfaceReference;
  185. PINTERFACE_DEREFERENCE InterfaceDereference;
  186. // interface specific entries go here
  187. // the following functions must be callable at high IRQL,
  188. // (ie higher than DISPATCH_LEVEL)
  189. PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion;
  190. PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime;
  191. PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb;
  192. PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation;
  193. } USB_BUS_INTERFACE_USBDI_V0, *PUSB_BUS_INTERFACE_USBDI_V0;
  194. /*
  195. New extensions for Windows XP
  196. */
  197. typedef struct _USB_BUS_INTERFACE_USBDI_V1 {
  198. USHORT Size;
  199. USHORT Version;
  200. PVOID BusContext;
  201. PINTERFACE_REFERENCE InterfaceReference;
  202. PINTERFACE_DEREFERENCE InterfaceDereference;
  203. // interface specific entries go here
  204. // the following functions must be callable at high IRQL,
  205. // (ie higher than DISPATCH_LEVEL)
  206. PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion;
  207. PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime;
  208. PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb;
  209. PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation;
  210. PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed;
  211. } USB_BUS_INTERFACE_USBDI_V1, *PUSB_BUS_INTERFACE_USBDI_V1;
  212. /*
  213. New extensions for Windows XP
  214. */
  215. typedef struct _USB_BUS_INTERFACE_USBDI_V2 {
  216. USHORT Size;
  217. USHORT Version;
  218. PVOID BusContext;
  219. PINTERFACE_REFERENCE InterfaceReference;
  220. PINTERFACE_DEREFERENCE InterfaceDereference;
  221. // interface specific entries go here
  222. // the following functions must be callable at high IRQL,
  223. // (ie higher than DISPATCH_LEVEL)
  224. PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion;
  225. PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime;
  226. PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb;
  227. PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation;
  228. PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed;
  229. PUSB_BUSIFFN_ENUM_LOG_ENTRY EnumLogEntry;
  230. } USB_BUS_INTERFACE_USBDI_V2, *PUSB_BUS_INTERFACE_USBDI_V2;
  231. #endif /* __USBBUSIF_H */