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.

147 lines
4.6 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1991 - 1999
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. Author:
  7. Environment:
  8. kernel mode only
  9. Notes:
  10. Revision History:
  11. --*/
  12. VOID ClassDebugPrint(CLASS_DEBUG_LEVEL DebugPrintLevel, PCCHAR DebugMessage, ...);
  13. #if DBG
  14. typedef struct _CLASSPNP_GLOBALS {
  15. //
  16. // whether or not to ASSERT for lost irps
  17. //
  18. ULONG BreakOnLostIrps;
  19. ULONG SecondsToWaitForIrps;
  20. //
  21. // use a buffered debug print to help
  22. // catch timing issues that do not
  23. // reproduce with std debugprints enabled
  24. //
  25. ULONG UseBufferedDebugPrint;
  26. ULONG UseDelayedRetry;
  27. //
  28. // the next four are the buffered printing support
  29. // (currently unimplemented) and require the spinlock
  30. // to use
  31. //
  32. ULONG Index; // index into buffer
  33. KSPIN_LOCK SpinLock;
  34. PUCHAR Buffer; // requires spinlock to access
  35. ULONG NumberOfBuffers; // number of buffers available
  36. SIZE_T EachBufferSize; // size of each buffer
  37. //
  38. // interlocked variables to initialize
  39. // this data only once
  40. //
  41. LONG Initializing;
  42. LONG Initialized;
  43. } CLASSPNP_GLOBALS, *PCLASSPNP_GLOBALS;
  44. #define DBGTRACE(dbgTraceLevel, args_in_parens) \
  45. if (ClassDebug & (1 << (dbgTraceLevel+15))){ \
  46. DbgPrint("CLASSPNP> *** TRACE *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
  47. DbgPrint(" > "); \
  48. DbgPrint args_in_parens; \
  49. DbgPrint("\n"); \
  50. if (DebugTrapOnWarn && (dbgTraceLevel == ClassDebugWarning)){ \
  51. DbgBreakPoint(); \
  52. } \
  53. }
  54. #define DBGWARN(args_in_parens) \
  55. { \
  56. DbgPrint("CLASSPNP> *** WARNING *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
  57. DbgPrint(" > "); \
  58. DbgPrint args_in_parens; \
  59. DbgPrint("\n"); \
  60. if (DebugTrapOnWarn){ \
  61. DbgBreakPoint(); \
  62. } \
  63. }
  64. #define DBGERR(args_in_parens) \
  65. { \
  66. DbgPrint("CLASSPNP> *** ERROR *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
  67. DbgPrint(" > "); \
  68. DbgPrint args_in_parens; \
  69. DbgPrint("\n"); \
  70. DbgBreakPoint(); \
  71. }
  72. #define DBGTRAP(args_in_parens) \
  73. { \
  74. DbgPrint("CLASSPNP> *** COVERAGE TRAP *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
  75. DbgPrint(" > "); \
  76. DbgPrint args_in_parens; \
  77. DbgPrint("\n"); \
  78. DbgBreakPoint(); \
  79. }
  80. #define DBGGETIOCTLSTR(_ioctl) DbgGetIoctlStr(_ioctl)
  81. #define DBGGETSCSIOPSTR(_pSrb) DbgGetScsiOpStr(_pSrb)
  82. #define DBGGETSENSECODESTR(_pSrb) DbgGetSenseCodeStr(_pSrb)
  83. #define DBGGETADSENSECODESTR(_pSrb) DbgGetAdditionalSenseCodeStr(_pSrb)
  84. #define DBGGETADSENSEQUALIFIERSTR(_pSrb) DbgGetAdditionalSenseCodeQualifierStr(_pSrb)
  85. #define DBGCHECKRETURNEDPKT(_pkt) DbgCheckReturnedPkt(_pkt)
  86. #define DBGGETSRBSTATUSSTR(_pSrb) DbgGetSrbStatusStr(_pSrb)
  87. VOID ClasspInitializeDebugGlobals();
  88. char *DbgGetIoctlStr(ULONG ioctl);
  89. char *DbgGetScsiOpStr(PSCSI_REQUEST_BLOCK Srb);
  90. char *DbgGetSenseCodeStr(PSCSI_REQUEST_BLOCK Srb);
  91. char *DbgGetAdditionalSenseCodeStr(PSCSI_REQUEST_BLOCK Srb);
  92. char *DbgGetAdditionalSenseCodeQualifierStr(PSCSI_REQUEST_BLOCK Srb);
  93. VOID DbgCheckReturnedPkt(TRANSFER_PACKET *Pkt);
  94. char *DbgGetSrbStatusStr(PSCSI_REQUEST_BLOCK Srb);
  95. extern CLASSPNP_GLOBALS ClasspnpGlobals;
  96. extern LONG ClassDebug;
  97. extern BOOLEAN DebugTrapOnWarn;
  98. #else
  99. #define ClasspInitializeDebugGlobals()
  100. #define DBGWARN(args_in_parens)
  101. #define DBGERR(args_in_parens)
  102. #define DBGTRACE(dbgTraceLevel, args_in_parens)
  103. #define DBGTRAP(args_in_parens)
  104. #define DBGGETIOCTLSTR(_ioctl)
  105. #define DBGGETSCSIOPSTR(_pSrb)
  106. #define DBGGETSENSECODESTR(_pSrb)
  107. #define DBGGETADSENSECODESTR(_pSrb)
  108. #define DBGGETADSENSEQUALIFIERSTR(_pSrb)
  109. #define DBGCHECKRETURNEDPKT(_pkt)
  110. #define DBGGETSRBSTATUSSTR(_pSrb)
  111. #endif