1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7 #ifndef __RTW_DEBUG_H__
8 #define __RTW_DEBUG_H__
9 
10 #include <osdep_service.h>
11 #include <drv_types.h>
12 
13 #define DRIVERVERSION	"v4.1.4_6773.20130222"
14 #define _drv_always_			1
15 #define _drv_emerg_			2
16 #define _drv_alert_			3
17 #define _drv_crit_			4
18 #define _drv_err_			5
19 #define	_drv_warning_			6
20 #define _drv_notice_			7
21 #define _drv_info_			8
22 #define	_drv_debug_			9
23 
24 
25 #define _module_rtl871x_xmit_c_		BIT(0)
26 #define _module_xmit_osdep_c_		BIT(1)
27 #define _module_rtl871x_recv_c_		BIT(2)
28 #define _module_recv_osdep_c_		BIT(3)
29 #define _module_rtl871x_mlme_c_		BIT(4)
30 #define _module_mlme_osdep_c_		BIT(5)
31 #define _module_rtl871x_sta_mgt_c_	BIT(6)
32 #define _module_rtl871x_cmd_c_		BIT(7)
33 #define _module_cmd_osdep_c_		BIT(8)
34 #define _module_rtl871x_io_c_		BIT(9)
35 #define _module_io_osdep_c_		BIT(10)
36 #define _module_os_intfs_c_		BIT(11)
37 #define _module_rtl871x_security_c_	BIT(12)
38 #define _module_rtl871x_eeprom_c_	BIT(13)
39 #define _module_hal_init_c_		BIT(14)
40 #define _module_hci_hal_init_c_		BIT(15)
41 #define _module_rtl871x_ioctl_c_	BIT(16)
42 #define _module_rtl871x_ioctl_set_c_	BIT(17)
43 #define _module_rtl871x_ioctl_query_c_	BIT(18)
44 #define _module_rtl871x_pwrctrl_c_	BIT(19)
45 #define _module_hci_intfs_c_		BIT(20)
46 #define _module_hci_ops_c_		BIT(21)
47 #define _module_osdep_service_c_	BIT(22)
48 #define _module_mp_			BIT(23)
49 #define _module_hci_ops_os_c_		BIT(24)
50 #define _module_rtl871x_ioctl_os_c	BIT(25)
51 #define _module_rtl8712_cmd_c_		BIT(26)
52 #define	_module_rtl8192c_xmit_c_	BIT(27)
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 #define DRIVER_PREFIX	"R8188EU: "
59 
60 extern u32 GlobalDebugLevel;
61 
62 #define DBG_88E_LEVEL(_level, fmt, arg...)				\
63 	do {								\
64 		if (_level <= GlobalDebugLevel)				\
65 			pr_info(DRIVER_PREFIX fmt, ##arg);	\
66 	} while (0)
67 
68 #define DBG_88E(...)							\
69 	do {								\
70 		if (_drv_err_ <= GlobalDebugLevel)			\
71 			pr_info(DRIVER_PREFIX __VA_ARGS__);		\
72 	} while (0)
73 
74 #define MSG_88E(...)							\
75 	do {								\
76 		if (_drv_err_ <= GlobalDebugLevel)			\
77 			pr_info(DRIVER_PREFIX __VA_ARGS__);			\
78 	} while (0)
79 
80 #define RT_TRACE(_comp, _level, fmt)					\
81 	do {								\
82 		if (_level <= GlobalDebugLevel) {			\
83 			pr_info("%s [0x%08x,%d]", DRIVER_PREFIX,	\
84 				 (unsigned int)_comp, _level);		\
85 			pr_info fmt;					\
86 		}							\
87 	} while (0)
88 
89 #define RT_PRINT_DATA(_comp, _level, _titlestring, _hexdata, _hexdatalen)\
90 	do {								\
91 		if (_level <= GlobalDebugLevel) {			\
92 			int __i;					\
93 			u8	*ptr = (u8 *)_hexdata;			\
94 			pr_info("%s", DRIVER_PREFIX);			\
95 			pr_info(_titlestring);				\
96 			for (__i = 0; __i < (int)_hexdatalen; __i++) {	\
97 				pr_info("%02X%s", ptr[__i],		\
98 					 (((__i + 1) % 4) == 0) ?	\
99 					 "  " : " ");	\
100 				if (((__i + 1) % 16) == 0)		\
101 					pr_cont("\n");			\
102 			}						\
103 			pr_cont("\n");					\
104 		}							\
105 	} while (0)
106 
107 int proc_get_drv_version(char *page, char **start,
108 			 off_t offset, int count,
109 			 int *eof, void *data);
110 
111 int proc_get_write_reg(char *page, char **start,
112 		       off_t offset, int count,
113 		       int *eof, void *data);
114 
115 int proc_set_write_reg(struct file *file, const char __user *buffer,
116 		       unsigned long count, void *data);
117 int proc_get_read_reg(char *page, char **start,
118 		      off_t offset, int count,
119 		      int *eof, void *data);
120 
121 int proc_set_read_reg(struct file *file, const char __user *buffer,
122 		      unsigned long count, void *data);
123 
124 int proc_get_adapter_state(char *page, char **start,
125 			   off_t offset, int count,
126 			   int *eof, void *data);
127 
128 int proc_get_best_channel(char *page, char **start,
129 			  off_t offset, int count,
130 			  int *eof, void *data);
131 
132 #endif	/* __RTW_DEBUG_H__ */
133