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.

173 lines
5.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 2000
  6. //
  7. // File: debug.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _DEBUG_H_
  11. #define _DEBUG_H_
  12. //
  13. // Debug Defines and Macros
  14. //
  15. extern ULONG d1;
  16. extern ULONG d2;
  17. extern ULONG d3;
  18. extern ULONG d4;
  19. extern ULONG d5;
  20. extern ULONG d6;
  21. extern ULONG d7;
  22. extern ULONG d8;
  23. extern ULONG d9;
  24. extern ULONG Trace;
  25. extern ULONG Break;
  26. extern ULONG AllowAsserts;
  27. //
  28. // set bits using DD_* bit defs to mask off debug spew for a specific device
  29. //
  30. extern ULONG DbgMaskFdo;
  31. extern ULONG DbgMaskRawPort;
  32. extern ULONG DbgMaskDaisyChain0;
  33. extern ULONG DbgMaskDaisyChain1;
  34. extern ULONG DbgMaskEndOfChain;
  35. extern ULONG DbgMaskLegacyZip;
  36. extern ULONG DbgMaskNoDevice;
  37. #define PptAssert(_expr_) if( AllowAsserts ) ASSERT((_expr_))
  38. #define PptAssertMsg(_msg_,_expr_) if( AllowAsserts ) ASSERTMSG((_msg_),(_expr_))
  39. #define ASSERT_EVENT(E) { \
  40. ASSERT((E)->Header.Type == NotificationEvent || \
  41. (E)->Header.Type == SynchronizationEvent); \
  42. }
  43. //
  44. // Break bit definitions:
  45. //
  46. #define PPT_BREAK_ON_DRIVER_ENTRY 0x00000001
  47. #define PptBreakOnRequest( BREAK_CONDITION, STRING) \
  48. if( Break & (BREAK_CONDITION) ) { \
  49. DbgPrint STRING; \
  50. DbgBreakPoint(); \
  51. }
  52. // driver logic analyzer - show data bytes xfer'd in NIBBLE and/or BECP/HWECP modes
  53. // 1 == ON
  54. // 0 == OFF
  55. #define DBG_SHOW_BYTES 0
  56. #if 1 == DBG_SHOW_BYTES
  57. extern ULONG DbgShowBytes;
  58. #endif
  59. #if DBG
  60. #define PptEnableDebugSpew 1
  61. #else
  62. #define PptEnableDebugSpew 0
  63. #endif
  64. #if 1 == PptEnableDebugSpew
  65. #define DD PptPrint
  66. #else
  67. #define DD
  68. #define P5ReadPortUchar( _PORT_ ) READ_PORT_UCHAR( (_PORT_) )
  69. #define P5ReadPortBufferUchar( _PORT_, _BUFFER_, _COUNT_ ) READ_PORT_BUFFER_UCHAR( (_PORT_), (_BUFFER_), (_COUNT_) )
  70. #define P5WritePortUchar( _PORT_, _VALUE_ ) WRITE_PORT_UCHAR( (_PORT_), (_VALUE_) )
  71. #define P5WritePortBufferUchar( _PORT_, _BUFFER_, _COUNT_ ) WRITE_PORT_BUFFER_UCHAR( (_PORT_), (_BUFFER_), (_COUNT_) )
  72. #define PptFdoDumpPnpIrpInfo( _FDO_, _IRP_ )
  73. #define PptPdoDumpPnpIrpInfo( _PDO_, _IRP_ )
  74. #define P5TraceIrpArrival( _DEVOBJ_, _IRP_ )
  75. #define P5TraceIrpCompletion( _IRP_ )
  76. #define PptAcquireRemoveLock( _REMOVELOCK_, _TAG_ ) IoAcquireRemoveLock( (_REMOVELOCK_), (_TAG_) )
  77. #define PptReleaseRemoveLock( _REMOVELOCK_, _TAG_ ) IoReleaseRemoveLock( (_REMOVELOCK_), (_TAG_) )
  78. #define PptReleaseRemoveLockAndWait( _REMOVELOCK_, _TAG_ ) IoReleaseRemoveLockAndWait( (_REMOVELOCK_), (_TAG_) )
  79. #define P5SetPhase( _PDX_, _PHASE_ ) (_PDX_)->CurrentPhase = (_PHASE_)
  80. #define P5BSetPhase( _IEEESTATE_, _PHASE_ ) (_IEEESTATE_)->CurrentPhase = (_PHASE_)
  81. #endif
  82. VOID
  83. PptPrint( PCOMMON_EXTENSION Ext, ULONG Flags, PCHAR FmtStr, ... );
  84. //
  85. // Trace bit definitions:
  86. //
  87. #define DDE 0x00000001 // Error messages
  88. #define DDW 0x00000002 // Warning messages
  89. #define DDT 0x00000004 // program Trace messages
  90. #define DDINFO 0x00000008 // Informational messages
  91. #define DDP 0x00000010 // Pnp and Power messages
  92. #define DDC 0x00000020 // daisy Chain messages - select/deselect
  93. #define DDA 0x00000040 // port Arbitration messages - acquire/release of port
  94. #define DDR 0x00000080 // Registry access
  95. #define DD_SEL 0x01000000 // Acquire/Release port & DaisyChain Select/Deselect device
  96. #define DD_DL 0x02000000 // 1284.3 DataLink (for dot4)
  97. #define DDB 0x00000100 // show Bytes written to / read from i/o ports
  98. #define DD_IU 0x00000200 // Init(DriverEntry)/Unload
  99. #define DD_PNP1 0x00000400 // PnP on FDO
  100. #define DD_PNP2 0x00000800 // PnP on PDO
  101. #define DD_OC1 0x00001000 // Open/Close/Cleanup on FDO
  102. #define DD_OC2 0x00002000 // Open/Close/Cleanup on PDO
  103. #define DD_RW 0x00004000 // Read/Write
  104. #define DD_RWV 0x00008000 // Read/Write Verbose
  105. #define DD_IEEE 0x00010000 // IEEE negotiation/termination etc.
  106. #define DD_CHIP 0x00020000 // parallel port chip info
  107. #define DD_ERR 0x00040000 // Error detected
  108. #define DD_WRN 0x00080000 // Warning
  109. #define DD_CAN 0x00200000 // Cancel
  110. #define DD_SM 0x00400000 // IEEE state machine (state & phase)
  111. #define DD_EX 0x00800000 // Exported functions (to ppa/ppa3)
  112. #define DD_TMP1 0x10000000 // temp 1 - used for temporary debugging
  113. #define DD_TMP2 0x20000000 // temp 2 - used for temporary debugging
  114. #define DD_VERB 0x80000000 // Verbose
  115. #define DDPrint( _b_, _x_ ) if( (_b_) & Trace ) DbgPrint _x_
  116. //
  117. // Specific Diagnostics
  118. //
  119. //
  120. // DVRH_SHOW_BYTE_LOG 0 - Byte Log off
  121. // 1 - Byte Log on
  122. #define DVRH_SHOW_BYTE_LOG 0
  123. //
  124. // DVRH_PAR_LOGFILE is used to allow for debug logging to a file
  125. // This functionality is for debugging purposes only.
  126. // 0 - off
  127. // 1 - on
  128. #define DVRH_PAR_LOGFILE 0
  129. //
  130. // DVRH_BUS_RESET_ON_ERROR
  131. // This functionality is for debugging purposes only.
  132. // Holds a bus reset for 100us when a handshaking error
  133. // is discovered. This is useful for triggering the
  134. // logic analyzer
  135. // 0 - off
  136. // 1 - on
  137. #define DVRH_BUS_RESET_ON_ERROR 0
  138. #if (1 == DVRH_PAR_LOGFILE)
  139. #define DEFAULT_LOG_FILE_NAME L"\\??\\C:\\tmp\\parport.log"
  140. #define DbgPrint DVRH_LogMessage
  141. BOOLEAN DVRH_LogMessage(PCHAR szFormat, ...);
  142. #endif
  143. #endif // _DEBUG_H_