ReactOS  0.4.15-dev-3453-gff89651
debug.c File Reference
#include "usbport.h"
#include <debug.h>
#include "usbdebug.h"
Include dependency graph for debug.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define NDEBUG_USBPORT_MINIPORT
 
#define NDEBUG_USBPORT_URB
 

Functions

ULONG USBPORT_DbgPrint (IN PVOID MiniPortExtension, IN ULONG Level, IN PCH Format,...)
 
ULONG NTAPI USBPORT_TestDebugBreak (IN PVOID MiniPortExtension)
 
ULONG NTAPI USBPORT_AssertFailure (PVOID MiniPortExtension, PVOID FailedAssertion, PVOID FileName, ULONG LineNumber, PCHAR Message)
 
VOID NTAPI USBPORT_BugCheck (IN PVOID MiniPortExtension)
 
ULONG NTAPI USBPORT_LogEntry (IN PVOID MiniPortExtension, IN ULONG DriverTag, IN ULONG EnumTag, IN ULONG P1, IN ULONG P2, IN ULONG P3)
 
VOID NTAPI USBPORT_DumpingDeviceDescriptor (IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor)
 
VOID NTAPI USBPORT_DumpingConfiguration (IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor)
 
VOID NTAPI USBPORT_DumpingCapabilities (IN PDEVICE_CAPABILITIES Capabilities)
 
VOID NTAPI USBPORT_DumpingSetupPacket (IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket)
 
VOID NTAPI USBPORT_DumpingURB (IN PURB Urb)
 
VOID NTAPI USBPORT_DumpingIDs (IN PVOID Buffer)
 
VOID NTAPI USBPORT_DumpingEndpointProperties (IN PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties)
 
VOID NTAPI USBPORT_DumpingTtEndpoint (IN PUSB2_TT_ENDPOINT TtEndpoint)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file debug.c.

◆ NDEBUG_USBPORT_MINIPORT

#define NDEBUG_USBPORT_MINIPORT

Definition at line 13 of file debug.c.

◆ NDEBUG_USBPORT_URB

#define NDEBUG_USBPORT_URB

Definition at line 14 of file debug.c.

Function Documentation

◆ USBPORT_AssertFailure()

ULONG NTAPI USBPORT_AssertFailure ( PVOID  MiniPortExtension,
PVOID  FailedAssertion,
PVOID  FileName,
ULONG  LineNumber,
PCHAR  Message 
)

Definition at line 38 of file debug.c.

43 {
44  DPRINT("USBPORT_AssertFailure: ... \n");
45  RtlAssert(FailedAssertion, FileName, LineNumber, Message);
46  return 0;
47 }
VOID NTAPI RtlAssert(IN PVOID FailedAssertion, IN PVOID FileName, IN ULONG LineNumber, IN PCHAR Message OPTIONAL)
Definition: debug.c:491
CHAR Message[80]
Definition: alive.c:5
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1216
#define DPRINT
Definition: sndvol32.h:71

Referenced by USBPORT_RegisterUSBPortDriver().

◆ USBPORT_BugCheck()

VOID NTAPI USBPORT_BugCheck ( IN PVOID  MiniPortExtension)

Definition at line 51 of file debug.c.

52 {
53  DPRINT1("USBPORT_BugCheck: FIXME \n");
54  //KeBugCheckEx(BUGCODE_USB_DRIVER, ...);
55  ASSERT(FALSE);
56 }
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:44
#define DPRINT1
Definition: precomp.h:8

Referenced by USBPORT_RegisterUSBPortDriver().

◆ USBPORT_DbgPrint()

ULONG USBPORT_DbgPrint ( IN PVOID  MiniPortExtension,
IN ULONG  Level,
IN PCH  Format,
  ... 
)

Definition at line 19 of file debug.c.

23 {
24  DPRINT("USBPORT_DbgPrint: UNIMPLEMENTED. FIXME. \n");
25  return 0;
26 }
#define DPRINT
Definition: sndvol32.h:71

Referenced by USBPORT_RegisterUSBPortDriver().

◆ USBPORT_DumpingCapabilities()

VOID NTAPI USBPORT_DumpingCapabilities ( IN PDEVICE_CAPABILITIES  Capabilities)

Definition at line 170 of file debug.c.

