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