1
2
3
4
5
6
7 #ifndef __RTW_DEBUG_H__
8 #define __RTW_DEBUG_H__
9
10 #include <linux/trace_seq.h>
11
12 #define _drv_always_ 1
13 #define _drv_emerg_ 2
14 #define _drv_alert_ 3
15 #define _drv_crit_ 4
16 #define _drv_err_ 5
17 #define _drv_warning_ 6
18 #define _drv_notice_ 7
19 #define _drv_info_ 8
20 #define _drv_dump_ 9
21 #define _drv_debug_ 10
22
23
24 #define _module_rtl871x_xmit_c_ BIT(0)
25 #define _module_xmit_osdep_c_ BIT(1)
26 #define _module_rtl871x_recv_c_ BIT(2)
27 #define _module_recv_osdep_c_ BIT(3)
28 #define _module_rtl871x_mlme_c_ BIT(4)
29 #define _module_mlme_osdep_c_ BIT(5)
30 #define _module_rtl871x_sta_mgt_c_ BIT(6)
31 #define _module_rtl871x_cmd_c_ BIT(7)
32 #define _module_cmd_osdep_c_ BIT(8)
33 #define _module_rtl871x_io_c_ BIT(9)
34 #define _module_io_osdep_c_ BIT(10)
35 #define _module_os_intfs_c_ BIT(11)
36 #define _module_rtl871x_security_c_ BIT(12)
37 #define _module_rtl871x_eeprom_c_ BIT(13)
38 #define _module_hal_init_c_ BIT(14)
39 #define _module_hci_hal_init_c_ BIT(15)
40 #define _module_rtl871x_ioctl_c_ BIT(16)
41 #define _module_rtl871x_ioctl_set_c_ BIT(17)
42 #define _module_rtl871x_ioctl_query_c_ BIT(18)
43 #define _module_rtl871x_pwrctrl_c_ BIT(19)
44 #define _module_hci_intfs_c_ BIT(20)
45 #define _module_hci_ops_c_ BIT(21)
46 #define _module_osdep_service_c_ BIT(22)
47 #define _module_mp_ BIT(23)
48 #define _module_hci_ops_os_c_ BIT(24)
49 #define _module_rtl871x_ioctl_os_c BIT(25)
50 #define _module_rtl8712_cmd_c_ BIT(26)
51
52 #define _module_rtl8192c_xmit_c_ BIT(28)
53 #define _module_hal_xmit_c_ BIT(28)
54 #define _module_efuse_ BIT(29)
55 #define _module_rtl8712_recv_c_ BIT(30)
56 #define _module_rtl8712_led_c_ BIT(31)
57
58 #undef _MODULE_DEFINE_
59
60 #if defined _RTW_XMIT_C_
61 #define _MODULE_DEFINE_ _module_rtl871x_xmit_c_
62 #elif defined _XMIT_OSDEP_C_
63 #define _MODULE_DEFINE_ _module_xmit_osdep_c_
64 #elif defined _RTW_RECV_C_
65 #define _MODULE_DEFINE_ _module_rtl871x_recv_c_
66 #elif defined _RECV_OSDEP_C_
67 #define _MODULE_DEFINE_ _module_recv_osdep_c_
68 #elif defined _RTW_MLME_C_
69 #define _MODULE_DEFINE_ _module_rtl871x_mlme_c_
70 #elif defined _MLME_OSDEP_C_
71 #define _MODULE_DEFINE_ _module_mlme_osdep_c_
72 #elif defined _RTW_MLME_EXT_C_
73 #define _MODULE_DEFINE_ 1
74 #elif defined _RTW_STA_MGT_C_
75 #define _MODULE_DEFINE_ _module_rtl871x_sta_mgt_c_
76 #elif defined _RTW_CMD_C_
77 #define _MODULE_DEFINE_ _module_rtl871x_cmd_c_
78 #elif defined _CMD_OSDEP_C_
79 #define _MODULE_DEFINE_ _module_cmd_osdep_c_
80 #elif defined _RTW_IO_C_
81 #define _MODULE_DEFINE_ _module_rtl871x_io_c_
82 #elif defined _IO_OSDEP_C_
83 #define _MODULE_DEFINE_ _module_io_osdep_c_
84 #elif defined _OS_INTFS_C_
85 #define _MODULE_DEFINE_ _module_os_intfs_c_
86 #elif defined _RTW_SECURITY_C_
87 #define _MODULE_DEFINE_ _module_rtl871x_security_c_
88 #elif defined _RTW_EEPROM_C_
89 #define _MODULE_DEFINE_ _module_rtl871x_eeprom_c_
90 #elif defined _HAL_INTF_C_
91 #define _MODULE_DEFINE_ _module_hal_init_c_
92 #elif (defined _HCI_HAL_INIT_C_) || (defined _SDIO_HALINIT_C_)
93 #define _MODULE_DEFINE_ _module_hci_hal_init_c_
94 #elif defined _RTL871X_IOCTL_C_
95 #define _MODULE_DEFINE_ _module_rtl871x_ioctl_c_
96 #elif defined _RTL871X_IOCTL_SET_C_
97 #define _MODULE_DEFINE_ _module_rtl871x_ioctl_set_c_
98 #elif defined _RTL871X_IOCTL_QUERY_C_
99 #define _MODULE_DEFINE_ _module_rtl871x_ioctl_query_c_
100 #elif defined _RTL871X_PWRCTRL_C_
101 #define _MODULE_DEFINE_ _module_rtl871x_pwrctrl_c_
102 #elif defined _RTW_PWRCTRL_C_
103 #define _MODULE_DEFINE_ 1
104 #elif defined _HCI_INTF_C_
105 #define _MODULE_DEFINE_ _module_hci_intfs_c_
106 #elif defined _HCI_OPS_C_
107 #define _MODULE_DEFINE_ _module_hci_ops_c_
108 #elif defined _SDIO_OPS_C_
109 #define _MODULE_DEFINE_ 1
110 #elif defined _OSDEP_HCI_INTF_C_
111 #define _MODULE_DEFINE_ _module_hci_intfs_c_
112 #elif defined _OSDEP_SERVICE_C_
113 #define _MODULE_DEFINE_ _module_osdep_service_c_
114 #elif defined _HCI_OPS_OS_C_
115 #define _MODULE_DEFINE_ _module_hci_ops_os_c_
116 #elif defined _RTL871X_IOCTL_LINUX_C_
117 #define _MODULE_DEFINE_ _module_rtl871x_ioctl_os_c
118 #elif defined _RTL8712_CMD_C_
119 #define _MODULE_DEFINE_ _module_rtl8712_cmd_c_
120 #elif defined _RTL8192C_XMIT_C_
121 #define _MODULE_DEFINE_ 1
122 #elif defined _RTL8723AS_XMIT_C_
123 #define _MODULE_DEFINE_ 1
124 #elif defined _RTL8712_RECV_C_
125 #define _MODULE_DEFINE_ _module_rtl8712_recv_c_
126 #elif defined _RTL8192CU_RECV_C_
127 #define _MODULE_DEFINE_ _module_rtl8712_recv_c_
128 #elif defined _RTL871X_MLME_EXT_C_
129 #define _MODULE_DEFINE_ _module_mlme_osdep_c_
130 #elif defined _RTW_EFUSE_C_
131 #define _MODULE_DEFINE_ _module_efuse_
132 #endif
133
134 #define RT_TRACE(_Comp, _Level, Fmt) do{}while (0)
135 #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) do{}while (0)
136
137 #define DBG_871X(x, ...) do {} while (0)
138 #define MSG_8192C(x, ...) do {} while (0)
139 #define DBG_8192C(x,...) do {} while (0)
140 #define DBG_871X_LEVEL(x,...) do {} while (0)
141
142 #undef _dbgdump
143
144 #ifndef _RTL871X_DEBUG_C_
145 extern u32 GlobalDebugLevel;
146 extern u64 GlobalDebugComponents;
147 #endif
148
149 #define _dbgdump printk
150
151 #define DRIVER_PREFIX "RTL8723BS: "
152
153 #if defined(_dbgdump)
154
155
156 #undef DBG_871X_LEVEL
157 #define DBG_871X_LEVEL(level, fmt, arg...) \
158 do {\
159 if (level <= GlobalDebugLevel) {\
160 if (level <= _drv_err_ && level > _drv_always_) \
161 _dbgdump(DRIVER_PREFIX"ERROR " fmt, ##arg);\
162 else \
163 _dbgdump(DRIVER_PREFIX fmt, ##arg);\
164 }\
165 }while (0)
166
167
168 #undef _DBG_871X_LEVEL
169 #define _DBG_871X_LEVEL(level, fmt, arg...) \
170 do {\
171 if (level <= GlobalDebugLevel) {\
172 if (level <= _drv_err_ && level > _drv_always_) \
173 _dbgdump("ERROR " fmt, ##arg);\
174 else \
175 _dbgdump(fmt, ##arg);\
176 }\
177 }while (0)
178
179 #define RTW_DBGDUMP NULL
180
181
182 #define DBG_871X_SEL(sel, fmt, arg...) \
183 do { \
184 if (sel == RTW_DBGDUMP) \
185 _DBG_871X_LEVEL(_drv_always_, fmt, ##arg); \
186 else \
187 seq_printf(sel, fmt, ##arg); \
188 } while (0)
189
190
191 #define DBG_871X_SEL_NL(sel, fmt, arg...) \
192 do { \
193 if (sel == RTW_DBGDUMP) \
194 DBG_871X_LEVEL(_drv_always_, fmt, ##arg); \
195 else \
196 seq_printf(sel, fmt, ##arg); \
197 } while (0)
198
199 #endif
200
201 #ifdef DEBUG
202 #if defined(_dbgdump)
203 #undef DBG_871X
204 #define DBG_871X(...) do {\
205 _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
206 }while (0)
207
208 #undef MSG_8192C
209 #define MSG_8192C(...) do {\
210 _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
211 }while (0)
212
213 #undef DBG_8192C
214 #define DBG_8192C(...) do {\
215 _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
216 }while (0)
217 #endif
218 #endif
219
220 #ifdef DEBUG_RTL871X
221
222 #if defined(_dbgdump) && defined(_MODULE_DEFINE_)
223
224 #undef RT_TRACE
225 #define RT_TRACE(_Comp, _Level, Fmt)\
226 do {\
227 if ((_Comp & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) {\
228 _dbgdump("%s [0x%08x,%d]", DRIVER_PREFIX, (unsigned int)_Comp, _Level);\
229 _dbgdump Fmt;\
230 }\
231 }while (0)
232
233 #endif
234
235
236 #if defined(_dbgdump)
237 #undef RT_PRINT_DATA
238 #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
239 if (((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
240 { \
241 int __i; \
242 u8 *ptr = (u8 *)_HexData; \
243 _dbgdump("%s", DRIVER_PREFIX); \
244 _dbgdump(_TitleString); \
245 for (__i = 0; __i<(int)_HexDataLen; __i++) \
246 { \
247 _dbgdump("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" "); \
248 if (((__i + 1) % 16) == 0) _dbgdump("\n"); \
249 } \
250 _dbgdump("\n"); \
251 }
252 #endif
253 #endif
254
255 #ifdef CONFIG_DBG_COUNTER
256 #define DBG_COUNTER(counter) counter++
257 #else
258 #define DBG_COUNTER(counter) do {} while (0)
259 #endif
260
261 void dump_drv_version(void *sel);
262 void dump_log_level(void *sel);
263
264 void sd_f0_reg_dump(void *sel, struct adapter *adapter);
265
266 void mac_reg_dump(void *sel, struct adapter *adapter);
267 void bb_reg_dump(void *sel, struct adapter *adapter);
268 void rf_reg_dump(void *sel, struct adapter *adapter);
269
270 #endif