171 {
172  if (!Capabilities)
173  {
174  return;
175  }
176 
177  DPRINT("Capabilities->Size - %x\n", Capabilities->Size);
178  DPRINT("Capabilities->Version - %x\n", Capabilities->Version);
179 
180  DPRINT("Capabilities->DeviceD1 - %x\n", Capabilities->DeviceD1);
181  DPRINT("Capabilities->DeviceD2 - %x\n", Capabilities->DeviceD2);
182  DPRINT("Capabilities->LockSupported - %x\n", Capabilities->LockSupported);
183  DPRINT("Capabilities->EjectSupported - %x\n", Capabilities->EjectSupported);
184  DPRINT("Capabilities->Removable - %x\n", Capabilities->Removable);
185  DPRINT("Capabilities->DockDevice - %x\n", Capabilities->DockDevice);
186  DPRINT("Capabilities->UniqueID - %x\n", Capabilities->UniqueID);
187  DPRINT("Capabilities->SilentInstall - %x\n", Capabilities->SilentInstall);
188  DPRINT("Capabilities->RawDeviceOK - %x\n", Capabilities->RawDeviceOK);
189  DPRINT("Capabilities->SurpriseRemovalOK - %x\n", Capabilities->SurpriseRemovalOK);
190 
191  DPRINT("Capabilities->Address - %x\n", Capabilities->Address);
192  DPRINT("Capabilities->UINumber - %x\n", Capabilities->UINumber);
193 
194  DPRINT("Capabilities->DeviceState[0] - %x\n", Capabilities->DeviceState[0]);
195  DPRINT("Capabilities->DeviceState[1] - %x\n", Capabilities->DeviceState[1]);
196  DPRINT("Capabilities->DeviceState[2] - %x\n", Capabilities->DeviceState[2]);
197  DPRINT("Capabilities->DeviceState[3] - %x\n", Capabilities->DeviceState[3]);
198  DPRINT("Capabilities->DeviceState[4] - %x\n", Capabilities->DeviceState[4]);
199  DPRINT("Capabilities->DeviceState[5] - %x\n", Capabilities->DeviceState[5]);
200  DPRINT("Capabilities->DeviceState[6] - %x\n", Capabilities->DeviceState[6]);
201 
202  DPRINT("Capabilities->SystemWake - %x\n", Capabilities->SystemWake);
203  DPRINT("Capabilities->DeviceWake - %x\n", Capabilities->DeviceWake);
204 
205  DPRINT("Capabilities->D1Latency - %x\n", Capabilities->D1Latency);
206  DPRINT("Capabilities->D2Latency - %x\n", Capabilities->D2Latency);
207  DPRINT("Capabilities->D3Latency - %x\n", Capabilities->D3Latency);
208 }
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
#define DPRINT
Definition: sndvol32.h:71

Referenced by USBPORT_QueryCapabilities().

◆ USBPORT_DumpingConfiguration()

VOID NTAPI USBPORT_DumpingConfiguration ( IN PUSB_CONFIGURATION_DESCRIPTOR  ConfigDescriptor)

Definition at line 105 of file debug.c.

