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.

190 lines
2.5 KiB

  1. #include "usb.h"
  2. #include "usbhcdi.h"
  3. // include all bus interfaces
  4. #include "usbbusif.h"
  5. #include "hubbusif.h"
  6. // inclulde ioctl defs for port drivers
  7. #include "usbkern.h"
  8. #include "usbuser.h"
  9. #include "..\..\USB2LIB\usb2lib.h"
  10. #include "..\usbport\dbg.h"
  11. #include "..\usbport\usbport.h"
  12. //#define DEBUGIT
  13. typedef union _SIG {
  14. UCHAR c[4];
  15. ULONG l;
  16. } SIG, *PSIG;
  17. typedef struct _FLAG_TABLE {
  18. PUCHAR Name;
  19. ULONG Mask;
  20. } FLAG_TABLE, *PFLAG_TABLE;
  21. #define GETMEMLOC(base, typ, field) \
  22. ((base) + FIELD_OFFSET(typ, field))
  23. typedef ULONG64 MEMLOC, *PMEMLOC;
  24. typedef struct _STRUC_ENTRY {
  25. PUCHAR FieldName;
  26. ULONG FieldType;
  27. } STRUC_ENTRY, *PSTRUC_ENTRY;
  28. #define FT_ULONG 1
  29. #define FT_UCHAR 2
  30. #define FT_USHORT 3
  31. #define FT_PTR 4
  32. #define FT_SIG 5
  33. #define FT_DEVSPEED 6
  34. #define FT_ULONG64 7
  35. ULONG
  36. CheckSym();
  37. #define CHECKSYM()\
  38. {\
  39. ULONG n;\
  40. if ((n=CheckSym()) != S_OK) {\
  41. return n;\
  42. }\
  43. }
  44. VOID
  45. UsbDumpStruc(
  46. MEMLOC MemLoc,
  47. PUCHAR Cs,
  48. PSTRUC_ENTRY FieldList,
  49. ULONG NumEntries
  50. );
  51. CPPMOD
  52. ScanfMemLoc(
  53. PMEMLOC MemLoc,
  54. PCSTR args
  55. );
  56. VOID
  57. PrintfMemLoc(
  58. PUCHAR Str1,
  59. MEMLOC MemLoc,
  60. PUCHAR Str2
  61. );
  62. VOID
  63. BadMemLoc(
  64. ULONG MemLoc
  65. );
  66. VOID
  67. BadSig(
  68. ULONG Sig,
  69. ULONG ExpectedSig
  70. );
  71. VOID
  72. DumpIPipe(
  73. MEMLOC MEmLoc
  74. );
  75. PCHAR
  76. ListEmpty(
  77. MEMLOC HeadMemLoc
  78. );
  79. VOID
  80. DumpPowerCaps(
  81. MEMLOC MemLoc
  82. );
  83. VOID
  84. UsbDumpFlags(
  85. ULONG Flags,
  86. PFLAG_TABLE FlagTable,
  87. ULONG NumEntries
  88. );
  89. VOID
  90. DumpUnicodeString(
  91. UNICODE_STRING uniString
  92. );
  93. VOID
  94. DumpEndpointParameters(
  95. MEMLOC MemLoc
  96. );
  97. VOID
  98. DumpUSBDescriptor(
  99. PVOID Descriptor
  100. );
  101. VOID
  102. EpType(
  103. ENDPOINT_TRANSFER_TYPE Typ
  104. );
  105. VOID
  106. EpDir(
  107. ENDPOINT_TRANSFER_DIRECTION Dir
  108. );
  109. VOID
  110. Sig(
  111. ULONG Sig,
  112. PUCHAR p
  113. );
  114. VOID
  115. DumpInterfaceInfo(
  116. MEMLOC MemLoc
  117. );
  118. ULONG
  119. UsbFieldOffset(
  120. IN LPSTR Type,
  121. IN LPSTR Field
  122. );
  123. MEMLOC
  124. UsbReadFieldPtr(
  125. IN ULONG64 Addr,
  126. IN LPSTR Type,
  127. IN LPSTR Field
  128. );
  129. ULONG
  130. UsbReadFieldUlong(
  131. IN ULONG64 Addr,
  132. IN LPSTR Type,
  133. IN LPSTR Field
  134. );
  135. UCHAR
  136. UsbReadFieldUchar(
  137. IN ULONG64 Addr,
  138. IN LPSTR Type,
  139. IN LPSTR Field
  140. );
  141. USHORT
  142. UsbReadFieldUshort(
  143. IN ULONG64 Addr,
  144. IN LPSTR Type,
  145. IN LPSTR Field
  146. );
  147. VOID
  148. DumpEHCI_StaticQHs(
  149. MEMLOC MemLoc
  150. );