• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *
15  ******************************************************************************/
16 #ifndef __RTW_DEBUG_H__
17 #define __RTW_DEBUG_H__
18 
19 #include <osdep_service.h>
20 #include <drv_types.h>
21 
22 #define _drv_always_			1
23 #define _drv_emerg_			2
24 #define _drv_alert_			3
25 #define _drv_err_			4
26 #define	_drv_warning_			5
27 #define _drv_notice_			6
28 #define _drv_info_			7
29 #define	_drv_debug_			8
30 
31 #define _module_rtl871x_xmit_c_		BIT(0)
32 #define _module_xmit_osdep_c_		BIT(1)
33 #define _module_rtl871x_recv_c_		BIT(2)
34 #define _module_recv_osdep_c_		BIT(3)
35 #define _module_rtl871x_mlme_c_		BIT(4)
36 #define _module_mlme_osdep_c_		BIT(5)
37 #define _module_rtl871x_sta_mgt_c_	BIT(6)
38 #define _module_rtl871x_cmd_c_		BIT(7)
39 #define _module_cmd_osdep_c_		BIT(8)
40 #define _module_rtl871x_io_c_		BIT(9)
41 #define _module_io_osdep_c_		BIT(10)
42 #define _module_os_intfs_c_		BIT(11)
43 #define _module_rtl871x_security_c_	BIT(12)
44 #define _module_rtl871x_eeprom_c_	BIT(13)
45 #define _module_hal_init_c_		BIT(14)
46 #define _module_hci_hal_init_c_		BIT(15)
47 #define _module_rtl871x_ioctl_c_	BIT(16)
48 #define _module_rtl871x_ioctl_set_c_	BIT(17)
49 #define _module_rtl871x_ioctl_query_c_	BIT(18)
50 #define _module_rtl871x_pwrctrl_c_	BIT(19)
51 #define _module_hci_intfs_c_		BIT(20)
52 #define _module_hci_ops_c_		BIT(21)
53 #define _module_osdep_service_c_	BIT(22)
54 #define _module_mp_			BIT(23)
55 #define _module_hci_ops_os_c_		BIT(24)
56 #define _module_rtl871x_ioctl_os_c	BIT(25)
57 #define _module_rtl8712_cmd_c_		BIT(26)
58 #define	_module_rtl8192c_xmit_c_	BIT(28)
59 #define _module_hal_xmit_c_		BIT(28) /* duplication intentional */
60 #define _module_efuse_			BIT(29)
61 #define _module_rtl8712_recv_c_		BIT(30)
62 #define _module_rtl8712_led_c_		BIT(31)
63 
64 #undef _MODULE_DEFINE_
65 
66 #if defined _RTW_XMIT_C_
67 	#define _MODULE_DEFINE_	_module_rtl871x_xmit_c_
68 #elif defined _XMIT_OSDEP_C_
69 	#define _MODULE_DEFINE_	_module_xmit_osdep_c_
70 #elif defined _RTW_RECV_C_
71 	#define _MODULE_DEFINE_	_module_rtl871x_recv_c_
72 #elif defined _RECV_OSDEP_C_
73 	#define _MODULE_DEFINE_	_module_recv_osdep_c_
74 #elif defined _RTW_MLME_C_
75 	#define _MODULE_DEFINE_	_module_rtl871x_mlme_c_
76 #elif defined _MLME_OSDEP_C_
77 	#define _MODULE_DEFINE_	_module_mlme_osdep_c_
78 #elif defined _RTW_MLME_EXT_C_
79 	#define _MODULE_DEFINE_ 1
80 #elif defined _RTW_STA_MGT_C_
81 	#define _MODULE_DEFINE_	_module_rtl871x_sta_mgt_c_
82 #elif defined _RTW_CMD_C_
83 	#define _MODULE_DEFINE_	_module_rtl871x_cmd_c_
84 #elif defined _CMD_OSDEP_C_
85 	#define _MODULE_DEFINE_	_module_cmd_osdep_c_
86 #elif defined _RTW_IO_C_
87 	#define _MODULE_DEFINE_	_module_rtl871x_io_c_
88 #elif defined _IO_OSDEP_C_
89 	#define _MODULE_DEFINE_	_module_io_osdep_c_
90 #elif defined _OS_INTFS_C_
91 	#define	_MODULE_DEFINE_	_module_os_intfs_c_
92 #elif defined _RTW_SECURITY_C_
93 	#define	_MODULE_DEFINE_	_module_rtl871x_security_c_
94 #elif defined _RTW_EEPROM_C_
95 	#define	_MODULE_DEFINE_	_module_rtl871x_eeprom_c_
96 #elif defined _HAL_INTF_C_
97 	#define	_MODULE_DEFINE_	_module_hal_init_c_
98 #elif (defined _HCI_HAL_INIT_C_) || (defined _SDIO_HALINIT_C_)
99 	#define	_MODULE_DEFINE_	_module_hci_hal_init_c_
100 #elif defined _RTL871X_IOCTL_C_
101 	#define	_MODULE_DEFINE_	_module_rtl871x_ioctl_c_
102 #elif defined _RTL871X_IOCTL_SET_C_
103 	#define	_MODULE_DEFINE_	_module_rtl871x_ioctl_set_c_
104 #elif defined _RTL871X_IOCTL_QUERY_C_
105 	#define	_MODULE_DEFINE_	_module_rtl871x_ioctl_query_c_
106 #elif defined _RTL871X_PWRCTRL_C_
107 	#define	_MODULE_DEFINE_	_module_rtl871x_pwrctrl_c_
108 #elif defined _RTW_PWRCTRL_C_
109 	#define	_MODULE_DEFINE_	1
110 #elif defined _HCI_INTF_C_
111 	#define	_MODULE_DEFINE_	_module_hci_intfs_c_
112 #elif defined _HCI_OPS_C_
113 	#define	_MODULE_DEFINE_	_module_hci_ops_c_
114 #elif defined _SDIO_OPS_C_
115 	#define	_MODULE_DEFINE_ 1
116 #elif defined _OSDEP_HCI_INTF_C_
117 	#define	_MODULE_DEFINE_	_module_hci_intfs_c_
118 #elif defined _OSDEP_SERVICE_C_
119 	#define	_MODULE_DEFINE_	_module_osdep_service_c_
120 #elif defined _HCI_OPS_OS_C_
121 	#define	_MODULE_DEFINE_	_module_hci_ops_os_c_
122 #elif defined _RTL871X_IOCTL_LINUX_C_
123 	#define	_MODULE_DEFINE_	_module_rtl871x_ioctl_os_c
124 #elif defined _RTL8712_CMD_C_
125 	#define	_MODULE_DEFINE_	_module_rtl8712_cmd_c_
126 #elif defined _RTL8192C_XMIT_C_
127 	#define	_MODULE_DEFINE_	1
128 #elif defined _RTL8723AS_XMIT_C_
129 	#define	_MODULE_DEFINE_	1
130 #elif defined _RTL8712_RECV_C_
131 	#define	_MODULE_DEFINE_	_module_rtl8712_recv_c_
132 #elif defined _RTL8192CU_RECV_C_
133 	#define	_MODULE_DEFINE_	_module_rtl8712_recv_c_
134 #elif defined _RTL871X_MLME_EXT_C_
135 	#define _MODULE_DEFINE_	_module_mlme_osdep_c_
136 #elif defined _RTW_MP_C_
137 	#define	_MODULE_DEFINE_	_module_mp_
138 #elif defined _RTW_MP_IOCTL_C_
139 	#define	_MODULE_DEFINE_	_module_mp_
140 #elif defined _RTW_EFUSE_C_
141 	#define	_MODULE_DEFINE_	_module_efuse_
142 #endif
143 
144 #define DRIVER_PREFIX	"RTL8723AU: "
145 #define DEBUG_LEVEL	(_drv_err_)
146 #define DBG_8723A_LEVEL(_level, fmt, arg...)				\
147 	do {								\
148 		if (_level <= GlobalDebugLevel23A)				\
149 			pr_info(DRIVER_PREFIX fmt, ##arg);\
150 	} while (0)
151 
152 #define DBG_8723A(...)							\
153 	do {								\
154 		if (_drv_err_ <= GlobalDebugLevel23A)			\
155 			pr_info(DRIVER_PREFIX __VA_ARGS__);		\
156 	} while (0)
157 
158 #define MSG_8723A(...)							\
159 	do {								\
160 		if (_drv_err_ <= GlobalDebugLevel23A)			\
161 			pr_info(DRIVER_PREFIX __VA_ARGS__);		\
162 	} while (0)
163 
164 extern u32 GlobalDebugLevel23A;
165 
166 __printf(3, 4)
167 void rt_trace(int comp, int level, const char *fmt, ...);
168 
169 #define RT_TRACE(_Comp, _Level, Fmt, ...)				\
170 do {									\
171 	if (_Level <= GlobalDebugLevel23A)				\
172 		rt_trace(_Comp, _Level, Fmt, ##__VA_ARGS__);		\
173 } while (0)
174 
175 #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData,		\
176 		      _HexDataLen)					\
177 	if (_Level <= GlobalDebugLevel23A) {				\
178 		int __i;						\
179 		u8	*ptr = (u8 *)_HexData;				\
180 		pr_info("%s", DRIVER_PREFIX);				\
181 		pr_info(_TitleString);					\
182 		for (__i = 0; __i < (int)_HexDataLen; __i++) {		\
183 			printk("%02X%s", ptr[__i],			\
184 			       (((__i + 1) % 4) == 0) ? "  " : " ");	\
185 			if (((__i + 1) % 16) == 0)			\
186 				printk("\n");				\
187 		}							\
188 		printk("\n");						\
189 	}
190 
191 #endif	/* __RTW_DEBUG_H__ */
192