dbglog_host.h 5.0 KB

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