debug.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* SPDX-License-Identifier: BSD-3-Clause-Clear */
  2. /*
  3. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _ATH12K_DEBUG_H_
  7. #define _ATH12K_DEBUG_H_
  8. #include "trace.h"
  9. enum ath12k_debug_mask {
  10. ATH12K_DBG_AHB = 0x00000001,
  11. ATH12K_DBG_WMI = 0x00000002,
  12. ATH12K_DBG_HTC = 0x00000004,
  13. ATH12K_DBG_DP_HTT = 0x00000008,
  14. ATH12K_DBG_MAC = 0x00000010,
  15. ATH12K_DBG_BOOT = 0x00000020,
  16. ATH12K_DBG_QMI = 0x00000040,
  17. ATH12K_DBG_DATA = 0x00000080,
  18. ATH12K_DBG_MGMT = 0x00000100,
  19. ATH12K_DBG_REG = 0x00000200,
  20. ATH12K_DBG_TESTMODE = 0x00000400,
  21. ATH12K_DBG_HAL = 0x00000800,
  22. ATH12K_DBG_PCI = 0x00001000,
  23. ATH12K_DBG_DP_TX = 0x00002000,
  24. ATH12K_DBG_DP_RX = 0x00004000,
  25. ATH12K_DBG_WOW = 0x00008000,
  26. ATH12K_DBG_CE = 0x00010000,
  27. ATH12K_DBG_ANY = 0xffffffff,
  28. };
  29. __printf(2, 3) void ath12k_info(struct ath12k_base *ab, const char *fmt, ...);
  30. __printf(2, 3) void ath12k_err(struct ath12k_base *ab, const char *fmt, ...);
  31. __printf(2, 3) void ath12k_warn(struct ath12k_base *ab, const char *fmt, ...);
  32. extern unsigned int ath12k_debug_mask;
  33. #ifdef CONFIG_ATH12K_DEBUG
  34. __printf(3, 4) void __ath12k_dbg(struct ath12k_base *ab,
  35. enum ath12k_debug_mask mask,
  36. const char *fmt, ...);
  37. void ath12k_dbg_dump(struct ath12k_base *ab,
  38. enum ath12k_debug_mask mask,
  39. const char *msg, const char *prefix,
  40. const void *buf, size_t len);
  41. #else /* CONFIG_ATH12K_DEBUG */
  42. static inline void __ath12k_dbg(struct ath12k_base *ab,
  43. enum ath12k_debug_mask dbg_mask,
  44. const char *fmt, ...)
  45. {
  46. }
  47. static inline void ath12k_dbg_dump(struct ath12k_base *ab,
  48. enum ath12k_debug_mask mask,
  49. const char *msg, const char *prefix,
  50. const void *buf, size_t len)
  51. {
  52. }
  53. #endif /* CONFIG_ATH12K_DEBUG */
  54. #define ath12k_dbg(ar, dbg_mask, fmt, ...) \
  55. do { \
  56. typeof(dbg_mask) mask = (dbg_mask); \
  57. if (ath12k_debug_mask & mask) \
  58. __ath12k_dbg(ar, mask, fmt, ##__VA_ARGS__); \
  59. } while (0)
  60. #endif /* _ATH12K_DEBUG_H_ */