1#ifndef BCM43xx_DEBUGFS_H_ 2#define BCM43xx_DEBUGFS_H_ 3 4struct bcm43xx_private; 5struct bcm43xx_xmitstatus; 6 7#ifdef CONFIG_BCM43XX_DEBUG 8 9#include <linux/list.h> 10#include <asm/semaphore.h> 11 12struct dentry; 13 14/* limited by the size of the "really_big_buffer" */ 15#define BCM43xx_NR_LOGGED_XMITSTATUS 100 16 17struct 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 struct dentry *dentry_restart; 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 41struct bcm43xx_debugfs { 42 struct dentry *root; 43 struct dentry *dentry_driverinfo; 44}; 45 46void bcm43xx_debugfs_init(void); 47void bcm43xx_debugfs_exit(void); 48void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm); 49void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm); 50void bcm43xx_debugfs_log_txstat(struct bcm43xx_private *bcm, 51 struct bcm43xx_xmitstatus *status); 52 53/* Debug helper: Dump binary data through printk. */ 54void bcm43xx_printk_dump(const char *data, 55 size_t size, 56 const char *description); 57/* Debug helper: Dump bitwise binary data through printk. */ 58void 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 71static inline 72void bcm43xx_debugfs_init(void) { } 73static inline 74void bcm43xx_debugfs_exit(void) { } 75static inline 76void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm) { } 77static inline 78void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm) { } 79static inline 80void bcm43xx_debugfs_log_txstat(struct bcm43xx_private *bcm, 81 struct bcm43xx_xmitstatus *status) { } 82 83static inline 84void bcm43xx_printk_dump(const char *data, 85 size_t size, 86 const char *description) 87{ 88} 89static inline 90void 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_ */ 119