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.

113 lines
4.6 KiB

  1. /*
  2. *************************************************************************
  3. * File: DEBUG.H
  4. *
  5. * Module: USBCCGP.SYS
  6. * USB Common Class Generic Parent driver.
  7. *
  8. * Copyright (c) 1998 Microsoft Corporation
  9. *
  10. *
  11. * Author: ervinp
  12. *
  13. *************************************************************************
  14. */
  15. #ifdef _WIN64
  16. #define BAD_POINTER ((PVOID)0xFFFFFFFFFFFFFF00)
  17. #else
  18. #define BAD_POINTER ((PVOID)0xFFFFFF00)
  19. #endif
  20. #define ISPTR(ptr) ((ptr) && ((ptr) != BAD_POINTER))
  21. #if DBG
  22. #if WIN95_BUILD
  23. #define DBG_LEADCHAR ' '
  24. #else
  25. #define DBG_LEADCHAR '\'' // required for kd debugger routing on NT
  26. #endif
  27. extern BOOLEAN dbgTrapOnWarn;
  28. extern BOOLEAN dbgVerbose;
  29. extern BOOLEAN dbgShowIsochProgress;
  30. #define TRAP(msg) \
  31. { \
  32. DbgPrint("%cUSBCCGP> Code coverage trap: '%s' file %s, line %d \n", DBG_LEADCHAR, (msg), __FILE__, __LINE__ ); \
  33. DbgBreakPoint(); \
  34. }
  35. #undef ASSERT
  36. #define ASSERT(fact) \
  37. if (!(fact)){ \
  38. DbgPrint("%cUSBCCGP> Assertion '%s' failed: file %s, line %d \n", DBG_LEADCHAR, #fact, __FILE__, __LINE__ ); \
  39. DbgBreakPoint(); \
  40. }
  41. #define DBGWARN(args_in_parens) \
  42. { \
  43. DbgPrint("%cUSBCCGP> *** WARNING *** (file %s, line %d)\n", DBG_LEADCHAR, __FILE__, __LINE__ ); \
  44. DbgPrint("%c > ", DBG_LEADCHAR); \
  45. DbgPrint args_in_parens; \
  46. DbgPrint("\n"); \
  47. if (dbgTrapOnWarn){ \
  48. DbgBreakPoint(); \
  49. } \
  50. }
  51. #define DBGERR(args_in_parens) \
  52. { \
  53. DbgPrint("%cUSBCCGP> *** ERROR *** (file %s, line %d)\n", DBG_LEADCHAR, __FILE__, __LINE__ ); \
  54. DbgPrint("%c > ", DBG_LEADCHAR); \
  55. DbgPrint args_in_parens; \
  56. DbgPrint("\n"); \
  57. DbgBreakPoint(); \
  58. }
  59. #define DBGOUT(args_in_parens) \
  60. { \
  61. DbgPrint("%cUSBCCGP> ", DBG_LEADCHAR); \
  62. DbgPrint args_in_parens; \
  63. DbgPrint("\n"); \
  64. }
  65. #define DBGVERBOSE(args_in_parens) \
  66. if (dbgVerbose){ \
  67. DbgPrint("%cUSBCCGP> ", DBG_LEADCHAR); \
  68. DbgPrint args_in_parens; \
  69. DbgPrint("\n"); \
  70. }
  71. VOID DbgLogIrpMajor(ULONG_PTR irpPtr, ULONG majorFunc, ULONG isForParentFdo, ULONG isComplete, ULONG status);
  72. VOID DbgLogPnpIrp(ULONG_PTR irpPtr, ULONG minorFunc, ULONG isForParentFdo, ULONG isComplete, ULONG status);
  73. VOID DbgLogIoctl(ULONG ioControlCode, ULONG status);
  74. VOID DbgLogUrb(PURB urb);
  75. VOID DbgDumpBytes(PUCHAR msg, PVOID bufPtr, ULONG dataLen);
  76. PUCHAR DbgGetUrbName(ULONG urbFunc);
  77. VOID DbgShowIsochProgress();
  78. #define DBG_LOG_IRP_MAJOR(irp, majorFunc, isForParentFdo, isComplete, status) \
  79. DbgLogIrpMajor((ULONG_PTR)(irp), (ULONG)(majorFunc), (ULONG)(isForParentFdo), (ULONG)(isComplete), (ULONG)(status));
  80. #define DBG_LOG_PNP_IRP(irp, minorFunc, isForParentFdo, isComplete, status) \
  81. DbgLogPnpIrp((ULONG_PTR)(irp), (ULONG)(minorFunc), (ULONG)(isForParentFdo), (ULONG)(isComplete), (ULONG)(status));
  82. #define DBG_LOG_IOCTL(ioControlCode, status) \
  83. DbgLogIoctl(ioControlCode, status)
  84. #define DBG_LOG_URB(urb) DbgLogUrb(urb)
  85. #define DBGDUMPBYTES(msg, data, dataLen) DbgDumpBytes(msg, data, dataLen)
  86. #define DBGSHOWISOCHPROGRESS() DbgShowIsochProgress()
  87. #else
  88. #define DBGWARN(args_in_parens)
  89. #define DBGERR(args_in_parens)
  90. #define DBGOUT(args_in_parens)
  91. #define DBGVERBOSE(args_in_parens)
  92. #define TRAP(msg)
  93. #define DBG_LOG_IRP_MAJOR(irp, majorFunc, isForParentFdo, isComplete, status)
  94. #define DBG_LOG_PNP_IRP(irp, minorFunc, isForParentFdo, isComplete, status)
  95. #define DBG_LOG_IOCTL(ioControlCode, status)
  96. #define DBG_LOG_URB(urb)
  97. #define DBGDUMPBYTES(msg, data, dataLen)
  98. #define DBGSHOWISOCHPROGRESS()
  99. #endif