dbglog_host.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. * Copyright (c) 2011, 2014-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifndef _DBGLOG_HOST_H_
  27. #define _DBGLOG_HOST_H_
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #include "dbglog_common.h"
  32. #include "ol_defines.h"
  33. #define DIAG_FWID_OFFSET 24
  34. #define DIAG_FWID_MASK 0xFF000000 /* Bit 24-31 */
  35. #define DIAG_TIMESTAMP_OFFSET 0
  36. #define DIAG_TIMESTAMP_MASK 0x00FFFFFF /* Bit 0-23 */
  37. #define DIAG_ID_OFFSET 16
  38. #define DIAG_ID_MASK 0xFFFF0000 /* Bit 16-31 */
  39. #define DIAG_VDEVID_OFFSET 11
  40. #define DIAG_VDEVID_MASK 0x0000F800 /* Bit 11-15 */
  41. #define DIAG_VDEVID_NUM_MAX 16
  42. #define DIAG_VDEVLEVEL_OFFSET 8
  43. #define DIAG_VDEVLEVEL_MASK 0x00000700 /* Bit 8-10 */
  44. #define DIAG_PAYLEN_OFFSET 0
  45. #define DIAG_PAYLEN_MASK 0x000000FF /* Bit 0-7 */
  46. #define DIAG_PAYLEN_OFFSET16 0
  47. #define DIAG_PAYLEN_MASK16 0x0000FFFF /* Bit 0-16 */
  48. #define DIAG_GET_TYPE(arg) \
  49. ((arg & DIAG_FWID_MASK) >> DIAG_FWID_OFFSET)
  50. #define DIAG_GET_TIME_STAMP(arg) \
  51. ((arg & DIAG_TIMESTAMP_MASK) >> DIAG_TIMESTAMP_OFFSET)
  52. #define DIAG_GET_ID(arg) \
  53. ((arg & DIAG_ID_MASK) >> DIAG_ID_OFFSET)
  54. #define DIAG_GET_VDEVID(arg) \
  55. ((arg & DIAG_VDEVID_MASK) >> DIAG_VDEVID_OFFSET)
  56. #define DIAG_GET_VDEVLEVEL(arg) \
  57. ((arg & DIAG_VDEVLEVEL_MASK) >> DIAG_VDEVLEVEL_OFFSET)
  58. #define DIAG_GET_PAYLEN(arg) \
  59. ((arg & DIAG_PAYLEN_MASK) >> DIAG_PAYLEN_OFFSET)
  60. #define DIAG_GET_PAYLEN16(arg) \
  61. ((arg & DIAG_PAYLEN_MASK16) >> DIAG_PAYLEN_OFFSET16)
  62. /*
  63. * set the dbglog parser type
  64. */int
  65. dbglog_parser_type_init(wmi_unified_t wmi_handle, int type);
  66. /** dbglog_int - Registers a WMI event handle for WMI_DBGMSG_EVENT
  67. * @brief wmi_handle - handle to wmi module
  68. */
  69. int
  70. dbglog_init(wmi_unified_t wmi_handle);
  71. /** dbglog_deinit - UnRegisters a WMI event handle for WMI_DBGMSG_EVENT
  72. * @brief wmi_handle - handle to wmi module
  73. */
  74. int
  75. dbglog_deinit(wmi_unified_t wmi_handle);
  76. /** set the size of the report size
  77. * @brief wmi_handle - handle to Wmi module
  78. * @brief size - Report size
  79. */
  80. int
  81. dbglog_set_report_size(wmi_unified_t wmi_handle, A_UINT16 size);
  82. /** Set the resolution for time stamp
  83. * @brief wmi_handle - handle to Wmi module
  84. * @ brief tsr - time stamp resolution
  85. */
  86. int
  87. dbglog_set_timestamp_resolution(wmi_unified_t wmi_handle,
  88. A_UINT16 tsr);
  89. /** Enable reporting. If it is set to false then Traget wont deliver
  90. * any debug information
  91. */
  92. int
  93. dbglog_report_enable(wmi_unified_t wmi_handle, A_BOOL isenable);
  94. #ifdef CONFIG_MCL
  95. /*
  96. * enum DBGLOG_LOG_LVL is not converged between WIN and MCL.
  97. * So this function declaration needs to be disabled from WIN side.
  98. */
  99. /** Set the log level
  100. * @brief DBGLOG_INFO - Information lowest log level
  101. * @brief DBGLOG_WARNING
  102. * @brief DBGLOG_ERROR - default log level
  103. */
  104. int
  105. dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl);
  106. #endif
  107. /*
  108. * set the debug log level for a given module
  109. * mod_id_lvl : the format is more user friendly.
  110. * module_id = mod_id_lvl/10;
  111. * log_level = mod_id_lvl%10;
  112. * example : mod_id_lvl is 153. then module id is 15 and log level is 3.
  113. * this format allows user to pass a sinlge value
  114. * (which is the most convenient way for most of the OSs)
  115. * to be passed from user to the driver.
  116. */
  117. int
  118. dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, A_UINT32 mod_id_lvl);
  119. /** Enable/Disable the logging for VAP */
  120. int
  121. dbglog_vap_log_enable(wmi_unified_t wmi_handle, A_UINT16 vap_id,
  122. A_BOOL isenable);
  123. /** Enable/Disable logging for Module */
  124. int
  125. dbglog_module_log_enable(wmi_unified_t wmi_handle, A_UINT32 mod_id,
  126. A_BOOL isenable);
  127. /** set vap enablie bitmap */
  128. void
  129. dbglog_set_vap_enable_bitmap(wmi_unified_t wmi_handle,
  130. A_UINT32 vap_enable_bitmap);
  131. /** set log level for all the modules specified in the bitmap.
  132. * for all other modules with 0 in the bitmap (or) outside the bitmap,
  133. * the log level be reset to DBGLOG_ERR.
  134. */
  135. void
  136. dbglog_set_mod_enable_bitmap(wmi_unified_t wmi_handle,
  137. A_UINT32 log_level,
  138. A_UINT32 *mod_enable_bitmap,
  139. A_UINT32 bitmap_len);
  140. int
  141. dbglog_parse_debug_logs(ol_scn_t scn, u_int8_t *datap,
  142. u_int32_t len);
  143. /** Register the cnss_diag activate with the wlan driver */
  144. int cnss_diag_activate_service(void);
  145. #ifdef __cplusplus
  146. }
  147. #endif
  148. #endif /* _DBGLOG_HOST_H_ */