John W. Linville | f222313 | 2006-01-23 16:59:58 -0500 | [diff] [blame] | 1 | #ifndef BCM43xx_DEBUGFS_H_ |
| 2 | #define BCM43xx_DEBUGFS_H_ |
| 3 | |
| 4 | struct bcm43xx_private; |
| 5 | struct bcm43xx_xmitstatus; |
| 6 | |
| 7 | #ifdef CONFIG_BCM43XX_DEBUG |
| 8 | |
| 9 | #include <linux/list.h> |
| 10 | #include <asm/semaphore.h> |
| 11 | |
| 12 | struct dentry; |
| 13 | |
| 14 | /* limited by the size of the "really_big_buffer" */ |
| 15 | #define BCM43xx_NR_LOGGED_XMITSTATUS 100 |
| 16 | |
| 17 | struct bcm43xx_dfsentry { |
| 18 | struct dentry *subdir; |
| 19 | struct dentry *dentry_devinfo; |
| 20 | struct dentry *dentry_spromdump; |
| 21 | struct dentry *dentry_tsf; |
| 22 | struct dentry *dentry_txstat; |
Michael Buesch | 58e5528 | 2006-07-08 22:02:18 +0200 | [diff] [blame] | 23 | struct dentry *dentry_restart; |
John W. Linville | f222313 | 2006-01-23 16:59:58 -0500 | [diff] [blame] | 24 | |
| 25 | struct bcm43xx_private *bcm; |
| 26 | |
| 27 | /* saved xmitstatus. */ |
| 28 | struct bcm43xx_xmitstatus *xmitstatus_buffer; |
| 29 | int xmitstatus_ptr; |
| 30 | int xmitstatus_cnt; |
| 31 | /* We need a seperate buffer while printing to avoid |
| 32 | * concurrency issues. (New xmitstatus can arrive |
| 33 | * while we are printing). |
| 34 | */ |
| 35 | struct bcm43xx_xmitstatus *xmitstatus_print_buffer; |
| 36 | int saved_xmitstatus_ptr; |
| 37 | int saved_xmitstatus_cnt; |
| 38 | int xmitstatus_printing; |
| 39 | }; |
| 40 | |
| 41 | struct bcm43xx_debugfs { |
| 42 | struct dentry *root; |
| 43 | struct dentry *dentry_driverinfo; |
| 44 | }; |
| 45 | |
| 46 | void bcm43xx_debugfs_init(void); |
| 47 | void bcm43xx_debugfs_exit(void); |
| 48 | void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm); |
| 49 | void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm); |
| 50 | void bcm43xx_debugfs_log_txstat(struct bcm43xx_private *bcm, |
| 51 | struct bcm43xx_xmitstatus *status); |
| 52 | |
| 53 | /* Debug helper: Dump binary data through printk. */ |
| 54 | void bcm43xx_printk_dump(const char *data, |
| 55 | size_t size, |
| 56 | const char *description); |
| 57 | /* Debug helper: Dump bitwise binary data through printk. */ |
| 58 | void bcm43xx_printk_bitdump(const unsigned char *data, |
| 59 | size_t bytes, int msb_to_lsb, |
| 60 | const char *description); |
| 61 | #define bcm43xx_printk_bitdumpt(pointer, msb_to_lsb, description) \ |
| 62 | do { \ |
| 63 | bcm43xx_printk_bitdump((const unsigned char *)(pointer), \ |
| 64 | sizeof(*(pointer)), \ |
| 65 | (msb_to_lsb), \ |
| 66 | (description)); \ |
| 67 | } while (0) |
| 68 | |
| 69 | #else /* CONFIG_BCM43XX_DEBUG*/ |
| 70 | |
| 71 | static inline |
| 72 | void bcm43xx_debugfs_init(void) { } |
| 73 | static inline |
| 74 | void bcm43xx_debugfs_exit(void) { } |
| 75 | static inline |
| 76 | void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm) { } |
| 77 | static inline |
| 78 | void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm) { } |
| 79 | static inline |
| 80 | void bcm43xx_debugfs_log_txstat(struct bcm43xx_private *bcm, |
| 81 | struct bcm43xx_xmitstatus *status) { } |
| 82 | |
| 83 | static inline |
| 84 | void bcm43xx_printk_dump(const char *data, |
| 85 | size_t size, |
| 86 | const char *description) |
| 87 | { |
| 88 | } |
| 89 | static inline |
| 90 | void bcm43xx_printk_bitdump(const unsigned char *data, |
| 91 | size_t bytes, int msb_to_lsb, |
| 92 | const char *description) |
| 93 | { |
| 94 | } |
| 95 | #define bcm43xx_printk_bitdumpt(pointer, msb_to_lsb, description) do { /* nothing */ } while (0) |
| 96 | |
| 97 | #endif /* CONFIG_BCM43XX_DEBUG*/ |
| 98 | |
| 99 | /* Ugly helper macros to make incomplete code more verbose on runtime */ |
| 100 | #ifdef TODO |
| 101 | # undef TODO |
| 102 | #endif |
| 103 | #define TODO() \ |
| 104 | do { \ |
| 105 | printk(KERN_INFO PFX "TODO: Incomplete code in %s() at %s:%d\n", \ |
| 106 | __FUNCTION__, __FILE__, __LINE__); \ |
| 107 | } while (0) |
| 108 | |
| 109 | #ifdef FIXME |
| 110 | # undef FIXME |
| 111 | #endif |
| 112 | #define FIXME() \ |
| 113 | do { \ |
| 114 | printk(KERN_INFO PFX "FIXME: Possibly broken code in %s() at %s:%d\n", \ |
| 115 | __FUNCTION__, __FILE__, __LINE__); \ |
| 116 | } while (0) |
| 117 | |
| 118 | #endif /* BCM43xx_DEBUGFS_H_ */ |