debug.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2012 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 _BRCMS_DEBUG_H_
  17. #define _BRCMS_DEBUG_H_
  18. #include <linux/device.h>
  19. #include <linux/bcma/bcma.h>
  20. #include <net/cfg80211.h>
  21. #include <net/mac80211.h>
  22. #include "main.h"
  23. #include "mac80211_if.h"
  24. __printf(2, 3)
  25. void __brcms_info(struct device *dev, const char *fmt, ...);
  26. __printf(2, 3)
  27. void __brcms_warn(struct device *dev, const char *fmt, ...);
  28. __printf(2, 3)
  29. void __brcms_err(struct device *dev, const char *fmt, ...);
  30. __printf(2, 3)
  31. void __brcms_crit(struct device *dev, const char *fmt, ...);
  32. #if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING)
  33. __printf(4, 5)
  34. void __brcms_dbg(struct device *dev, u32 level, const char *func,
  35. const char *fmt, ...);
  36. #else
  37. static inline __printf(4, 5)
  38. void __brcms_dbg(struct device *dev, u32 level, const char *func,
  39. const char *fmt, ...)
  40. {
  41. }
  42. #endif
  43. /*
  44. * Debug macros cannot be used when wlc is uninitialized. Generally
  45. * this means any code that could run before brcms_c_attach() has
  46. * returned successfully probably shouldn't use the following macros.
  47. */
  48. #define brcms_dbg(core, l, f, a...) __brcms_dbg(&(core)->dev, l, __func__, f, ##a)
  49. #define brcms_info(core, f, a...) __brcms_info(&(core)->dev, f, ##a)
  50. #define brcms_warn(core, f, a...) __brcms_warn(&(core)->dev, f, ##a)
  51. #define brcms_err(core, f, a...) __brcms_err(&(core)->dev, f, ##a)
  52. #define brcms_crit(core, f, a...) __brcms_crit(&(core)->dev, f, ##a)
  53. #define brcms_dbg_info(core, f, a...) brcms_dbg(core, BRCM_DL_INFO, f, ##a)
  54. #define brcms_dbg_mac80211(core, f, a...) brcms_dbg(core, BRCM_DL_MAC80211, f, ##a)
  55. #define brcms_dbg_rx(core, f, a...) brcms_dbg(core, BRCM_DL_RX, f, ##a)
  56. #define brcms_dbg_tx(core, f, a...) brcms_dbg(core, BRCM_DL_TX, f, ##a)
  57. #define brcms_dbg_int(core, f, a...) brcms_dbg(core, BRCM_DL_INT, f, ##a)
  58. #define brcms_dbg_dma(core, f, a...) brcms_dbg(core, BRCM_DL_DMA, f, ##a)
  59. #define brcms_dbg_ht(core, f, a...) brcms_dbg(core, BRCM_DL_HT, f, ##a)
  60. struct brcms_pub;
  61. void brcms_debugfs_init(void);
  62. void brcms_debugfs_exit(void);
  63. int brcms_debugfs_attach(struct brcms_pub *drvr);
  64. void brcms_debugfs_detach(struct brcms_pub *drvr);
  65. struct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr);
  66. void brcms_debugfs_create_files(struct brcms_pub *drvr);
  67. #endif /* _BRCMS_DEBUG_H_ */