debug.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (c) 2008-2009 Atheros Communications Inc.
  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
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef ATH_DEBUG_H
  17. #define ATH_DEBUG_H
  18. #include "ath.h"
  19. /**
  20. * enum ath_debug_level - atheros wireless debug level
  21. *
  22. * @ATH_DBG_RESET: reset processing
  23. * @ATH_DBG_QUEUE: hardware queue management
  24. * @ATH_DBG_EEPROM: eeprom processing
  25. * @ATH_DBG_CALIBRATE: periodic calibration
  26. * @ATH_DBG_INTERRUPT: interrupt processing
  27. * @ATH_DBG_REGULATORY: regulatory processing
  28. * @ATH_DBG_ANI: adaptive noise immunitive processing
  29. * @ATH_DBG_XMIT: basic xmit operation
  30. * @ATH_DBG_BEACON: beacon handling
  31. * @ATH_DBG_CONFIG: configuration of the hardware
  32. * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT
  33. * @ATH_DBG_PS: power save processing
  34. * @ATH_DBG_HWTIMER: hardware timer handling
  35. * @ATH_DBG_BTCOEX: bluetooth coexistance
  36. * @ATH_DBG_BSTUCK: stuck beacons
  37. * @ATH_DBG_ANY: enable all debugging
  38. *
  39. * The debug level is used to control the amount and type of debugging output
  40. * we want to see. Each driver has its own method for enabling debugging and
  41. * modifying debug level states -- but this is typically done through a
  42. * module parameter 'debug' along with a respective 'debug' debugfs file
  43. * entry.
  44. */
  45. enum ATH_DEBUG {
  46. ATH_DBG_RESET = 0x00000001,
  47. ATH_DBG_QUEUE = 0x00000002,
  48. ATH_DBG_EEPROM = 0x00000004,
  49. ATH_DBG_CALIBRATE = 0x00000008,
  50. ATH_DBG_INTERRUPT = 0x00000010,
  51. ATH_DBG_REGULATORY = 0x00000020,
  52. ATH_DBG_ANI = 0x00000040,
  53. ATH_DBG_XMIT = 0x00000080,
  54. ATH_DBG_BEACON = 0x00000100,
  55. ATH_DBG_CONFIG = 0x00000200,
  56. ATH_DBG_FATAL = 0x00000400,
  57. ATH_DBG_PS = 0x00000800,
  58. ATH_DBG_HWTIMER = 0x00001000,
  59. ATH_DBG_BTCOEX = 0x00002000,
  60. ATH_DBG_WMI = 0x00004000,
  61. ATH_DBG_BSTUCK = 0x00008000,
  62. ATH_DBG_ANY = 0xffffffff
  63. };
  64. #define ATH_DBG_DEFAULT (ATH_DBG_FATAL)
  65. #ifdef CONFIG_ATH_DEBUG
  66. void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
  67. __attribute__ ((format (printf, 3, 4)));
  68. #define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)
  69. #else
  70. static inline void __attribute__ ((format (printf, 3, 4)))
  71. ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
  72. {
  73. }
  74. #define ATH_DBG_WARN(foo, arg)
  75. #endif /* CONFIG_ATH_DEBUG */
  76. /** Returns string describing opmode, or NULL if unknown mode. */
  77. #ifdef CONFIG_ATH_DEBUG
  78. const char *ath_opmode_to_string(enum nl80211_iftype opmode);
  79. #else
  80. static inline const char *ath_opmode_to_string(enum nl80211_iftype opmode)
  81. {
  82. return "UNKNOWN";
  83. }
  84. #endif
  85. #endif /* ATH_DEBUG_H */