debug.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2012 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * The full GNU General Public License is included in this distribution in the
  15. * file called LICENSE.
  16. *
  17. * Contact Information:
  18. * wlanfae <wlanfae@realtek.com>
  19. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  20. * Hsinchu 300, Taiwan.
  21. *
  22. * Larry Finger <Larry.Finger@lwfinger.net>
  23. *****************************************************************************/
  24. #ifndef __RTL_DEBUG_H__
  25. #define __RTL_DEBUG_H__
  26. /*--------------------------------------------------------------
  27. Debug level
  28. --------------------------------------------------------------*/
  29. /*
  30. *Fatal bug.
  31. *For example, Tx/Rx/IO locked up,
  32. *memory access violation,
  33. *resource allocation failed,
  34. *unexpected HW behavior, HW BUG
  35. *and so on.
  36. */
  37. /*#define DBG_EMERG 0 */
  38. /*
  39. *Abnormal, rare, or unexpeted cases.
  40. *For example, Packet/IO Ctl canceled,
  41. *device suprisely unremoved and so on.
  42. */
  43. #define DBG_WARNING 2
  44. /*
  45. *Normal case driver developer should
  46. *open, we can see link status like
  47. *assoc/AddBA/DHCP/adapter start and
  48. *so on basic and useful infromations.
  49. */
  50. #define DBG_DMESG 3
  51. /*
  52. *Normal case with useful information
  53. *about current SW or HW state.
  54. *For example, Tx/Rx descriptor to fill,
  55. *Tx/Rx descriptor completed status,
  56. *SW protocol state change, dynamic
  57. *mechanism state change and so on.
  58. */
  59. #define DBG_LOUD 4
  60. /*
  61. *Normal case with detail execution
  62. *flow or information.
  63. */
  64. #define DBG_TRACE 5
  65. /*--------------------------------------------------------------
  66. Define the rt_trace components
  67. --------------------------------------------------------------*/
  68. #define COMP_ERR BIT(0)
  69. #define COMP_FW BIT(1)
  70. #define COMP_INIT BIT(2) /*For init/deinit */
  71. #define COMP_RECV BIT(3) /*For Rx. */
  72. #define COMP_SEND BIT(4) /*For Tx. */
  73. #define COMP_MLME BIT(5) /*For MLME. */
  74. #define COMP_SCAN BIT(6) /*For Scan. */
  75. #define COMP_INTR BIT(7) /*For interrupt Related. */
  76. #define COMP_LED BIT(8) /*For LED. */
  77. #define COMP_SEC BIT(9) /*For sec. */
  78. #define COMP_BEACON BIT(10) /*For beacon. */
  79. #define COMP_RATE BIT(11) /*For rate. */
  80. #define COMP_RXDESC BIT(12) /*For rx desc. */
  81. #define COMP_DIG BIT(13) /*For DIG */
  82. #define COMP_TXAGC BIT(14) /*For Tx power */
  83. #define COMP_HIPWR BIT(15) /*For High Power Mechanism */
  84. #define COMP_POWER BIT(16) /*For lps/ips/aspm. */
  85. #define COMP_POWER_TRACKING BIT(17) /*For TX POWER TRACKING */
  86. #define COMP_BB_POWERSAVING BIT(18)
  87. #define COMP_SWAS BIT(19) /*For SW Antenna Switch */
  88. #define COMP_RF BIT(20) /*For RF. */
  89. #define COMP_TURBO BIT(21) /*For EDCA TURBO. */
  90. #define COMP_RATR BIT(22)
  91. #define COMP_CMD BIT(23)
  92. #define COMP_EFUSE BIT(24)
  93. #define COMP_QOS BIT(25)
  94. #define COMP_MAC80211 BIT(26)
  95. #define COMP_REGD BIT(27)
  96. #define COMP_CHAN BIT(28)
  97. #define COMP_USB BIT(29)
  98. #define COMP_EASY_CONCURRENT COMP_USB /* reuse of this bit is OK */
  99. #define COMP_BT_COEXIST BIT(30)
  100. #define COMP_IQK BIT(31)
  101. /*--------------------------------------------------------------
  102. Define the rt_print components
  103. --------------------------------------------------------------*/
  104. /* Define EEPROM and EFUSE check module bit*/
  105. #define EEPROM_W BIT(0)
  106. #define EFUSE_PG BIT(1)
  107. #define EFUSE_READ_ALL BIT(2)
  108. /* Define init check for module bit*/
  109. #define INIT_EEPROM BIT(0)
  110. #define INIT_TXPOWER BIT(1)
  111. #define INIT_IQK BIT(2)
  112. #define INIT_RF BIT(3)
  113. /* Define PHY-BB/RF/MAC check module bit */
  114. #define PHY_BBR BIT(0)
  115. #define PHY_BBW BIT(1)
  116. #define PHY_RFR BIT(2)
  117. #define PHY_RFW BIT(3)
  118. #define PHY_MACR BIT(4)
  119. #define PHY_MACW BIT(5)
  120. #define PHY_ALLR BIT(6)
  121. #define PHY_ALLW BIT(7)
  122. #define PHY_TXPWR BIT(8)
  123. #define PHY_PWRDIFF BIT(9)
  124. /* Define Dynamic Mechanism check module bit --> FDM */
  125. #define WA_IOT BIT(0)
  126. #define DM_PWDB BIT(1)
  127. #define DM_MONITOR BIT(2)
  128. #define DM_DIG BIT(3)
  129. #define DM_EDCA_TURBO BIT(4)
  130. #define DM_PWDB BIT(1)
  131. enum dbgp_flag_e {
  132. FQOS = 0,
  133. FTX = 1,
  134. FRX = 2,
  135. FSEC = 3,
  136. FMGNT = 4,
  137. FMLME = 5,
  138. FRESOURCE = 6,
  139. FBEACON = 7,
  140. FISR = 8,
  141. FPHY = 9,
  142. FMP = 10,
  143. FEEPROM = 11,
  144. FPWR = 12,
  145. FDM = 13,
  146. FDBGCtrl = 14,
  147. FC2H = 15,
  148. FBT = 16,
  149. FINIT = 17,
  150. FIOCTL = 18,
  151. DBGP_TYPE_MAX
  152. };
  153. #ifdef CONFIG_RTLWIFI_DEBUG
  154. struct rtl_priv;
  155. __printf(4, 5)
  156. void _rtl_dbg_trace(struct rtl_priv *rtlpriv, int comp, int level,
  157. const char *fmt, ...);
  158. __printf(4, 5)
  159. void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
  160. const char *fmt, ...);
  161. void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
  162. const char *titlestring,
  163. const void *hexdata, int hexdatalen);
  164. #define RT_TRACE(rtlpriv, comp, level, fmt, ...) \
  165. _rtl_dbg_trace(rtlpriv, comp, level, \
  166. fmt, ##__VA_ARGS__)
  167. #define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...) \
  168. _rtl_dbg_print(rtlpriv, dbgtype, dbgflag, fmt, ##__VA_ARGS__)
  169. #define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata, \
  170. _hexdatalen) \
  171. _rtl_dbg_print_data(rtlpriv, _comp, _level, \
  172. _titlestring, _hexdata, _hexdatalen)
  173. #else
  174. struct rtl_priv;
  175. __printf(4, 5)
  176. static inline void RT_TRACE(struct rtl_priv *rtlpriv,
  177. int comp, int level,
  178. const char *fmt, ...)
  179. {
  180. }
  181. __printf(4, 5)
  182. static inline void RTPRINT(struct rtl_priv *rtlpriv,
  183. int dbgtype, int dbgflag,
  184. const char *fmt, ...)
  185. {
  186. }
  187. static inline void RT_PRINT_DATA(struct rtl_priv *rtlpriv,
  188. int comp, int level,
  189. const char *titlestring,
  190. const void *hexdata, size_t hexdatalen)
  191. {
  192. }
  193. #endif
  194. #endif