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.

291 lines
5.2 KiB

  1. /*++
  2. Copyright (c) 1996, 1997 Microsoft Corporation
  3. Module Name:
  4. hidmini.h
  5. --*/
  6. #ifndef __HIDMINI_H__
  7. #define __HIDMINI_H__
  8. #include <usb100.h>
  9. #include <hidusage.h>
  10. //
  11. // Declarations of HID descriptor formats
  12. //
  13. #include <PSHPACK1.H>
  14. typedef struct _USB_HID_DESCRIPTOR
  15. {
  16. UCHAR bLength;
  17. UCHAR bDescriptorType;
  18. USHORT bcdHID;
  19. UCHAR bCountry;
  20. UCHAR bNumDescriptors;
  21. UCHAR bReportType;
  22. USHORT wReportLength;
  23. } USB_HID_DESCRIPTOR, * PUSB_HID_DESCRIPTOR;
  24. typedef struct _USB_PHYSICAL_DESCRIPTOR
  25. {
  26. UCHAR bNumber;
  27. USHORT wLength;
  28. } USB_PHYSICAL_DESCRIPTOR, * PUSB_PHYSICAL_DESCRIPTOR;
  29. typedef UCHAR HID_REPORT_DESCRIPTOR, *PHID_REPORT_DESCRIPTOR;
  30. #include <POPPACK.H>
  31. //
  32. // Device Extension
  33. //
  34. // This data structure is hooked onto HIDCLASS' device extension, so both drivers can
  35. // have their own private data on each device object.
  36. //
  37. typedef struct _DEVICE_EXTENSION
  38. {
  39. ULONG DeviceState;
  40. USB_HID_DESCRIPTOR HidDescriptor;
  41. PHID_REPORT_DESCRIPTOR ReportDescriptor;
  42. PUSB_STRING_DESCRIPTOR StringDescriptor;
  43. PUSB_PHYSICAL_DESCRIPTOR PhysicalDescriptor;
  44. ULONG NumPendingRequests;
  45. KEVENT AllRequestsCompleteEvent;
  46. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  47. #define DEVICE_STATE_NONE 0
  48. #define DEVICE_STATE_STARTING 1
  49. #define DEVICE_STATE_RUNNING 2
  50. #define DEVICE_STATE_STOPPING 3
  51. #define DEVICE_STATE_STOPPED 4
  52. #define DEVICE_STATE_REMOVING 5
  53. //
  54. // Device Extension Macros
  55. //
  56. #define GET_MINIDRIVER_DEVICE_EXTENSION(DO) ((PDEVICE_EXTENSION) (((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)->MiniDeviceExtension))
  57. #define GET_NEXT_DEVICE_OBJECT(DO) (((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)->NextDeviceObject)
  58. //
  59. // Built In descriptors for this device
  60. //
  61. HID_REPORT_DESCRIPTOR MyReportDescriptor[];
  62. USB_HID_DESCRIPTOR MyHidDescriptor;
  63. PUSB_STRING_DESCRIPTOR MyStringDescriptor;
  64. PUSB_PHYSICAL_DESCRIPTOR MyPhysicalDescriptor;
  65. #define HIDMINI_PID 0xFEED
  66. #define HIDMINI_VID 0xBEEF
  67. #define HIDMINI_VERSION 0x0101
  68. //
  69. // IO lists
  70. //
  71. extern KSPIN_LOCK HidMini_IrpReadLock;
  72. extern KSPIN_LOCK HidMini_IrpWriteLock;
  73. extern LIST_ENTRY HidMini_ReadIrpHead;
  74. extern LIST_ENTRY HidMini_WriteIrpHead;
  75. typedef struct {
  76. LIST_ENTRY List;
  77. union {
  78. PIRP Irp;
  79. };
  80. } NODE, *PNODE;
  81. extern BOOLEAN IsRunning;
  82. //
  83. // Turn on debug printing and breaking, if appropriate
  84. //
  85. #if DBG
  86. #define DBGPrint(arg) DbgPrint arg
  87. #define DBGBREAK DbgBreakPoint()
  88. #else
  89. #define DBGPrint(arg)
  90. #define DBGBREAK
  91. #endif
  92. //
  93. // Function prototypes
  94. //
  95. NTSTATUS
  96. DriverEntry(
  97. IN PDRIVER_OBJECT DriverObject,
  98. IN PUNICODE_STRING registryPath
  99. );
  100. NTSTATUS
  101. HidMiniAbortPendingRequests(
  102. IN PDEVICE_OBJECT DeviceObject
  103. );
  104. NTSTATUS
  105. HidMiniCreateClose(
  106. IN PDEVICE_OBJECT DeviceObject,
  107. IN PIRP Irp
  108. );
  109. NTSTATUS
  110. HidMiniIoctl(
  111. IN PDEVICE_OBJECT DeviceObject,
  112. IN PIRP Irp
  113. );
  114. NTSTATUS
  115. HidMiniPnP(
  116. IN PDEVICE_OBJECT DeviceObject,
  117. IN PIRP Irp
  118. );
  119. NTSTATUS
  120. HidMiniCreateDevice(
  121. IN PDRIVER_OBJECT DriverObject,
  122. IN OUT PDEVICE_OBJECT *DeviceObject
  123. );
  124. NTSTATUS
  125. HidMiniAddDevice(
  126. IN PDRIVER_OBJECT DriverObject,
  127. IN PDEVICE_OBJECT FunctionalDeviceObject
  128. );
  129. NTSTATUS
  130. HidMiniStartDevice(
  131. IN PDEVICE_OBJECT DeviceObject
  132. );
  133. NTSTATUS
  134. HidMiniStartCompletion(
  135. IN PDEVICE_OBJECT DeviceObject,
  136. IN PIRP Irp,
  137. IN PVOID Context
  138. );
  139. NTSTATUS
  140. HidMiniInitDevice(
  141. IN PDEVICE_OBJECT DeviceObject
  142. );
  143. NTSTATUS
  144. HidMiniStopDevice(
  145. IN PDEVICE_OBJECT DeviceObject
  146. );
  147. NTSTATUS
  148. HidMiniStopCompletion(
  149. IN PDEVICE_OBJECT DeviceObject,
  150. IN PIRP Irp,
  151. IN PVOID Context
  152. );
  153. NTSTATUS
  154. HidMiniQueryIDCompletion(
  155. IN PDEVICE_OBJECT DeviceObject,
  156. IN PIRP Irp,
  157. IN PVOID Context
  158. );
  159. NTSTATUS
  160. HidMiniRemoveDevice(
  161. IN PDEVICE_OBJECT DeviceObject
  162. );
  163. VOID
  164. HidMiniUnload(
  165. IN PDRIVER_OBJECT DriverObject
  166. );
  167. NTSTATUS
  168. HidMiniGetHIDDescriptor(
  169. IN PDEVICE_OBJECT DeviceObject,
  170. IN PIRP Irp
  171. );
  172. NTSTATUS
  173. HidMiniGetDeviceAttributes(
  174. IN PDEVICE_OBJECT DeviceObject,
  175. IN PIRP Irp
  176. );
  177. NTSTATUS
  178. HidMiniGetReportDescriptor(
  179. IN PDEVICE_OBJECT DeviceObject,
  180. IN PIRP Irp
  181. );
  182. NTSTATUS
  183. HidMiniGetStringDescriptor(
  184. IN PDEVICE_OBJECT DeviceObject,
  185. IN PIRP Irp
  186. );
  187. NTSTATUS
  188. HidMiniReadReport(
  189. IN PDEVICE_OBJECT DeviceObject,
  190. IN PIRP Irp
  191. );
  192. NTSTATUS
  193. HidMiniReadCompletion(
  194. PVOID Context
  195. );
  196. NTSTATUS
  197. HidMiniWriteReport(
  198. IN PDEVICE_OBJECT DeviceObject,
  199. IN PIRP Irp
  200. );
  201. NTSTATUS
  202. HidMiniWriteCompletion(
  203. VOID
  204. );
  205. NTSTATUS
  206. HidMiniGetString(
  207. IN PDEVICE_OBJECT DeviceObject,
  208. IN PIRP Irp
  209. );
  210. NTSTATUS
  211. HidMiniOpenCollection(
  212. IN PDEVICE_OBJECT DeviceObject,
  213. IN PIRP Irp
  214. );
  215. NTSTATUS
  216. HidMiniCloseCollection(
  217. IN PDEVICE_OBJECT DeviceObject,
  218. IN PIRP Irp
  219. );
  220. VOID
  221. HidMiniIncrementPendingRequestCount(
  222. IN PDEVICE_EXTENSION DeviceExtension
  223. );
  224. VOID
  225. HidMiniDecrementPendingRequestCount(
  226. IN PDEVICE_EXTENSION DeviceExtension
  227. );
  228. #endif // _HIDMINI_H__