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