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.

157 lines
6.6 KiB

  1. /*
  2. *************************************************************************
  3. * File: HID1394.H
  4. *
  5. * Module: HID1394.SYS
  6. * HID (Human Input Device) minidriver for IEEE 1394 devices.
  7. *
  8. *
  9. * Author: ervinp
  10. *
  11. *************************************************************************
  12. */
  13. //
  14. // Device Class Constants for HID
  15. //
  16. #define HID_GET_REPORT 0x01
  17. #define HID_GET_IDLE 0x02
  18. #define HID_GET_PROTOCOL 0x03
  19. #define HID_SET_REPORT 0x09
  20. #define HID_SET_IDLE 0x0A
  21. #define HID_SET_PROTOCOL 0x0B
  22. /*
  23. * This device extension resides in memory immediately after
  24. * HIDCLASS' extension.
  25. */
  26. typedef struct _DEVICE_EXTENSION
  27. {
  28. ULONG DeviceState;
  29. // BUGBUG PUSB_DEVICE_DESCRIPTOR DeviceDescriptor;
  30. // BUGBUG PUSBD_INTERFACE_INFORMATION Interface;
  31. // BUGBUG USBD_CONFIGURATION_HANDLE ConfigurationHandle;
  32. CONFIG_ROM configROM;
  33. ULONG NumPendingRequests;
  34. KEVENT AllRequestsCompleteEvent;
  35. ULONG DeviceFlags;
  36. PWORK_QUEUE_ITEM ResetWorkItem;
  37. // BUGBUG USB_HID_DESCRIPTOR HidDescriptor;
  38. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  39. /*
  40. * This structure is used to pass information to the
  41. * resetWorkItem callback.
  42. */
  43. typedef struct tag_resetWorkItemContext {
  44. WORK_QUEUE_ITEM workItem;
  45. PDEVICE_OBJECT deviceObject;
  46. PIRP irpToComplete;
  47. BOOLEAN irpWasCancelled;
  48. struct tag_resetWorkItemContext *next;
  49. #if DBG
  50. #define RESET_WORK_ITEM_CONTEXT_SIG 'IWSR'
  51. ULONG sig;
  52. #endif
  53. } resetWorkItemContext;
  54. #define DEVICE_STATE_NONE 0
  55. #define DEVICE_STATE_STARTING 1
  56. #define DEVICE_STATE_RUNNING 2
  57. #define DEVICE_STATE_STOPPING 3
  58. #define DEVICE_STATE_STOPPED 4
  59. #define DEVICE_STATE_REMOVING 5
  60. #define DEVICE_STATE_START_FAILED 6
  61. #define DEVICE_FLAGS_HID_1_0_D3_COMPAT_DEVICE 0x00000001
  62. //
  63. // Interface slection options
  64. //
  65. #define HUM_SELECT_DEFAULT_INTERFACE 0
  66. #define HUM_SELECT_SPECIFIED_INTERFACE 1
  67. //
  68. // Device Extension Macros
  69. //
  70. #define GET_MINIDRIVER_DEVICE_EXTENSION(DO) ((PDEVICE_EXTENSION) (((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)->MiniDeviceExtension))
  71. #define GET_HIDCLASS_DEVICE_EXTENSION(DO) ((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)
  72. #define GET_NEXT_DEVICE_OBJECT(DO) (((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)->NextDeviceObject)
  73. /*
  74. * HID1394 signature tag for memory allocations
  75. */
  76. #define HID1394_TAG (ULONG)'TdiH'
  77. //
  78. // Function prototypes
  79. //
  80. NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING registryPath);
  81. NTSTATUS HIDT_AbortPendingRequests(IN PDEVICE_OBJECT DeviceObject);
  82. NTSTATUS HIDT_CreateClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  83. NTSTATUS HIDT_InternalIoctl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  84. NTSTATUS HIDT_PnP(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  85. NTSTATUS HIDT_Power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  86. NTSTATUS HIDT_CreateDevice(IN PDRIVER_OBJECT DriverObject, IN OUT PDEVICE_OBJECT *DeviceObject);
  87. NTSTATUS HIDT_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT FunctionalDeviceObject);
  88. NTSTATUS HIDT_StartDevice(IN PDEVICE_OBJECT DeviceObject);
  89. NTSTATUS HIDT_PnpCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context);
  90. NTSTATUS HIDT_InitDevice(IN PDEVICE_OBJECT DeviceObject);
  91. NTSTATUS HIDT_StopDevice(IN PDEVICE_OBJECT DeviceObject);
  92. NTSTATUS HIDT_RemoveDevice(IN PDEVICE_OBJECT DeviceObject);
  93. VOID HIDT_Unload(IN PDRIVER_OBJECT DriverObject);
  94. NTSTATUS HIDT_GetHidDescriptor(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  95. NTSTATUS HIDT_GetReportDescriptor(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  96. NTSTATUS HIDT_ReadReport(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, OUT BOOLEAN *NeedsCompletion);
  97. NTSTATUS HIDT_ReadCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context);
  98. NTSTATUS HIDT_WriteReport(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, OUT BOOLEAN *NeedsCompletion);
  99. NTSTATUS HIDT_GetFeature(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, OUT BOOLEAN *NeedsCompletion);
  100. NTSTATUS HIDT_SetFeature(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, OUT BOOLEAN *NeedsCompletion);
  101. NTSTATUS HIDT_WriteCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context);
  102. NTSTATUS HIDT_GetString(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, OUT BOOLEAN *NeedsCompletion);
  103. NTSTATUS HIDT_GetDeviceAttributes(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, OUT BOOLEAN *NeedsCompletion);
  104. NTSTATUS HIDT_GetDescriptorRequest(IN PDEVICE_OBJECT DeviceObject, IN ULONG DescriptorType, IN OUT PVOID *Descriptor, IN OUT ULONG *DescSize, IN ULONG TypeSize, IN ULONG Index, IN ULONG LangID, IN ULONG ShortTransferOk);
  105. NTSTATUS HIDT_GetDescriptorEndpoint(IN PDEVICE_OBJECT DeviceObject, IN ULONG DescriptorType, IN OUT PVOID *Descriptor, IN OUT ULONG *DescSize, IN ULONG TypeSize, IN ULONG Index, IN ULONG LangID);
  106. NTSTATUS HIDT_GetDescriptorInterface(IN PDEVICE_OBJECT DeviceObject, IN ULONG DescriptorType, IN OUT PVOID *Descriptor, IN OUT ULONG *DescSize, IN ULONG TypeSize, IN ULONG Index, IN ULONG LangID);
  107. NTSTATUS HIDT_SetIdle(IN PDEVICE_OBJECT DeviceObject);
  108. NTSTATUS HIDT_SelectConfiguration(IN PDEVICE_OBJECT DeviceObject);
  109. NTSTATUS HIDT_ParseHidInterface(IN PDEVICE_EXTENSION DeviceExtension, IN ULONG InterfaceLength);
  110. NTSTATUS HIDT_GetDeviceDescriptor(IN PDEVICE_OBJECT, IN PDEVICE_EXTENSION);
  111. NTSTATUS HIDT_GetConfigDescriptor(IN PDEVICE_OBJECT DeviceObject, OUT PULONG ConfigurationDescLength);
  112. NTSTATUS HIDT_GetHidInfo(IN PDEVICE_OBJECT DeviceObject, IN ULONG DescriptorLength);
  113. NTSTATUS DumpConfigDescriptor(IN ULONG DescriptorLength);
  114. VOID HIDT_DecrementPendingRequestCount(IN PDEVICE_EXTENSION DeviceExtension);
  115. NTSTATUS HIDT_IncrementPendingRequestCount(IN PDEVICE_EXTENSION DeviceExtension);
  116. NTSTATUS HIDT_ResetWorkItem(IN PVOID Context);
  117. NTSTATUS HIDT_EnableParentPort(IN PDEVICE_OBJECT DeviceObject);
  118. NTSTATUS HIDT_GetPortStatus(IN PDEVICE_OBJECT DeviceObject, IN PULONG PortStatus);
  119. NTSTATUS HIDT_ResetInterruptPipe(IN PDEVICE_OBJECT DeviceObject);
  120. NTSTATUS HIDT_SystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  121. NTSTATUS HIDT_GetStringDescriptor(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  122. NTSTATUS HIDT_GetPhysicalDescriptor(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, BOOLEAN *NeedsCompletion);
  123. extern KSPIN_LOCK resetWorkItemsListSpinLock;