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.

180 lines
5.0 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. This header provides debugging support prototypes and macros
  7. Author:
  8. Neil Sandlin (neilsa) 10-Aug-98
  9. - code merged from mf.sys and pcmcia.sys
  10. Revision History:
  11. --*/
  12. #if !defined(_DEBUG_)
  13. #define DEBUG
  14. #if DBG
  15. typedef struct _PCMCIA_STRING_MAP {
  16. ULONG Id;
  17. PCHAR String;
  18. } PCMCIA_STRING_MAP, *PPCMCIA_STRING_MAP;
  19. //
  20. // Debug globals
  21. //
  22. extern ULONG PcmciaDebugMask;
  23. extern PCMCIA_STRING_MAP PcmciaDbgPnpIrpStringMap[];
  24. extern PCMCIA_STRING_MAP PcmciaDbgPoIrpStringMap[];
  25. extern PCMCIA_STRING_MAP PcmciaDbgDeviceRelationStringMap[];
  26. extern PCMCIA_STRING_MAP PcmciaDbgSystemPowerStringMap[];
  27. extern PCMCIA_STRING_MAP PcmciaDbgDevicePowerStringMap[];
  28. extern PPCMCIA_STRING_MAP PcmciaDbgStatusStringMap;
  29. extern PCMCIA_STRING_MAP PcmciaDbgFdoPowerWorkerStringMap[];
  30. extern PCMCIA_STRING_MAP PcmciaDbgPdoPowerWorkerStringMap[];
  31. extern PCMCIA_STRING_MAP PcmciaDbgSocketPowerWorkerStringMap[];
  32. extern PCMCIA_STRING_MAP PcmciaDbgConfigurationWorkerStringMap[];
  33. extern PCMCIA_STRING_MAP PcmciaDbgTupleStringMap[];
  34. extern PCMCIA_STRING_MAP PcmciaDbgWakeStateStringMap[];
  35. //
  36. // Debug prototypes
  37. //
  38. PCHAR
  39. PcmciaDbgLookupString(
  40. IN PPCMCIA_STRING_MAP Map,
  41. IN ULONG Id
  42. );
  43. VOID
  44. PcmciaDebugPrint(
  45. ULONG DebugMask,
  46. PCCHAR DebugMessage,
  47. ...
  48. );
  49. VOID
  50. PcmciaDumpSocket(
  51. IN PSOCKET Socket
  52. );
  53. VOID
  54. PcmciaWriteTraceEntry(
  55. IN PSOCKET Socket,
  56. IN ULONG Context
  57. );
  58. //
  59. // Debug macros
  60. //
  61. #define DebugPrint(X) PcmciaDebugPrint X
  62. #define DUMP_SOCKET(Socket) PcmciaDumpSocket(Socket)
  63. #define TRACE(Socket, Context) PcmciaWriteTraceEntry(Socket, Context)
  64. #define STATUS_STRING(_Status) \
  65. (_Status) == STATUS_SUCCESS ? \
  66. "STATUS_SUCCESS" : PcmciaDbgLookupString(PcmciaDbgStatusStringMap, (_Status))
  67. #define PNP_IRP_STRING(_Irp) \
  68. PcmciaDbgLookupString(PcmciaDbgPnpIrpStringMap, (_Irp))
  69. #define PO_IRP_STRING(_Irp) \
  70. PcmciaDbgLookupString(PcmciaDbgPoIrpStringMap, (_Irp))
  71. #define RELATION_STRING(_Relation) \
  72. PcmciaDbgLookupString(PcmciaDbgDeviceRelationStringMap, (_Relation))
  73. #define SYSTEM_POWER_STRING(_State) \
  74. PcmciaDbgLookupString(PcmciaDbgSystemPowerStringMap, (_State))
  75. #define DEVICE_POWER_STRING(_State) \
  76. PcmciaDbgLookupString(PcmciaDbgDevicePowerStringMap, (_State))
  77. #define FDO_POWER_WORKER_STRING(_State) \
  78. PcmciaDbgLookupString(PcmciaDbgFdoPowerWorkerStringMap, (_State))
  79. #define PDO_POWER_WORKER_STRING(_State) \
  80. PcmciaDbgLookupString(PcmciaDbgPdoPowerWorkerStringMap, (_State))
  81. #define SOCKET_POWER_WORKER_STRING(_State) \
  82. PcmciaDbgLookupString(PcmciaDbgSocketPowerWorkerStringMap, (_State))
  83. #define CONFIGURATION_WORKER_STRING(_State) \
  84. PcmciaDbgLookupString(PcmciaDbgConfigurationWorkerStringMap, (_State))
  85. #define TUPLE_STRING(_Tuple) \
  86. PcmciaDbgLookupString(PcmciaDbgTupleStringMap, (_Tuple))
  87. #define WAKESTATE_STRING(_State) \
  88. PcmciaDbgLookupString(PcmciaDbgWakeStateStringMap, (_State))
  89. //
  90. // Debug mask flags
  91. //
  92. #define PCMCIA_DEBUG_ALL 0xFFFFFFFF
  93. #define PCMCIA_DEBUG_FAIL 0x00000001
  94. #define PCMCIA_DEBUG_INFO 0x00000002
  95. #define PCMCIA_DEBUG_PNP 0x00000004
  96. #define PCMCIA_DEBUG_POWER 0x00000008
  97. #define PCMCIA_DEBUG_SOCKET 0x00000010
  98. #define PCMCIA_DEBUG_CONFIG 0x00000020
  99. #define PCMCIA_DEBUG_TUPLES 0x00000040
  100. #define PCMCIA_DEBUG_RESOURCES 0x00000080
  101. #define PCMCIA_DEBUG_ENUM 0x00000100
  102. #define PCMCIA_DEBUG_INTERFACE 0x00001000
  103. #define PCMCIA_DEBUG_IOCTL 0x00002000
  104. #define PCMCIA_DEBUG_DPC 0x00004000
  105. #define PCMCIA_DEBUG_ISR 0x00008000
  106. #define PCMCIA_PCCARD_READY 0x00010000
  107. #define PCMCIA_DEBUG_DETECT 0x00020000
  108. #define PCMCIA_COUNTERS 0x00040000
  109. #define PCMCIA_DEBUG_IRQMASK 0x00080000
  110. #define PCMCIA_DUMP_SOCKET 0x00100000
  111. //
  112. // Structures
  113. //
  114. typedef struct _TRACE_ENTRY {
  115. ULONG Context;
  116. ULONG CardBusReg[5];
  117. UCHAR ExcaReg[70];
  118. } TRACE_ENTRY, *PTRACE_ENTRY;
  119. #else
  120. //
  121. // !defined DBG
  122. //
  123. #define DebugPrint(X)
  124. #define DUMP_SOCKET(Socket)
  125. #define PDO_TRACE(PdoExt, Context)
  126. #define STATUS_STRING(_Status) ""
  127. #define PNP_IRP_STRING(_Irp) ""
  128. #define PO_IRP_STRING(_Irp) ""
  129. #define RELATION_STRING(_Relation) ""
  130. #define SYSTEM_POWER_STRING(_State) ""
  131. #define DEVICE_POWER_STRING(_State) ""
  132. #endif // DBG
  133. #endif