dhd_dbg.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 _BRCMF_DBG_H_
  17. #define _BRCMF_DBG_H_
  18. /* message levels */
  19. #define BRCMF_ERROR_VAL 0x0001
  20. #define BRCMF_TRACE_VAL 0x0002
  21. #define BRCMF_INFO_VAL 0x0004
  22. #define BRCMF_DATA_VAL 0x0008
  23. #define BRCMF_CTL_VAL 0x0010
  24. #define BRCMF_TIMER_VAL 0x0020
  25. #define BRCMF_HDRS_VAL 0x0040
  26. #define BRCMF_BYTES_VAL 0x0080
  27. #define BRCMF_INTR_VAL 0x0100
  28. #define BRCMF_GLOM_VAL 0x0400
  29. #define BRCMF_EVENT_VAL 0x0800
  30. #define BRCMF_BTA_VAL 0x1000
  31. #define BRCMF_ISCAN_VAL 0x2000
  32. #if defined(DEBUG)
  33. #define brcmf_dbg(level, fmt, ...) \
  34. do { \
  35. if (BRCMF_ERROR_VAL == BRCMF_##level##_VAL) { \
  36. if (brcmf_msg_level & BRCMF_##level##_VAL) { \
  37. if (net_ratelimit()) \
  38. pr_debug("%s: " fmt, \
  39. __func__, ##__VA_ARGS__); \
  40. } \
  41. } else { \
  42. if (brcmf_msg_level & BRCMF_##level##_VAL) { \
  43. pr_debug("%s: " fmt, \
  44. __func__, ##__VA_ARGS__); \
  45. } \
  46. } \
  47. } while (0)
  48. #define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL)
  49. #define BRCMF_CTL_ON() (brcmf_msg_level & BRCMF_CTL_VAL)
  50. #define BRCMF_HDRS_ON() (brcmf_msg_level & BRCMF_HDRS_VAL)
  51. #define BRCMF_BYTES_ON() (brcmf_msg_level & BRCMF_BYTES_VAL)
  52. #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  53. #else /* (defined DEBUG) || (defined DEBUG) */
  54. #define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
  55. #define BRCMF_DATA_ON() 0
  56. #define BRCMF_CTL_ON() 0
  57. #define BRCMF_HDRS_ON() 0
  58. #define BRCMF_BYTES_ON() 0
  59. #define BRCMF_GLOM_ON() 0
  60. #endif /* defined(DEBUG) */
  61. #define brcmf_dbg_hex_dump(test, data, len, fmt, ...) \
  62. do { \
  63. if (test) \
  64. brcmu_dbg_hex_dump(data, len, fmt, ##__VA_ARGS__); \
  65. } while (0)
  66. extern int brcmf_msg_level;
  67. #endif /* _BRCMF_DBG_H_ */