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.

137 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. repltrace.h
  5. Abstract:
  6. This module contains public declarations and definitions for tracing
  7. and debugging the endpoint replenish code.
  8. Author:
  9. Michael Courage (mcourage) 3-Oct-2000
  10. Revision History:
  11. --*/
  12. #ifndef _REPLTRACE_H_
  13. #define _REPLTRACE_H_
  14. #if defined(__cplusplus)
  15. extern "C" {
  16. #endif // __cplusplus
  17. //
  18. // Globals.
  19. //
  20. extern ENDPOINT_SYNCH DummySynch;
  21. //
  22. // This defines the entry written to the trace log.
  23. //
  24. typedef struct _REPLENISH_TRACE_LOG_ENTRY
  25. {
  26. PUL_ENDPOINT pEndpoint;
  27. ENDPOINT_SYNCH Previous;
  28. ENDPOINT_SYNCH Current;
  29. USHORT Action;
  30. USHORT Processor;
  31. } REPLENISH_TRACE_LOG_ENTRY, *PREPLENISH_TRACE_LOG_ENTRY;
  32. //
  33. // Action codes.
  34. //
  35. // N.B. These codes must be contiguous, starting at zero. If you update
  36. // this list, you must also update the corresponding array in
  37. // ul\ulkd\replenish.c.
  38. //
  39. #define REPLENISH_ACTION_START_REPLENISH 0
  40. #define REPLENISH_ACTION_END_REPLENISH 1
  41. #define REPLENISH_ACTION_QUEUE_REPLENISH 2
  42. #define REPLENISH_ACTION_INCREMENT 3
  43. #define REPLENISH_ACTION_DECREMENT 4
  44. #define REPLENISH_ACTION_COUNT 5
  45. #define REPLENISH_TRACE_LOG_SIGNATURE ((LONG)'gLpR')
  46. //
  47. // Manipulators.
  48. //
  49. PTRACE_LOG
  50. CreateReplenishTraceLog(
  51. IN LONG LogSize,
  52. IN LONG ExtraBytesInHeader
  53. );
  54. VOID
  55. DestroyReplenishTraceLog(
  56. IN PTRACE_LOG pLog
  57. );
  58. VOID
  59. WriteReplenishTraceLog(
  60. IN PTRACE_LOG pLog,
  61. IN PUL_ENDPOINT pEndpoint,
  62. IN ENDPOINT_SYNCH Previous,
  63. IN ENDPOINT_SYNCH Current,
  64. IN USHORT Action
  65. );
  66. #if ENABLE_REPL_TRACE
  67. #define CREATE_REPLENISH_TRACE_LOG( ptr, size, extra ) \
  68. (ptr) = CreateReplenishTraceLog( (size), (extra) )
  69. #define DESTROY_REPLENISH_TRACE_LOG( ptr ) \
  70. do \
  71. { \
  72. DestroyReplenishTraceLog( ptr ); \
  73. (ptr) = NULL; \
  74. } while (FALSE)
  75. #define WRITE_REPLENISH_TRACE_LOG( plog, pendp, prev, cur, act ) \
  76. WriteReplenishTraceLog( \
  77. (plog), \
  78. (pendp), \
  79. (prev), \
  80. (cur), \
  81. (act) \
  82. )
  83. #else // !ENABLE_REPL_TRACE
  84. #define CREATE_REPLENISH_TRACE_LOG( ptr, size, extra )
  85. #define DESTROY_REPLENISH_TRACE_LOG( ptr )
  86. #define WRITE_REPLENISH_TRACE_LOG( plog, pendp, prev, cur, act )
  87. #endif // ENABLE_REPL_TRACE
  88. #define TRACE_REPLENISH( pendp, prev, cur, act ) \
  89. WRITE_REPLENISH_TRACE_LOG( \
  90. g_pReplenishTraceLog, \
  91. (pendp), \
  92. (prev), \
  93. (cur), \
  94. (act) \
  95. )
  96. #if defined(__cplusplus)
  97. } // extern "C"
  98. #endif // __cplusplus
  99. #endif // _REPLTRACE_H_