halrf_debug.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2017 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. *****************************************************************************/
  25. #ifndef __HALRF_DEBUG_H__
  26. #define __HALRF_DEBUG_H__
  27. /*============================================================*/
  28. /*include files*/
  29. /*============================================================*/
  30. /*============================================================*/
  31. /*Definition */
  32. /*============================================================*/
  33. #if DBG
  34. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  35. #define RF_DBG(dm, comp, fmt, args...) \
  36. do { \
  37. if ((comp) & dm->rf_table.rf_dbg_comp) { \
  38. pr_debug("[RF] "); \
  39. RT_PRINTK(fmt, ##args); \
  40. } \
  41. } while (0)
  42. #elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  43. static __inline void RF_DBG(PDM_ODM_T dm, int comp, char *fmt, ...)
  44. {
  45. RT_STATUS rt_status;
  46. va_list args;
  47. char buf[PRINT_MAX_SIZE] = {0};
  48. if ((comp & dm->rf_table.rf_dbg_comp) == 0)
  49. return;
  50. if (fmt == NULL)
  51. return;
  52. va_start(args, fmt);
  53. rt_status = (RT_STATUS)RtlStringCbVPrintfA(buf, PRINT_MAX_SIZE, fmt, args);
  54. va_end(args);
  55. if (rt_status != RT_STATUS_SUCCESS) {
  56. DbgPrint("Failed (%d) to print message to buffer\n", rt_status);
  57. return;
  58. }
  59. DbgPrint("[RF] %s", buf);
  60. }
  61. #elif (DM_ODM_SUPPORT_TYPE == ODM_IOT)
  62. #define RF_DBG(dm, comp, fmt, args...) \
  63. do { \
  64. if ((comp) & dm->rf_table.rf_dbg_comp) { \
  65. RT_DEBUG(COMP_PHYDM, DBG_DMESG, "[RF] " fmt, ##args); \
  66. } \
  67. } while (0)
  68. #else
  69. #define RF_DBG(dm, comp, fmt, args...) \
  70. do { \
  71. struct dm_struct *__dm = dm; \
  72. if ((comp) & __dm->rf_table.rf_dbg_comp) { \
  73. RT_TRACE(((struct rtl_priv *)__dm->adapter), \
  74. COMP_PHYDM, DBG_DMESG, "[RF] " fmt, ##args); \
  75. } \
  76. } while (0)
  77. #endif
  78. #else /*#if DBG*/
  79. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  80. static __inline void RF_DBG(struct dm_struct *dm, int comp, char *fmt, ...)
  81. {
  82. }
  83. #else
  84. #define RF_DBG(dm, comp, fmt, args...)
  85. #endif
  86. #endif /*#if DBG*/
  87. /*============================================================*/
  88. /* enumeration */
  89. /*============================================================*/
  90. /*============================================================*/
  91. /* structure */
  92. /*============================================================*/
  93. /*============================================================*/
  94. /* function prototype */
  95. /*============================================================*/
  96. void halrf_cmd_parser(void *dm_void, char input[][16], u32 *_used, char *output,
  97. u32 *_out_len, u32 input_num);
  98. void halrf_init_debug_setting(void *dm_void);
  99. #endif /*#ifndef __HALRF_H__*/