106 {
107  PUSB_INTERFACE_DESCRIPTOR iDescriptor;
109  ULONG ix;
110 
111  if (!ConfigDescriptor ||
113  {
114  return;
115  }
116 
117  DPRINT_URB("Dumping ConfigDescriptor - %p\n", ConfigDescriptor);
118  DPRINT_URB("bLength - %x\n", ConfigDescriptor->bLength);
119  DPRINT_URB("bDescriptorType - %x\n", ConfigDescriptor->bDescriptorType);
120  DPRINT_URB("wTotalLength - %x\n", ConfigDescriptor->wTotalLength);
121  DPRINT_URB("bNumInterfaces - %x\n", ConfigDescriptor->bNumInterfaces);
122  DPRINT_URB("bConfigurationValue - %x\n", ConfigDescriptor->bConfigurationValue);
123  DPRINT_URB("iConfiguration - %x\n", ConfigDescriptor->iConfiguration);
124  DPRINT_URB("bmAttributes - %x\n", ConfigDescriptor->bmAttributes);
125  DPRINT_URB("MaxPower - %x\n", ConfigDescriptor->MaxPower);
126 
128  ConfigDescriptor->bLength);
129 
130  if (iDescriptor->bLength < sizeof(USB_INTERFACE_DESCRIPTOR))
131  {
132  return;
133  }
134 
135  DPRINT_URB("Dumping iDescriptor - %p\n", iDescriptor);
136  DPRINT_URB("bLength - %x\n", iDescriptor->bLength);
137  DPRINT_URB("bDescriptorType - %x\n", iDescriptor->bDescriptorType);
138  DPRINT_URB("bInterfaceNumber - %x\n", iDescriptor->bInterfaceNumber);
139  DPRINT_URB("bAlternateSetting - %x\n", iDescriptor->bAlternateSetting);
140  DPRINT_URB("bNumEndpoints - %x\n", iDescriptor->bNumEndpoints);
141  DPRINT_URB("bInterfaceClass - %x\n", iDescriptor->bInterfaceClass);
142  DPRINT_URB("bInterfaceSubClass - %x\n", iDescriptor->bInterfaceSubClass);
143  DPRINT_URB("bInterfaceProtocol - %x\n", iDescriptor->bInterfaceProtocol);
144  DPRINT_URB("iInterface - %x\n", iDescriptor->iInterface);
145 
147  iDescriptor->bLength);
148 
149  for (ix = 0; ix < iDescriptor->bNumEndpoints; ix++)
150  {
151  if (Descriptor->bLength < sizeof(USB_ENDPOINT_DESCRIPTOR))
152  {
153  return;
154  }
155 
156  DPRINT_URB("Dumping Descriptor - %p\n", Descriptor);
157  DPRINT_URB("bLength - %x\n", Descriptor->bLength);
158  DPRINT_URB("bDescriptorType - %x\n", Descriptor->bDescriptorType);
159  DPRINT_URB("bEndpointAddress - %x\n", Descriptor->bEndpointAddress);
160  DPRINT_URB("bmAttributes - %x\n", Descriptor->bmAttributes);
161  DPRINT_URB("wMaxPacketSize - %x\n", Descriptor->wMaxPacketSize);
162  DPRINT_URB("bInterval - %x\n", Descriptor->bInterval);
163 
164  Descriptor += 1;
165  }
166 }
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
#define DPRINT_URB(...)
Definition: usbdebug.h:145
struct _USB_INTERFACE_DESCRIPTOR * PUSB_INTERFACE_DESCRIPTOR
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFUSBDEVICE _Out_writes_bytes_to_opt_ ConfigDescriptorLength PVOID ConfigDescriptor
Definition: wdfusb.h:1036
struct _USB_ENDPOINT_DESCRIPTOR * PUSB_ENDPOINT_DESCRIPTOR
unsigned int ULONG
Definition: retypes.h:1

Referenced by USBPORT_HandleSelectConfiguration().

◆ USBPORT_DumpingDeviceDescriptor()

VOID NTAPI USBPORT_DumpingDeviceDescriptor ( IN PUSB_DEVICE_DESCRIPTOR  DeviceDescriptor)

Definition at line 79 of file debug.c.

80 {
81  if (!DeviceDescriptor)
82  {
83  return;
84  }
85 
86  DPRINT_URB("Dumping Device Descriptor - %p\n", DeviceDescriptor);
87  DPRINT_URB("bLength - %x\n", DeviceDescriptor->bLength);
88  DPRINT_URB("bDescriptorType - %x\n", DeviceDescriptor->bDescriptorType);
89  DPRINT_URB("bcdUSB - %x\n", DeviceDescriptor->bcdUSB);
90  DPRINT_URB("bDeviceClass - %x\n", DeviceDescriptor->bDeviceClass);
91  DPRINT_URB("bDeviceSubClass - %x\n", DeviceDescriptor->bDeviceSubClass);
92  DPRINT_URB("bDeviceProtocol - %x\n", DeviceDescriptor->bDeviceProtocol);
93  DPRINT_URB("bMaxPacketSize0 - %x\n", DeviceDescriptor->bMaxPacketSize0);
94  DPRINT_URB("idVendor - %x\n", DeviceDescriptor->idVendor);
95  DPRINT_URB("idProduct - %x\n", DeviceDescriptor->idProduct);
96  DPRINT_URB("bcdDevice - %x\n", DeviceDescriptor->bcdDevice);
97  DPRINT_URB("iManufacturer - %x\n", DeviceDescriptor->iManufacturer);
98  DPRINT_URB("iProduct - %x\n", DeviceDescriptor->iProduct);
99  DPRINT_URB("iSerialNumber - %x\n", DeviceDescriptor->iSerialNumber);
100  DPRINT_URB("bNumConfigurations - %x\n", DeviceDescriptor->bNumConfigurations);
101 }
#define DPRINT_URB(...)
Definition: usbdebug.h:145
const KSDEVICE_DESCRIPTOR DeviceDescriptor
Definition: splitter.c:257

Referenced by USBHI_GetUsbDescriptors(), and USBHI_QueryDeviceInformation().

◆ USBPORT_DumpingEndpointProperties()

VOID NTAPI USBPORT_DumpingEndpointProperties ( IN PUSBPORT_ENDPOINT_PROPERTIES  EndpointProperties)

