add b43
[openwrt-10.03/.git] / package / b43 / src / debugfs.h
1 #ifndef B43_DEBUGFS_H_
2 #define B43_DEBUGFS_H_
3
4 struct b43_wldev;
5 struct b43_txstatus;
6
7 enum b43_dyndbg {               /* Dynamic debugging features */
8         B43_DBG_XMITPOWER,
9         B43_DBG_DMAOVERFLOW,
10         B43_DBG_DMAVERBOSE,
11         B43_DBG_PWORK_FAST,
12         B43_DBG_PWORK_STOP,
13         __B43_NR_DYNDBG,
14 };
15
16 #ifdef CONFIG_B43_DEBUG
17
18 struct dentry;
19
20 #define B43_NR_LOGGED_TXSTATUS  100
21
22 struct b43_txstatus_log {
23         struct b43_txstatus *log;
24         int end;
25         spinlock_t lock;
26 };
27
28 struct b43_dfs_file {
29         struct dentry *dentry;
30         char *buffer;
31         size_t data_len;
32 };
33
34 struct b43_dfsentry {
35         struct b43_wldev *dev;
36         struct dentry *subdir;
37
38         struct b43_dfs_file file_tsf;
39         struct b43_dfs_file file_ucode_regs;
40         struct b43_dfs_file file_shm;
41         struct b43_dfs_file file_txstat;
42         struct b43_dfs_file file_txpower_g;
43         struct b43_dfs_file file_restart;
44         struct b43_dfs_file file_loctls;
45
46         struct b43_txstatus_log txstatlog;
47
48         /* Enabled/Disabled list for the dynamic debugging features. */
49         u32 dyn_debug[__B43_NR_DYNDBG];
50         /* Dentries for the dynamic debugging entries. */
51         struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
52 };
53
54 int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
55
56 void b43_debugfs_init(void);
57 void b43_debugfs_exit(void);
58 void b43_debugfs_add_device(struct b43_wldev *dev);
59 void b43_debugfs_remove_device(struct b43_wldev *dev);
60 void b43_debugfs_log_txstat(struct b43_wldev *dev,
61                             const struct b43_txstatus *status);
62
63 #else /* CONFIG_B43_DEBUG */
64
65 static inline int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
66 {
67         return 0;
68 }
69
70 static inline void b43_debugfs_init(void)
71 {
72 }
73 static inline void b43_debugfs_exit(void)
74 {
75 }
76 static inline void b43_debugfs_add_device(struct b43_wldev *dev)
77 {
78 }
79 static inline void b43_debugfs_remove_device(struct b43_wldev *dev)
80 {
81 }
82 static inline void b43_debugfs_log_txstat(struct b43_wldev *dev,
83                                           const struct b43_txstatus *status)
84 {
85 }
86
87 #endif /* CONFIG_B43_DEBUG */
88
89 #endif /* B43_DEBUGFS_H_ */