1 /* ==========================================================================
3 * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
4 * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
5 * otherwise expressly agreed to in writing between Synopsys and you.
7 * The Software IS NOT an item of Licensed Software or Licensed Product under
8 * any End User Software License Agreement or Agreement for Licensed Product
9 * with Synopsys or any supplement thereto. You are permitted to use and
10 * redistribute this Software in source and binary forms, with or without
11 * modification, provided that redistributions of source code must retain this
12 * notice. You may not view, use, disclose, copy or distribute this file or
13 * any information contained herein except pursuant to this license grant from
14 * Synopsys. If you do not agree with this notice, including the disclaimer
15 * below, then you are not authorized to use the Software.
17 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28 * ========================================================================== */
30 #ifndef __DWC_OTG_DBG_H__
31 #define __DWC_OTG_DBG_H__
34 * This file defines debug levels.
35 * Debugging support vanishes in non-debug builds.
39 * The Debug Level bit-mask variable.
41 extern uint32_t g_dbg_lvl;
43 * Set the Debug Level variable.
45 static inline uint32_t SET_DEBUG_LEVEL(const uint32_t new)
47 uint32_t old = g_dbg_lvl;
52 /** When debug level has the DBG_CIL bit set, display CIL Debug messages. */
54 /** When debug level has the DBG_CILV bit set, display CIL Verbose debug
56 #define DBG_CILV (0x20)
57 /** When debug level has the DBG_PCD bit set, display PCD (Device) debug
60 /** When debug level has the DBG_PCDV set, display PCD (Device) Verbose debug
62 #define DBG_PCDV (0x40)
63 /** When debug level has the DBG_HCD bit set, display Host debug messages */
65 /** When debug level has the DBG_HCDV bit set, display Verbose Host debug
67 #define DBG_HCDV (0x80)
68 /** When debug level has the DBG_HCD_URB bit set, display enqueued URBs in host
70 #define DBG_HCD_URB (0x800)
72 /** When debug level has any bit set, display debug messages */
73 #define DBG_ANY (0xFF)
75 /** All debug messages off */
78 /** Prefix string for DWC_DEBUG print macros. */
79 #define USB_DWC "DWC_otg: "
82 * Print a debug message when the Global debug level variable contains
83 * the bit defined in <code>lvl</code>.
85 * @param[in] lvl - Debug level, use one of the DBG_ constants above.
86 * @param[in] x - like printf
90 * DWC_DEBUGPL( DBG_ANY, "%s(%p)\n", __func__, _reg_base_addr);
95 * usb-DWC_otg: dwc_otg_cil_init(ca867000)
100 # define DWC_DEBUGPL(lvl, x...) do { if ((lvl)&g_dbg_lvl)__DWC_DEBUG(USB_DWC x); } while (0)
101 # define DWC_DEBUGP(x...) DWC_DEBUGPL(DBG_ANY, x)
103 # define CHK_DEBUG_LEVEL(level) ((level) & g_dbg_lvl)
107 # define DWC_DEBUGPL(lvl, x...) do {} while (0)
108 # define DWC_DEBUGP(x...)
110 # define CHK_DEBUG_LEVEL(level) (0)