]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/staging/rtl8192e/rtl_debug.h
staging: rtl8192e: Convert typedef rtl_fs_debug to struct rtl_fs_debug
[karo-tx-linux.git] / drivers / staging / rtl8192e / rtl_debug.h
1 /******************************************************************************
2  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
3  *
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.
9  *
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
13  * more details.
14  *
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
18  *
19  * The full GNU General Public License is included in this distribution in the
20  * file called LICENSE.
21  *
22  * Contact Information:
23  * wlanfae <wlanfae@realtek.com>
24 ******************************************************************************/
25 #ifndef _RTL_DEBUG_H
26 #define _RTL_DEBUG_H
27 #include <linux/kernel.h>
28 #include <linux/module.h>
29 #include <linux/version.h>
30 #include <linux/debugfs.h>
31
32 struct r8192_priv;
33 struct _tx_desc_8192se;
34 struct _TX_DESC_8192CE;
35 struct net_device;
36
37 #define DBG_LOUD        4
38
39 #define RT_ASSERT(_Exp,Fmt)                             \
40                 if (!(_Exp))                                            \
41                 {                                                               \
42                         printk("Rtl819x: ");                            \
43                         printk Fmt;                                     \
44                 }
45
46 typedef enum tag_DBGP_Flag_Type_Definition
47 {
48         FQoS                            = 0,
49         FTX                                     = 1,
50         FRX                                     = 2,
51         FSEC                            = 3,
52         FMGNT                           = 4,
53         FMLME                           = 5,
54         FRESOURCE                       = 6,
55         FBEACON                 = 7,
56         FISR                            = 8,
57         FPHY                            = 9,
58         FMP                                     = 10,
59         FEEPROM                 = 11,
60         FPWR                            = 12,
61         FDM                                     = 13,
62         FDBGCtrl                                = 14,
63         FC2H                            = 15,
64         FBT                                     = 16,
65         FINIT                           = 17,
66         FIOCTL                          = 18,
67         DBGP_TYPE_MAX
68 }DBGP_FLAG_E;
69
70 #define         QoS_INIT                                BIT0
71 #define         QoS_VISTA                               BIT1
72
73 #define         TX_DESC                                 BIT0
74 #define         TX_DESC_TID                             BIT1
75
76 #define         RX_DATA                                 BIT0
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
84
85
86
87 #define         MEDIA_STS                               BIT0
88 #define         LINK_STS                                BIT1
89
90 #define         OS_CHK                                  BIT0
91
92 #define         BCN_SHOW                                BIT0
93 #define         BCN_PEER                                BIT1
94
95 #define         ISR_CHK                                 BIT0
96
97 #define         PHY_BBR                         BIT0
98 #define         PHY_BBW                         BIT1
99 #define         PHY_RFR                         BIT2
100 #define         PHY_RFW                         BIT3
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
107
108 #define         MP_RX                                   BIT0
109 #define         MP_SWICH_CH                     BIT1
110
111 #define         EEPROM_W                                BIT0
112 #define         EFUSE_PG                                BIT1
113 #define         EFUSE_READ_ALL                  BIT2
114
115 #define         LPS                                             BIT0
116 #define         IPS                                             BIT1
117 #define         PWRSW                                   BIT2
118 #define         PWRHW                                   BIT3
119 #define         PWRHAL                                  BIT4
120
121 #define         WA_IOT                                  BIT0
122 #define         DM_PWDB                         BIT1
123 #define         DM_Monitor                              BIT2
124 #define         DM_DIG                                  BIT3
125 #define         DM_EDCA_Turbo                   BIT4
126
127 #define         DbgCtrl_Trace                   BIT0
128 #define         DbgCtrl_InbandNoise             BIT1
129
130 #define         BT_TRACE                                BIT0
131 #define         BT_RFPoll                               BIT1
132
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
138
139 #define         INIT_EEPROM                             BIT0
140 #define         INIT_TxPower                    BIT1
141 #define         INIT_IQK                                BIT2
142 #define         INIT_RF                                 BIT3
143
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
159
160 /* 2007/07/13 MH  ------For DeBuG Print modeue------*/
161 /*------------------------------Define structure----------------------------*/
162
163
164 /*------------------------Export Marco Definition---------------------------*/
165 #define         DEBUG_PRINT             1
166
167 #if (DEBUG_PRINT == 1)
168 #define RTPRINT(dbgtype, dbgflag, printstr)     \
169 {                                                                       \
170         if (DBGP_Type[dbgtype] & dbgflag)\
171         {                                                               \
172                 printk printstr;                                \
173         }                                                               \
174 }
175
176 #define RTPRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)\
177 {\
178         if (DBGP_Type[dbgtype] & dbgflag)\
179         {\
180                                 int __i;                                                \
181                                 u8*     ptr = (u8*)_Ptr;        \
182                                 printk printstr;                                \
183                                 printk(" ");                                    \
184                                 for ( __i=0; __i<6; __i++ )             \
185                                         printk("%02X%s", ptr[__i], (__i==5)?"":"-");            \
186                                 printk("\n");                                                   \
187         }\
188 }
189
190 #define RTPRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)\
191 {\
192         if (DBGP_Type[dbgtype] & dbgflag)\
193         {\
194                 int __i;                                                                        \
195                 u8*     ptr = (u8*)_HexData;                    \
196                 printk(_TitleString);                                   \
197                 for ( __i=0; __i<(int)_HexDataLen; __i++ )      \
198                 {                                                                               \
199                         printk("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?"  ":" ");\
200                         if (((__i + 1) % 16) == 0)      printk("\n");\
201                 }                                                                               \
202                 printk("\n");                                                   \
203         }\
204 }
205 #else
206 #define RTPRINT(dbgtype, dbgflag, printstr)
207 #define RTPRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)
208 #define         RTPRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)
209 #endif
210
211 extern u32      DBGP_Type[DBGP_TYPE_MAX];
212
213 #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen)                       \
214 do {\
215         if (((_Comp) & rt_global_debug_component ) && (_Level <= rt_global_debug_component ))   \
216         {                                                                       \
217                 int __i;                                                                \
218                 u8*     ptr = (u8*)_HexData;                            \
219                 printk("Rtl819x: ");                                            \
220                 printk(_TitleString);                                           \
221                 for ( __i=0; __i<(int)_HexDataLen; __i++ )                              \
222                 {                                                               \
223                         printk("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?"  ":" ");    \
224                         if (((__i + 1) % 16) == 0)      printk("\n");                   \
225                 }                                                               \
226                 printk("\n");                                                   \
227         } \
228 }while(0);
229
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" , \
237                ##args);\
238 }while(0);
239
240 #define assert(expr) \
241         if (!(expr)) {                                  \
242                 printk( "Assertion failed! %s,%s,%s,line=%d\n", \
243                 #expr,__FILE__,__func__,__LINE__);          \
244         }
245 #define RT_DEBUG_DATA(level, data, datalen)      \
246         do{ if ((rt_global_debug_component & (level)) == (level))   \
247                 {       \
248                         int _i;                                  \
249                         u8* _pdata = (u8*) data;                 \
250                         printk(KERN_DEBUG DRV_NAME ": %s()\n", __func__);   \
251                         for (_i=0; _i<(int)(datalen); _i++)                 \
252                         {                                               \
253                                 printk("%2x ", _pdata[_i]);               \
254                                 if ((_i+1)%16 == 0) printk("\n");        \
255                         }                               \
256                         printk("\n");                   \
257                 }                                       \
258         } while (0)
259
260 struct rtl_fs_debug {
261         const char *name;
262         struct dentry *dir_drv;
263         struct dentry *debug_register;
264         u32 hw_type;
265         u32 hw_offset;
266         bool hw_holding;
267 };
268
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);
272
273 /* debugfs stuff */
274 static inline int rtl_debug_module_init(struct r8192_priv *priv, const char *name) {
275         return 0;
276 }
277 static inline void rtl_debug_module_remove(struct r8192_priv *priv) {
278
279 }
280 static inline int rtl_create_debugfs_root(void) {
281         return 0;
282 }
283 static inline void rtl_remove_debugfs_root(void) {
284 }
285
286 /* proc stuff */
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);
292 #endif