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.

202 lines
4.7 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. dbg.h
  5. Abstract:
  6. debug macros.
  7. Environment:
  8. Kernel & user mode
  9. Revision History:
  10. 6-6-97 : created jdunn
  11. --*/
  12. //
  13. // masks fo rdebug trace level
  14. //
  15. #define OHCI_DBG_STARTUP_SHUTDOWN_MASK 0x0000000F
  16. #define OHCI_DBG_SS_NOISE 0x00000001
  17. #define OHCI_DBG_SS_TRACE 0x00000002
  18. #define OHCI_DBG_SS_INFO 0x00000004
  19. #define OHCI_DBG_SS_ERROR 0x00000008
  20. #define OHCI_DBG_CALL_MASK 0x000000F0
  21. #define OHCI_DBG_CALL_NOISE 0x00000010
  22. #define OHCI_DBG_CALL_TRACE 0x00000020
  23. #define OHCI_DBG_CALL_INFO 0x00000040
  24. #define OHCI_DBG_CALL_ERROR 0x00000080
  25. #define OHCI_DBG_ENDPOINT_MASK 0x00000F00
  26. #define OHCI_DBG_END_NOISE 0x00000100
  27. #define OHCI_DBG_END_TRACE 0x00000200
  28. #define OHCI_DBG_END_INFO 0x00000400
  29. #define OHCI_DBG_END_ERROR 0x00000800
  30. #define OHCI_DBG_TRANSFER_DESC_MASK 0x0000F000
  31. #define OHCI_DBG_TD_NOISE 0x00001000
  32. #define OHCI_DBG_TD_TRACE 0x00002000
  33. #define OHCI_DBG_TD_INFO 0x00004000
  34. #define OHCI_DBG_TD_ERROR 0x00008000
  35. #define OHCI_DBG_ISR_MASK 0x000F0000
  36. #define OHCI_DBG_ISR_NOISE 0x00010000
  37. #define OHCI_DBG_ISR_TRACE 0x00020000
  38. #define OHCI_DBG_ISR_INFO 0x00040000
  39. #define OHCI_DBG_ISR_ERROR 0x00080000
  40. #define OHCI_DBG_ROOT_HUB_MASK 0x00F00000
  41. #define OHCI_DBG_RH_NOISE 0x00100000
  42. #define OHCI_DBG_RH_TRACE 0x00200000
  43. #define OHCI_DBG_RH_INFO 0x00400000
  44. #define OHCI_DBG_RH_ERROR 0x00800000
  45. #define OHCI_DBG_PNP_MASK 0x0F000000
  46. #define OHCI_DBG_PNP_NOISE 0x01000000
  47. #define OHCI_DBG_PNP_TRACE 0x02000000
  48. #define OHCI_DBG_PNP_INFO 0x04000000
  49. #define OHCI_DBG_PNP_ERROR 0x08000000
  50. #define OHCI_DBG_CANCEL_MASK 0xF0000000
  51. #define OHCI_DBG_CANCEL_NOISE 0x10000000
  52. #define OHCI_DBG_CANCEL_TRACE 0x20000000
  53. #define OHCI_DBG_CANCEL_INFO 0x40000000
  54. #define OHCI_DBG_CANCEL_ERROR 0x80000000
  55. #define SIG_EP 0x70655045 //'EPep' signature for endpoint
  56. //
  57. // debug log masks
  58. #define M 0x00000001
  59. #define G 0x00000002
  60. #ifdef _WIN64
  61. #define TD_NOREQUEST_SIG ((PVOID) 0xDEADFACEDEADFACE)
  62. #define MAGIC_SIG ((PVOID) 0x4d4147694d414769)
  63. #else
  64. #define TD_NOREQUEST_SIG ((PVOID) 0xDEADFACE)
  65. #define MAGIC_SIG ((PVOID) 0x4d414769)
  66. #endif
  67. #if DBG
  68. // Assert Macros
  69. //
  70. // We define our own assert function because ntkern will
  71. // not stop in the debugger on assert failures in our own
  72. // code.
  73. //
  74. VOID
  75. OHCI_LogIrp(
  76. PIRP Irp,
  77. ULONG Add
  78. );
  79. VOID
  80. OpenHCI_Assert(
  81. PVOID FailedAssertion,
  82. PVOID FileName,
  83. ULONG LineNumber,
  84. PCHAR Message
  85. );
  86. ULONG
  87. _cdecl
  88. OHCI_KdPrint2(
  89. PCH Format,
  90. ...
  91. );
  92. ULONG
  93. _cdecl
  94. OHCI_KdPrintX(
  95. ULONG l,
  96. PCH Format,
  97. ...
  98. );
  99. #define OHCI_ASSERT( exp ) \
  100. if (!(exp)) {\
  101. OpenHCI_Assert( #exp, __FILE__, __LINE__, NULL );\
  102. }
  103. #define OHCI_ASSERTMSG( msg, exp ) \
  104. if (!(exp)) {\
  105. OpenHCI_Assert( #exp, __FILE__, __LINE__, msg );\
  106. }
  107. extern ULONG OHCI_Debug_Trace_Level;
  108. #define OpenHCI_KdPrintDD(_d_, _l_, _x_) \
  109. if (((_d_)->DebugLevel & (_l_)) || \
  110. OHCI_Debug_Trace_Level > 0) { \
  111. OHCI_KdPrint2 _x_;\
  112. }
  113. #define OpenHCI_KdPrint(_x_) OHCI_KdPrintX _x_
  114. #ifdef NTKERN
  115. #define TRAP() _asm {int 3}
  116. #else
  117. #define TRAP() DbgBreakPoint()
  118. #endif //NTKERN
  119. #define TEST_TRAP() { \
  120. DbgPrint ("'OpenHCI.SYS: Code Coverage %s, %d\n", __FILE__, __LINE__);\
  121. TRAP(); \
  122. }
  123. #define OpenHCI_KdTrap(_x_) \
  124. { \
  125. DbgPrint("OpenHCI.SYS: "); \
  126. DbgPrint _x_; \
  127. TRAP(); \
  128. }
  129. #define DEBUG_LOG
  130. //#define IRP_LOG
  131. #ifdef MAX_DEBUG
  132. #define OpenHCI_KdBreak(_x_) \
  133. { \
  134. DbgPrint ("'OpenHCI.SYS: "); \
  135. DbgPrint _x_; \
  136. TRAP();\
  137. }
  138. #else
  139. #define OpenHCI_KdBreak(_x_) \
  140. { \
  141. DbgPrint ("'OpenHCI.SYS: "); \
  142. DbgPrint _x_; \
  143. }
  144. #endif //MAX_DEBUG
  145. #define ASSERT_ENDPOINT(ep) OHCI_ASSERT((ep)->Sig == SIG_EP)
  146. #else // not DBG
  147. #define OpenHCI_KdPrintDD(_d_, _l_, _x_)
  148. #define OpenHCI_KdPrint(_x_)
  149. #define OpenHCI_KdTrap(_x_)
  150. #define TRAP()
  151. #define TEST_TRAP()
  152. #define OpenHCI_KdBreak(_x_)
  153. #define OHCI_ASSERT(exp)
  154. #define ASSERT_ENDPOINT(ep)
  155. #endif