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.

193 lines
3.8 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1994 - 1999
  3. Module Name :
  4. parsimp.h
  5. Abstract:
  6. Type definitions and data for a simple parallel class driver.
  7. Author:
  8. Norbert P. Kusters 4-Feb-1994
  9. Revision History:
  10. --*/
  11. #ifdef POOL_TAGGING
  12. #ifdef ExAllocatePool
  13. #undef ExAllocatePool
  14. #endif
  15. #define ExAllocatePool(a,b) ExAllocatePoolWithTag(a,b,'ParV')
  16. #endif
  17. #define PARALLEL_DATA_OFFSET 0
  18. #define PARALLEL_STATUS_OFFSET 1
  19. #define PARALLEL_CONTROL_OFFSET 2
  20. #define PARALLEL_REGISTER_SPAN 3
  21. typedef struct _DEVICE_EXTENSION {
  22. //
  23. // Points to the device object that contains
  24. // this device extension.
  25. //
  26. PDEVICE_OBJECT DeviceObject;
  27. //
  28. // Points to the port device object that this class device is
  29. // connected to.
  30. //
  31. PDEVICE_OBJECT PortDeviceObject;
  32. //
  33. // Keeps track of whether or not we actually own the
  34. // parallel hardware
  35. //
  36. BOOLEAN PortOwned;
  37. BOOLEAN spare[3]; // force to DWORD alignment
  38. //
  39. // Enforce exclusive Create/Open - 1 == either handle open or Create/Open in process
  40. // 0 == no handle open to device
  41. //
  42. ULONG CreateOpenLock;
  43. //
  44. // This holds the result of the get parallel port info
  45. // request to the port driver.
  46. //
  47. PHYSICAL_ADDRESS OriginalController;
  48. PUCHAR Controller;
  49. ULONG SpanOfController;
  50. PPARALLEL_FREE_ROUTINE FreePort;
  51. PVOID FreePortContext;
  52. //
  53. // Records whether we actually created the symbolic link name
  54. // at driver load time and the symbolic link itself. If we didn't
  55. // create it, we won't try to destroy it when we unload.
  56. //
  57. BOOLEAN CreatedSymbolicLink;
  58. UNICODE_STRING SymbolicLinkName;
  59. #ifdef INTERRUPT_NEEDED
  60. //
  61. // Set 'IgnoreInterrupts' to TRUE unless the port is owned by
  62. // this device.
  63. //
  64. BOOLEAN IgnoreInterrupts;
  65. PKINTERRUPT InterruptObject;
  66. //
  67. // Keep the interrupt level alloc and free routines.
  68. //
  69. PPARALLEL_TRY_ALLOCATE_ROUTINE TryAllocatePortAtInterruptLevel;
  70. PVOID TryAllocateContext;
  71. #endif
  72. #ifdef TIMEOUT_ALLOCS
  73. //
  74. // This timer is used to timeout allocate requests that are sent
  75. // to the port device.
  76. //
  77. KTIMER AllocTimer;
  78. KDPC AllocTimerDpc;
  79. LARGE_INTEGER AllocTimeout;
  80. //
  81. // This variable is used to indicate outstanding references
  82. // to the current irp. This solves the contention problem between
  83. // the timer DPC and the completion routine. Access using
  84. // 'ControlLock'.
  85. //
  86. #define IRP_REF_TIMER 1
  87. #define IRP_REF_COMPLETION_ROUTINE 2
  88. LONG CurrentIrpRefCount;
  89. KSPIN_LOCK ControlLock;
  90. //
  91. // Indicates that the current request timed out.
  92. //
  93. BOOLEAN TimedOut;
  94. #endif
  95. //
  96. // Name of the parport device that we use when opening a FILE
  97. //
  98. UNICODE_STRING ParPortName;
  99. PFILE_OBJECT ParPortFileObject;
  100. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  101. #ifdef INTERRUPT_NEEDED
  102. BOOLEAN
  103. ParInterruptService(
  104. IN PKINTERRUPT Interrupt,
  105. IN OUT PVOID Extension
  106. );
  107. VOID
  108. ParDpcForIsr(
  109. IN PKDPC Dpc,
  110. IN PDEVICE_OBJECT DeviceObject,
  111. IN PIRP Irp,
  112. IN PVOID Extension
  113. );
  114. VOID
  115. ParDeferredPortCheck(
  116. IN PVOID Extension
  117. );
  118. #endif
  119. #ifdef TIMEOUT_ALLOCS
  120. VOID
  121. ParAllocTimerDpc(
  122. IN PKDPC Dpc,
  123. IN PVOID Extension,
  124. IN PVOID SystemArgument1,
  125. IN PVOID SystemArgument2
  126. );
  127. #endif
  128. NTSTATUS
  129. ParCreateOpen(
  130. IN PDEVICE_OBJECT DeviceObject,
  131. IN PIRP Irp
  132. );
  133. NTSTATUS
  134. ParClose(
  135. IN PDEVICE_OBJECT DeviceObject,
  136. IN PIRP Irp
  137. );
  138. NTSTATUS
  139. ParDeviceControl(
  140. IN PDEVICE_OBJECT DeviceObject,
  141. IN PIRP Irp
  142. );
  143. VOID
  144. ParUnload(
  145. IN PDRIVER_OBJECT DriverObject
  146. );