1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28/* This file contains various factored out debug macros. */ 29 30#ifndef _USB_DEBUG_H_ 31#define _USB_DEBUG_H_ 32 33/* Declare global USB debug variable. */ 34extern int usb_debug; 35 36/* Check if USB debugging is enabled. */ 37#ifdef USB_DEBUG_VAR 38#ifdef LOSCFG_USB_DEBUG 39#define DPRINTFN(n,fmt,...) do { \ 40 if ((USB_DEBUG_VAR) >= (n)) { \ 41 PRINTK("%s: " fmt, \ 42 __FUNCTION__ ,##__VA_ARGS__); \ 43 } \ 44} while (0) 45#define DPRINTF(...) DPRINTFN(1, __VA_ARGS__) 46#else 47#define DPRINTF(...) do { } while (0) 48#define DPRINTFN(...) do { } while (0) 49#endif 50/* usb_debug shell command supports the following modules print level control */ 51/* 52 * composite, about composite.c 53 * dwc_pcd, about dwc_otg_pcd.c 54 * dwc_intr, about dwc_ptg_pcd_intr.c 55 * ehci, about ehci.c 56 * fmass, about f_mass_storage.c 57 * axe, about if_axe.c 58 * cdce, about if_cdce.c 59 * urndis, about if_urndis.c 60 * u3g, about u3g.c 61 * umass, about umass.c 62 * controller, about usb_controller.c 63 * uhub, about usb_hub.c 64 * process, about usb_process.c 65 * serial, about usb_serial.c 66 * other, about bsd_kernel.c/linux_usb.c/usb_device.c/usb_request.c/usb_transfer.c 67 */ 68 69/* For example: usb_debug modules level */ 70#endif 71 72struct usb_interface; 73struct usb_device; 74struct usb_endpoint; 75struct usb_xfer; 76 77void usb_dump_iface(struct usb_interface *iface); 78void usb_dump_device(struct usb_device *udev); 79void usb_dump_queue(struct usb_endpoint *ep); 80void usb_dump_endpoint(struct usb_endpoint *ep); 81void usb_dump_xfer(struct usb_xfer *xfer); 82 83#ifdef LOSCFG_USB_DEBUG 84extern unsigned int usb_port_reset_delay; 85extern unsigned int usb_port_root_reset_delay; 86extern unsigned int usb_port_reset_recovery; 87extern unsigned int usb_port_powerup_delay; 88extern unsigned int usb_port_resume_delay; 89extern unsigned int usb_set_address_settle; 90extern unsigned int usb_resume_delay; 91extern unsigned int usb_resume_wait; 92extern unsigned int usb_resume_recovery; 93extern unsigned int usb_extra_power_up_time; 94#else 95#define usb_port_reset_delay USB_PORT_RESET_DELAY 96#define usb_port_root_reset_delay USB_PORT_ROOT_RESET_DELAY 97#define usb_port_reset_recovery USB_PORT_RESET_RECOVERY 98#define usb_port_powerup_delay USB_PORT_POWERUP_DELAY 99#define usb_port_resume_delay USB_PORT_RESUME_DELAY 100#define usb_set_address_settle USB_SET_ADDRESS_SETTLE 101#define usb_resume_delay USB_RESUME_DELAY 102#define usb_resume_wait USB_RESUME_WAIT 103#define usb_resume_recovery USB_RESUME_RECOVERY 104#define usb_extra_power_up_time USB_EXTRA_POWER_UP_TIME 105#endif 106 107#endif /* _USB_DEBUG_H_ */ 108