1 /* ==========================================================================
2  *
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.
6  *
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.
16  *
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
27  * DAMAGE.
28  * ========================================================================== */
29 
30 #ifndef __DWC_OTG_DBG_H__
31 #define __DWC_OTG_DBG_H__
32 #include "section_config.h"
33 
34 #define OTGDEBUG    1
35 #define VERBOSE     1
36 
37 /** @file
38  * This file defines debug levels.
39  * Debugging support vanishes in non-debug builds.
40  */
41 
42 /**
43  * The Debug Level bit-mask variable.
44  */
45 extern uint32_t g_dbg_lvl;
46 /**
47  * Set the Debug Level variable.
48  */
49 extern _LONG_CALL_ uint32_t SET_DEBUG_LEVEL(const uint32_t new);
50 
51 /** When debug level has the DBG_CIL bit set, display CIL Debug messages. */
52 #define DBG_CIL		(0x2)
53 /** When debug level has the DBG_CILV bit set, display CIL Verbose debug
54  * messages */
55 #define DBG_CILV	(0x20)
56 /**  When debug level has the DBG_PCD bit set, display PCD (Device) debug
57  *  messages */
58 #define DBG_PCD		(0x4)
59 /** When debug level has the DBG_PCDV set, display PCD (Device) Verbose debug
60  * messages */
61 #define DBG_PCDV	(0x40)
62 /** When debug level has the DBG_HCD bit set, display Host debug messages */
63 #define DBG_HCD		(0x8)
64 /** When debug level has the DBG_HCDV bit set, display Verbose Host debug
65  * messages */
66 #define DBG_HCDV	(0x80)
67 /** When debug level has the DBG_HCD_URB bit set, display enqueued URBs in host
68  *  mode. */
69 #define DBG_HCD_URB	(0x800)
70 
71 /** When debug level has any bit set, display debug messages */
72 #define DBG_ANY		(0xFF)
73 
74 /** All debug messages off */
75 #define DBG_OFF		0
76 
77 /** Prefix string for DWC_DEBUG print macros. */
78 #define USB_DWC "DWC_otg: "
79 
80 /**
81  * Print a debug message when the Global debug level variable contains
82  * the bit defined in <code>lvl</code>.
83  *
84  * @param[in] lvl - Debug level, use one of the DBG_ constants above.
85  * @param[in] x - like printf
86  *
87  *    Example:<p>
88  * <code>
89  *      DWC_DEBUGPL( DBG_ANY, "%s(%p)\n", __func__, _reg_base_addr);
90  * </code>
91  * <br>
92  * results in:<br>
93  * <code>
94  * usb-DWC_otg: dwc_otg_cil_init(ca867000)
95  * </code>
96  */
97 #ifdef OTGDEBUG
98 
99 //# define DWC_DEBUGPL(lvl, x...) do{ if ((lvl)&g_dbg_lvl)__DWC_DEBUG(USB_DWC x ); }while(0)
100 # define DWC_DEBUGPL(lvl, x...) do{ if ((lvl)&g_dbg_lvl)DBG_8195A_OTG(x); }while(0)
101 
102 # define DWC_DEBUGP(x...)	DWC_DEBUGPL(DBG_ANY, x )
103 
104 # define CHK_DEBUG_LEVEL(level) ((level) & g_dbg_lvl)
105 
106 #else
107 
108 # define DWC_DEBUGPL(lvl, x...) do{}while(0)
109 # define DWC_DEBUGP(x...)
110 
111 # define CHK_DEBUG_LEVEL(level) (0)
112 
113 #endif /*DEBUG*/
114 #endif
115