blob: 7886cbe2d1d19276f22e3a974dd4d7e44a55347b [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 Buesche4d6b792007-09-18 15:39:42 -040016 __B43_NR_DYNDBG,
17};
18
19#ifdef CONFIG_B43_DEBUG
20
21struct dentry;
22
23#define B43_NR_LOGGED_TXSTATUS 100
24
25struct b43_txstatus_log {
26 struct b43_txstatus *log;
27 int end;
28 spinlock_t lock;
29};
30
31struct b43_dfs_file {
32 struct dentry *dentry;
33 char *buffer;
34 size_t data_len;
35};
36
37struct b43_dfsentry {
38 struct b43_wldev *dev;
39 struct dentry *subdir;
40
Michael Buesch6bbc3212008-06-19 19:33:51 +020041 struct b43_dfs_file file_shm16read;
42 struct b43_dfs_file file_shm16write;
43 struct b43_dfs_file file_shm32read;
44 struct b43_dfs_file file_shm32write;
Michael Buesch8bd463f2008-06-19 00:35:49 +020045 struct b43_dfs_file file_mmio16read;
46 struct b43_dfs_file file_mmio16write;
47 struct b43_dfs_file file_mmio32read;
48 struct b43_dfs_file file_mmio32write;
Michael Buesche4d6b792007-09-18 15:39:42 -040049 struct b43_dfs_file file_tsf;
Michael Buesche4d6b792007-09-18 15:39:42 -040050 struct b43_dfs_file file_txstat;
51 struct b43_dfs_file file_txpower_g;
52 struct b43_dfs_file file_restart;
53 struct b43_dfs_file file_loctls;
54
55 struct b43_txstatus_log txstatlog;
56
Michael Buesch8bd463f2008-06-19 00:35:49 +020057 /* The cached address for the next mmio16read file read */
58 u16 mmio16read_next;
59 /* The cached address for the next mmio32read file read */
60 u16 mmio32read_next;
61
Michael Buesch6bbc3212008-06-19 19:33:51 +020062 /* The cached address for the next shm16read file read */
63 u32 shm16read_routing_next;
64 u32 shm16read_addr_next;
65 /* The cached address for the next shm32read file read */
66 u32 shm32read_routing_next;
67 u32 shm32read_addr_next;
68
Michael Buesche4d6b792007-09-18 15:39:42 -040069 /* Enabled/Disabled list for the dynamic debugging features. */
70 u32 dyn_debug[__B43_NR_DYNDBG];
71 /* Dentries for the dynamic debugging entries. */
72 struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
73};
74
75int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
76
77void b43_debugfs_init(void);
78void b43_debugfs_exit(void);
79void b43_debugfs_add_device(struct b43_wldev *dev);
80void b43_debugfs_remove_device(struct b43_wldev *dev);
81void b43_debugfs_log_txstat(struct b43_wldev *dev,
82 const struct b43_txstatus *status);
83
84#else /* CONFIG_B43_DEBUG */
85
86static inline int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
87{
88 return 0;
89}
90
91static inline void b43_debugfs_init(void)
92{
93}
94static inline void b43_debugfs_exit(void)
95{
96}
97static inline void b43_debugfs_add_device(struct b43_wldev *dev)
98{
99}
100static inline void b43_debugfs_remove_device(struct b43_wldev *dev)
101{
102}
103static inline void b43_debugfs_log_txstat(struct b43_wldev *dev,
104 const struct b43_txstatus *status)
105{
106}
107
108#endif /* CONFIG_B43_DEBUG */
109
110#endif /* B43_DEBUGFS_H_ */