0001
0002
0003
0004
0005 #ifndef __RTW89_DEBUG_H__
0006 #define __RTW89_DEBUG_H__
0007
0008 #include "core.h"
0009
0010 enum rtw89_debug_mask {
0011 RTW89_DBG_TXRX = BIT(0),
0012 RTW89_DBG_RFK = BIT(1),
0013 RTW89_DBG_RFK_TRACK = BIT(2),
0014 RTW89_DBG_CFO = BIT(3),
0015 RTW89_DBG_TSSI = BIT(4),
0016 RTW89_DBG_TXPWR = BIT(5),
0017 RTW89_DBG_HCI = BIT(6),
0018 RTW89_DBG_RA = BIT(7),
0019 RTW89_DBG_REGD = BIT(8),
0020 RTW89_DBG_PHY_TRACK = BIT(9),
0021 RTW89_DBG_DIG = BIT(10),
0022 RTW89_DBG_SER = BIT(11),
0023 RTW89_DBG_FW = BIT(12),
0024 RTW89_DBG_BTC = BIT(13),
0025 RTW89_DBG_BF = BIT(14),
0026 RTW89_DBG_HW_SCAN = BIT(15),
0027 RTW89_DBG_SAR = BIT(16),
0028
0029 RTW89_DBG_UNEXP = BIT(31),
0030 };
0031
0032 enum rtw89_debug_mac_reg_sel {
0033 RTW89_DBG_SEL_MAC_00,
0034 RTW89_DBG_SEL_MAC_30,
0035 RTW89_DBG_SEL_MAC_40,
0036 RTW89_DBG_SEL_MAC_80,
0037 RTW89_DBG_SEL_MAC_C0,
0038 RTW89_DBG_SEL_MAC_E0,
0039 RTW89_DBG_SEL_BB,
0040 RTW89_DBG_SEL_IQK,
0041 RTW89_DBG_SEL_RFC,
0042 };
0043
0044 #ifdef CONFIG_RTW89_DEBUGFS
0045 void rtw89_debugfs_init(struct rtw89_dev *rtwdev);
0046 #else
0047 static inline void rtw89_debugfs_init(struct rtw89_dev *rtwdev) {}
0048 #endif
0049
0050 #define rtw89_info(rtwdev, a...) dev_info((rtwdev)->dev, ##a)
0051 #define rtw89_warn(rtwdev, a...) dev_warn((rtwdev)->dev, ##a)
0052 #define rtw89_err(rtwdev, a...) dev_err((rtwdev)->dev, ##a)
0053
0054 #ifdef CONFIG_RTW89_DEBUGMSG
0055 extern unsigned int rtw89_debug_mask;
0056 #define rtw89_debug(rtwdev, a...) __rtw89_debug(rtwdev, ##a)
0057
0058 __printf(3, 4)
0059 void __rtw89_debug(struct rtw89_dev *rtwdev,
0060 enum rtw89_debug_mask mask,
0061 const char *fmt, ...);
0062 static inline void rtw89_hex_dump(struct rtw89_dev *rtwdev,
0063 enum rtw89_debug_mask mask,
0064 const char *prefix_str,
0065 const void *buf, size_t len)
0066 {
0067 if (!(rtw89_debug_mask & mask))
0068 return;
0069
0070 print_hex_dump_bytes(prefix_str, DUMP_PREFIX_OFFSET, buf, len);
0071 }
0072 #else
0073 static inline void rtw89_debug(struct rtw89_dev *rtwdev,
0074 enum rtw89_debug_mask mask,
0075 const char *fmt, ...) {}
0076 static inline void rtw89_hex_dump(struct rtw89_dev *rtwdev,
0077 enum rtw89_debug_mask mask,
0078 const char *prefix_str,
0079 const void *buf, size_t len) {}
0080 #endif
0081
0082 #endif