102ac6454SAndrew Thompson /* $FreeBSD$ */ 202ac6454SAndrew Thompson /*- 302ac6454SAndrew Thompson * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 402ac6454SAndrew Thompson * 502ac6454SAndrew Thompson * Redistribution and use in source and binary forms, with or without 602ac6454SAndrew Thompson * modification, are permitted provided that the following conditions 702ac6454SAndrew Thompson * are met: 802ac6454SAndrew Thompson * 1. Redistributions of source code must retain the above copyright 902ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer. 1002ac6454SAndrew Thompson * 2. Redistributions in binary form must reproduce the above copyright 1102ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer in the 1202ac6454SAndrew Thompson * documentation and/or other materials provided with the distribution. 1302ac6454SAndrew Thompson * 1402ac6454SAndrew Thompson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1502ac6454SAndrew Thompson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1602ac6454SAndrew Thompson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1702ac6454SAndrew Thompson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1802ac6454SAndrew Thompson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1902ac6454SAndrew Thompson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2002ac6454SAndrew Thompson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2102ac6454SAndrew Thompson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2202ac6454SAndrew Thompson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2302ac6454SAndrew Thompson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2402ac6454SAndrew Thompson * SUCH DAMAGE. 2502ac6454SAndrew Thompson */ 2602ac6454SAndrew Thompson 2702ac6454SAndrew Thompson /* This file contains various factored out debug macros. */ 2802ac6454SAndrew Thompson 2902ac6454SAndrew Thompson #ifndef _USB2_DEBUG_H_ 3002ac6454SAndrew Thompson #define _USB2_DEBUG_H_ 3102ac6454SAndrew Thompson 3202ac6454SAndrew Thompson /* Declare parent SYSCTL USB node. */ 339360ae40SAndrew Thompson SYSCTL_DECL(_hw_usb); 3402ac6454SAndrew Thompson 3502ac6454SAndrew Thompson /* Declare global USB debug variable. */ 3602ac6454SAndrew Thompson extern int usb2_debug; 3702ac6454SAndrew Thompson 3802ac6454SAndrew Thompson /* Check if USB debugging is enabled. */ 3902ac6454SAndrew Thompson #ifdef USB_DEBUG_VAR 4002ac6454SAndrew Thompson #if (USB_DEBUG != 0) 4102ac6454SAndrew Thompson #define DPRINTFN(n,fmt,...) do { \ 4202ac6454SAndrew Thompson if ((USB_DEBUG_VAR) >= (n)) { \ 4302ac6454SAndrew Thompson printf("%s:%u: " fmt, \ 4402ac6454SAndrew Thompson __FUNCTION__, __LINE__,## __VA_ARGS__); \ 4502ac6454SAndrew Thompson } \ 4602ac6454SAndrew Thompson } while (0) 4702ac6454SAndrew Thompson #define DPRINTF(...) DPRINTFN(1, __VA_ARGS__) 4802ac6454SAndrew Thompson #else 4902ac6454SAndrew Thompson #define DPRINTF(...) do { } while (0) 5002ac6454SAndrew Thompson #define DPRINTFN(...) do { } while (0) 5102ac6454SAndrew Thompson #endif 5202ac6454SAndrew Thompson #endif 5302ac6454SAndrew Thompson 54760bc48eSAndrew Thompson struct usb_interface; 55760bc48eSAndrew Thompson struct usb_device; 56ae60fdfbSAndrew Thompson struct usb_endpoint; 57760bc48eSAndrew Thompson struct usb_xfer; 5802ac6454SAndrew Thompson 59760bc48eSAndrew Thompson void usb2_dump_iface(struct usb_interface *iface); 60760bc48eSAndrew Thompson void usb2_dump_device(struct usb_device *udev); 61ae60fdfbSAndrew Thompson void usb2_dump_queue(struct usb_endpoint *ep); 62ae60fdfbSAndrew Thompson void usb2_dump_endpoint(struct usb_endpoint *ep); 63760bc48eSAndrew Thompson void usb2_dump_xfer(struct usb_xfer *xfer); 6402ac6454SAndrew Thompson 6502ac6454SAndrew Thompson #endif /* _USB2_DEBUG_H_ */ 66