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.

148 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. This header provides debugging support prototypes and macros
  7. Author:
  8. Andy Thornton (andrewth) 20-Oct-97
  9. Revision History:
  10. --*/
  11. #if !defined(_DEBUG_)
  12. #define DEBUG
  13. #if DBG
  14. typedef struct _MF_STRING_MAP {
  15. ULONG Id;
  16. PCHAR String;
  17. } MF_STRING_MAP, *PMF_STRING_MAP;
  18. //
  19. // Debug globals
  20. //
  21. extern LONG MfDebug;
  22. extern MF_STRING_MAP MfDbgPnpIrpStringMap[];
  23. extern MF_STRING_MAP MfDbgPoIrpStringMap[];
  24. extern MF_STRING_MAP MfDbgDeviceRelationStringMap[];
  25. extern MF_STRING_MAP MfDbgSystemPowerStringMap[];
  26. extern MF_STRING_MAP MfDbgDevicePowerStringMap[];
  27. extern PMF_STRING_MAP MfDbgStatusStringMap;
  28. //
  29. // Debug prototypes
  30. //
  31. VOID
  32. MfDbgInitialize(
  33. VOID
  34. );
  35. VOID
  36. MfDbgPrintMultiSz(
  37. LONG DebugLevel,
  38. PWSTR MultiSz
  39. );
  40. PCHAR
  41. MfDbgLookupString(
  42. IN PMF_STRING_MAP Map,
  43. IN ULONG Id
  44. );
  45. VOID
  46. MfDbgPrintResourceMap(
  47. LONG DebugLevel,
  48. PMF_RESOURCE_MAP Map
  49. );
  50. VOID
  51. MfDbgPrintVaryingResourceMap(
  52. LONG DebugLevel,
  53. PMF_VARYING_RESOURCE_MAP Map
  54. );
  55. VOID
  56. MfDbgPrintCmResList(
  57. IN LONG Level,
  58. IN PCM_RESOURCE_LIST ResourceList
  59. );
  60. VOID
  61. MfDbgPrintIoResReqList(
  62. IN LONG Level,
  63. IN PIO_RESOURCE_REQUIREMENTS_LIST IoResReqList
  64. );
  65. PUCHAR
  66. MfDbgCmResourceTypeToText(
  67. UCHAR Type
  68. );
  69. //
  70. // Debug macros
  71. //
  72. #define DEBUG_PRINT(Level, Msg) \
  73. if (Level <= MfDebug) DbgPrint Msg
  74. #define DEBUG_MSG(Level, Msg) \
  75. if (Level <= MfDebug) { DbgPrint("Mf: "); DbgPrint Msg; }
  76. #define ASSERT_MF_DEVICE(DeviceObject) \
  77. ASSERT(((PMF_COMMON_EXTENSION)DeviceObject->DeviceExtension)->Type \
  78. == MfFunctionalDeviceObject \
  79. || \
  80. ((PMF_COMMON_EXTENSION)DeviceObject->DeviceExtension)->Type \
  81. == MfPhysicalDeviceObject)
  82. #define STATUS_STRING(_Status) \
  83. (_Status) == STATUS_SUCCESS ? \
  84. "STATUS_SUCCESS" : MfDbgLookupString(MfDbgStatusStringMap, (_Status))
  85. #define PNP_IRP_STRING(_Irp) \
  86. MfDbgLookupString(MfDbgPnpIrpStringMap, (_Irp))
  87. #define PO_IRP_STRING(_Irp) \
  88. MfDbgLookupString(MfDbgPoIrpStringMap, (_Irp))
  89. #define RELATION_STRING(_Relation) \
  90. MfDbgLookupString(MfDbgDeviceRelationStringMap, (_Relation))
  91. #define SYSTEM_POWER_STRING(_State) \
  92. MfDbgLookupString(MfDbgSystemPowerStringMap, (_State))
  93. #define DEVICE_POWER_STRING(_State) \
  94. MfDbgLookupString(MfDbgDevicePowerStringMap, (_State))
  95. #else
  96. #define DEBUG_PRINT(Level, Msg)
  97. #define DEBUG_MSG(Level, Msg)
  98. #define ASSERT_MF_DEVICE(DeviceObject)
  99. #define STATUS_STRING(_Status) ""
  100. #define PNP_IRP_STRING(_Irp) ""
  101. #define PO_IRP_STRING(_Irp) ""
  102. #define RELATION_STRING(_Relation) ""
  103. #define SYSTEM_POWER_STRING(_State) ""
  104. #define DEVICE_POWER_STRING(_State) ""
  105. #endif // DBG
  106. #endif