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.

101 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. debug.h
  5. Abstract: ESC/POS (serial) interface for USB Point-of-Sale devices
  6. Author:
  7. ervinp
  8. Environment:
  9. Kernel mode
  10. Revision History:
  11. --*/
  12. #define BAD_POINTER ((PVOID)0xDEADDEAD)
  13. #define ISPTR(ptr) ((ptr) && ((ptr) != BAD_POINTER))
  14. #if DBG
  15. extern BOOLEAN dbgTrapOnWarn;
  16. extern BOOLEAN dbgVerbose;
  17. extern BOOLEAN dbgSkipSecurity;
  18. #define DBG_LEADCHAR (UCHAR)((isWin9x) ? ' ' : '\'' )
  19. #define TRAP(msg) \
  20. { \
  21. DbgPrint("%cPOSUSB> Code coverage trap: '%s' file %s, line %d \n", DBG_LEADCHAR, (msg), __FILE__, __LINE__ ); \
  22. DbgBreakPoint(); \
  23. }
  24. #undef ASSERT
  25. #define ASSERT(fact) \
  26. if (!(fact)){ \
  27. DbgPrint("%cPOSUSB> Assertion '%s' failed: file %s, line %d \n", DBG_LEADCHAR, #fact, __FILE__, __LINE__ ); \
  28. DbgBreakPoint(); \
  29. }
  30. #define DBGWARN(args_in_parens) \
  31. { \
  32. DbgPrint("%cPOSUSB> *** WARNING *** (file %s, line %d)\n", DBG_LEADCHAR, __FILE__, __LINE__ ); \
  33. DbgPrint("%c > ", DBG_LEADCHAR); \
  34. DbgPrint args_in_parens; \
  35. DbgPrint("\n"); \
  36. if (dbgTrapOnWarn){ \
  37. DbgBreakPoint(); \
  38. } \
  39. }
  40. #define DBGERR(args_in_parens) \
  41. { \
  42. DbgPrint("%cPOSUSB> *** ERROR *** (file %s, line %d)\n", DBG_LEADCHAR, __FILE__, __LINE__ ); \
  43. DbgPrint("%c > ", DBG_LEADCHAR); \
  44. DbgPrint args_in_parens; \
  45. DbgPrint("\n"); \
  46. DbgBreakPoint(); \
  47. }
  48. #define DBGOUT(args_in_parens) \
  49. { \
  50. DbgPrint("%cPOSUSB> ", DBG_LEADCHAR); \
  51. DbgPrint args_in_parens; \
  52. DbgPrint("\n"); \
  53. }
  54. #define DBGVERBOSE(args_in_parens) \
  55. if (dbgVerbose){ \
  56. DbgPrint("%cPOSUSB> ", DBG_LEADCHAR); \
  57. DbgPrint args_in_parens; \
  58. DbgPrint("\n"); \
  59. }
  60. VOID DbgLogIrpMajor(ULONG irpPtr, ULONG majorFunc, ULONG isPdo, ULONG isComplete, ULONG status);
  61. VOID DbgLogPnpIrp(ULONG irpPtr, ULONG minorFunc, ULONG isPdo, ULONG isComplete, ULONG status);
  62. VOID DbgShowBytes(PUCHAR msg, PUCHAR buf, ULONG len);
  63. #define DBG_LOG_IRP_MAJOR(irp, majorFunc, isPdo, isComplete, status) \
  64. DbgLogIrpMajor((ULONG)(irp), (ULONG)(majorFunc), (ULONG)isPdo, (ULONG)(isComplete), (ULONG)(status));
  65. #define DBG_LOG_PNP_IRP(irp, minorFunc, isPdo, isComplete, status) \
  66. DbgLogPnpIrp((ULONG)(irp), (ULONG)(minorFunc), (ULONG)isPdo, (ULONG)(isComplete), (ULONG)(status));
  67. #define DBGSHOWBYTES(msg, buf, len) DbgShowBytes(msg, buf, len)
  68. #else
  69. #define DBGWARN(args_in_parens)
  70. #define DBGERR(args_in_parens)
  71. #define DBGOUT(args_in_parens)
  72. #define DBGVERBOSE(args_in_parens)
  73. #define TRAP(msg)
  74. #define DBG_LOG_IRP_MAJOR(irp, majorFunc, isPdo, isComplete, status)
  75. #define DBG_LOG_PNP_IRP(irp, minorFunc, isPdo, isComplete, status)
  76. #define DBGSHOWBYTES(msg, buf, len)
  77. #endif