odm_debug.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  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. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #ifndef __ODM_DBG_H__
  21. #define __ODM_DBG_H__
  22. /* */
  23. /* Define the debug levels */
  24. /* */
  25. /* 1. DBG_TRACE and DBG_LOUD are used for normal cases. */
  26. /* They can help SW engineer to develop or trace states changed */
  27. /* and also help HW enginner to trace every operation to and from HW, */
  28. /* e.g IO, Tx, Rx. */
  29. /* */
  30. /* 2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases, */
  31. /* which help us to debug SW or HW. */
  32. /* Never used in a call to ODM_RT_TRACE()! */
  33. #define ODM_DBG_OFF 1
  34. /* Fatal bug. */
  35. /* For example, Tx/Rx/IO locked up, OS hangs, memory access violation, */
  36. /* resource allocation failed, unexpected HW behavior, HW BUG and so on. */
  37. #define ODM_DBG_SERIOUS 2
  38. /* Abnormal, rare, or unexpeted cases. */
  39. /* For example, IRP/Packet/OID canceled, device suprisely unremoved and so on. */
  40. #define ODM_DBG_WARNING 3
  41. /* Normal case with useful information about current SW or HW state. */
  42. /* For example, Tx/Rx descriptor to fill, Tx/Rx descr. completed status, */
  43. /* SW protocol state change, dynamic mechanism state change and so on. */
  44. /* */
  45. #define ODM_DBG_LOUD 4
  46. /* Normal case with detail execution flow or information. */
  47. #define ODM_DBG_TRACE 5
  48. /* Define the tracing components */
  49. /* BB Functions */
  50. #define ODM_COMP_DIG BIT(0)
  51. #define ODM_COMP_RA_MASK BIT(1)
  52. #define ODM_COMP_DYNAMIC_TXPWR BIT(2)
  53. #define ODM_COMP_FA_CNT BIT(3)
  54. #define ODM_COMP_RSSI_MONITOR BIT(4)
  55. #define ODM_COMP_CCK_PD BIT(5)
  56. #define ODM_COMP_ANT_DIV BIT(6)
  57. #define ODM_COMP_PWR_SAVE BIT(7)
  58. #define ODM_COMP_PWR_TRA BIT(8)
  59. #define ODM_COMP_RATE_ADAPTIVE BIT(9)
  60. #define ODM_COMP_PATH_DIV BIT(10)
  61. #define ODM_COMP_PSD BIT(11)
  62. #define ODM_COMP_DYNAMIC_PRICCA BIT(12)
  63. #define ODM_COMP_RXHP BIT(13)
  64. /* MAC Functions */
  65. #define ODM_COMP_EDCA_TURBO BIT(16)
  66. #define ODM_COMP_EARLY_MODE BIT(17)
  67. /* RF Functions */
  68. #define ODM_COMP_TX_PWR_TRACK BIT(24)
  69. #define ODM_COMP_RX_GAIN_TRACK BIT(25)
  70. #define ODM_COMP_CALIBRATION BIT(26)
  71. /* Common Functions */
  72. #define ODM_COMP_COMMON BIT(30)
  73. #define ODM_COMP_INIT BIT(31)
  74. /*------------------------Export Marco Definition---------------------------*/
  75. #define RT_PRINTK(fmt, args...) \
  76. pr_info("%s(): " fmt, __func__, ## args);
  77. #ifndef ASSERT
  78. #define ASSERT(expr)
  79. #endif
  80. #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
  81. if (((comp) & pDM_Odm->DebugComponents) && \
  82. (level <= pDM_Odm->DebugLevel)) { \
  83. pr_info("[ODM-8188E] "); \
  84. RT_PRINTK fmt; \
  85. }
  86. #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
  87. if (!(expr)) { \
  88. pr_info("Assertion failed! %s at ......\n", #expr); \
  89. pr_info(" ......%s,%s,line=%d\n", __FILE__, \
  90. __func__, __LINE__); \
  91. RT_PRINTK fmt; \
  92. ASSERT(false); \
  93. }
  94. void ODM_InitDebugSetting(struct odm_dm_struct *pDM_Odm);
  95. #endif /* __ODM_DBG_H__ */