dwc_otg_dbg.h 3.9 KB

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