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.

208 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. buttons.h
  5. Abstract: Contains definitions of all constants and data types for the
  6. serial pen hid driver.
  7. Environment:
  8. Kernel mode
  9. Author:
  10. Michael Tsang (MikeTs) 13-Apr-2000
  11. Revision History:
  12. --*/
  13. #ifndef _BUTTONS_H
  14. #define _BUTTONS_H
  15. //
  16. // Constants
  17. //
  18. #define HBUT_POOL_TAG 'tubH'
  19. #define STUCK_DETECTION_RETRIES 5
  20. #define MAX_STUCK_COUNT 6
  21. // dwfHBut flag values
  22. #define HBUTF_DEVICE_STARTED 0x00000001
  23. #define HBUTF_DEVICE_REMOVED 0x00000002
  24. #define HBUTF_INTERRUPT_CONNECTED 0x00000004
  25. #define HBUTF_DEBOUNCE_TIMER_SET 0x00000008
  26. //
  27. // Macros
  28. //
  29. #define GET_MINIDRIVER_DEVICE_EXTENSION(DO) \
  30. ((PDEVICE_EXTENSION)(((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)->MiniDeviceExtension))
  31. #define GET_NEXT_DEVICE_OBJECT(DO) \
  32. (((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)->NextDeviceObject)
  33. //
  34. // Type Definitions
  35. //
  36. typedef struct _DEVICE_EXTENSION
  37. {
  38. #ifdef DEBUG
  39. LIST_ENTRY List; //list of of other tablet devices
  40. #endif
  41. ULONG dwfHBut; //flags
  42. IO_REMOVE_LOCK RemoveLock; //to protect IRP_MN_REMOVE_DEVICE
  43. CM_PARTIAL_RESOURCE_DESCRIPTOR IORes;//button port resource
  44. CM_PARTIAL_RESOURCE_DESCRIPTOR IRQRes;//button IRQ resource
  45. PKINTERRUPT InterruptObject; //location of the interrupt object
  46. KSPIN_LOCK SpinLock;
  47. LIST_ENTRY PendingIrpList;
  48. LARGE_INTEGER DebounceTime;
  49. KTIMER DebounceTimer;
  50. KDPC TimerDpc;
  51. UCHAR LastButtonState;
  52. UCHAR StuckButtonsMask;
  53. UCHAR bStuckCount;
  54. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  55. //
  56. // Global Data Declarations
  57. //
  58. //
  59. // Function prototypes
  60. //
  61. // buttons.c
  62. NTSTATUS EXTERNAL
  63. DriverEntry(
  64. IN PDRIVER_OBJECT DrvObj,
  65. IN PUNICODE_STRING RegPath
  66. );
  67. NTSTATUS EXTERNAL
  68. HbutCreateClose(
  69. IN PDEVICE_OBJECT DevObj,
  70. IN PIRP Irp
  71. );
  72. NTSTATUS EXTERNAL
  73. HbutAddDevice(
  74. IN PDRIVER_OBJECT DrvObj,
  75. IN PDEVICE_OBJECT DevObj
  76. );
  77. VOID EXTERNAL
  78. HbutUnload(
  79. IN PDRIVER_OBJECT DrvObj
  80. );
  81. // pnp.c
  82. NTSTATUS EXTERNAL
  83. HbutPnp(
  84. IN PDEVICE_OBJECT DevObj,
  85. IN PIRP Irp
  86. );
  87. NTSTATUS EXTERNAL
  88. HbutPower(
  89. IN PDEVICE_OBJECT DevObj,
  90. IN PIRP Irp
  91. );
  92. NTSTATUS INTERNAL
  93. StartDevice(
  94. IN PDEVICE_OBJECT DevObj,
  95. IN PIRP Irp
  96. );
  97. VOID INTERNAL
  98. RemoveDevice(
  99. PDEVICE_OBJECT DevObj,
  100. PIRP Irp
  101. );
  102. NTSTATUS INTERNAL
  103. SendSyncIrp(
  104. IN PDEVICE_OBJECT DevObj,
  105. IN PIRP Irp,
  106. IN BOOLEAN fCopyToNext
  107. );
  108. NTSTATUS INTERNAL
  109. IrpCompletion(
  110. IN PDEVICE_OBJECT DevObj,
  111. IN PIRP Irp,
  112. IN PKEVENT Event
  113. );
  114. // ioctl.c
  115. NTSTATUS EXTERNAL
  116. HbutInternalIoctl(
  117. IN PDEVICE_OBJECT DevObj,
  118. IN PIRP Irp
  119. );
  120. NTSTATUS INTERNAL
  121. GetDeviceDescriptor(
  122. IN PDEVICE_OBJECT DevObj,
  123. IN PIRP Irp
  124. );
  125. NTSTATUS INTERNAL
  126. GetReportDescriptor(
  127. IN PDEVICE_OBJECT DevObj,
  128. IN PIRP Irp
  129. );
  130. NTSTATUS INTERNAL
  131. ReadReport(
  132. IN PDEVICE_OBJECT DevObj,
  133. IN PIRP Irp
  134. );
  135. VOID EXTERNAL
  136. ReadReportCanceled(
  137. IN PDEVICE_OBJECT DevObj,
  138. IN PIRP Irp
  139. );
  140. NTSTATUS INTERNAL
  141. GetString(
  142. PDEVICE_OBJECT DevObj,
  143. PIRP Irp
  144. );
  145. NTSTATUS INTERNAL
  146. GetAttributes(
  147. PDEVICE_OBJECT DevObj,
  148. PIRP Irp
  149. );
  150. // oembutton.c
  151. BOOLEAN EXTERNAL
  152. OemInterruptServiceRoutine(
  153. IN PKINTERRUPT Interrupt,
  154. IN PDEVICE_EXTENSION DevExt
  155. );
  156. VOID EXTERNAL
  157. OemButtonDebounceDpc(
  158. IN PKDPC Dpc,
  159. IN PDEVICE_EXTENSION DevExt,
  160. IN PVOID SysArg1,
  161. IN PVOID SysArg2
  162. );
  163. // misc.c
  164. PCM_PARTIAL_RESOURCE_DESCRIPTOR INTERNAL
  165. RtlUnpackPartialDesc(
  166. IN UCHAR ResType,
  167. IN PCM_RESOURCE_LIST ResList,
  168. IN OUT PULONG Count
  169. );
  170. #endif //ifndef _BUTTONS_H