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.

136 lines
3.4 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 _SPSIM_STRING_MAP {
  15. ULONG Id;
  16. PCHAR String;
  17. } SPSIM_STRING_MAP, *PSPSIM_STRING_MAP;
  18. //
  19. // Debug globals
  20. //
  21. extern LONG SpSimDebug;
  22. extern SPSIM_STRING_MAP SpSimDbgPnpIrpStringMap[];
  23. extern SPSIM_STRING_MAP SpSimDbgPoIrpStringMap[];
  24. extern SPSIM_STRING_MAP SpSimDbgDeviceRelationStringMap[];
  25. extern SPSIM_STRING_MAP SpSimDbgSystemPowerStringMap[];
  26. extern SPSIM_STRING_MAP SpSimDbgDevicePowerStringMap[];
  27. extern PSPSIM_STRING_MAP SpSimDbgStatusStringMap;
  28. //
  29. // Debug prototypes
  30. //
  31. VOID
  32. SpSimDbgInitialize(
  33. VOID
  34. );
  35. VOID
  36. SpSimDbgPrintMultiSz(
  37. LONG DebugLevel,
  38. PWSTR MultiSz
  39. );
  40. PCHAR
  41. SpSimDbgLookupString(
  42. IN PSPSIM_STRING_MAP Map,
  43. IN ULONG Id
  44. );
  45. VOID
  46. SpSimDbgPrintCmResList(
  47. IN LONG Level,
  48. IN PCM_RESOURCE_LIST ResourceList
  49. );
  50. VOID
  51. SpSimDbgPrintIoResReqList(
  52. IN LONG Level,
  53. IN PIO_RESOURCE_REQUIREMENTS_LIST IoResReqList
  54. );
  55. PUCHAR
  56. SpSimDbgCmResourceTypeToText(
  57. UCHAR Type
  58. );
  59. //
  60. // Debug macros
  61. //
  62. #define DEBUG_PRINT(Level, Msg) \
  63. if (Level <= SpSimDebug) DbgPrint Msg
  64. #define DEBUG_MSG(Level, Msg) \
  65. if (Level <= SpSimDebug) { DbgPrint("SpSim: "); DbgPrint Msg; }
  66. #define ASSERT_SPSIM_DEVICE(DeviceObject) \
  67. ASSERT(((PSPSIM_COMMON_EXTENSION)DeviceObject->DeviceExtension)->Type \
  68. == SpSimFunctionalDeviceObject \
  69. || \
  70. ((PSPSIM_COMMON_EXTENSION)DeviceObject->DeviceExtension)->Type \
  71. == SpSimPhysicalDeviceObject)
  72. #define STATUS_STRING(_Status) \
  73. (_Status) == STATUS_SUCCESS ? \
  74. "STATUS_SUCCESS" : SpSimDbgLookupString(SpSimDbgStatusStringMap, (_Status))
  75. #define PNP_IRP_STRING(_Irp) \
  76. SpSimDbgLookupString(SpSimDbgPnpIrpStringMap, (_Irp))
  77. #define PO_IRP_STRING(_Irp) \
  78. SpSimDbgLookupString(SpSimDbgPoIrpStringMap, (_Irp))
  79. #define RELATION_STRING(_Relation) \
  80. SpSimDbgLookupString(SpSimDbgDeviceRelationStringMap, (_Relation))
  81. #define SYSTEM_POWER_STRING(_State) \
  82. SpSimDbgLookupString(SpSimDbgSystemPowerStringMap, (_State))
  83. #define DEVICE_POWER_STRING(_State) \
  84. SpSimDbgLookupString(SpSimDbgDevicePowerStringMap, (_State))
  85. #else
  86. #define DEBUG_PRINT(Level, Msg)
  87. #define DEBUG_MSG(Level, Msg)
  88. #define ASSERT_SPSIM_DEVICE(DeviceObject)
  89. #define STATUS_STRING(_Status) ""
  90. #define PNP_IRP_STRING(_Irp) ""
  91. #define PO_IRP_STRING(_Irp) ""
  92. #define RELATION_STRING(_Relation) ""
  93. #define SYSTEM_POWER_STRING(_State) ""
  94. #define DEVICE_POWER_STRING(_State) ""
  95. #endif // DBG
  96. #endif