Leaked source code of windows server 2003
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.

233 lines
4.6 KiB

  1. /*++
  2. Copyright (c) 1996-1998 Microsoft Corporation
  3. Module Name:
  4. DBG.H
  5. Abstract:
  6. Header file for I82930 driver debug utility functions
  7. Environment:
  8. kernel mode
  9. Revision History:
  10. 06-01-98 : started rewrite
  11. --*/
  12. //*****************************************************************************
  13. // D E F I N E S
  14. //*****************************************************************************
  15. #if DBG
  16. #if defined(DEBUG_LOG)
  17. #undef DEBUG_LOG
  18. #endif
  19. #define DEBUG_LOG 1
  20. #else
  21. #if !defined(DEBUG_LOG)
  22. #define DEBUG_LOG 0
  23. #endif
  24. #endif
  25. #if !DBG
  26. #define DBGFBRK(flag)
  27. #define DBGPRINT(level, _x_)
  28. #else
  29. #define DBGF_BRK_DRIVERENTRY 0x00000001
  30. #define DBGF_BRK_UNLOAD 0x00000002
  31. #define DBGF_BRK_ADDDEVICE 0x00000004
  32. #define DBGF_BRK_REMOVEDEVICE 0x00000008
  33. #define DBGF_BRK_STARTDEVICE 0x00000010
  34. #define DBGF_BRK_STOPDEVICE 0x00000020
  35. #define DBGF_BRK_QUERYSTOPDEVICE 0x00000040
  36. #define DBGF_BRK_CANCELSTOPDEVICE 0x00000080
  37. #define DBGF_BRK_CREATE 0x00010000
  38. #define DBGF_BRK_CLOSE 0x00020000
  39. #define DBGF_BRK_READWRITE 0x00040000
  40. #define DBGF_BRK_IOCTL 0x00080000
  41. #define DBGFBRK(flag) do { \
  42. if (I82930_DriverGlobals.DebugFlags & flag) { \
  43. DbgBreakPoint(); \
  44. } \
  45. } while (0)
  46. #define DBGPRINT(level, _x_) do { \
  47. if (level <= I82930_DriverGlobals.DebugLevel) { \
  48. KdPrint(("I82930: ")); \
  49. KdPrint( _x_ ); \
  50. } \
  51. } while (0)
  52. #endif
  53. #if !DEBUG_LOG
  54. #define LOGINIT()
  55. #define LOGUNINIT()
  56. #define LOGENTRY(tag, info1, info2, info3)
  57. #else
  58. #define LOGSIZE 4096
  59. #define LOGINIT() I82930_LogInit()
  60. #define LOGUNINIT() I82930_LogUnInit()
  61. #define LOGENTRY(tag, info1, info2, info3) \
  62. I82930_LogEntry(((((tag) >> 24) & 0x000000FF) | \
  63. (((tag) >> 8) & 0x0000FF00) | \
  64. (((tag) << 8) & 0x00FF0000) | \
  65. (((tag) << 24) & 0xFF000000)), \
  66. ((ULONG_PTR)info1), \
  67. ((ULONG_PTR)info2), \
  68. ((ULONG_PTR)info3))
  69. #endif
  70. //*****************************************************************************
  71. // T Y P E D E F S
  72. //*****************************************************************************
  73. #if DEBUG_LOG
  74. typedef struct _I82930_LOG_ENTRY {
  75. ULONG le_tag;
  76. ULONG_PTR le_info1;
  77. ULONG_PTR le_info2;
  78. ULONG_PTR le_info3;
  79. } I82930_LOG_ENTRY, *PI82930_LOG_ENTRY;
  80. #endif
  81. #if DBG || DEBUG_LOG
  82. typedef struct _DRIVERGLOBALS
  83. {
  84. #if DBG
  85. ULONG DebugFlags; // DBGF_* Flags
  86. LONG DebugLevel; // Level of debug output
  87. #endif
  88. PI82930_LOG_ENTRY LogStart; // Start of log buffer (older entries)
  89. PI82930_LOG_ENTRY LogPtr; // Current entry in log buffer
  90. PI82930_LOG_ENTRY LogEnd; // End of log buffer (newer entries)
  91. KSPIN_LOCK LogSpinLock; // Protects LogPtr
  92. } DRIVERGLOBALS;
  93. #endif
  94. //*****************************************************************************
  95. //
  96. // G L O B A L S
  97. //
  98. //*****************************************************************************
  99. //
  100. // DBG.C
  101. //
  102. #if DBG || DEBUG_LOG
  103. DRIVERGLOBALS I82930_DriverGlobals;
  104. #endif
  105. //*****************************************************************************
  106. //
  107. // F U N C T I O N P R O T O T Y P E S
  108. //
  109. //*****************************************************************************
  110. //
  111. // DBG.C
  112. //
  113. #if DBG
  114. VOID
  115. I82930_QueryGlobalParams (
  116. );
  117. #endif
  118. #if DEBUG_LOG
  119. VOID
  120. I82930_LogInit (
  121. );
  122. VOID
  123. I82930_LogUnInit (
  124. );
  125. VOID
  126. I82930_LogEntry (
  127. IN ULONG Tag,
  128. IN ULONG_PTR Info1,
  129. IN ULONG_PTR Info2,
  130. IN ULONG_PTR Info3
  131. );
  132. #endif
  133. #if DBG
  134. PCHAR
  135. PnPMinorFunctionString (
  136. UCHAR MinorFunction
  137. );
  138. PCHAR
  139. PowerMinorFunctionString (
  140. UCHAR MinorFunction
  141. );
  142. PCHAR
  143. PowerDeviceStateString (
  144. DEVICE_POWER_STATE State
  145. );
  146. PCHAR
  147. PowerSystemStateString (
  148. SYSTEM_POWER_STATE State
  149. );
  150. VOID
  151. DumpDeviceDesc (
  152. PUSB_DEVICE_DESCRIPTOR DeviceDesc
  153. );
  154. VOID
  155. DumpConfigDesc (
  156. PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc
  157. );
  158. VOID
  159. DumpConfigurationDescriptor (
  160. PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc
  161. );
  162. VOID
  163. DumpInterfaceDescriptor (
  164. PUSB_INTERFACE_DESCRIPTOR InterfaceDesc
  165. );
  166. VOID
  167. DumpEndpointDescriptor (
  168. PUSB_ENDPOINT_DESCRIPTOR EndpointDesc
  169. );
  170. #endif