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.

133 lines
2.0 KiB

  1. //===========================================================================
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright (c) 1996 - 1998 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //===========================================================================
  11. /*++
  12. Module Name:
  13. dbg.c
  14. Abstract:
  15. Debug Code for 1394 drivers.
  16. Environment:
  17. kernel mode only
  18. Notes:
  19. Revision History:
  20. 5-Sep-95
  21. --*/
  22. #include "wdm.h"
  23. #include "dbg.h"
  24. #if DBG
  25. struct LOG_ENTRY {
  26. CHAR le_name[4]; // Identifying string
  27. ULONG le_info1; // entry specific info
  28. ULONG le_info2; // entry specific info
  29. ULONG le_info3; // entry specific info
  30. };
  31. struct LOG_ENTRY *LogStart = 0; // No log yet
  32. struct LOG_ENTRY *LogPtr;
  33. struct LOG_ENTRY *LogEnd;
  34. #endif
  35. VOID
  36. Debug_LogEntry(
  37. IN CHAR *Name,
  38. IN ULONG Info1,
  39. IN ULONG Info2,
  40. IN ULONG Info3
  41. )
  42. /*++
  43. Routine Description:
  44. Adds an Entry to log.
  45. Arguments:
  46. Return Value:
  47. None.
  48. --*/
  49. {
  50. #if DBG
  51. if (LogStart == 0)
  52. return;
  53. if (LogPtr > LogStart)
  54. LogPtr -= 1; // Decrement to next entry
  55. else
  56. LogPtr = LogEnd;
  57. RtlCopyMemory(LogPtr->le_name, Name, 4);
  58. LogPtr->le_info1 = Info1;
  59. LogPtr->le_info2 = Info2;
  60. LogPtr->le_info3 = Info3;
  61. #endif
  62. return;
  63. }
  64. VOID
  65. Debug_LogInit(
  66. )
  67. /*++
  68. Routine Description:
  69. Init the debug log - remember interesting information in a circular buffer
  70. Arguments:
  71. Return Value:
  72. None.
  73. --*/
  74. {
  75. ULONG logSize = 4096; //1 page of log entries
  76. #if DBG
  77. LogStart = ExAllocatePoolWithTag(NonPagedPool, logSize, 'macd');
  78. if (LogStart) {
  79. LogPtr = LogStart;
  80. // Point the end (and first entry) 1 entry from the end of the segment
  81. LogEnd = LogStart + (logSize / sizeof(struct LOG_ENTRY)) - 1;
  82. }
  83. #endif
  84. return;
  85. }