/drivers/staging/brcm80211/brcmsmac/wl_dbg.h

https://bitbucket.org/wisechild/galaxy-nexus · C++ Header · 92 lines · 59 code · 16 blank · 17 comment · 4 complexity · 6414806c76565418cffdbfc988c78631 MD5 · raw file

  1. /*
  2. * Copyright (c) 2010 Broadcom Corporation
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _wl_dbg_h_
  17. #define _wl_dbg_h_
  18. #include <linux/device.h> /* dev_err() */
  19. /* wl_msg_level is a bit vector with defs in wlioctl.h */
  20. extern u32 wl_msg_level;
  21. #define BCMMSG(dev, fmt, args...) \
  22. do { \
  23. if (wl_msg_level & WL_TRACE_VAL) \
  24. wiphy_err(dev, "%s: " fmt, __func__, ##args); \
  25. } while (0)
  26. #ifdef BCMDBG
  27. /* Extra message control for AMPDU debugging */
  28. #define WL_AMPDU_UPDN_VAL 0x00000001 /* Config up/down related */
  29. #define WL_AMPDU_ERR_VAL 0x00000002 /* Calls to beaocn update */
  30. #define WL_AMPDU_TX_VAL 0x00000004 /* Transmit data path */
  31. #define WL_AMPDU_RX_VAL 0x00000008 /* Receive data path */
  32. #define WL_AMPDU_CTL_VAL 0x00000010 /* TSF-related items */
  33. #define WL_AMPDU_HW_VAL 0x00000020 /* AMPDU_HW */
  34. #define WL_AMPDU_HWTXS_VAL 0x00000040 /* AMPDU_HWTXS */
  35. #define WL_AMPDU_HWDBG_VAL 0x00000080 /* AMPDU_DBG */
  36. extern u32 wl_ampdu_dbg;
  37. #define WL_AMPDU_PRINT(level, fmt, args...) \
  38. do { \
  39. if (wl_ampdu_dbg & level) { \
  40. WL_AMPDU(fmt, ##args); \
  41. } \
  42. } while (0)
  43. #define WL_AMPDU_UPDN(fmt, args...) \
  44. WL_AMPDU_PRINT(WL_AMPDU_UPDN_VAL, fmt, ##args)
  45. #define WL_AMPDU_RX(fmt, args...) \
  46. WL_AMPDU_PRINT(WL_AMPDU_RX_VAL, fmt, ##args)
  47. #define WL_AMPDU_ERR(fmt, args...) \
  48. WL_AMPDU_PRINT(WL_AMPDU_ERR_VAL, fmt, ##args)
  49. #define WL_AMPDU_TX(fmt, args...) \
  50. WL_AMPDU_PRINT(WL_AMPDU_TX_VAL, fmt, ##args)
  51. #define WL_AMPDU_CTL(fmt, args...) \
  52. WL_AMPDU_PRINT(WL_AMPDU_CTL_VAL, fmt, ##args)
  53. #define WL_AMPDU_HW(fmt, args...) \
  54. WL_AMPDU_PRINT(WL_AMPDU_HW_VAL, fmt, ##args)
  55. #define WL_AMPDU_HWTXS(fmt, args...) \
  56. WL_AMPDU_PRINT(WL_AMPDU_HWTXS_VAL, fmt, ##args)
  57. #define WL_AMPDU_HWDBG(fmt, args...) \
  58. WL_AMPDU_PRINT(WL_AMPDU_HWDBG_VAL, fmt, ##args)
  59. #define WL_AMPDU_ERR_ON() (wl_ampdu_dbg & WL_AMPDU_ERR_VAL)
  60. #define WL_AMPDU_HW_ON() (wl_ampdu_dbg & WL_AMPDU_HW_VAL)
  61. #define WL_AMPDU_HWTXS_ON() (wl_ampdu_dbg & WL_AMPDU_HWTXS_VAL)
  62. #else /* BCMDBG */
  63. #define WL_AMPDU_UPDN(fmt, args...) no_printk(fmt, ##args)
  64. #define WL_AMPDU_RX(fmt, args...) no_printk(fmt, ##args)
  65. #define WL_AMPDU_ERR(fmt, args...) no_printk(fmt, ##args)
  66. #define WL_AMPDU_TX(fmt, args...) no_printk(fmt, ##args)
  67. #define WL_AMPDU_CTL(fmt, args...) no_printk(fmt, ##args)
  68. #define WL_AMPDU_HW(fmt, args...) no_printk(fmt, ##args)
  69. #define WL_AMPDU_HWTXS(fmt, args...) no_printk(fmt, ##args)
  70. #define WL_AMPDU_HWDBG(fmt, args...) no_printk(fmt, ##args)
  71. #define WL_AMPDU_ERR_ON() 0
  72. #define WL_AMPDU_HW_ON() 0
  73. #define WL_AMPDU_HWTXS_ON() 0
  74. #endif /* BCMDBG */
  75. #define WL_ERROR_ON() (wl_msg_level & WL_ERROR_VAL)
  76. #endif /* _wl_dbg_h_ */