1 /******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
4 * Based on the r8180 driver, which is:
5 * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 * The full GNU General Public License is included in this distribution in the
20 * file called LICENSE.
22 * Contact Information:
23 * wlanfae <wlanfae@realtek.com>
24 ******************************************************************************/
27 #include <linux/kernel.h>
28 #include <linux/module.h>
29 #include <linux/version.h>
30 #include <linux/debugfs.h>
33 struct _tx_desc_8192se;
34 struct _TX_DESC_8192CE;
39 #define RT_ASSERT(_Exp,Fmt) \
42 printk("Rtl819x: "); \
46 typedef enum tag_DBGP_Flag_Type_Definition
71 #define QoS_VISTA BIT1
74 #define TX_DESC_TID BIT1
77 #define RX_PHY_STS BIT1
78 #define RX_PHY_SS BIT2
79 #define RX_PHY_SQ BIT3
80 #define RX_PHY_ASTS BIT4
81 #define RX_ERR_LEN BIT5
82 #define RX_DEFRAG BIT6
83 #define RX_ERR_RATE BIT7
87 #define MEDIA_STS BIT0
101 #define PHY_MACR BIT4
102 #define PHY_MACW BIT5
103 #define PHY_ALLR BIT6
104 #define PHY_ALLW BIT7
105 #define PHY_TXPWR BIT8
106 #define PHY_PWRDIFF BIT9
109 #define MP_SWICH_CH BIT1
111 #define EEPROM_W BIT0
112 #define EFUSE_PG BIT1
113 #define EFUSE_READ_ALL BIT2
123 #define DM_Monitor BIT2
125 #define DM_EDCA_Turbo BIT4
127 #define DbgCtrl_Trace BIT0
128 #define DbgCtrl_InbandNoise BIT1
130 #define BT_TRACE BIT0
131 #define BT_RFPoll BIT1
133 #define C2H_Summary BIT0
134 #define C2H_PacketData BIT1
135 #define C2H_ContentData BIT2
136 #define BT_TRACE BIT0
137 #define BT_RFPoll BIT1
139 #define INIT_EEPROM BIT0
140 #define INIT_TxPower BIT1
141 #define INIT_IQK BIT2
144 #define IOCTL_TRACE BIT0
145 #define IOCTL_BT_EVENT BIT1
146 #define IOCTL_BT_EVENT_DETAIL BIT2
147 #define IOCTL_BT_TX_ACLDATA BIT3
148 #define IOCTL_BT_TX_ACLDATA_DETAIL BIT4
149 #define IOCTL_BT_RX_ACLDATA BIT5
150 #define IOCTL_BT_RX_ACLDATA_DETAIL BIT6
151 #define IOCTL_BT_HCICMD BIT7
152 #define IOCTL_BT_HCICMD_DETAIL BIT8
153 #define IOCTL_IRP BIT9
154 #define IOCTL_IRP_DETAIL BIT10
155 #define IOCTL_CALLBACK_FUN BIT11
156 #define IOCTL_STATE BIT12
157 #define IOCTL_BT_TP BIT13
158 #define IOCTL_BT_LOGO BIT14
160 /* 2007/07/13 MH ------For DeBuG Print modeue------*/
161 /*------------------------------Define structure----------------------------*/
164 /*------------------------Export Marco Definition---------------------------*/
165 #define DEBUG_PRINT 1
167 #if (DEBUG_PRINT == 1)
168 #define RTPRINT(dbgtype, dbgflag, printstr) \
170 if (DBGP_Type[dbgtype] & dbgflag)\
176 #define RTPRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)\
178 if (DBGP_Type[dbgtype] & dbgflag)\
181 u8* ptr = (u8*)_Ptr; \
184 for ( __i=0; __i<6; __i++ ) \
185 printk("%02X%s", ptr[__i], (__i==5)?"":"-"); \
190 #define RTPRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)\
192 if (DBGP_Type[dbgtype] & dbgflag)\
195 u8* ptr = (u8*)_HexData; \
196 printk(_TitleString); \
197 for ( __i=0; __i<(int)_HexDataLen; __i++ ) \
199 printk("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" ");\
200 if (((__i + 1) % 16) == 0) printk("\n");\
206 #define RTPRINT(dbgtype, dbgflag, printstr)
207 #define RTPRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)
208 #define RTPRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)
211 extern u32 DBGP_Type[DBGP_TYPE_MAX];
213 #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
215 if (((_Comp) & rt_global_debug_component ) && (_Level <= rt_global_debug_component )) \
218 u8* ptr = (u8*)_HexData; \
219 printk("Rtl819x: "); \
220 printk(_TitleString); \
221 for ( __i=0; __i<(int)_HexDataLen; __i++ ) \
223 printk("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" "); \
224 if (((__i + 1) % 16) == 0) printk("\n"); \
230 #define DMESG(x,a...)
231 #define DMESGW(x,a...)
232 #define DMESGE(x,a...)
233 extern u32 rt_global_debug_component;
234 #define RT_TRACE(component, x, args...) \
235 do { if (rt_global_debug_component & component) \
236 printk(KERN_DEBUG DRV_NAME ":" x "\n" , \
240 #define assert(expr) \
242 printk( "Assertion failed! %s,%s,%s,line=%d\n", \
243 #expr,__FILE__,__func__,__LINE__); \
245 #define RT_DEBUG_DATA(level, data, datalen) \
246 do{ if ((rt_global_debug_component & (level)) == (level)) \
249 u8* _pdata = (u8*) data; \
250 printk(KERN_DEBUG DRV_NAME ": %s()\n", __func__); \
251 for (_i=0; _i<(int)(datalen); _i++) \
253 printk("%2x ", _pdata[_i]); \
254 if ((_i+1)%16 == 0) printk("\n"); \
260 struct rtl_fs_debug {
262 struct dentry *dir_drv;
263 struct dentry *debug_register;
269 void print_buffer(u32 *buffer, int len);
270 void dump_eprom(struct net_device *dev);
271 void rtl8192_dump_reg(struct net_device *dev);
274 static inline int rtl_debug_module_init(struct r8192_priv *priv, const char *name) {
277 static inline void rtl_debug_module_remove(struct r8192_priv *priv) {
280 static inline int rtl_create_debugfs_root(void) {
283 static inline void rtl_remove_debugfs_root(void) {
287 void rtl8192_proc_init_one(struct net_device *dev);
288 void rtl8192_proc_remove_one(struct net_device *dev);
289 void rtl8192_proc_module_init(void);
290 void rtl8192_proc_module_remove(void);
291 void rtl8192_dbgp_flag_init(struct net_device *dev);