deb_defs.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /**
  2. * This header file contains global constant/enum definitions,
  3. * global variable declaration.
  4. */
  5. #ifndef _LBS_DEB_DEFS_H_
  6. #define _LBS_DEB_DEFS_H_
  7. #ifndef DRV_NAME
  8. #define DRV_NAME "libertas_tf"
  9. #endif
  10. #include <linux/spinlock.h>
  11. #ifdef CONFIG_LIBERTAS_THINFIRM_DEBUG
  12. #define DEBUG
  13. #define PROC_DEBUG
  14. #endif
  15. #define LBTF_DEB_ENTER 0x00000001
  16. #define LBTF_DEB_LEAVE 0x00000002
  17. #define LBTF_DEB_MAIN 0x00000004
  18. #define LBTF_DEB_NET 0x00000008
  19. #define LBTF_DEB_MESH 0x00000010
  20. #define LBTF_DEB_WEXT 0x00000020
  21. #define LBTF_DEB_IOCTL 0x00000040
  22. #define LBTF_DEB_SCAN 0x00000080
  23. #define LBTF_DEB_ASSOC 0x00000100
  24. #define LBTF_DEB_JOIN 0x00000200
  25. #define LBTF_DEB_11D 0x00000400
  26. #define LBTF_DEB_DEBUGFS 0x00000800
  27. #define LBTF_DEB_ETHTOOL 0x00001000
  28. #define LBTF_DEB_HOST 0x00002000
  29. #define LBTF_DEB_CMD 0x00004000
  30. #define LBTF_DEB_RX 0x00008000
  31. #define LBTF_DEB_TX 0x00010000
  32. #define LBTF_DEB_USB 0x00020000
  33. #define LBTF_DEB_CS 0x00040000
  34. #define LBTF_DEB_FW 0x00080000
  35. #define LBTF_DEB_THREAD 0x00100000
  36. #define LBTF_DEB_HEX 0x00200000
  37. #define LBTF_DEB_SDIO 0x00400000
  38. #define LBTF_DEB_MACOPS 0x00800000
  39. extern unsigned int lbtf_debug;
  40. #ifdef DEBUG
  41. #define LBTF_DEB_LL(grp, grpnam, fmt, args...) \
  42. do { if ((lbtf_debug & (grp)) == (grp)) \
  43. printk(KERN_DEBUG DRV_NAME grpnam "%s: " fmt, \
  44. in_interrupt() ? " (INT)" : "", ## args); } while (0)
  45. #else
  46. #define LBTF_DEB_LL(grp, grpnam, fmt, args...) do {} while (0)
  47. #endif
  48. #define lbtf_deb_enter(grp) \
  49. LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s()\n", __func__);
  50. #define lbtf_deb_enter_args(grp, fmt, args...) \
  51. LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s(" fmt ")\n", __func__, ## args);
  52. #define lbtf_deb_leave(grp) \
  53. LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s()\n", __func__);
  54. #define lbtf_deb_leave_args(grp, fmt, args...) \
  55. LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s(), " fmt "\n", \
  56. __func__, ##args);
  57. #define lbtf_deb_main(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MAIN, " main", fmt, ##args)
  58. #define lbtf_deb_net(fmt, args...) LBTF_DEB_LL(LBTF_DEB_NET, " net", fmt, ##args)
  59. #define lbtf_deb_mesh(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MESH, " mesh", fmt, ##args)
  60. #define lbtf_deb_wext(fmt, args...) LBTF_DEB_LL(LBTF_DEB_WEXT, " wext", fmt, ##args)
  61. #define lbtf_deb_ioctl(fmt, args...) LBTF_DEB_LL(LBTF_DEB_IOCTL, " ioctl", fmt, ##args)
  62. #define lbtf_deb_scan(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SCAN, " scan", fmt, ##args)
  63. #define lbtf_deb_assoc(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ASSOC, " assoc", fmt, ##args)
  64. #define lbtf_deb_join(fmt, args...) LBTF_DEB_LL(LBTF_DEB_JOIN, " join", fmt, ##args)
  65. #define lbtf_deb_11d(fmt, args...) LBTF_DEB_LL(LBTF_DEB_11D, " 11d", fmt, ##args)
  66. #define lbtf_deb_debugfs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_DEBUGFS, " debugfs", fmt, ##args)
  67. #define lbtf_deb_ethtool(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ETHTOOL, " ethtool", fmt, ##args)
  68. #define lbtf_deb_host(fmt, args...) LBTF_DEB_LL(LBTF_DEB_HOST, " host", fmt, ##args)
  69. #define lbtf_deb_cmd(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CMD, " cmd", fmt, ##args)
  70. #define lbtf_deb_rx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_RX, " rx", fmt, ##args)
  71. #define lbtf_deb_tx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_TX, " tx", fmt, ##args)
  72. #define lbtf_deb_fw(fmt, args...) LBTF_DEB_LL(LBTF_DEB_FW, " fw", fmt, ##args)
  73. #define lbtf_deb_usb(fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usb", fmt, ##args)
  74. #define lbtf_deb_usbd(dev, fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args)
  75. #define lbtf_deb_cs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CS, " cs", fmt, ##args)
  76. #define lbtf_deb_thread(fmt, args...) LBTF_DEB_LL(LBTF_DEB_THREAD, " thread", fmt, ##args)
  77. #define lbtf_deb_sdio(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SDIO, " thread", fmt, ##args)
  78. #define lbtf_deb_macops(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MACOPS, " thread", fmt, ##args)
  79. #ifdef DEBUG
  80. static inline void lbtf_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len)
  81. {
  82. char newprompt[32];
  83. if (len &&
  84. (lbtf_debug & LBTF_DEB_HEX) &&
  85. (lbtf_debug & grp)) {
  86. snprintf(newprompt, sizeof(newprompt), DRV_NAME " %s: ", prompt);
  87. print_hex_dump_bytes(prompt, DUMP_PREFIX_NONE, buf, len);
  88. }
  89. }
  90. #else
  91. #define lbtf_deb_hex(grp, prompt, buf, len) do {} while (0)
  92. #endif
  93. #endif