[U-Boot] [PATCH 2/8] USB add macros for debugging usb device setup.

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Sep 5 02:31:21 CEST 2009


On 15:12 Fri 04 Sep     , Tom Rix wrote:
> When developing usb device features, it is useful to print out
> common usb structures.
> 
> Signed-off-by: Tom Rix <Tom.Rix at windriver.com>
> ---
>  include/usbdescriptors.h |   31 +++++++++++++
>  include/usbdevice.h      |  105 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 136 insertions(+), 0 deletions(-)
> 
> diff --git a/include/usbdescriptors.h b/include/usbdescriptors.h
> index ea05672..f4e33b6 100644
> --- a/include/usbdescriptors.h
> +++ b/include/usbdescriptors.h
> @@ -510,4 +510,35 @@ struct usb_class_descriptor {
>  
>  } __attribute__ ((packed));
>  
> +#ifdef DEBUG
> +#define PRINT_DEVICE_DESCRIPTOR(d)					\
inline will be better
> +do {									\
> +	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);				\
> +} while (0)
Best Regards,
J.


More information about the U-Boot mailing list