Definition at line 280 of file debug.c.

281 {
282  DPRINT_USB2("DeviceAddress - %X\n", EndpointProperties->DeviceAddress);
283  DPRINT_USB2("EndpointAddress - %X\n", EndpointProperties->EndpointAddress);
284  DPRINT_USB2("TotalMaxPacketSize - %X\n", EndpointProperties->TotalMaxPacketSize);
285  DPRINT_USB2("Period - %X\n", EndpointProperties->Period);
286  DPRINT_USB2("DeviceSpeed - %X\n", EndpointProperties->DeviceSpeed);
287  DPRINT_USB2("UsbBandwidth - %X\n", EndpointProperties->UsbBandwidth);
288  DPRINT_USB2("ScheduleOffset - %X\n", EndpointProperties->ScheduleOffset);
289  DPRINT_USB2("TransferType - %X\n", EndpointProperties->TransferType);
290  DPRINT_USB2("MaxTransferSize - %X\n", EndpointProperties->MaxTransferSize);
291  DPRINT_USB2("HubAddr - %X\n", EndpointProperties->HubAddr);
292  DPRINT_USB2("PortNumber - %X\n", EndpointProperties->PortNumber);
293  DPRINT_USB2("InterruptScheduleMask - %X\n", EndpointProperties->InterruptScheduleMask);
294  DPRINT_USB2("SplitCompletionMask - %X\n", EndpointProperties->SplitCompletionMask);
295  DPRINT_USB2("MaxPacketSize - %X\n", EndpointProperties->MaxPacketSize);
296 }
#define DPRINT_USB2(...)
Definition: usbdebug.h:149

Referenced by USBPORT_AllocateBandwidthUSB2().

◆ USBPORT_DumpingIDs()

VOID NTAPI USBPORT_DumpingIDs ( IN PVOID  Buffer)

Definition at line 257 of file debug.c.

