]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/net/wireless/realtek/rtl8192cu/include/rtw_debug.h
net: Fix rtl8192cu build errors on other platforms
[mirror_ubuntu-artful-kernel.git] / drivers / net / wireless / realtek / rtl8192cu / include / rtw_debug.h
1 /******************************************************************************
2 *
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 *
19 ******************************************************************************/
20 #ifndef __RTW_DEBUG_H__
21 #define __RTW_DEBUG_H__
22
23 #include <drv_conf.h>
24 #include <osdep_service.h>
25 #include <drv_types.h>
26
27
28 #define _no_debug_ 0
29 #define _drv_emerg_ 1
30 #define _drv_alert_ 2
31 #define _drv_crit_ 3
32 #define _drv_err_ 4
33 #define _drv_warning_ 5
34 #define _drv_notice_ 6
35 #define _drv_info_ 7
36 #define _drv_dump_ 8
37 #define _drv_debug_ 9
38 #define _drv_always_ _drv_emerg_
39
40 #define _module_rtl871x_xmit_c_ BIT(0)
41 #define _module_xmit_osdep_c_ BIT(1)
42 #define _module_rtl871x_recv_c_ BIT(2)
43 #define _module_recv_osdep_c_ BIT(3)
44 #define _module_rtl871x_mlme_c_ BIT(4)
45 #define _module_mlme_osdep_c_ BIT(5)
46 #define _module_rtl871x_sta_mgt_c_ BIT(6)
47 #define _module_rtl871x_cmd_c_ BIT(7)
48 #define _module_cmd_osdep_c_ BIT(8)
49 #define _module_rtl871x_io_c_ BIT(9)
50 #define _module_io_osdep_c_ BIT(10)
51 #define _module_os_intfs_c_ BIT(11)
52 #define _module_rtl871x_security_c_ BIT(12)
53 #define _module_rtl871x_eeprom_c_ BIT(13)
54 #define _module_hal_init_c_ BIT(14)
55 #define _module_hci_hal_init_c_ BIT(15)
56 #define _module_rtl871x_ioctl_c_ BIT(16)
57 #define _module_rtl871x_ioctl_set_c_ BIT(17)
58 #define _module_rtl871x_ioctl_query_c_ BIT(18)
59 #define _module_rtl871x_pwrctrl_c_ BIT(19)
60 #define _module_hci_intfs_c_ BIT(20)
61 #define _module_hci_ops_c_ BIT(21)
62 #define _module_osdep_service_c_ BIT(22)
63 #define _module_mp_ BIT(23)
64 #define _module_hci_ops_os_c_ BIT(24)
65 #define _module_rtl871x_ioctl_os_c BIT(25)
66 #define _module_rtl8712_cmd_c_ BIT(26)
67 //#define _module_efuse_ BIT(27)
68 #define _module_rtl8192c_xmit_c_ BIT(28)
69 #define _module_hal_xmit_c_ BIT(28)
70 #define _module_efuse_ BIT(29)
71 #define _module_rtl8712_recv_c_ BIT(30)
72 #define _module_rtl8712_led_c_ BIT(31)
73
74 #undef _MODULE_DEFINE_
75
76 #if defined _RTW_XMIT_C_
77 #define _MODULE_DEFINE_ _module_rtl871x_xmit_c_
78 #elif defined _XMIT_OSDEP_C_
79 #define _MODULE_DEFINE_ _module_xmit_osdep_c_
80 #elif defined _RTW_RECV_C_
81 #define _MODULE_DEFINE_ _module_rtl871x_recv_c_
82 #elif defined _RECV_OSDEP_C_
83 #define _MODULE_DEFINE_ _module_recv_osdep_c_
84 #elif defined _RTW_MLME_C_
85 #define _MODULE_DEFINE_ _module_rtl871x_mlme_c_
86 #elif defined _MLME_OSDEP_C_
87 #define _MODULE_DEFINE_ _module_mlme_osdep_c_
88 #elif defined _RTW_MLME_EXT_C_
89 #define _MODULE_DEFINE_ 1
90 #elif defined _RTW_STA_MGT_C_
91 #define _MODULE_DEFINE_ _module_rtl871x_sta_mgt_c_
92 #elif defined _RTW_CMD_C_
93 #define _MODULE_DEFINE_ _module_rtl871x_cmd_c_
94 #elif defined _CMD_OSDEP_C_
95 #define _MODULE_DEFINE_ _module_cmd_osdep_c_
96 #elif defined _RTW_IO_C_
97 #define _MODULE_DEFINE_ _module_rtl871x_io_c_
98 #elif defined _IO_OSDEP_C_
99 #define _MODULE_DEFINE_ _module_io_osdep_c_
100 #elif defined _OS_INTFS_C_
101 #define _MODULE_DEFINE_ _module_os_intfs_c_
102 #elif defined _RTW_SECURITY_C_
103 #define _MODULE_DEFINE_ _module_rtl871x_security_c_
104 #elif defined _RTW_EEPROM_C_
105 #define _MODULE_DEFINE_ _module_rtl871x_eeprom_c_
106 #elif defined _HAL_INTF_C_
107 #define _MODULE_DEFINE_ _module_hal_init_c_
108 #elif defined _HCI_HAL_INIT_C_
109 #define _MODULE_DEFINE_ _module_hci_hal_init_c_
110 #elif defined _RTL871X_IOCTL_C_
111 #define _MODULE_DEFINE_ _module_rtl871x_ioctl_c_
112 #elif defined _RTL871X_IOCTL_SET_C_
113 #define _MODULE_DEFINE_ _module_rtl871x_ioctl_set_c_
114 #elif defined _RTL871X_IOCTL_QUERY_C_
115 #define _MODULE_DEFINE_ _module_rtl871x_ioctl_query_c_
116 #elif defined _RTL871X_PWRCTRL_C_
117 #define _MODULE_DEFINE_ _module_rtl871x_pwrctrl_c_
118 #elif defined _RTW_PWRCTRL_C_
119 #define _MODULE_DEFINE_ 1
120 #elif defined _HCI_INTF_C_
121 #define _MODULE_DEFINE_ _module_hci_intfs_c_
122 #elif defined _HCI_OPS_C_
123 #define _MODULE_DEFINE_ _module_hci_ops_c_
124 #elif defined _SDIO_OPS_C_
125 #define _MODULE_DEFINE_ 1
126 #elif defined _OSDEP_HCI_INTF_C_
127 #define _MODULE_DEFINE_ _module_hci_intfs_c_
128 #elif defined _OSDEP_SERVICE_C_
129 #define _MODULE_DEFINE_ _module_osdep_service_c_
130 #elif defined _HCI_OPS_OS_C_
131 #define _MODULE_DEFINE_ _module_hci_ops_os_c_
132 #elif defined _RTL871X_IOCTL_LINUX_C_
133 #define _MODULE_DEFINE_ _module_rtl871x_ioctl_os_c
134 #elif defined _RTL8712_CMD_C_
135 #define _MODULE_DEFINE_ _module_rtl8712_cmd_c_
136 #elif defined _RTL8192C_XMIT_C_
137 #define _MODULE_DEFINE_ 1
138 #elif defined _RTL8723AS_XMIT_C_
139 #define _MODULE_DEFINE_ 1
140 #elif defined _RTL8712_RECV_C_
141 #define _MODULE_DEFINE_ _module_rtl8712_recv_c_
142 #elif defined _RTL8192CU_RECV_C_
143 #define _MODULE_DEFINE_ _module_rtl8712_recv_c_
144 #elif defined _RTL871X_MLME_EXT_C_
145 #define _MODULE_DEFINE_ _module_mlme_osdep_c_
146 #elif defined _RTW_MP_C_
147 #define _MODULE_DEFINE_ _module_mp_
148 #elif defined _RTW_MP_IOCTL_C_
149 #define _MODULE_DEFINE_ _module_mp_
150 #elif defined _RTW_EFUSE_C_
151 #define _MODULE_DEFINE_ _module_efuse_
152 #endif
153
154 #ifdef PLATFORM_OS_CE
155 extern void rtl871x_cedbg(const char *fmt, ...);
156 #endif
157
158 #define RT_TRACE(_Comp, _Level, Fmt) do{}while(0)
159 #define _func_enter_ do{}while(0)
160 #define _func_exit_ do{}while(0)
161 #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) do{}while(0)
162
163 #undef _dbgdump
164
165 #ifdef CONFIG_DEBUG_RTL871X
166
167 #ifndef _RTL871X_DEBUG_C_
168 extern u32 GlobalDebugLevel;
169 extern u64 GlobalDebugComponents;
170 #endif
171
172 #ifdef PLATFORM_WINDOWS
173
174 #ifdef PLATFORM_OS_XP
175
176 #define _dbgdump DbgPrint
177
178 #elif defined PLATFORM_OS_CE
179
180 #define _dbgdump rtl871x_cedbg
181
182 #endif
183
184 #elif defined PLATFORM_LINUX
185
186 #define _dbgdump printk
187
188 #elif defined PLATFORM_FREEBSD
189
190 #define _dbgdump printf
191
192 #endif
193
194 #endif /* CONFIG_DEBUG_RTL871X */
195
196
197 #if defined (_dbgdump) && defined (_MODULE_DEFINE_)
198
199 #undef RT_TRACE
200 #define RT_TRACE(_Comp, _Level, Fmt)\
201 do {\
202 if((_Comp & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) {\
203 _dbgdump("%s [0x%08x,%d]", RTL871X_MODULE_NAME, (unsigned int)_Comp, _Level);\
204 _dbgdump Fmt;\
205 }\
206 }while(0)
207
208 #endif
209
210
211 #if defined (_dbgdump)
212
213 #undef _func_enter_
214 #define _func_enter_ \
215 do { \
216 if (GlobalDebugLevel >= _drv_debug_) \
217 { \
218 _dbgdump("\n %s : %s enters at %d\n", RTL871X_MODULE_NAME, __FUNCTION__, __LINE__);\
219 } \
220 } while(0)
221
222 #undef _func_exit_
223 #define _func_exit_ \
224 do { \
225 if (GlobalDebugLevel >= _drv_debug_) \
226 { \
227 _dbgdump("\n %s : %s exits at %d\n", RTL871X_MODULE_NAME, __FUNCTION__, __LINE__); \
228 } \
229 } while(0)
230
231 #undef RT_PRINT_DATA
232 #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
233 if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
234 { \
235 int __i; \
236 u8 *ptr = (u8 *)_HexData; \
237 _dbgdump("Rtl871x: "); \
238 _dbgdump(_TitleString); \
239 for( __i=0; __i<(int)_HexDataLen; __i++ ) \
240 { \
241 _dbgdump("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" "); \
242 if (((__i + 1) % 16) == 0) _dbgdump("\n"); \
243 } \
244 _dbgdump("\n"); \
245 }
246 #endif
247
248
249 #ifdef CONFIG_DEBUG_RTL819X
250
251 #undef _dbgdump
252
253 #ifdef PLATFORM_WINDOWS
254
255 #ifdef PLATFORM_OS_XP
256
257 #define _dbgdump DbgPrint
258
259 #elif defined PLATFORM_OS_CE
260
261 #define _dbgdump rtl871x_cedbg
262
263 #endif
264
265 #elif defined PLATFORM_LINUX
266
267 #define _dbgdump printk
268
269 #elif defined PLATFORM_FREEBSD
270
271 #define _dbgdump printf
272
273 #endif
274
275 #endif /* CONFIG_DEBUG_RTL819X */
276
277
278 #ifdef PLATFORM_WINDOWS
279 #define DBG_871X do {} while(0)
280 #define MSG_8192C do {} while(0)
281 #define DBG_8192C do {} while(0)
282 #define WRN_8192C do {} while(0)
283 #define ERR_8192C do {} while(0)
284 #endif
285
286 #ifdef PLATFORM_LINUX
287 #define DBG_871X(x, ...) do {} while(0)
288 #define MSG_8192C(x, ...) do {} while(0)
289 #define DBG_8192C(x,...) do {} while(0)
290 #define WRN_8192C(x,...) do {} while(0)
291 #define ERR_8192C(x,...) do {} while(0)
292 #endif
293
294 #ifdef PLATFORM_FREEBSD
295 #define _dbgdump printf
296 #define DBG_871X(x, ...) do {} while(0)
297 #define MSG_8192C(x, ...) do {} while(0)
298 #define DBG_8192C(x,...) do {} while(0)
299 #define WRN_8192C(x,...) do {} while(0)
300 #define ERR_8192C(x,...) do {} while(0)
301 #endif
302
303 extern u32 GlobalDebugLevel;
304 #define LOG_LEVEL(level, ...)\
305 do {\
306 if(level <= GlobalDebugLevel) {\
307 printk(__VA_ARGS__);\
308 }\
309 }while(0)
310
311 #define DBG_871X_LEVEL LOG_LEVEL
312
313 #if defined (_dbgdump)
314 #undef DBG_871X
315 // #define DBG_871X _dbgdump
316 #define DBG_871X(...) LOG_LEVEL(_drv_debug_ , __VA_ARGS__)
317
318 #undef MSG_8192C
319 // #define MSG_8192C _dbgdump
320 #define MSG_8192C(...) LOG_LEVEL(_drv_info_ , __VA_ARGS__)
321
322 #undef DBG_8192C
323 // #define DBG_8192C _dbgdump
324 #define DBG_8192C(...) LOG_LEVEL(_drv_debug_ , __VA_ARGS__)
325
326
327 #undef WRN_8192C
328 #define WRN_8192C _dbgdump
329
330 #undef ERR_8192C
331 #define ERR_8192C _dbgdump
332 #endif
333
334
335 #ifdef CONFIG_PROC_DEBUG
336
337 int proc_get_drv_version(char *page, char **start,
338 off_t offset, int count,
339 int *eof, void *data);
340
341 int proc_get_log_level(char *page, char **start,
342 off_t offset, int count,
343 int *eof, void *data);
344
345 int proc_set_log_level(struct file *file, const char *buffer,
346 unsigned long count, void *data);
347
348 #ifdef DBG_MEM_ALLOC
349 int proc_get_mstat(char *page, char **start,
350 off_t offset, int count,
351 int *eof, void *data);
352 #endif /* DBG_MEM_ALLOC */
353
354 int proc_get_write_reg(char *page, char **start,
355 off_t offset, int count,
356 int *eof, void *data);
357
358 int proc_set_write_reg(struct file *file, const char *buffer,
359 unsigned long count, void *data);
360
361 int proc_get_read_reg(char *page, char **start,
362 off_t offset, int count,
363 int *eof, void *data);
364
365 int proc_set_read_reg(struct file *file, const char *buffer,
366 unsigned long count, void *data);
367
368
369 int proc_get_fwstate(char *page, char **start,
370 off_t offset, int count,
371 int *eof, void *data);
372
373 int proc_get_sec_info(char *page, char **start,
374 off_t offset, int count,
375 int *eof, void *data);
376
377 int proc_get_mlmext_state(char *page, char **start,
378 off_t offset, int count,
379 int *eof, void *data);
380
381 int proc_get_qos_option(char *page, char **start,
382 off_t offset, int count,
383 int *eof, void *data);
384
385 int proc_get_ht_option(char *page, char **start,
386 off_t offset, int count,
387 int *eof, void *data);
388
389 int proc_get_rf_info(char *page, char **start,
390 off_t offset, int count,
391 int *eof, void *data);
392
393 int proc_get_ap_info(char *page, char **start,
394 off_t offset, int count,
395 int *eof, void *data);
396
397 int proc_get_adapter_state(char *page, char **start,
398 off_t offset, int count,
399 int *eof, void *data);
400
401 int proc_get_trx_info(char *page, char **start,
402 off_t offset, int count,
403 int *eof, void *data);
404
405 int proc_get_mac_reg_dump1(char *page, char **start,
406 off_t offset, int count,
407 int *eof, void *data);
408
409 int proc_get_mac_reg_dump2(char *page, char **start,
410 off_t offset, int count,
411 int *eof, void *data);
412
413 int proc_get_mac_reg_dump3(char *page, char **start,
414 off_t offset, int count,
415 int *eof, void *data);
416
417 int proc_get_bb_reg_dump1(char *page, char **start,
418 off_t offset, int count,
419 int *eof, void *data);
420
421 int proc_get_bb_reg_dump2(char *page, char **start,
422 off_t offset, int count,
423 int *eof, void *data);
424
425 int proc_get_bb_reg_dump3(char *page, char **start,
426 off_t offset, int count,
427 int *eof, void *data);
428
429 int proc_get_rf_reg_dump1(char *page, char **start,
430 off_t offset, int count,
431 int *eof, void *data);
432
433 int proc_get_rf_reg_dump2(char *page, char **start,
434 off_t offset, int count,
435 int *eof, void *data);
436
437 int proc_get_rf_reg_dump3(char *page, char **start,
438 off_t offset, int count,
439 int *eof, void *data);
440
441 int proc_get_rf_reg_dump4(char *page, char **start,
442 off_t offset, int count,
443 int *eof, void *data);
444
445 #ifdef CONFIG_AP_MODE
446
447 int proc_get_all_sta_info(char *page, char **start,
448 off_t offset, int count,
449 int *eof, void *data);
450
451 #endif
452
453 #ifdef DBG_MEMORY_LEAK
454 int proc_get_malloc_cnt(char *page, char **start,
455 off_t offset, int count,
456 int *eof, void *data);
457 #endif
458
459 #ifdef CONFIG_FIND_BEST_CHANNEL
460 int proc_get_best_channel(char *page, char **start,
461 off_t offset, int count,
462 int *eof, void *data);
463 int proc_set_best_channel(struct file *file, const char *buffer,
464 unsigned long count, void *data);
465 #endif
466
467 int proc_get_rx_signal(char *page, char **start,
468 off_t offset, int count,
469 int *eof, void *data);
470
471 int proc_set_rx_signal(struct file *file, const char *buffer,
472 unsigned long count, void *data);
473
474 int proc_get_ht_enable(char *page, char **start,
475 off_t offset, int count,
476 int *eof, void *data);
477
478 int proc_set_ht_enable(struct file *file, const char *buffer,
479 unsigned long count, void *data);
480
481 int proc_get_cbw40_enable(char *page, char **start,
482 off_t offset, int count,
483 int *eof, void *data);
484
485 int proc_set_cbw40_enable(struct file *file, const char *buffer,
486 unsigned long count, void *data);
487
488 int proc_get_ampdu_enable(char *page, char **start,
489 off_t offset, int count,
490 int *eof, void *data);
491
492 int proc_set_ampdu_enable(struct file *file, const char *buffer,
493 unsigned long count, void *data);
494
495 int proc_get_two_path_rssi(char *page, char **start,
496 off_t offset, int count,
497 int *eof, void *data);
498
499 int proc_get_rx_stbc(char *page, char **start,
500 off_t offset, int count,
501 int *eof, void *data);
502
503 int proc_set_rx_stbc(struct file *file, const char *buffer,
504 unsigned long count, void *data);
505
506
507 int proc_get_vid(char *page, char **start,
508 off_t offset, int count,
509 int *eof, void *data);
510
511 int proc_get_pid(char *page, char **start,
512 off_t offset, int count,
513 int *eof, void *data);
514
515 int proc_get_rssi_disp(char *page, char **start,
516 off_t offset, int count,
517 int *eof, void *data);
518
519 int proc_set_rssi_disp(struct file *file, const char *buffer,
520 unsigned long count, void *data);
521
522 #if defined(DBG_CONFIG_ERROR_DETECT)
523 int proc_get_sreset(char *page, char **start, off_t offset, int count, int *eof, void *data);
524 int proc_set_sreset(struct file *file, const char *buffer, unsigned long count, void *data);
525 #endif /* DBG_CONFIG_ERROR_DETECT */
526
527 #ifdef CONFIG_DM_ADAPTIVITY
528 int proc_get_dm_adaptivity(char *page, char **start,
529 off_t offset, int count,
530 int *eof, void *data);
531 int proc_set_dm_adaptivity(struct file *file, const char *buffer,
532 unsigned long count, void *data);
533 #endif /* CONFIG_DM_ADAPTIVITY */
534
535 #endif //CONFIG_PROC_DEBUG
536
537 #endif //__RTW_DEBUG_H__