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.

1962 lines
59 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1993 - 1999
  3. Module Name :
  4. parport.h
  5. Abstract:
  6. Type definitions and data for the parallel port driver.
  7. Revision History:
  8. --*/
  9. #ifndef _PARPORT_H_
  10. #define _PARPORT_H_
  11. #define arraysize(p) (sizeof(p)/sizeof((p)[0])) // From Walter Oney WDM book
  12. // Used to keep track of the state of an IEEE negotiation, transfer, or termination
  13. typedef struct _IEEE_STATE {
  14. ULONG CurrentEvent; // IEEE 1284 event - see IEEE 1284-1994 spec
  15. P1284_PHASE CurrentPhase; // see parallel.h for enum def - PHASE_UNKNOWN, ..., PHASE_INTERRUPT_HOST
  16. BOOLEAN Connected; // are we currently negotiated into a 1284 mode?
  17. BOOLEAN IsIeeeTerminateOk; // are we in a state where an IEEE Terminate is legal?
  18. USHORT ProtocolFamily; // what protocol family are we currently using (if connected)
  19. } IEEE_STATE, *PIEEE_STATE;
  20. // should we use or ignore XFlag on termination event 24 when terminating NIBBLE mode for 1284 ID query?
  21. typedef enum {
  22. IgnoreXFlagOnEvent24,
  23. UseXFlagOnEvent24
  24. } XFlagOnEvent24;
  25. // DVDF - 2000-08-16
  26. // Used with IOCTL_INTERNAL_PARPORT_EXECUTE_TASK
  27. typedef enum {
  28. Select,
  29. Deselect,
  30. Write,
  31. Read,
  32. MaxTask
  33. } ParportTask;
  34. // Used with IOCTL_INTERNAL_PARPORT_EXECUTE_TASK
  35. typedef struct _PARPORT_TASK {
  36. ParportTask Task; // what type of request?
  37. PCHAR Buffer; // where is the buffer to use?
  38. ULONG BufferLength; // how big is the buffer?
  39. ULONG RequestLength; // how many bytes of data is requested or supplied?
  40. CHAR Requestor[8]; // diagnostic use only - suggest pdx->Location, e.g., "LPT2.4"
  41. } PARPORT_TASK, *PPARPORT_TASK;
  42. // handled by parport FDOs - execute a specified task
  43. #define IOCTL_INTERNAL_PARPORT_EXECUTE_TASK CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 64, METHOD_BUFFERED, FILE_ANY_ACCESS)
  44. struct _PDO_EXTENSION;
  45. typedef struct _PDO_EXTENSION * PPDO_EXTENSION;
  46. typedef
  47. NTSTATUS
  48. (*PPROTOCOL_READ_ROUTINE) (
  49. IN PPDO_EXTENSION Extension,
  50. IN PVOID Buffer,
  51. IN ULONG BufferSize,
  52. OUT PULONG BytesTransferred
  53. );
  54. typedef
  55. NTSTATUS
  56. (*PPROTOCOL_WRITE_ROUTINE) (
  57. IN PPDO_EXTENSION Extension,
  58. IN PVOID Buffer,
  59. IN ULONG BufferSize,
  60. OUT PULONG BytesTransferred
  61. );
  62. typedef
  63. NTSTATUS
  64. (*PDOT3_RESET_ROUTINE) (
  65. IN PPDO_EXTENSION Extension
  66. );
  67. typedef struct _DOT3DL_PCTL {
  68. PPROTOCOL_READ_ROUTINE fnRead;
  69. PPROTOCOL_WRITE_ROUTINE fnWrite;
  70. PDOT3_RESET_ROUTINE fnReset;
  71. P12843_DL_MODES DataLinkMode;
  72. USHORT CurrentPID;
  73. USHORT FwdSkipMask;
  74. USHORT RevSkipMask;
  75. UCHAR DataChannel;
  76. UCHAR ResetChannel;
  77. UCHAR ResetByteCount;
  78. UCHAR ResetByte;
  79. PKEVENT Event;
  80. BOOLEAN bEventActive;
  81. } DOT3DL_PCTL, *PDOT3DL_PCTL;
  82. //
  83. // If we can't use our preferred \Device\ParallelN number due to name collision,
  84. // then start with N == PAR_CLASSNAME_OFFSET and increment until we are successful
  85. //
  86. #define PAR_CLASSNAME_OFFSET 8
  87. //
  88. // For pnp id strings
  89. //
  90. #define MAX_ID_SIZE 256
  91. // used to construct IEEE 1284.3 "Dot" name suffixes
  92. // table lookup for integer to WCHAR conversion
  93. #define PAR_UNICODE_PERIOD L'.'
  94. #define PAR_UNICODE_COLON L':'
  95. //#define PAR_REV_MODE_SKIP_MASK (CHANNEL_NIBBLE | BYTE_BIDIR | EPP_ANY)
  96. #define PAR_REV_MODE_SKIP_MASK (CHANNEL_NIBBLE | BYTE_BIDIR | EPP_ANY | ECP_ANY)
  97. #define PAR_FWD_MODE_SKIP_MASK (EPP_ANY | BOUNDED_ECP | ECP_HW_NOIRQ | ECP_HW_IRQ)
  98. //#define PAR_FWD_MODE_SKIP_MASK (EPP_ANY)
  99. #define PAR_MAX_CHANNEL 127
  100. #define PAR_COMPATIBILITY_RESET 300
  101. #define PptSetFlags( FlagsVariable, FlagsToSet ) { (FlagsVariable) |= (FlagsToSet); }
  102. #define PptClearFlags( FlagsVariable, FlagsToClear ) { (FlagsVariable) &= ~(FlagsToClear); }
  103. // convert timeout in Milliseconds to relative timeout in 100ns units
  104. // suitable as parameter 5 to KeWaitForSingleObject(..., TimeOut)
  105. #define PPT_SET_RELATIVE_TIMEOUT_IN_MILLISECONDS(VARIABLE, VALUE) (VARIABLE).QuadPart = -( (LONGLONG) (VALUE)*10*1000 )
  106. #define MAX_PNP_IRP_MN_HANDLED IRP_MN_QUERY_LEGACY_BUS_INFORMATION
  107. extern ULONG PptDebugLevel;
  108. extern ULONG PptBreakOn;
  109. extern UNICODE_STRING RegistryPath; // copy of the registry path passed to DriverEntry()
  110. extern UCHAR PptDot3Retries; // variable to know how many times to try a select or
  111. // deselect for 1284.3 if we do not succeed.
  112. typedef enum _DevType {
  113. DevTypeFdo = 1,
  114. DevTypePdo = 2,
  115. } DevType, *PDevType;
  116. typedef enum _PdoType {
  117. PdoTypeRawPort = 1,
  118. PdoTypeEndOfChain = 2,
  119. PdoTypeDaisyChain = 4,
  120. PdoTypeLegacyZip = 8
  121. } PdoType, *PPdoType;
  122. extern const PHYSICAL_ADDRESS PhysicalZero;
  123. #define PARPORT_TAG (ULONG) 'PraP'
  124. #ifdef POOL_TAGGING
  125. #ifdef ExAllocatePool
  126. #undef ExAllocatePool
  127. #endif
  128. #define ExAllocatePool(a,b) ExAllocatePoolWithTag(a,b,PARPORT_TAG)
  129. #endif
  130. //
  131. // used for FilterResourceMethod in processing PnP IRP_MN_FILTER_RESOURCE_REQUIREMENTS
  132. //
  133. #define PPT_TRY_USE_NO_IRQ 0 // if alternatives exist that don't require an IRQ then
  134. // delete those alternatives that do, otherwise do nothing
  135. #define PPT_FORCE_USE_NO_IRQ 1 // try previous method - if it fails (i.e., all alternatives
  136. // require resources), then nuke IRQ resource descriptors
  137. // in all alternatives
  138. #define PPT_ACCEPT_IRQ 2 // don't do any resource filtering - accept resources that
  139. // we are given
  140. //
  141. // Keep track of GET and RELEASE port info.
  142. //
  143. extern LONG PortInfoReferenceCount;
  144. extern PFAST_MUTEX PortInfoMutex;
  145. //
  146. // DeviceStateFlags
  147. //
  148. #define PAR_DEVICE_PAUSED ((ULONG)0x00000010) // stop-pending, stopped, or remove-pending states
  149. #define PAR_DEVICE_PORT_REMOVE_PENDING ((ULONG)0x00000200) // our ParPort is in a Remove Pending State
  150. //
  151. // extension->PnpState - define the current PnP state of the device
  152. //
  153. #define PPT_DEVICE_STARTED ((ULONG)0x00000001) // Device has succeeded START
  154. #define PPT_DEVICE_DELETED ((ULONG)0x00000002) // IoDeleteDevice has been called
  155. #define PPT_DEVICE_STOP_PENDING ((ULONG)0x00000010) // Device has succeeded QUERY_STOP, waiting for STOP or CANCEL
  156. #define PPT_DEVICE_STOPPED ((ULONG)0x00000020) // Device has received STOP
  157. #define PPT_DEVICE_DELETE_PENDING ((ULONG)0x00000040) // we have started the process of deleting device object
  158. #define PPT_DEVICE_HARDWARE_GONE ((ULONG)0x00000080) // our hardware is gone
  159. #define PPT_DEVICE_REMOVE_PENDING ((ULONG)0x00000100) // Device succeeded QUERY_REMOVE, waiting for REMOVE or CANCEL
  160. #define PPT_DEVICE_REMOVED ((ULONG)0x00000200) // Device has received REMOVE
  161. #define PPT_DEVICE_SURPRISE_REMOVED ((ULONG)0x00001000) // Device has received SURPRISE_REMOVAL
  162. #define PPT_DEVICE_PAUSED ((ULONG)0x00010000) // stop-pending, stopped, or remove-pending - hold requests
  163. //
  164. // IEEE 1284 constants (Protocol Families)
  165. //
  166. #define FAMILY_NONE 0x0
  167. #define FAMILY_REVERSE_NIBBLE 0x1
  168. #define FAMILY_REVERSE_BYTE 0x2
  169. #define FAMILY_ECP 0x3
  170. #define FAMILY_EPP 0x4
  171. #define FAMILY_BECP 0x5
  172. #define FAMILY_MAX FAMILY_BECP
  173. typedef struct _IRPQUEUE_CONTEXT {
  174. LIST_ENTRY irpQueue;
  175. KSPIN_LOCK irpQueueSpinLock;
  176. } IRPQUEUE_CONTEXT, *PIRPQUEUE_CONTEXT;
  177. typedef struct _COMMON_EXTENSION {
  178. ULONG Signature1; // Used to increase our confidence that this is a ParPort extension
  179. enum _DevType DevType; // distinguish an FDO_EXTENSION from a PDO_EXTENSION
  180. PCHAR Location; // LPTx or LPTx.y location for PDO (symlink name less the \DosDevices prefix)
  181. // LPTxF for FDO
  182. PDEVICE_OBJECT DeviceObject; // back pointer to our DEVICE_OBJECT
  183. ULONG PnpState; // Device State - See Device State Flags: PPT_DEVICE_... above
  184. IO_REMOVE_LOCK RemoveLock; // Used to prevent PnP from removing us while requests are pending
  185. LONG OpenCloseRefCount; // keep track of the number of handles open to our device
  186. UNICODE_STRING DeviceInterface; // SymbolicLinkName returned from IoRegisterDeviceInterface
  187. BOOLEAN DeviceInterfaceState; // Did we last set the DeviceInterface to True or False?
  188. BOOLEAN TimeToTerminateThread;// TRUE == worker thread should kill itself via PsTerminateSystemThread()
  189. PVOID ThreadObjectPointer; // pointer to a worker thread for this Device
  190. } COMMON_EXTENSION, *PCOMMON_EXTENSION, *PCE;
  191. //
  192. // Fdo Device Extension
  193. //
  194. typedef struct _FDO_EXTENSION {
  195. COMMON_EXTENSION;
  196. //
  197. // Devices that we have enumerated
  198. //
  199. PDEVICE_OBJECT RawPortPdo; // LPTx - legacy "Raw Port" interface
  200. PDEVICE_OBJECT DaisyChainPdo[4]; // LPTx.0 -- LPTx.3 - IEEE 1284.3 daisy chain devices
  201. PDEVICE_OBJECT EndOfChainPdo; // LPTx.4 - end-of-chain devices
  202. PDEVICE_OBJECT LegacyZipPdo; // LPTx.5 - original (non-1284.3) Iomega Zip drive
  203. IEEE_STATE IeeeState;
  204. //
  205. // DisableEndOfChainBusRescan - if TRUE then do NOT rescan bus for change in End Of Chain (LPTx.4)
  206. // device in response to PnP IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations,
  207. // simply report the LPTx.4 device that we found on the previous bus rescan.
  208. // - if we did not have an End Of Chain device on the previous rescan then this
  209. // flag is ignored.
  210. //
  211. BOOLEAN DisableEndOfChainBusRescan;
  212. //
  213. // Points to the driver object that contains this instance of parport.
  214. //
  215. PDRIVER_OBJECT DriverObject;
  216. //
  217. // Points to the PDO
  218. //
  219. PDEVICE_OBJECT PhysicalDeviceObject;
  220. //
  221. // Points to our parent
  222. //
  223. PDEVICE_OBJECT ParentDeviceObject;
  224. //
  225. // Counter is incremented by the "polling for printers" thread on
  226. // each failed attempt at reading the IEEE 1284 Device ID from the
  227. // device. When the counter hits a defined threshold the polling
  228. // thread considers the error unrecoverable and stops polling
  229. //
  230. ULONG PollingFailureCounter;
  231. // list head for list of PDOs to delete on Driver Unload
  232. LIST_ENTRY DevDeletionListHead;
  233. //
  234. // Queue of ALLOCATE & SELECT irps waiting to be processed. Access with cancel spin lock.
  235. //
  236. LIST_ENTRY WorkQueue;
  237. // Queue Irps while waiting to be processed
  238. IRPQUEUE_CONTEXT IrpQueueContext;
  239. //
  240. // The number of irps in the queue where -1 represents
  241. // a free port, 0 represents an allocated port with
  242. // zero waiters, 1 represents an allocated port with
  243. // 1 waiter, etc...
  244. //
  245. // This variable must be accessed with the cancel spin
  246. // lock or at interrupt level whenever interrupts are
  247. // being used.
  248. //
  249. LONG WorkQueueCount;
  250. //
  251. // These structures hold the port address and range for the parallel port.
  252. //
  253. PARALLEL_PORT_INFORMATION PortInfo;
  254. PARALLEL_PNP_INFORMATION PnpInfo;
  255. //
  256. // Information about the interrupt so that we
  257. // can connect to it when we have a client that
  258. // uses the interrupt.
  259. //
  260. ULONG AddressSpace;
  261. ULONG EcpAddressSpace;
  262. INTERFACE_TYPE InterfaceType;
  263. ULONG BusNumber;
  264. BOOLEAN FoundInterrupt;
  265. KIRQL InterruptLevel;
  266. ULONG InterruptVector;
  267. KAFFINITY InterruptAffinity;
  268. KINTERRUPT_MODE InterruptMode;
  269. //
  270. // This list contains all of the interrupt service
  271. // routines registered by class drivers. All access
  272. // to this list should be done at interrupt level.
  273. //
  274. // This list also contains all of the deferred port check
  275. // routines. These routines are called whenever
  276. // the port is freed if there are no IRPs queued for
  277. // the port. Access this list only at interrupt level.
  278. //
  279. LIST_ENTRY IsrList;
  280. //
  281. // The parallel port interrupt object.
  282. //
  283. PKINTERRUPT InterruptObject;
  284. //
  285. // Keep a reference count for the interrupt object.
  286. // This count should be referenced with the cancel
  287. // spin lock.
  288. //
  289. ULONG InterruptRefCount;
  290. //
  291. // DPC for freeing the port from the interrupt routine.
  292. //
  293. KDPC FreePortDpc;
  294. //
  295. // Points to workitem for freeing the port
  296. //
  297. PIO_WORKITEM FreePortWorkItem;
  298. //
  299. // Set at initialization to indicate that on the current
  300. // architecture we need to unmap the base register address
  301. // when we unload the driver.
  302. //
  303. BOOLEAN UnMapRegisters;
  304. //
  305. // Flags for ECP and EPP detection and changing of the modes
  306. //
  307. BOOLEAN NationalChecked;
  308. BOOLEAN NationalChipFound;
  309. BOOLEAN FilterMode;
  310. UCHAR EcrPortData;
  311. //
  312. // Structure that hold information from the Chip Filter Driver
  313. //
  314. PARALLEL_PARCHIP_INFO ChipInfo;
  315. UNICODE_STRING DeviceName;
  316. //
  317. // Current Device Power State
  318. //
  319. DEVICE_POWER_STATE DeviceState;
  320. SYSTEM_POWER_STATE SystemState;
  321. FAST_MUTEX ExtensionFastMutex;
  322. FAST_MUTEX OpenCloseMutex;
  323. KEVENT FdoThreadEvent; // polling for printers thread waits w/timeout on this event
  324. WMILIB_CONTEXT WmiLibContext;
  325. PARPORT_WMI_ALLOC_FREE_COUNTS WmiPortAllocFreeCounts;
  326. BOOLEAN CheckedForGenericEpp; // did we check for Generic (via the ECR) EPP capability?
  327. BOOLEAN FdoWaitingOnPort;
  328. BOOLEAN spare[2];
  329. // Used to increase our confidence that this is a ParPort extension
  330. ULONG Signature2;
  331. } FDO_EXTENSION, *PFDO_EXTENSION;
  332. typedef struct _PDO_EXTENSION {
  333. COMMON_EXTENSION;
  334. ULONG DeviceStateFlags; // Device State - See Device State Flags above
  335. ULONG DeviceType; // - deprecated, use DevType in COMMON_EXTENSION - PAR_DEVTYPE_FDO=0x1, PODO=0x2, or PDO=0x4
  336. enum _PdoType PdoType;
  337. PDEVICE_OBJECT Fdo; // Points to our FDO (bus driver/parent device)
  338. PCHAR Mfg; // MFG field from device's IEEE 1284 ID string
  339. PCHAR Mdl; // MDL field from device's IEEE 1284 ID string
  340. PCHAR Cid; // CID (Compatible ID) field from device's IEEE 1284 ID string
  341. PWSTR PdoName; // name used in call to IoCreateDevice
  342. PWSTR SymLinkName; // name used in call to IoCreateUnprotectedSymbolicLink
  343. LIST_ENTRY DevDeletionList; // used by driver to create list of PDOs to delete on Driver Unload
  344. // UCHAR DaisyChainId; // 0..3 if PdoTypeDaisyChain, ignored otherwise
  345. UCHAR Ieee1284_3DeviceId; // PDO - 0..3 is 1284.3 Daisy Chain device, 4 is End-Of-Chain Device, 5 is Legacy Zip
  346. BOOLEAN IsPdo; // TRUE == this is either a PODO or a PDO - use DeviceIdString[0] to distinguish
  347. BOOLEAN EndOfChain; // PODO - TRUE==NOT a .3 daisy chain dev - deprecated, use Ieee1284_3DeviceId==4 instead
  348. BOOLEAN PodoRegForWMI; // has this PODO registered for WMI callbacks?
  349. PDEVICE_OBJECT ParClassFdo; // P[O]DO - points to the ParClass FDO
  350. PDEVICE_OBJECT ParClassPdo; // FDO - points to first P[O]DO in list of ParClass created PODOs and PDOs
  351. PDEVICE_OBJECT Next; // P[O]DO - points to the next DO in the list of ParClass ejected P[O]DOs
  352. PDEVICE_OBJECT PortDeviceObject; // P[O]DO - points to the associated ParPort device object
  353. PFILE_OBJECT PortDeviceFileObject;// P[O]DO - referenced pointer to a FILE created against PortDeviceObject
  354. UNICODE_STRING PortSymbolicLinkName;// P[O]DO - Sym link name of the assoc ParPort device - used to open a FILE
  355. PDEVICE_OBJECT PhysicalDeviceObject;// FDO - The PDO passed to ParPnPAddDevice
  356. PDEVICE_OBJECT ParentDeviceObject; // FDO - parent DO returned by IoAttachDeviceToDeviceStack
  357. PIRP CurrentOpIrp; // IRP that our thread is currently processing
  358. PVOID NotificationHandle; // PlugPlay Notification Handle
  359. ULONG Event22Delay; // time in microseconds to delay prior to setting event 22 in IEEE 1284 Termination
  360. ULONG TimerStart; // initial value used for countdown when starting an operation
  361. BOOLEAN CreatedSymbolicLink; // P[O]DO - did we create a Symbolic Link for this device?
  362. BOOLEAN UsePIWriteLoop; // P[O]DO - do we want to use processor independant write loop?
  363. BOOLEAN ParPortDeviceGone; // Is our ParPort device object gone, possibly surprise removed?
  364. BOOLEAN RegForPptRemovalRelations; // Are we registered for ParPort removal relations?
  365. UCHAR Ieee1284Flags; // is device Stl older 1284.3 spec device?
  366. BOOLEAN DeleteOnRemoveOk; // True means that it is OK to call IoDeleteDevice during IRP_MN_REMOVE_DEVICE processing
  367. // - FDO sets this to True during QDR/BusRelations processing if it detects that the hardware
  368. // is no longer present.
  369. USHORT IdxForwardProtocol; // see afpForward[] in ieee1284.c
  370. USHORT IdxReverseProtocol; // see arpReverse[] in ieee1284.c
  371. ULONG CurrentEvent; // IEEE 1284 event - see IEEE 1284-1994 spec
  372. P1284_PHASE CurrentPhase; // see parallel.h for enum def - PHASE_UNKNOWN, ..., PHASE_INTERRUPT_HOST
  373. P1284_HW_MODE PortHWMode; // see parallel.h for enum def - HW_MODE_COMPATIBILITY, ..., HW_MODE_CONFIGURATION
  374. FAST_MUTEX OpenCloseMutex; // protect manipulation of OpenCloseRefCount
  375. FAST_MUTEX DevObjListMutex; // protect manipulation of list of ParClass ejected DOs
  376. LIST_ENTRY WorkQueue; // Queue of irps waiting to be processed.
  377. KSEMAPHORE RequestSemaphore;// dispatch routines use this to tell device worker thread that there is work to do
  378. //
  379. // PARALLEL_PORT_INFORMATION returned by IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO
  380. //
  381. PHYSICAL_ADDRESS OriginalController;
  382. PUCHAR Controller;
  383. PUCHAR EcrController;
  384. ULONG SpanOfController;
  385. PPARALLEL_TRY_ALLOCATE_ROUTINE TryAllocatePort; // nonblocking callback to allocate ParPort device
  386. PPARALLEL_FREE_ROUTINE FreePort; // callback to free ParPort device
  387. PPARALLEL_QUERY_WAITERS_ROUTINE QueryNumWaiters; // callback to query number of waiters in port allocation queue
  388. PVOID PortContext; // context for callbacks to ParPort
  389. //
  390. // subset of PARALLEL_PNP_INFORMATION returned by IOCTL_INTERNAL_GET_PARALLEL_PNP_INFO
  391. //
  392. ULONG HardwareCapabilities;
  393. PPARALLEL_SET_CHIP_MODE TrySetChipMode;
  394. PPARALLEL_CLEAR_CHIP_MODE ClearChipMode;
  395. PPARALLEL_TRY_SELECT_ROUTINE TrySelectDevice;
  396. PPARALLEL_DESELECT_ROUTINE DeselectDevice;
  397. ULONG FifoDepth;
  398. ULONG FifoWidth;
  399. BOOLEAN bAllocated; // have we allocated associated ParPort device?
  400. // Note: during some PnP processing we may have the port
  401. // for a short duration without setting this value to TRUE
  402. ULONG BusyDelay; // number of microseconds to wait after strobing a byte before checking the BUSY line.
  403. BOOLEAN BusyDelayDetermined;// Indicates if the BusyDelay parameter has been computed yet.
  404. PWORK_QUEUE_ITEM DeferredWorkItem; // Holds the work item used to defer printer initialization
  405. // If the registry entry by the same name is set, run the parallel
  406. // thread at the priority we used for NT 3.5 - this solves some
  407. // cases where a dos app spinning for input in the foreground is
  408. // starving the parallel thread
  409. BOOLEAN UseNT35Priority;
  410. ULONG InitializationTimeout;// timeout in seconds to wait for device to respond to an initialization request
  411. // - default == 15 seconds
  412. // - value overridden by registry entry of same name
  413. // - we will spin for max amount if no device attached
  414. LARGE_INTEGER AbsoluteOneSecond;// constants that are cheaper to put here rather
  415. LARGE_INTEGER OneSecond; // than in bss
  416. //
  417. // IEEE 1284 Mode support
  418. //
  419. PPROTOCOL_READ_ROUTINE fnRead; // Current pointer to a valid read funtion
  420. PPROTOCOL_WRITE_ROUTINE fnWrite; // Current pointer to a valid write Funtion
  421. BOOLEAN Connected; // are we currently negotiated into a 1284 mode?
  422. BOOLEAN AllocatedByLockPort; // are we currently allocated via IOCTL_INTERNAL_LOCK_PORT?
  423. USHORT spare4[2];
  424. LARGE_INTEGER IdleTimeout; // how long do we hold the port on the caller's behalf following an operation?
  425. USHORT ProtocolData[FAMILY_MAX];
  426. UCHAR ForwardInterfaceAddress;
  427. UCHAR ReverseInterfaceAddress;
  428. BOOLEAN SetForwardAddress;
  429. BOOLEAN SetReverseAddress;
  430. FAST_MUTEX LockPortMutex;
  431. DEVICE_POWER_STATE DeviceState;// Current Device Power State
  432. SYSTEM_POWER_STATE SystemState;// Current System Power State
  433. ULONG spare2;
  434. BOOLEAN bShadowBuffer;
  435. Queue ShadowBuffer;
  436. ULONG spare3;
  437. BOOLEAN bSynchWrites; // TRUE if ECP HW writes should be synchronous
  438. BOOLEAN bFirstByteTimeout; // TRUE if bus just reversed, means give the
  439. // device some time to respond with some data
  440. BOOLEAN bIsHostRecoverSupported; // Set via IOCTL_PAR_ECP_HOST_RECOVERY.
  441. // HostRecovery will not be utilized unless this bit is set
  442. KEVENT PauseEvent; // PnP dispatch routine uses this to pause worker thread during
  443. // during QUERY_STOP, STOP, and QUERY_REMOVE states
  444. USHORT ProtocolModesSupported;
  445. USHORT BadProtocolModes;
  446. PARALLEL_SAFETY ModeSafety;
  447. BOOLEAN IsIeeeTerminateOk;
  448. DOT3DL_PCTL P12843DL;
  449. // WMI
  450. PARALLEL_WMI_LOG_INFO log;
  451. WMILIB_CONTEXT WmiLibContext;
  452. LONG WmiRegistrationCount; // number of times this device has registered with WMI
  453. // PnP Query ID results
  454. UCHAR DeviceIdString[MAX_ID_SIZE]; // IEEE 1284 DeviceID string massaged/checksum'd to match INF form
  455. UCHAR DeviceDescription[MAX_ID_SIZE]; // "Manufacturer<SPACE>Model" from IEEE 1284 DeviceID string
  456. ULONG dummy; // dummy word to force RemoveLock to QuadWord alignment
  457. PVOID HwProfileChangeNotificationHandle;
  458. ULONG Signature2; // keep this the last member in extension
  459. } PDO_EXTENSION, *PPDO_EXTENSION;
  460. typedef struct _SYNCHRONIZED_COUNT_CONTEXT {
  461. PLONG Count;
  462. LONG NewCount;
  463. } SYNCHRONIZED_COUNT_CONTEXT, *PSYNCHRONIZED_COUNT_CONTEXT;
  464. typedef struct _SYNCHRONIZED_LIST_CONTEXT {
  465. PLIST_ENTRY List;
  466. PLIST_ENTRY NewEntry;
  467. } SYNCHRONIZED_LIST_CONTEXT, *PSYNCHRONIZED_LIST_CONTEXT;
  468. typedef struct _SYNCHRONIZED_DISCONNECT_CONTEXT {
  469. PFDO_EXTENSION Extension;
  470. PPARALLEL_INTERRUPT_SERVICE_ROUTINE IsrInfo;
  471. } SYNCHRONIZED_DISCONNECT_CONTEXT, *PSYNCHRONIZED_DISCONNECT_CONTEXT;
  472. typedef struct _ISR_LIST_ENTRY {
  473. LIST_ENTRY ListEntry;
  474. PKSERVICE_ROUTINE ServiceRoutine;
  475. PVOID ServiceContext;
  476. PPARALLEL_DEFERRED_ROUTINE DeferredPortCheckRoutine;
  477. PVOID CheckContext;
  478. } ISR_LIST_ENTRY, *PISR_LIST_ENTRY;
  479. typedef struct _REMOVAL_RELATIONS_LIST_ENTRY {
  480. LIST_ENTRY ListEntry;
  481. PDEVICE_OBJECT DeviceObject;
  482. ULONG Flags;
  483. UNICODE_STRING DeviceName;
  484. } REMOVAL_RELATIONS_LIST_ENTRY, *PREMOVAL_RELATIONS_LIST_ENTRY;
  485. // former ecp.h follows:
  486. #define DEFAULT_ECP_CHANNEL 0
  487. #define ParTestEcpWrite(X) \
  488. (X->CurrentPhase != PHASE_FORWARD_IDLE && X->CurrentPhase != PHASE_FORWARD_XFER) \
  489. ? STATUS_IO_DEVICE_ERROR : STATUS_SUCCESS
  490. // ==================================================================
  491. // The following RECOVER codes are used for Hewlett-Packard devices.
  492. // Do not remove any of the error codes. These recover codes are
  493. // used to quickly get the host and periph back to a known state.
  494. // When using a recover code, add a comment where it is used at...
  495. #define RECOVER_0 0 // Reserved - not used anywhere
  496. #define RECOVER_1 1 // ECP_Terminate
  497. #define RECOVER_2 2 // SLP_SetupPhase init
  498. #define RECOVER_3 3 // SLP_FTP init DCR
  499. #define RECOVER_4 4 // SLP_FTP init DSR
  500. #define RECOVER_5 5 // SLP_FTP data xfer DCR
  501. #define RECOVER_6 6 // SLP_FRP init DCR
  502. #define RECOVER_7 7 // SLP_FRP init DSR
  503. #define RECOVER_8 8 // SLP_FRP state 38 DCR
  504. #define RECOVER_9 9 // SLP_FRP state 39 DCR
  505. #define RECOVER_10 10 // SLP_FRP state 40 DSR
  506. #define RECOVER_11 11 // SLP_RTP init DCR
  507. #define RECOVER_12 12 // SLP_RTP init DSR
  508. #define RECOVER_13 13 // SLP_RTP state 43 DCR
  509. #define RECOVER_14 14 // SLP_RFP init DCR
  510. #define RECOVER_15 15 // SLP_RFP init DSR
  511. #define RECOVER_16 16 // SLP_RFP state 47- DCR
  512. #define RECOVER_17 17 // SLP_RFP state 47 DCR
  513. #define RECOVER_18 18 // SLP_RFP state 48 DSR
  514. #define RECOVER_19 19 // SLP_RFP state 49 DSR
  515. #define RECOVER_20 20 // ZIP_EmptyFifo DCR
  516. #define RECOVER_21 21 // ZIP_FTP init DCR
  517. #define RECOVER_22 22 // ZIP_FTP init DSR
  518. #define RECOVER_23 23 // ZIP_FTP data xfer DCR
  519. #define RECOVER_24 24 // ZIP_FRP init DSR
  520. #define RECOVER_25 25 // ZIP_FRP init DCR
  521. #define RECOVER_26 26 // ZIP_FRP state 38 DCR
  522. #define RECOVER_27 27 // ZIP_FRP state 39 DCR
  523. #define RECOVER_28 28 // ZIP_FRP state 40 DSR
  524. #define RECOVER_29 29 // ZIP_FRP state 41 DCR
  525. #define RECOVER_30 30 // ZIP_RTP init DSR
  526. #define RECOVER_31 31 // ZIP_RTP init DCR
  527. #define RECOVER_32 32 // ZIP_RFP init DSR
  528. #define RECOVER_33 33 // ZIP_RFP init DCR
  529. #define RECOVER_34 34 // ZIP_RFP state 47- DCR
  530. #define RECOVER_35 35 // ZIP_RFP state 47 DCR
  531. #define RECOVER_36 36 // ZIP_RFP state 48 DSR
  532. #define RECOVER_37 37 // ZIP_RFP state 49 DSR
  533. #define RECOVER_38 38 // ZIP_RFP state 49+ DCR
  534. #define RECOVER_39 39 // Slippy_Terminate
  535. #define RECOVER_40 40 // ZIP_SCA init DCR
  536. #define RECOVER_41 41 // ZIP_SCA init DSR
  537. #define RECOVER_42 42 // SLP_SCA init DCR
  538. #define RECOVER_43 43 // SLP_SCA init DSR
  539. #define RECOVER_44 44 // ZIP_SP init DCR
  540. #define RECOVER_45 45 // SIP_FRP init DSR
  541. #define RECOVER_46 46 // SIP_FRP init DCR
  542. #define RECOVER_47 47 // SIP_FRP state 38 DCR
  543. #define RECOVER_48 48 // SIP_FRP state 39 DCR
  544. #define RECOVER_49 49 // SIP_FRP state 40 DSR
  545. #define RECOVER_50 50 // SIP_RTP init DCR
  546. #define RECOVER_51 51 // SIP_RFP init DSR
  547. #define RECOVER_52 52 // SIP_RFP state 43 DCR
  548. // former ecp.h preceeds
  549. // former hwecp.h follows
  550. //--------------------------------------------------------------------------
  551. // Printer status constants. Seem to only be used by hwecp
  552. //--------------------------------------------------------------------------
  553. #define CHKPRNOK 0xDF // DSR value indicating printer ok.
  554. #define CHKPRNOFF1 0x87 // DSR value indicating printer off.
  555. #define CHKPRNOFF2 0x4F // DSR value indicating printer off.
  556. #define CHKNOCABLE 0x7F // DSR value indicating no cable.
  557. #define CHKPRNOFLIN 0xCF // DSR value indicating printer offline.
  558. #define CHKNOPAPER 0xEF // DSR value indicating out of paper.
  559. #define CHKPAPERJAM 0xC7 // DSR value indicating paper jam.
  560. // former hwecp.h preceeds
  561. // former parclass.h follows
  562. #define REQUEST_DEVICE_ID TRUE
  563. #define HAVE_PORT_KEEP_PORT TRUE
  564. // enable scans for Legacy Zip?
  565. extern ULONG ParEnableLegacyZip;
  566. #define PAR_LGZIP_PSEUDO_1284_ID_STRING "MFG:IMG;CMD:;MDL:VP0;CLS:SCSIADAPTER;DES:IOMEGA PARALLEL PORT"
  567. extern PCHAR ParLegacyZipPseudoId;
  568. #define USE_PAR3QUERYDEVICEID 1
  569. extern LARGE_INTEGER AcquirePortTimeout; // timeout for IOCTL_INTERNAL_PARALLEL_PORT_ALLOCATE
  570. extern ULONG g_NumPorts; // used to generate N in \Device\ParallelN ClassName
  571. extern UNICODE_STRING RegistryPath; // copy of the registry path passed to DriverEntry()
  572. extern ULONG DumpDevExtTable;
  573. // Driver Globals
  574. extern ULONG SppNoRaiseIrql; // 0 == original raise IRQL behavior in SPP
  575. // !0 == new behavior - disable raise IRQL
  576. // and insert some KeDelayExecutionThread
  577. // calls while waiting for peripheral response
  578. extern ULONG DefaultModes; // Upper USHORT is Reverse Default Mode, Lower is Forward Default Mode
  579. // if == 0, or invalid, then use default of Nibble/Centronics
  580. extern ULONG WarmPollPeriod; // time between polls for printers (in seconds)
  581. extern BOOLEAN PowerStateIsAC;
  582. extern PCALLBACK_OBJECT PowerStateCallbackObject;
  583. extern PVOID PowerStateCallbackRegistration;
  584. #define PAR_NO_FAST_CALLS 1
  585. #if PAR_NO_FAST_CALLS
  586. VOID
  587. ParCompleteRequest(
  588. IN PIRP Irp,
  589. IN CCHAR PriorityBoost
  590. );
  591. NTSTATUS
  592. ParCallDriver(
  593. IN PDEVICE_OBJECT DeviceObject,
  594. IN OUT PIRP Irp
  595. );
  596. #else
  597. #define ParCompleteRequest(a,b) IoCompleteRequest(a,b)
  598. #define ParCallDriver(a,b) IoCallDriver(a,b)
  599. #endif
  600. extern const PHYSICAL_ADDRESS PhysicalZero;
  601. //
  602. // For the above directory, the serial port will
  603. // use the following name as the suffix of the serial
  604. // ports for that directory. It will also append
  605. // a number onto the end of the name. That number
  606. // will start at 1.
  607. //
  608. #define DEFAULT_PARALLEL_NAME L"LPT"
  609. //
  610. // This is the parallel class name.
  611. //
  612. #define DEFAULT_NT_SUFFIX L"Parallel"
  613. #define PARALLEL_DATA_OFFSET 0
  614. #define PARALLEL_STATUS_OFFSET 1
  615. #define PARALLEL_CONTROL_OFFSET 2
  616. #define PARALLEL_REGISTER_SPAN 3
  617. //
  618. // Ieee 1284 constants (Protocol Families)
  619. //
  620. #define FAMILY_NONE 0x0
  621. #define FAMILY_REVERSE_NIBBLE 0x1
  622. #define FAMILY_REVERSE_BYTE 0x2
  623. #define FAMILY_ECP 0x3
  624. #define FAMILY_EPP 0x4
  625. #define FAMILY_BECP 0x5
  626. #define FAMILY_MAX FAMILY_BECP
  627. //
  628. // For pnp id strings
  629. //
  630. #define MAX_ID_SIZE 256
  631. // used to construct IEEE 1284.3 "Dot" name suffixes
  632. // table lookup for integer to WCHAR conversion
  633. #define PAR_UNICODE_PERIOD L'.'
  634. #define PAR_UNICODE_COLON L':'
  635. //
  636. // DeviceStateFlags
  637. //
  638. #define PAR_DEVICE_DELETED ((ULONG)0x00000002) // IoDeleteDevice has been called
  639. #define PAR_DEVICE_PAUSED ((ULONG)0x00000010) // stop-pending, stopped, or remove-pending states
  640. #define PAR_DEVICE_PORT_REMOVE_PENDING ((ULONG)0x00000200) // our ParPort is in a Remove Pending State
  641. #define PAR_REV_MODE_SKIP_MASK (CHANNEL_NIBBLE | BYTE_BIDIR | EPP_ANY | ECP_ANY)
  642. #define PAR_FWD_MODE_SKIP_MASK (EPP_ANY | BOUNDED_ECP | ECP_HW_NOIRQ | ECP_HW_IRQ)
  643. #define PAR_MAX_CHANNEL 127
  644. #define PAR_COMPATIBILITY_RESET 300
  645. //
  646. // ParClass DeviceObject structure
  647. //
  648. // - Lists the ParClass created PODO and all PDOs associated with a specific ParPort device
  649. //
  650. typedef struct _PAR_DEVOBJ_STRUCT {
  651. PUCHAR Controller; // host controller address for devices in this structure
  652. PDEVICE_OBJECT LegacyPodo; // legacy or "raw" port device
  653. PDEVICE_OBJECT EndOfChainPdo; // End-Of-Chain PnP device
  654. PDEVICE_OBJECT Dot3Id0Pdo; // 1284.3 daisy chain device, 1284.3 deviceID == 0
  655. PDEVICE_OBJECT Dot3Id1Pdo;
  656. PDEVICE_OBJECT Dot3Id2Pdo;
  657. PDEVICE_OBJECT Dot3Id3Pdo; // 1284.3 daisy chain device, 1284.3 deviceID == 3
  658. PDEVICE_OBJECT LegacyZipPdo; // Legacy Zip Drive
  659. PFILE_OBJECT pFileObject; // Need an open handle to ParPort device to prevent it
  660. // from being removed out from under us
  661. struct _PAR_DEVOBJ_STRUCT *Next;
  662. } PAR_DEVOBJ_STRUCT, *PPAR_DEVOBJ_STRUCT;
  663. //
  664. // Used in device extension for DeviceType field
  665. //
  666. #define PAR_DEVTYPE_FDO 0x00000001
  667. #define PAR_DEVTYPE_PODO 0x00000002
  668. #define PAR_DEVTYPE_PDO 0x00000004
  669. //
  670. // Protocol structure definitions
  671. //
  672. typedef
  673. BOOLEAN
  674. (*PPROTOCOL_IS_MODE_SUPPORTED_ROUTINE) (
  675. IN PPDO_EXTENSION Extension
  676. );
  677. typedef
  678. NTSTATUS
  679. (*PPROTOCOL_CONNECT_ROUTINE) (
  680. IN PPDO_EXTENSION Extension,
  681. IN BOOLEAN DeviceIdRequest
  682. );
  683. typedef
  684. VOID
  685. (*PPROTOCOL_DISCONNECT_ROUTINE) (
  686. IN PPDO_EXTENSION Extension
  687. );
  688. typedef
  689. NTSTATUS
  690. (*PPROTOCOL_ENTER_FORWARD_ROUTINE) (
  691. IN PPDO_EXTENSION Extension
  692. );
  693. typedef
  694. NTSTATUS
  695. (*PPROTOCOL_EXIT_FORWARD_ROUTINE) (
  696. IN PPDO_EXTENSION Extension
  697. );
  698. typedef
  699. NTSTATUS
  700. (*PPROTOCOL_ENTER_REVERSE_ROUTINE) (
  701. IN PPDO_EXTENSION Extension
  702. );
  703. typedef
  704. NTSTATUS
  705. (*PPROTOCOL_EXIT_REVERSE_ROUTINE) (
  706. IN PPDO_EXTENSION Extension
  707. );
  708. typedef
  709. VOID
  710. (*PPROTOCOL_READSHADOW_ROUTINE) (
  711. IN Queue *pShadowBuffer,
  712. IN PUCHAR lpsBufPtr,
  713. IN ULONG dCount,
  714. OUT ULONG *fifoCount
  715. );
  716. typedef
  717. BOOLEAN
  718. (*PPROTOCOL_HAVEREADDATA_ROUTINE) (
  719. IN PPDO_EXTENSION Extension
  720. );
  721. typedef
  722. NTSTATUS
  723. (*PPROTOCOL_SET_INTERFACE_ADDRESS_ROUTINE) (
  724. IN PPDO_EXTENSION Extension,
  725. IN UCHAR Address
  726. );
  727. typedef struct _FORWARD_PTCL {
  728. PPROTOCOL_IS_MODE_SUPPORTED_ROUTINE fnIsModeSupported;
  729. PPROTOCOL_CONNECT_ROUTINE fnConnect;
  730. PPROTOCOL_DISCONNECT_ROUTINE fnDisconnect;
  731. PPROTOCOL_SET_INTERFACE_ADDRESS_ROUTINE fnSetInterfaceAddress;
  732. PPROTOCOL_ENTER_FORWARD_ROUTINE fnEnterForward;
  733. PPROTOCOL_EXIT_FORWARD_ROUTINE fnExitForward;
  734. PPROTOCOL_WRITE_ROUTINE fnWrite;
  735. USHORT Protocol;
  736. USHORT ProtocolFamily;
  737. } FORWARD_PTCL, *PFORWARD_PTCL;
  738. typedef struct _REVERSE_PTCL {
  739. PPROTOCOL_IS_MODE_SUPPORTED_ROUTINE fnIsModeSupported;
  740. PPROTOCOL_CONNECT_ROUTINE fnConnect;
  741. PPROTOCOL_DISCONNECT_ROUTINE fnDisconnect;
  742. PPROTOCOL_SET_INTERFACE_ADDRESS_ROUTINE fnSetInterfaceAddress;
  743. PPROTOCOL_ENTER_REVERSE_ROUTINE fnEnterReverse;
  744. PPROTOCOL_EXIT_REVERSE_ROUTINE fnExitReverse;
  745. PPROTOCOL_READSHADOW_ROUTINE fnReadShadow;
  746. PPROTOCOL_HAVEREADDATA_ROUTINE fnHaveReadData;
  747. PPROTOCOL_READ_ROUTINE fnRead;
  748. USHORT Protocol;
  749. USHORT ProtocolFamily;
  750. } REVERSE_PTCL, *PREVERSE_PTCL;
  751. extern FORWARD_PTCL afpForward[];
  752. extern REVERSE_PTCL arpReverse[];
  753. //
  754. // WARNING...Make sure that enumeration matches the protocol array...
  755. //
  756. typedef enum _FORWARD_MODE {
  757. FORWARD_FASTEST = 0, // 0
  758. BOUNDED_ECP_FORWARD = FORWARD_FASTEST, // 0
  759. ECP_HW_FORWARD_NOIRQ, // 1
  760. EPP_HW_FORWARD, // 2
  761. EPP_SW_FORWARD, // 3
  762. ECP_SW_FORWARD, //......................// 4
  763. IEEE_COMPAT_MODE, // 6
  764. CENTRONICS_MODE, // 7
  765. FORWARD_NONE // 8
  766. } FORWARD_MODE;
  767. typedef enum _REVERSE_MODE {
  768. REVERSE_FASTEST = 0, // 0
  769. BOUNDED_ECP_REVERSE = REVERSE_FASTEST, // 0
  770. ECP_HW_REVERSE_NOIRQ, // 1
  771. EPP_HW_REVERSE, // 2
  772. EPP_SW_REVERSE, // 3
  773. ECP_SW_REVERSE, //......................// 4
  774. BYTE_MODE, // 5
  775. NIBBLE_MODE, // 6
  776. CHANNELIZED_NIBBLE_MODE, // 7
  777. REVERSE_NONE // 8
  778. } REVERSE_MODE;
  779. //
  780. // Ieee Extensibility constants
  781. //
  782. #define NIBBLE_EXTENSIBILITY 0x00
  783. #define BYTE_EXTENSIBILITY 0x01
  784. #define CHANNELIZED_EXTENSIBILITY 0x08
  785. #define ECP_EXTENSIBILITY 0x10
  786. #define BECP_EXTENSIBILITY 0x18
  787. #define EPP_EXTENSIBILITY 0x40
  788. #define DEVICE_ID_REQ 0x04
  789. //
  790. // Bit Definitions in the status register.
  791. //
  792. #define PAR_STATUS_NOT_ERROR 0x08 //not error on device
  793. #define PAR_STATUS_SLCT 0x10 //device is selected (on-line)
  794. #define PAR_STATUS_PE 0x20 //paper empty
  795. #define PAR_STATUS_NOT_ACK 0x40 //not acknowledge (data transfer was not ok)
  796. #define PAR_STATUS_NOT_BUSY 0x80 //operation in progress
  797. //
  798. // Bit Definitions in the control register.
  799. //
  800. #define PAR_CONTROL_STROBE 0x01 //to read or write data
  801. #define PAR_CONTROL_AUTOFD 0x02 //to autofeed continuous form paper
  802. #define PAR_CONTROL_NOT_INIT 0x04 //begin an initialization routine
  803. #define PAR_CONTROL_SLIN 0x08 //to select the device
  804. #define PAR_CONTROL_IRQ_ENB 0x10 //to enable interrupts
  805. #define PAR_CONTROL_DIR 0x20 //direction = read
  806. #define PAR_CONTROL_WR_CONTROL 0xc0 //the 2 highest bits of the control
  807. // register must be 1
  808. //
  809. // More bit definitions.
  810. //
  811. #define DATA_OFFSET 0
  812. #define DSR_OFFSET 1
  813. #define DCR_OFFSET 2
  814. #define OFFSET_DATA DATA_OFFSET // Put in for compatibility with legacy code
  815. #define OFFSET_DSR DSR_OFFSET // Put in for compatibility with legacy code
  816. #define OFFSET_DCR DCR_OFFSET // Put in for compatibility with legacy code
  817. //
  818. // Bit definitions for the DSR.
  819. //
  820. #define DSR_NOT_BUSY 0x80
  821. #define DSR_NOT_ACK 0x40
  822. #define DSR_PERROR 0x20
  823. #define DSR_SELECT 0x10
  824. #define DSR_NOT_FAULT 0x08
  825. //
  826. // More bit definitions for the DSR.
  827. //
  828. #define DSR_NOT_PTR_BUSY 0x80
  829. #define DSR_NOT_PERIPH_ACK 0x80
  830. #define DSR_WAIT 0x80
  831. #define DSR_PTR_CLK 0x40
  832. #define DSR_PERIPH_CLK 0x40
  833. #define DSR_INTR 0x40
  834. #define DSR_ACK_DATA_REQ 0x20
  835. #define DSR_NOT_ACK_REVERSE 0x20
  836. #define DSR_XFLAG 0x10
  837. #define DSR_NOT_DATA_AVAIL 0x08
  838. #define DSR_NOT_PERIPH_REQUEST 0x08
  839. //
  840. // Bit definitions for the DCR.
  841. //
  842. #define DCR_RESERVED 0xC0
  843. #define DCR_DIRECTION 0x20
  844. #define DCR_ACKINT_ENABLED 0x10
  845. #define DCR_SELECT_IN 0x08
  846. #define DCR_NOT_INIT 0x04
  847. #define DCR_AUTOFEED 0x02
  848. #define DCR_STROBE 0x01
  849. //
  850. // More bit definitions for the DCR.
  851. //
  852. #define DCR_NOT_1284_ACTIVE 0x08
  853. #define DCR_ASTRB 0x08
  854. #define DCR_NOT_REVERSE_REQUEST 0x04
  855. #define DCR_NOT_HOST_BUSY 0x02
  856. #define DCR_NOT_HOST_ACK 0x02
  857. #define DCR_DSTRB 0x02
  858. #define DCR_NOT_HOST_CLK 0x01
  859. #define DCR_WRITE 0x01
  860. #define DCR_NEUTRAL (DCR_RESERVED | DCR_SELECT_IN | DCR_NOT_INIT)
  861. //
  862. // Give a timeout of 300 seconds. Some postscript printers will
  863. // buffer up a lot of commands then proceed to render what they
  864. // have. The printer will then refuse to accept any characters
  865. // until it's done with the rendering. This render process can
  866. // take a while. We'll give it 300 seconds.
  867. //
  868. // Note that an application can change this value.
  869. //
  870. #define PAR_WRITE_TIMEOUT_VALUE 300
  871. #ifdef JAPAN // IBM-J printers
  872. //
  873. // Support for IBM-J printers.
  874. //
  875. // When the printer operates in Japanese (PS55) mode, it redefines
  876. // the meaning of parallel lines so that extended error status can
  877. // be reported. It is roughly compatible with PC/AT, but we have to
  878. // take care of a few cases where the status looks like PC/AT error
  879. // condition.
  880. //
  881. // Status Busy /AutoFdXT Paper Empty Select /Fault
  882. // ------ ---- --------- ----------- ------ ------
  883. // Not RMR 1 1 1 1 1
  884. // Head Alarm 1 1 1 1 0
  885. // ASF Jam 1 1 1 0 0
  886. // Paper Empty 1 0 1 0 0
  887. // No Error 0 0 0 1 1
  888. // Can Req 1 0 0 0 1
  889. // Deselect 1 0 0 0 0
  890. //
  891. // The printer keeps "Not RMR" during the parallel port
  892. // initialization, then it takes "Paper Empty", "No Error"
  893. // or "Deselect". Other status can be thought as an
  894. // H/W error condition.
  895. //
  896. // Namely, "Not RMR" conflicts with PAR_NO_CABLE and "Deselect"
  897. // should also be regarded as another PAR_OFF_LINE. When the
  898. // status is PAR_PAPER_EMPTY, the initialization is finished
  899. // (we should not send init purlse again.)
  900. //
  901. // See ParInitializeDevice() for more information.
  902. //
  903. // [takashim]
  904. #define PAR_OFF_LINE_COMMON( Status ) ( \
  905. (IsNotNEC_98) ? \
  906. (Status & PAR_STATUS_NOT_ERROR) && \
  907. ((Status & PAR_STATUS_NOT_BUSY) ^ PAR_STATUS_NOT_BUSY) && \
  908. !(Status & PAR_STATUS_SLCT) : \
  909. \
  910. ((Status & PAR_STATUS_NOT_ERROR) ^ PAR_STATUS_NOT_ERROR) && \
  911. ((Status & PAR_STATUS_NOT_BUSY) ^ PAR_STATUS_NOT_BUSY) && \
  912. ((Status & PAR_STATUS_PE) ^ PAR_STATUS_PE) && \
  913. !(Status & PAR_STATUS_SLCT) \
  914. )
  915. #define PAR_OFF_LINE_IBM55( Status ) ( \
  916. ((Status & PAR_STATUS_NOT_BUSY) ^ PAR_STATUS_NOT_BUSY) && \
  917. ((Status & PAR_STATUS_PE) ^ PAR_STATUS_PE) && \
  918. ((Status & PAR_STATUS_SLCT) ^ PAR_STATUS_SLCT) && \
  919. ((Status & PAR_STATUS_NOT_ERROR) ^ PAR_STATUS_NOT_ERROR))
  920. #define PAR_PAPER_EMPTY2( Status ) ( \
  921. ((Status & PAR_STATUS_NOT_BUSY) ^ PAR_STATUS_NOT_BUSY) && \
  922. (Status & PAR_STATUS_PE) && \
  923. ((Status & PAR_STATUS_SLCT) ^ PAR_STATUS_SLCT) && \
  924. ((Status & PAR_STATUS_NOT_ERROR) ^ PAR_STATUS_NOT_ERROR))
  925. //
  926. // Redefine this for Japan.
  927. //
  928. #define PAR_OFF_LINE( Status ) ( \
  929. PAR_OFF_LINE_COMMON( Status ) || \
  930. PAR_OFF_LINE_IBM55( Status ))
  931. #else // JAPAN
  932. //
  933. // Busy, not select, not error
  934. //
  935. // !JAPAN
  936. #define PAR_OFF_LINE( Status ) ( \
  937. (IsNotNEC_98) ? \
  938. (Status & PAR_STATUS_NOT_ERROR) && \
  939. ((Status & PAR_STATUS_NOT_BUSY) ^ PAR_STATUS_NOT_BUSY) && \
  940. !(Status & PAR_STATUS_SLCT) : \
  941. \
  942. ((Status & PAR_STATUS_NOT_ERROR) ^ PAR_STATUS_NOT_ERROR) && \
  943. ((Status & PAR_STATUS_NOT_BUSY) ^ PAR_STATUS_NOT_BUSY) && \
  944. ((Status & PAR_STATUS_PE) ^ PAR_STATUS_PE) && \
  945. !(Status & PAR_STATUS_SLCT) \
  946. )
  947. #endif // JAPAN
  948. //
  949. // Busy, PE
  950. //
  951. #define PAR_PAPER_EMPTY( Status ) ( \
  952. (Status & PAR_STATUS_PE) )
  953. //
  954. // error, ack, not busy
  955. //
  956. #define PAR_POWERED_OFF( Status ) ( \
  957. (IsNotNEC_98) ? \
  958. ((Status & PAR_STATUS_NOT_ERROR) ^ PAR_STATUS_NOT_ERROR) && \
  959. ((Status & PAR_STATUS_NOT_ACK) ^ PAR_STATUS_NOT_ACK) && \
  960. (Status & PAR_STATUS_NOT_BUSY) : \
  961. \
  962. ((Status & PAR_STATUS_NOT_ERROR) ^ PAR_STATUS_NOT_ERROR) && \
  963. (Status & PAR_STATUS_NOT_ACK) && \
  964. (Status & PAR_STATUS_NOT_BUSY) \
  965. )
  966. //
  967. // not error, not busy, not select
  968. //
  969. #define PAR_NOT_CONNECTED( Status ) ( \
  970. (Status & PAR_STATUS_NOT_ERROR) && \
  971. (Status & PAR_STATUS_NOT_BUSY) &&\
  972. !(Status & PAR_STATUS_SLCT) )
  973. //
  974. // not error, not busy
  975. //
  976. #define PAR_OK(Status) ( \
  977. (Status & PAR_STATUS_NOT_ERROR) && \
  978. ((Status & PAR_STATUS_PE) ^ PAR_STATUS_PE) && \
  979. (Status & PAR_STATUS_NOT_BUSY) )
  980. //
  981. // busy, select, not error
  982. //
  983. #define PAR_POWERED_ON(Status) ( \
  984. ((Status & PAR_STATUS_NOT_BUSY) ^ PAR_STATUS_NOT_BUSY) && \
  985. (Status & PAR_STATUS_SLCT) && \
  986. (Status & PAR_STATUS_NOT_ERROR))
  987. //
  988. // busy, not error
  989. //
  990. #define PAR_BUSY(Status) (\
  991. (( Status & PAR_STATUS_NOT_BUSY) ^ PAR_STATUS_NOT_BUSY) && \
  992. ( Status & PAR_STATUS_NOT_ERROR ) )
  993. //
  994. // selected
  995. //
  996. #define PAR_SELECTED(Status) ( \
  997. ( Status & PAR_STATUS_SLCT ) )
  998. //
  999. // No cable attached.
  1000. //
  1001. #define PAR_NO_CABLE(Status) ( \
  1002. (IsNotNEC_98) ? \
  1003. ((Status & PAR_STATUS_NOT_BUSY) ^ PAR_STATUS_NOT_BUSY) && \
  1004. (Status & PAR_STATUS_NOT_ACK) && \
  1005. (Status & PAR_STATUS_PE) && \
  1006. (Status & PAR_STATUS_SLCT) && \
  1007. (Status & PAR_STATUS_NOT_ERROR) : \
  1008. \
  1009. (Status & PAR_STATUS_NOT_BUSY) && \
  1010. (Status & PAR_STATUS_NOT_ACK) && \
  1011. (Status & PAR_STATUS_PE) && \
  1012. (Status & PAR_STATUS_SLCT) && \
  1013. (Status & PAR_STATUS_NOT_ERROR) \
  1014. )
  1015. //
  1016. // not error, not busy, selected.
  1017. //
  1018. #define PAR_ONLINE(Status) ( \
  1019. (Status & PAR_STATUS_NOT_ERROR) && \
  1020. (Status & PAR_STATUS_NOT_BUSY) && \
  1021. ((Status & PAR_STATUS_PE) ^ PAR_STATUS_PE) && \
  1022. (Status & PAR_STATUS_SLCT) )
  1023. //BOOLEAN
  1024. //ParCompareGuid(
  1025. // IN LPGUID guid1,
  1026. // IN LPGUID guid2
  1027. // )
  1028. //
  1029. #define ParCompareGuid(g1, g2) ( \
  1030. ( (g1) == (g2) ) ? \
  1031. TRUE : \
  1032. RtlCompareMemory( (g1), (g2), sizeof(GUID) ) == sizeof(GUID) \
  1033. )
  1034. //VOID StoreData(
  1035. // IN PUCHAR RegisterBase,
  1036. // IN UCHAR DataByte
  1037. // )
  1038. // Data must be on line before Strobe = 1;
  1039. // Strobe = 1, DIR = 0
  1040. // Strobe = 0
  1041. //
  1042. // We change the port direction to output (and make sure stobe is low).
  1043. //
  1044. // Note that the data must be available at the port for at least
  1045. // .5 microseconds before and after you strobe, and that the strobe
  1046. // must be active for at least 500 nano seconds. We are going
  1047. // to end up stalling for twice as much time as we need to, but, there
  1048. // isn't much we can do about that.
  1049. //
  1050. // We put the data into the port and wait for 1 micro.
  1051. // We strobe the line for at least 1 micro
  1052. // We lower the strobe and again delay for 1 micro
  1053. // We then revert to the original port direction.
  1054. //
  1055. // Thanks to Olivetti for advice.
  1056. //
  1057. #define StoreData(RegisterBase,DataByte) \
  1058. { \
  1059. PUCHAR _Address = RegisterBase; \
  1060. UCHAR _Control; \
  1061. _Control = GetControl(_Address); \
  1062. ASSERT(!(_Control & PAR_CONTROL_STROBE)); \
  1063. StoreControl( \
  1064. _Address, \
  1065. (UCHAR)(_Control & ~(PAR_CONTROL_STROBE | PAR_CONTROL_DIR)) \
  1066. ); \
  1067. P5WritePortUchar( \
  1068. _Address+PARALLEL_DATA_OFFSET, \
  1069. (UCHAR)DataByte \
  1070. ); \
  1071. KeStallExecutionProcessor((ULONG)1); \
  1072. StoreControl( \
  1073. _Address, \
  1074. (UCHAR)((_Control | PAR_CONTROL_STROBE) & ~PAR_CONTROL_DIR) \
  1075. ); \
  1076. KeStallExecutionProcessor((ULONG)1); \
  1077. StoreControl( \
  1078. _Address, \
  1079. (UCHAR)(_Control & ~(PAR_CONTROL_STROBE | PAR_CONTROL_DIR)) \
  1080. ); \
  1081. KeStallExecutionProcessor((ULONG)1); \
  1082. StoreControl( \
  1083. _Address, \
  1084. (UCHAR)_Control \
  1085. ); \
  1086. }
  1087. //
  1088. // Function prototypes
  1089. //
  1090. //
  1091. // parpnp.c
  1092. //
  1093. #ifndef STATIC_LOAD
  1094. NTSTATUS
  1095. ParPnpAddDevice(
  1096. IN PDRIVER_OBJECT pDriverObject,
  1097. IN PDEVICE_OBJECT pPhysicalDeviceObject
  1098. );
  1099. NTSTATUS
  1100. ParParallelPnp (
  1101. IN PDEVICE_OBJECT pDeviceObject,
  1102. IN PIRP pIrp
  1103. );
  1104. NTSTATUS
  1105. ParSynchCompletionRoutine(
  1106. IN PDEVICE_OBJECT DeviceObject,
  1107. IN PIRP Irp,
  1108. IN PKEVENT Event
  1109. );
  1110. BOOLEAN
  1111. ParMakeNames(
  1112. IN ULONG ParallelPortNumber,
  1113. OUT PUNICODE_STRING ClassName,
  1114. OUT PUNICODE_STRING LinkName
  1115. );
  1116. VOID
  1117. ParCheckParameters(
  1118. IN OUT PPDO_EXTENSION Extension
  1119. );
  1120. #endif
  1121. //
  1122. // oldinit.c
  1123. //
  1124. #ifdef STATIC_LOAD
  1125. NTSTATUS
  1126. DriverEntry(
  1127. IN PDRIVER_OBJECT DriverObject,
  1128. IN PUNICODE_STRING RegistryPath
  1129. );
  1130. BOOLEAN
  1131. ParMakeNames(
  1132. IN ULONG ParallelPortNumber,
  1133. OUT PUNICODE_STRING PortName,
  1134. OUT PUNICODE_STRING ClassName,
  1135. OUT PUNICODE_STRING LinkName
  1136. );
  1137. VOID
  1138. ParInitializeClassDevice(
  1139. IN PDRIVER_OBJECT DriverObject,
  1140. IN PUNICODE_STRING RegistryPath,
  1141. IN ULONG ParallelPortNumber
  1142. );
  1143. VOID
  1144. ParCheckParameters(
  1145. IN PUNICODE_STRING RegistryPath,
  1146. IN OUT PPDO_EXTENSION Extension
  1147. );
  1148. #endif
  1149. //
  1150. // parclass.c
  1151. //
  1152. VOID
  1153. ParLogError(
  1154. IN PDRIVER_OBJECT DriverObject,
  1155. IN PDEVICE_OBJECT DeviceObject OPTIONAL,
  1156. IN PHYSICAL_ADDRESS P1,
  1157. IN PHYSICAL_ADDRESS P2,
  1158. IN ULONG SequenceNumber,
  1159. IN UCHAR MajorFunctionCode,
  1160. IN UCHAR RetryCount,
  1161. IN ULONG UniqueErrorValue,
  1162. IN NTSTATUS FinalStatus,
  1163. IN NTSTATUS SpecificIOStatus
  1164. );
  1165. NTSTATUS
  1166. ParCreateOpen(
  1167. IN PDEVICE_OBJECT DeviceObject,
  1168. IN PIRP Irp
  1169. );
  1170. NTSTATUS
  1171. ParClose(
  1172. IN PDEVICE_OBJECT DeviceObject,
  1173. IN PIRP Irp
  1174. );
  1175. NTSTATUS
  1176. ParCleanup(
  1177. IN PDEVICE_OBJECT DeviceObject,
  1178. IN PIRP Irp
  1179. );
  1180. NTSTATUS
  1181. PptPdoReadWrite(
  1182. IN PDEVICE_OBJECT DeviceObject,
  1183. IN PIRP Irp
  1184. );
  1185. NTSTATUS
  1186. ParDeviceControl(
  1187. IN PDEVICE_OBJECT DeviceObject,
  1188. IN PIRP Irp
  1189. );
  1190. NTSTATUS
  1191. ParInternalDeviceControl(
  1192. IN PDEVICE_OBJECT DeviceObject,
  1193. IN PIRP Irp
  1194. );
  1195. NTSTATUS
  1196. ParQueryInformationFile(
  1197. IN PDEVICE_OBJECT DeviceObject,
  1198. IN PIRP Irp
  1199. );
  1200. NTSTATUS
  1201. ParSetInformationFile(
  1202. IN PDEVICE_OBJECT DeviceObject,
  1203. IN PIRP Irp
  1204. );
  1205. NTSTATUS
  1206. ParExportedNegotiateIeeeMode(
  1207. IN PPDO_EXTENSION Extension,
  1208. IN USHORT ModeMaskFwd,
  1209. IN USHORT ModeMaskRev,
  1210. IN PARALLEL_SAFETY ModeSafety,
  1211. IN BOOLEAN IsForward
  1212. );
  1213. NTSTATUS
  1214. ParExportedTerminateIeeeMode(
  1215. IN PPDO_EXTENSION Extension
  1216. );
  1217. //////////////////////////////////////////////////////////////////
  1218. // Modes of operation
  1219. //////////////////////////////////////////////////////////////////
  1220. //
  1221. // spp.c
  1222. //
  1223. NTSTATUS
  1224. ParEnterSppMode(
  1225. IN PPDO_EXTENSION Extension,
  1226. IN BOOLEAN DeviceIdRequest
  1227. );
  1228. ULONG
  1229. SppWriteLoopPI(
  1230. IN PUCHAR Controller,
  1231. IN PUCHAR WriteBuffer,
  1232. IN ULONG NumBytesToWrite,
  1233. IN ULONG BusyDelay
  1234. );
  1235. ULONG
  1236. SppCheckBusyDelay(
  1237. IN PPDO_EXTENSION Extension,
  1238. IN PUCHAR WriteBuffer,
  1239. IN ULONG NumBytesToWrite
  1240. );
  1241. NTSTATUS
  1242. SppWrite(
  1243. IN PPDO_EXTENSION Extension,
  1244. IN PVOID Buffer,
  1245. IN ULONG BytesToWrite,
  1246. OUT PULONG BytesTransferred
  1247. );
  1248. VOID
  1249. ParTerminateSppMode(
  1250. IN PPDO_EXTENSION Extension
  1251. );
  1252. NTSTATUS
  1253. SppQueryDeviceId(
  1254. IN PPDO_EXTENSION Extension,
  1255. OUT PCHAR DeviceIdBuffer,
  1256. IN ULONG BufferSize,
  1257. OUT PULONG DeviceIdSize,
  1258. IN BOOLEAN bReturnRawString
  1259. );
  1260. //
  1261. // sppieee.c
  1262. //
  1263. NTSTATUS
  1264. SppIeeeWrite(
  1265. IN PPDO_EXTENSION Extension,
  1266. IN PVOID Buffer,
  1267. IN ULONG BytesToWrite,
  1268. OUT PULONG BytesTransferred
  1269. );
  1270. //
  1271. // nibble.c
  1272. //
  1273. BOOLEAN
  1274. ParIsChannelizedNibbleSupported(
  1275. IN PPDO_EXTENSION Extension
  1276. );
  1277. BOOLEAN
  1278. ParIsNibbleSupported(
  1279. IN PPDO_EXTENSION Extension
  1280. );
  1281. NTSTATUS
  1282. ParEnterNibbleMode(
  1283. IN PPDO_EXTENSION Extension,
  1284. IN BOOLEAN DeviceIdRequest
  1285. );
  1286. NTSTATUS
  1287. ParEnterChannelizedNibbleMode(
  1288. IN PPDO_EXTENSION Extension,
  1289. IN BOOLEAN DeviceIdRequest
  1290. );
  1291. VOID
  1292. ParTerminateNibbleMode(
  1293. IN PPDO_EXTENSION Extension
  1294. );
  1295. NTSTATUS
  1296. ParNibbleModeRead(
  1297. IN PPDO_EXTENSION Extension,
  1298. IN PVOID Buffer,
  1299. IN ULONG BufferSize,
  1300. OUT PULONG BytesTransferred
  1301. );
  1302. //
  1303. // Byte.c
  1304. //
  1305. BOOLEAN
  1306. ParIsByteSupported(
  1307. IN PPDO_EXTENSION Extension
  1308. );
  1309. NTSTATUS
  1310. ParEnterByteMode(
  1311. IN PPDO_EXTENSION Extension,
  1312. IN BOOLEAN DeviceIdRequest
  1313. );
  1314. VOID
  1315. ParTerminateByteMode(
  1316. IN PPDO_EXTENSION Extension
  1317. );
  1318. NTSTATUS
  1319. ParByteModeRead(
  1320. IN PPDO_EXTENSION Extension,
  1321. IN PVOID Buffer,
  1322. IN ULONG BufferSize,
  1323. OUT PULONG BytesTransferred
  1324. );
  1325. //
  1326. // epp.c
  1327. //
  1328. NTSTATUS
  1329. ParEppSetAddress(
  1330. IN PPDO_EXTENSION Extension,
  1331. IN UCHAR Address
  1332. );
  1333. //
  1334. // hwepp.c
  1335. //
  1336. BOOLEAN
  1337. ParIsEppHwSupported(
  1338. IN PPDO_EXTENSION Extension
  1339. );
  1340. NTSTATUS
  1341. ParEnterEppHwMode(
  1342. IN PPDO_EXTENSION Extension,
  1343. IN BOOLEAN DeviceIdRequest
  1344. );
  1345. VOID
  1346. ParTerminateEppHwMode(
  1347. IN PPDO_EXTENSION Extension
  1348. );
  1349. NTSTATUS
  1350. ParEppHwWrite(
  1351. IN PPDO_EXTENSION Extension,
  1352. IN PVOID Buffer,
  1353. IN ULONG BufferSize,
  1354. OUT PULONG BytesTransferred
  1355. );
  1356. NTSTATUS
  1357. ParEppHwRead(
  1358. IN PPDO_EXTENSION Extension,
  1359. IN PVOID Buffer,
  1360. IN ULONG BufferSize,
  1361. OUT PULONG BytesTransferred
  1362. );
  1363. //
  1364. // swepp.c
  1365. //
  1366. BOOLEAN
  1367. ParIsEppSwWriteSupported(
  1368. IN PPDO_EXTENSION Extension
  1369. );
  1370. BOOLEAN
  1371. ParIsEppSwReadSupported(
  1372. IN PPDO_EXTENSION Extension
  1373. );
  1374. NTSTATUS
  1375. ParEnterEppSwMode(
  1376. IN PPDO_EXTENSION Extension,
  1377. IN BOOLEAN DeviceIdRequest
  1378. );
  1379. VOID
  1380. ParTerminateEppSwMode(
  1381. IN PPDO_EXTENSION Extension
  1382. );
  1383. NTSTATUS
  1384. ParEppSwWrite(
  1385. IN PPDO_EXTENSION Extension,
  1386. IN PVOID Buffer,
  1387. IN ULONG BufferSize,
  1388. OUT PULONG BytesTransferred
  1389. );
  1390. NTSTATUS
  1391. ParEppSwRead(
  1392. IN PPDO_EXTENSION Extension,
  1393. IN PVOID Buffer,
  1394. IN ULONG BufferSize,
  1395. OUT PULONG BytesTransferred
  1396. );
  1397. //
  1398. // ecp.c and swecp.c
  1399. //
  1400. NTSTATUS
  1401. ParEcpEnterForwardPhase (
  1402. IN PPDO_EXTENSION Extension
  1403. );
  1404. BOOLEAN
  1405. ParEcpHaveReadData (
  1406. IN PPDO_EXTENSION Extension
  1407. );
  1408. BOOLEAN
  1409. ParIsEcpSwWriteSupported(
  1410. IN PPDO_EXTENSION Extension
  1411. );
  1412. BOOLEAN
  1413. ParIsEcpSwReadSupported(
  1414. IN PPDO_EXTENSION Extension
  1415. );
  1416. NTSTATUS
  1417. ParEnterEcpSwMode(
  1418. IN PPDO_EXTENSION Extension,
  1419. IN BOOLEAN DeviceIdRequest
  1420. );
  1421. VOID
  1422. ParCleanupSwEcpPort(
  1423. IN PPDO_EXTENSION Extension
  1424. );
  1425. VOID
  1426. ParTerminateEcpMode(
  1427. IN PPDO_EXTENSION Extension
  1428. );
  1429. NTSTATUS
  1430. ParEcpSetAddress(
  1431. IN PPDO_EXTENSION Extension,
  1432. IN UCHAR Address
  1433. );
  1434. NTSTATUS
  1435. ParEcpSwWrite(
  1436. IN PPDO_EXTENSION Extension,
  1437. IN PVOID Buffer,
  1438. IN ULONG BufferSize,
  1439. OUT PULONG BytesTransferred
  1440. );
  1441. NTSTATUS
  1442. ParEcpSwRead(
  1443. IN PPDO_EXTENSION Extension,
  1444. IN PVOID Buffer,
  1445. IN ULONG BufferSize,
  1446. OUT PULONG BytesTransferred
  1447. );
  1448. NTSTATUS
  1449. ParEcpForwardToReverse(
  1450. IN PPDO_EXTENSION Extension
  1451. );
  1452. NTSTATUS
  1453. ParEcpReverseToForward(
  1454. IN PPDO_EXTENSION Extension
  1455. );
  1456. //
  1457. // hwecp.c
  1458. //
  1459. BOOLEAN
  1460. PptEcpHwHaveReadData (
  1461. IN PPDO_EXTENSION Extension
  1462. );
  1463. NTSTATUS
  1464. ParEcpHwExitForwardPhase (
  1465. IN PPDO_EXTENSION Extension
  1466. );
  1467. NTSTATUS
  1468. PptEcpHwEnterReversePhase (
  1469. IN PPDO_EXTENSION Extension
  1470. );
  1471. NTSTATUS
  1472. ParEcpHwExitReversePhase (
  1473. IN PPDO_EXTENSION Extension
  1474. );
  1475. VOID
  1476. PptEcpHwDrainShadowBuffer(IN Queue *pShadowBuffer,
  1477. IN PUCHAR lpsBufPtr,
  1478. IN ULONG dCount,
  1479. OUT ULONG *fifoCount);
  1480. NTSTATUS
  1481. ParEcpHwRead(
  1482. IN PPDO_EXTENSION Extension,
  1483. IN PVOID Buffer,
  1484. IN ULONG BufferSize,
  1485. OUT PULONG BytesTransferred
  1486. );
  1487. NTSTATUS
  1488. ParEcpHwWrite(
  1489. IN PPDO_EXTENSION Extension,
  1490. IN PVOID Buffer,
  1491. IN ULONG BufferSize,
  1492. OUT PULONG BytesTransferred
  1493. );
  1494. NTSTATUS
  1495. ParEcpHwSetAddress(
  1496. IN PPDO_EXTENSION Extension,
  1497. IN UCHAR Address
  1498. );
  1499. NTSTATUS
  1500. ParEnterEcpHwMode(
  1501. IN PPDO_EXTENSION Extension,
  1502. IN BOOLEAN DeviceIdRequest
  1503. );
  1504. BOOLEAN
  1505. ParIsEcpHwSupported(
  1506. IN PPDO_EXTENSION Extension
  1507. );
  1508. NTSTATUS
  1509. ParEcpHwSetupPhase(
  1510. IN PPDO_EXTENSION Extension
  1511. );
  1512. VOID
  1513. ParTerminateHwEcpMode(
  1514. IN PPDO_EXTENSION Extension
  1515. );
  1516. //
  1517. // becp.c
  1518. //
  1519. NTSTATUS
  1520. PptBecpExitReversePhase(
  1521. IN PPDO_EXTENSION Extension
  1522. );
  1523. NTSTATUS
  1524. PptBecpRead(
  1525. IN PPDO_EXTENSION Extension,
  1526. IN PVOID Buffer,
  1527. IN ULONG BufferSize,
  1528. OUT PULONG BytesTransferred
  1529. );
  1530. NTSTATUS
  1531. PptEnterBecpMode(
  1532. IN PPDO_EXTENSION Extension,
  1533. IN BOOLEAN DeviceIdRequest
  1534. );
  1535. BOOLEAN
  1536. PptIsBecpSupported(
  1537. IN PPDO_EXTENSION Extension
  1538. );
  1539. VOID
  1540. PptTerminateBecpMode(
  1541. IN PPDO_EXTENSION Extension
  1542. );
  1543. //
  1544. // p12843dl.c
  1545. //
  1546. NTSTATUS
  1547. ParDot3Connect(
  1548. IN PPDO_EXTENSION Extension
  1549. );
  1550. VOID
  1551. ParDot3CreateObject(
  1552. IN PPDO_EXTENSION Extension,
  1553. IN PCHAR DOT3DL,
  1554. IN PCHAR DOT3C
  1555. );
  1556. VOID
  1557. ParDot4CreateObject(
  1558. IN PPDO_EXTENSION Extension,
  1559. IN PCHAR DOT4DL
  1560. );
  1561. VOID
  1562. ParDot3ParseModes(
  1563. IN PPDO_EXTENSION Extension,
  1564. IN PCHAR DOT3M
  1565. );
  1566. VOID
  1567. ParMLCCreateObject(
  1568. IN PPDO_EXTENSION Extension,
  1569. IN PCHAR CMDField
  1570. );
  1571. VOID
  1572. ParDot3DestroyObject(
  1573. IN PPDO_EXTENSION Extension
  1574. );
  1575. NTSTATUS
  1576. ParDot3Disconnect(
  1577. IN PPDO_EXTENSION Extension
  1578. );
  1579. NTSTATUS
  1580. ParDot3Read(
  1581. IN PPDO_EXTENSION Extension,
  1582. IN PVOID Buffer,
  1583. IN ULONG BufferSize,
  1584. OUT PULONG BytesTransferred
  1585. );
  1586. NTSTATUS
  1587. ParDot3Write(
  1588. IN PPDO_EXTENSION Extension,
  1589. IN PVOID Buffer,
  1590. IN ULONG BufferSize,
  1591. OUT PULONG BytesTransferred
  1592. );
  1593. NTSTATUS
  1594. ParMLCCompatReset(
  1595. IN PPDO_EXTENSION Extension
  1596. );
  1597. NTSTATUS
  1598. ParMLCECPReset(
  1599. IN PPDO_EXTENSION Extension
  1600. );
  1601. #if DBG
  1602. VOID
  1603. ParInitDebugLevel (
  1604. IN PUNICODE_STRING RegistryPath
  1605. );
  1606. #endif
  1607. // former parclass.h preceeds
  1608. #endif // _PARPORT_H_