blob: 50517b801cb42d40137d2c0739440220ce8e2151 [file] [log] [blame]
Michael Buesche4d6b792007-09-18 15:39:42 -04001#ifndef B43_DEBUGFS_H_
2#define B43_DEBUGFS_H_
3
4struct b43_wldev;
5struct b43_txstatus;
6
7enum 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,
Michael Bueschf5eda472008-04-20 16:03:32 +020013 B43_DBG_LO,
Michael Buesch923fd702008-06-20 18:02:08 +020014 B43_DBG_FIRMWARE,
Michael Buesch9cf7f242008-12-19 20:24:30 +010015 B43_DBG_KEYS,
Michael Buesch990b86f2009-09-12 00:48:03 +020016 B43_DBG_VERBOSESTATS,
Michael Buesche4d6b792007-09-18 15:39:42 -040017 __B43_NR_DYNDBG,
18};
19
20#ifdef CONFIG_B43_DEBUG
21
22struct dentry;
23
24#define B43_NR_LOGGED_TXSTATUS 100
25
26struct b43_txstatus_log {
Michael Buesch36dbd952009-09-04 22:51:29 +020027 /* This structure is protected by wl->mutex */
28
Michael Buesche4d6b792007-09-18 15:39:42 -040029 struct b43_txstatus *log;
30 int end;
Michael Buesche4d6b792007-09-18 15:39:42 -040031};
32
33struct b43_dfs_file {
34 struct dentry *dentry;
35 char *buffer;
36 size_t data_len;
37};
38
39struct b43_dfsentry {
40 struct b43_wldev *dev;
41 struct dentry *subdir;
42
Michael Buesch6bbc3212008-06-19 19:33:51 +020043 struct b43_dfs_file file_shm16read;
44 struct b43_dfs_file file_shm16write;
45 struct b43_dfs_file file_shm32read;
46 struct b43_dfs_file file_shm32write;
Michael Buesch8bd463f2008-06-19 00:35:49 +020047 struct b43_dfs_file file_mmio16read;
48 struct b43_dfs_file file_mmio16write;
49 struct b43_dfs_file file_mmio32read;
50 struct b43_dfs_file file_mmio32write;
Michael Buesche4d6b792007-09-18 15:39:42 -040051 struct b43_dfs_file file_txstat;
52 struct b43_dfs_file file_txpower_g;
53 struct b43_dfs_file file_restart;
54 struct b43_dfs_file file_loctls;
55
56 struct b43_txstatus_log txstatlog;
57
Michael Buesch8bd463f2008-06-19 00:35:49 +020058 /* The cached address for the next mmio16read file read */
59 u16 mmio16read_next;
60 /* The cached address for the next mmio32read file read */
61 u16 mmio32read_next;
62
Michael Buesch6bbc3212008-06-19 19:33:51 +020063 /* The cached address for the next shm16read file read */
64 u32 shm16read_routing_next;
65 u32 shm16read_addr_next;
66 /* The cached address for the next shm32read file read */
67 u32 shm32read_routing_next;
68 u32 shm32read_addr_next;
69
Michael Buesche4d6b792007-09-18 15:39:42 -040070 /* Enabled/Disabled list for the dynamic debugging features. */
71 u32 dyn_debug[__B43_NR_DYNDBG];
72 /* Dentries for the dynamic debugging entries. */
73 struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
74};
75
Michael Buesch060210f2009-01-25 15:49:59 +010076bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
Michael Buesche4d6b792007-09-18 15:39:42 -040077
78void b43_debugfs_init(void);
79void b43_debugfs_exit(void);
80void b43_debugfs_add_device(struct b43_wldev *dev);
81void b43_debugfs_remove_device(struct b43_wldev *dev);
82void b43_debugfs_log_txstat(struct b43_wldev *dev,
83 const struct b43_txstatus *status);
84
85#else /* CONFIG_B43_DEBUG */
86
Michael Buesch060210f2009-01-25 15:49:59 +010087static inline bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
Michael Buesche4d6b792007-09-18 15:39:42 -040088{
Zhao, Gang1a2b2502014-02-16 22:31:38 +080089 return false;
Michael Buesche4d6b792007-09-18 15:39:42 -040090}
91
92static inline void b43_debugfs_init(void)
93{
94}
95static inline void b43_debugfs_exit(void)
96{
97}
98static inline void b43_debugfs_add_device(struct b43_wldev *dev)
99{
100}
101static inline void b43_debugfs_remove_device(struct b43_wldev *dev)
102{
103}
104static inline void b43_debugfs_log_txstat(struct b43_wldev *dev,
105 const struct b43_txstatus *status)
106{
107}
108
109#endif /* CONFIG_B43_DEBUG */
110
111#endif /* B43_DEBUGFS_H_ */