summaryrefslogtreecommitdiff
path: root/include/usbdescriptors.h
diff options
context:
space:
mode:
authorTom Rix <Tom.Rix@windriver.com>2009-10-31 12:37:39 -0500
committerRemy Bohmer <linux@bohmer.net>2009-12-20 12:47:37 +0100
commit988365a2048356f94ed0c294009233317c9fb4b2 (patch)
tree0d59abec6a42e447f46a34ad837d3c70567a6fd6 /include/usbdescriptors.h
parent8f8bd565f35ff8a068727bfcf8975c50df082043 (diff)
downloadu-boot-imx-988365a2048356f94ed0c294009233317c9fb4b2.zip
u-boot-imx-988365a2048356f94ed0c294009233317c9fb4b2.tar.gz
u-boot-imx-988365a2048356f94ed0c294009233317c9fb4b2.tar.bz2
USB add macros for debugging usb device setup.
When developing usb device features, it is useful to print out common usb structures. Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
Diffstat (limited to 'include/usbdescriptors.h')
-rw-r--r--include/usbdescriptors.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/usbdescriptors.h b/include/usbdescriptors.h
index a752097..2dec3b9 100644
--- a/include/usbdescriptors.h
+++ b/include/usbdescriptors.h
@@ -504,4 +504,30 @@ struct usb_class_descriptor {
} __attribute__ ((packed));
+#ifdef DEBUG
+static inline void print_device_descriptor(struct usb_device_descriptor *d)
+{
+ serial_printf("usb device descriptor \n");
+ serial_printf("\tbLength %2.2x\n", d->bLength);
+ serial_printf("\tbDescriptorType %2.2x\n", d->bDescriptorType);
+ serial_printf("\tbcdUSB %4.4x\n", d->bcdUSB);
+ serial_printf("\tbDeviceClass %2.2x\n", d->bDeviceClass);
+ serial_printf("\tbDeviceSubClass %2.2x\n", d->bDeviceSubClass);
+ serial_printf("\tbDeviceProtocol %2.2x\n", d->bDeviceProtocol);
+ serial_printf("\tbMaxPacketSize0 %2.2x\n", d->bMaxPacketSize0);
+ serial_printf("\tidVendor %4.4x\n", d->idVendor);
+ serial_printf("\tidProduct %4.4x\n", d->idProduct);
+ serial_printf("\tbcdDevice %4.4x\n", d->bcdDevice);
+ serial_printf("\tiManufacturer %2.2x\n", d->iManufacturer);
+ serial_printf("\tiProduct %2.2x\n", d->iProduct);
+ serial_printf("\tiSerialNumber %2.2x\n", d->iSerialNumber);
+ serial_printf("\tbNumConfigurations %2.2x\n", d->bNumConfigurations);
+}
+
+#else
+
+/* stubs */
+#define print_device_descriptor(d)
+
+#endif /* DEBUG */
#endif