Merge bcm43xx-mac80211 driver from tree at bu3sch.de, pulled 24/6
[openwrt.git] / package / bcm43xx-mac80211 / src / bcm43xx / bcm43xx_debugfs.h
1 #ifndef BCM43xx_DEBUGFS_H_
2 #define BCM43xx_DEBUGFS_H_
3
4 struct bcm43xx_wldev;
5 struct bcm43xx_txstatus;
6
7 enum bcm43xx_dyndbg { /* Dynamic debugging features */
8 BCM43xx_DBG_XMITPOWER,
9 BCM43xx_DBG_DMAOVERFLOW,
10 BCM43xx_DBG_PWORK_FAST,
11 BCM43xx_DBG_PWORK_STOP,
12 __BCM43xx_NR_DYNDBG,
13 };
14
15
16 #ifdef CONFIG_BCM43XX_MAC80211_DEBUG
17
18 struct dentry;
19
20 #define BCM43xx_NR_LOGGED_TXSTATUS 100
21
22 struct bcm43xx_txstatus_log {
23 struct bcm43xx_txstatus *log;
24 int end;
25 int printing;
26 char printbuf[(BCM43xx_NR_LOGGED_TXSTATUS * 70) + 200];
27 size_t buf_avail;
28 spinlock_t lock;
29 };
30
31 struct bcm43xx_dfsentry {
32 struct dentry *subdir;
33 struct dentry *dentry_tsf;
34 struct dentry *dentry_txstat;
35 struct dentry *dentry_txpower_g;
36 struct dentry *dentry_restart;
37
38 struct bcm43xx_wldev *dev;
39
40 struct bcm43xx_txstatus_log txstatlog;
41
42 /* Enabled/Disabled list for the dynamic debugging features. */
43 u32 dyn_debug[__BCM43xx_NR_DYNDBG];
44 /* Dentries for the dynamic debugging entries. */
45 struct dentry *dyn_debug_dentries[__BCM43xx_NR_DYNDBG];
46 };
47
48 struct bcm43xx_debugfs {
49 struct dentry *root;
50 struct dentry *dentry_driverinfo;
51 };
52
53 int bcm43xx_debug(struct bcm43xx_wldev *dev, enum bcm43xx_dyndbg feature);
54
55 void bcm43xx_debugfs_init(void);
56 void bcm43xx_debugfs_exit(void);
57 void bcm43xx_debugfs_add_device(struct bcm43xx_wldev *dev);
58 void bcm43xx_debugfs_remove_device(struct bcm43xx_wldev *dev);
59 void bcm43xx_debugfs_log_txstat(struct bcm43xx_wldev *dev,
60 const struct bcm43xx_txstatus *status);
61
62 /* Debug helper: Dump binary data through printk. */
63 void bcm43xx_printk_dump(const char *data,
64 size_t size,
65 const char *description);
66 /* Debug helper: Dump bitwise binary data through printk. */
67 void bcm43xx_printk_bitdump(const unsigned char *data,
68 size_t bytes, int msb_to_lsb,
69 const char *description);
70 #define bcm43xx_printk_bitdumpt(pointer, msb_to_lsb, description) \
71 do { \
72 bcm43xx_printk_bitdump((const unsigned char *)(pointer), \
73 sizeof(*(pointer)), \
74 (msb_to_lsb), \
75 (description)); \
76 } while (0)
77
78 #else /* CONFIG_BCM43XX_MAC80211_DEBUG*/
79
80 static inline
81 int bcm43xx_debug(struct bcm43xx_wldev *dev, enum bcm43xx_dyndbg feature)
82 {
83 return 0;
84 }
85
86 static inline
87 void bcm43xx_debugfs_init(void) { }
88 static inline
89 void bcm43xx_debugfs_exit(void) { }
90 static inline
91 void bcm43xx_debugfs_add_device(struct bcm43xx_wldev *dev) { }
92 static inline
93 void bcm43xx_debugfs_remove_device(struct bcm43xx_wldev *dev) { }
94 static inline
95 void bcm43xx_debugfs_log_txstat(struct bcm43xx_wldev *dev,
96 const struct bcm43xx_txstatus *status) { }
97
98 static inline
99 void bcm43xx_printk_dump(const char *data,
100 size_t size,
101 const char *description)
102 {
103 }
104 static inline
105 void bcm43xx_printk_bitdump(const unsigned char *data,
106 size_t bytes, int msb_to_lsb,
107 const char *description)
108 {
109 }
110 #define bcm43xx_printk_bitdumpt(pointer, msb_to_lsb, description) do { /* nothing */ } while (0)
111
112 #endif /* CONFIG_BCM43XX_MAC80211_DEBUG*/
113
114 /* Ugly helper macros to make incomplete code more verbose on runtime */
115 #ifdef TODO
116 # undef TODO
117 #endif
118 #define TODO() \
119 do { \
120 printk(KERN_INFO PFX "TODO: Incomplete code in %s() at %s:%d\n", \
121 __FUNCTION__, __FILE__, __LINE__); \
122 } while (0)
123
124 #ifdef FIXME
125 # undef FIXME
126 #endif
127 #define FIXME() \
128 do { \
129 printk(KERN_INFO PFX "FIXME: Possibly broken code in %s() at %s:%d\n", \
130 __FUNCTION__, __FILE__, __LINE__); \
131 } while (0)
132
133 #endif /* BCM43xx_DEBUGFS_H_ */
This page took 0.043025 seconds and 5 git commands to generate.