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; |
| 23 | |
| 24 | struct bcm43xx_private *bcm; |
| 25 | |
| 26 | /* saved xmitstatus. */ |
| 27 | struct bcm43xx_xmitstatus *xmitstatus_buffer; |
| 28 | int xmitstatus_ptr; |
| 29 | int xmitstatus_cnt; |
| 30 | /* We need a seperate buffer while printing to avoid |
| 31 | * concurrency issues. (New xmitstatus can arrive |
| 32 | * while we are printing). |
| 33 | */ |
| 34 | struct bcm43xx_xmitstatus *xmitstatus_print_buffer; |
| 35 | int saved_xmitstatus_ptr; |
| 36 | int saved_xmitstatus_cnt; |
| 37 | int xmitstatus_printing; |
| 38 | }; |
| 39 | |
| 40 | struct bcm43xx_debugfs { |
| 41 | struct dentry *root; |
| 42 | struct dentry *dentry_driverinfo; |
| 43 | }; |
| 44 | |
| 45 | void bcm43xx_debugfs_init(void); |
| 46 | void bcm43xx_debugfs_exit(void); |
| 47 | void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm); |
| 48 | void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm); |
| 49 | void bcm43xx_debugfs_log_txstat(struct bcm43xx_private *bcm, |
| 50 | struct bcm43xx_xmitstatus *status); |
| 51 | |
| 52 | /* Debug helper: Dump binary data through printk. */ |
| 53 | void bcm43xx_printk_dump(const char *data, |
| 54 | size_t size, |
| 55 | const char *description); |
| 56 | /* Debug helper: Dump bitwise binary data through printk. */ |
| 57 | void bcm43xx_printk_bitdump(const unsigned char *data, |
| 58 | size_t bytes, int msb_to_lsb, |
| 59 | const char *description); |
| 60 | #define bcm43xx_printk_bitdumpt(pointer, msb_to_lsb, description) \ |
| 61 | do { \ |
| 62 | bcm43xx_printk_bitdump((const unsigned char *)(pointer), \ |
| 63 | sizeof(*(pointer)), \ |
| 64 | (msb_to_lsb), \ |
| 65 | (description)); \ |
| 66 | } while (0) |
| 67 | |
| 68 | #else /* CONFIG_BCM43XX_DEBUG*/ |
| 69 | |
| 70 | static inline |
| 71 | void bcm43xx_debugfs_init(void) { } |
| 72 | static inline |
| 73 | void bcm43xx_debugfs_exit(void) { } |
| 74 | static inline |
| 75 | void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm) { } |
| 76 | static inline |
| 77 | void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm) { } |
| 78 | static inline |
| 79 | void bcm43xx_debugfs_log_txstat(struct bcm43xx_private *bcm, |
| 80 | struct bcm43xx_xmitstatus *status) { } |
| 81 | |
| 82 | static inline |
| 83 | void bcm43xx_printk_dump(const char *data, |
| 84 | size_t size, |
| 85 | const char *description) |
| 86 | { |
| 87 | } |
| 88 | static inline |
| 89 | void bcm43xx_printk_bitdump(const unsigned char *data, |
| 90 | size_t bytes, int msb_to_lsb, |
| 91 | const char *description) |
| 92 | { |
| 93 | } |
| 94 | #define bcm43xx_printk_bitdumpt(pointer, msb_to_lsb, description) do { /* nothing */ } while (0) |
| 95 | |
| 96 | #endif /* CONFIG_BCM43XX_DEBUG*/ |
| 97 | |
| 98 | /* Ugly helper macros to make incomplete code more verbose on runtime */ |
| 99 | #ifdef TODO |
| 100 | # undef TODO |
| 101 | #endif |
| 102 | #define TODO() \ |
| 103 | do { \ |
| 104 | printk(KERN_INFO PFX "TODO: Incomplete code in %s() at %s:%d\n", \ |
| 105 | __FUNCTION__, __FILE__, __LINE__); \ |
| 106 | } while (0) |
| 107 | |
| 108 | #ifdef FIXME |
| 109 | # undef FIXME |
| 110 | #endif |
| 111 | #define FIXME() \ |
| 112 | do { \ |
| 113 | printk(KERN_INFO PFX "FIXME: Possibly broken code in %s() at %s:%d\n", \ |
| 114 | __FUNCTION__, __FILE__, __LINE__); \ |
| 115 | } while (0) |
| 116 | |
| 117 | #endif /* BCM43xx_DEBUGFS_H_ */ |