0001
0002
0003
0004
0005
0006 #ifndef _LBS_DEB_DEFS_H_
0007 #define _LBS_DEB_DEFS_H_
0008
0009 #ifndef DRV_NAME
0010 #define DRV_NAME "libertas_tf"
0011 #endif
0012
0013 #include <linux/spinlock.h>
0014
0015 #ifdef CONFIG_LIBERTAS_THINFIRM_DEBUG
0016 #define DEBUG
0017 #define PROC_DEBUG
0018 #endif
0019
0020 #define LBTF_DEB_ENTER 0x00000001
0021 #define LBTF_DEB_LEAVE 0x00000002
0022 #define LBTF_DEB_MAIN 0x00000004
0023 #define LBTF_DEB_NET 0x00000008
0024 #define LBTF_DEB_MESH 0x00000010
0025 #define LBTF_DEB_WEXT 0x00000020
0026 #define LBTF_DEB_IOCTL 0x00000040
0027 #define LBTF_DEB_SCAN 0x00000080
0028 #define LBTF_DEB_ASSOC 0x00000100
0029 #define LBTF_DEB_JOIN 0x00000200
0030 #define LBTF_DEB_11D 0x00000400
0031 #define LBTF_DEB_DEBUGFS 0x00000800
0032 #define LBTF_DEB_ETHTOOL 0x00001000
0033 #define LBTF_DEB_HOST 0x00002000
0034 #define LBTF_DEB_CMD 0x00004000
0035 #define LBTF_DEB_RX 0x00008000
0036 #define LBTF_DEB_TX 0x00010000
0037 #define LBTF_DEB_USB 0x00020000
0038 #define LBTF_DEB_CS 0x00040000
0039 #define LBTF_DEB_FW 0x00080000
0040 #define LBTF_DEB_THREAD 0x00100000
0041 #define LBTF_DEB_HEX 0x00200000
0042 #define LBTF_DEB_SDIO 0x00400000
0043 #define LBTF_DEB_MACOPS 0x00800000
0044
0045 extern unsigned int lbtf_debug;
0046
0047
0048 #ifdef DEBUG
0049 #define LBTF_DEB_LL(grp, grpnam, fmt, args...) \
0050 do { if ((lbtf_debug & (grp)) == (grp)) \
0051 printk(KERN_DEBUG DRV_NAME grpnam ": " fmt, ## args); } while (0)
0052 #else
0053 #define LBTF_DEB_LL(grp, grpnam, fmt, args...) do {} while (0)
0054 #endif
0055
0056 #define lbtf_deb_enter(grp) \
0057 LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s()\n", __func__);
0058 #define lbtf_deb_enter_args(grp, fmt, args...) \
0059 LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s(" fmt ")\n", __func__, ## args);
0060 #define lbtf_deb_leave(grp) \
0061 LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s()\n", __func__);
0062 #define lbtf_deb_leave_args(grp, fmt, args...) \
0063 LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s(), " fmt "\n", \
0064 __func__, ##args);
0065 #define lbtf_deb_main(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MAIN, " main", fmt, ##args)
0066 #define lbtf_deb_net(fmt, args...) LBTF_DEB_LL(LBTF_DEB_NET, " net", fmt, ##args)
0067 #define lbtf_deb_mesh(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MESH, " mesh", fmt, ##args)
0068 #define lbtf_deb_wext(fmt, args...) LBTF_DEB_LL(LBTF_DEB_WEXT, " wext", fmt, ##args)
0069 #define lbtf_deb_ioctl(fmt, args...) LBTF_DEB_LL(LBTF_DEB_IOCTL, " ioctl", fmt, ##args)
0070 #define lbtf_deb_scan(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SCAN, " scan", fmt, ##args)
0071 #define lbtf_deb_assoc(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ASSOC, " assoc", fmt, ##args)
0072 #define lbtf_deb_join(fmt, args...) LBTF_DEB_LL(LBTF_DEB_JOIN, " join", fmt, ##args)
0073 #define lbtf_deb_11d(fmt, args...) LBTF_DEB_LL(LBTF_DEB_11D, " 11d", fmt, ##args)
0074 #define lbtf_deb_debugfs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_DEBUGFS, " debugfs", fmt, ##args)
0075 #define lbtf_deb_ethtool(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ETHTOOL, " ethtool", fmt, ##args)
0076 #define lbtf_deb_host(fmt, args...) LBTF_DEB_LL(LBTF_DEB_HOST, " host", fmt, ##args)
0077 #define lbtf_deb_cmd(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CMD, " cmd", fmt, ##args)
0078 #define lbtf_deb_rx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_RX, " rx", fmt, ##args)
0079 #define lbtf_deb_tx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_TX, " tx", fmt, ##args)
0080 #define lbtf_deb_fw(fmt, args...) LBTF_DEB_LL(LBTF_DEB_FW, " fw", fmt, ##args)
0081 #define lbtf_deb_usb(fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usb", fmt, ##args)
0082 #define lbtf_deb_usbd(dev, fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args)
0083 #define lbtf_deb_cs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CS, " cs", fmt, ##args)
0084 #define lbtf_deb_thread(fmt, args...) LBTF_DEB_LL(LBTF_DEB_THREAD, " thread", fmt, ##args)
0085 #define lbtf_deb_sdio(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SDIO, " thread", fmt, ##args)
0086 #define lbtf_deb_macops(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MACOPS, " thread", fmt, ##args)
0087
0088 #ifdef DEBUG
0089 static inline void lbtf_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len)
0090 {
0091 char newprompt[32];
0092
0093 if (len &&
0094 (lbtf_debug & LBTF_DEB_HEX) &&
0095 (lbtf_debug & grp)) {
0096 snprintf(newprompt, sizeof(newprompt), DRV_NAME " %s: ", prompt);
0097 print_hex_dump_bytes(prompt, DUMP_PREFIX_NONE, buf, len);
0098 }
0099 }
0100 #else
0101 #define lbtf_deb_hex(grp, prompt, buf, len) do {} while (0)
0102 #endif
0103
0104 #endif