258 {
259  PWSTR Ptr;
260  ULONG Length;
261  ULONG TotalLength = 0;
262 
263  Ptr = (PWSTR)Buffer;
264 
265  while (*Ptr)
266  {
267  DPRINT(" %S\n", Ptr);
268  Length = (ULONG)wcslen(Ptr) + 1;
269 
270  Ptr += Length;
271  TotalLength += Length;
272  }
273 
274  DPRINT("TotalLength: %hu\n", TotalLength);
275  DPRINT("\n");
276 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
uint16_t * PWSTR
Definition: typedefs.h:56
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
_In_ ULONG TotalLength
Definition: usbdlib.h:158
Definition: bufpool.h:45
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
unsigned int ULONG
Definition: retypes.h:1
#define DPRINT
Definition: sndvol32.h:71

Referenced by USBPORT_GetDeviceHwIds().

◆ USBPORT_DumpingSetupPacket()

VOID NTAPI USBPORT_DumpingSetupPacket ( IN PUSB_DEFAULT_PIPE_SETUP_PACKET  SetupPacket)

Definition at line 212 of file debug.c.

213 {
214  DPRINT("SetupPacket->bmRequestType.B - %x\n", SetupPacket->bmRequestType.B);
215  DPRINT("SetupPacket->bRequest - %x\n", SetupPacket->bRequest);
216  DPRINT("SetupPacket->wValue.LowByte - %x\n", SetupPacket->wValue.LowByte);
217  DPRINT("SetupPacket->wValue.HiByte - %x\n", SetupPacket->wValue.HiByte);
218  DPRINT("SetupPacket->wIndex.W - %x\n", SetupPacket->wIndex.W);
219  DPRINT("SetupPacket->wLength - %x\n", SetupPacket->wLength);
220 }
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET SetupPacket
Definition: wdfusb.h:1331
#define DPRINT
Definition: sndvol32.h:71

Referenced by USBPORT_DumpingURB(), USBPORT_HandleGetConfiguration(), USBPORT_HandleGetSetDescriptor(), USBPORT_HandleGetStatus(), USBPORT_HandleSetOrClearFeature(), and USBPORT_HandleVendorOrClass().

◆ USBPORT_DumpingTtEndpoint()

VOID NTAPI USBPORT_DumpingTtEndpoint ( IN PUSB2_TT_ENDPOINT  TtEndpoint)

Definition at line 300 of file debug.c.

301 {
302  DPRINT_USB2("MaxPacketSize - %X\n", TtEndpoint->MaxPacketSize);
303  DPRINT_USB2("Period - %X\n", TtEndpoint->Period);
304  DPRINT_USB2("TtEndpointParams- %X\n", TtEndpoint->TtEndpointParams.AsULONG);
305  DPRINT_USB2("CalcBusTime - %X\n", TtEndpoint->CalcBusTime);
306  DPRINT_USB2("StartTime - %X\n", TtEndpoint->StartTime);
307  DPRINT_USB2("ActualPeriod - %X\n", TtEndpoint->ActualPeriod);
308  DPRINT_USB2("StartFrame - %X\n", TtEndpoint->StartFrame);
309  DPRINT_USB2("StartMicroframe - %X\n", TtEndpoint->StartMicroframe);
310  DPRINT_USB2("Nums - %X\n", TtEndpoint->Nums.AsULONG);
311  DPRINT_USB2("nextTtEndpoint - %X\n", TtEndpoint->NextTtEndpoint);
312 }
#define DPRINT_USB2(...)
Definition: usbdebug.h:149

Referenced by USBPORT_AllocateBandwidthUSB2().

◆ USBPORT_DumpingURB()

VOID NTAPI USBPORT_DumpingURB ( IN PURB  Urb)

Definition at line 224 of file debug.c.

225 {
227 
228  DPRINT_URB("UrbHeader.Length - %x\n", Urb->UrbHeader.Length);
229  DPRINT_URB("UrbHeader.Function - %x\n", Urb->UrbHeader.Function);
230  DPRINT_URB("UrbHeader.Status - %x\n", Urb->UrbHeader.Status);
231  DPRINT_URB("UrbHeader.UsbdDeviceHandle - %p\n", Urb->UrbHeader.UsbdDeviceHandle);
232  DPRINT_URB("UrbHeader.UsbdFlags - %x\n", Urb->UrbHeader.UsbdFlags);
233 
234  if (Urb->UrbHeader.Length < 0x48)
235  {
236  return;
237  }
238 
239  DPRINT_URB("PipeHandle - %p\n", Urb->UrbControlTransfer.PipeHandle);
240  DPRINT_URB("TransferFlags - %x\n", Urb->UrbControlTransfer.TransferFlags);
241  DPRINT_URB("TransferBufferLength - %x\n", Urb->UrbControlTransfer.TransferBufferLength);
242  DPRINT_URB("TransferBuffer - %p\n", Urb->UrbControlTransfer.TransferBuffer);
243  DPRINT_URB("TransferBufferMDL - %p\n", Urb->UrbControlTransfer.TransferBufferMDL);
244  DPRINT_URB("UrbLink - %p\n", Urb->UrbControlTransfer.UrbLink);
245 
246  if (Urb->UrbHeader.Length < 0x50)
247  {
248  return;
249  }
250 
251  SetupPacket = (PUSB_DEFAULT_PIPE_SETUP_PACKET)&Urb->UrbControlTransfer.SetupPacket;
253 }
VOID NTAPI USBPORT_DumpingSetupPacket(IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket)
Definition: debug.c:212
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET SetupPacket
Definition: wdfusb.h:1331
#define DPRINT_URB(...)
Definition: usbdebug.h:145
struct _USB_DEFAULT_PIPE_SETUP_PACKET * PUSB_DEFAULT_PIPE_SETUP_PACKET

Referenced by USBPORT_CompleteTransfer(), USBPORT_ValidateTransferParametersURB(), and USBPORT_ValidateURB().

◆ USBPORT_LogEntry()

ULONG NTAPI USBPORT_LogEntry ( IN PVOID  MiniPortExtension,
IN ULONG  DriverTag,
IN ULONG  EnumTag,
IN ULONG  P1,
IN ULONG  P2,
IN ULONG  P3 
)

Definition at line 60 of file debug.c.

66 {
67  DPRINT_MINIPORT("USBPORT_LogEntry: MiniPortExtension - %p, EnumTag - %lx, P1 - %lx, P2 - %lx, P3 - %lx\n",
68  MiniPortExtension,
69  EnumTag,
70  P1,
71  P2,
72  P3);
73 
74  return 0;
75 }
#define DPRINT_MINIPORT(...)
Definition: usbdebug.h:143

Referenced by USBPORT_RegisterUSBPortDriver().

◆ USBPORT_TestDebugBreak()

ULONG NTAPI USBPORT_TestDebugBreak ( IN PVOID  MiniPortExtension)

Definition at line 30 of file debug.c.

31 {
32  DPRINT("USBPORT_TestDebugBreak: UNIMPLEMENTED. FIXME. \n");
33  return 0;
34 }
#define DPRINT
Definition: sndvol32.h:71

Referenced by USBPORT_RegisterUSBPortDriver().