ozdbg.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* -----------------------------------------------------------------------------
  2. * Copyright (c) 2011 Ozmo Inc
  3. * Released under the GNU General Public License Version 2 (GPLv2).
  4. * ---------------------------------------------------------------------------*/
  5. #ifndef _OZDBG_H
  6. #define _OZDBG_H
  7. #define OZ_WANT_DBG 0
  8. #define OZ_WANT_VERBOSE_DBG 1
  9. #define OZ_DBG_ON 0x0
  10. #define OZ_DBG_STREAM 0x1
  11. #define OZ_DBG_URB 0x2
  12. #define OZ_DBG_CTRL_DETAIL 0x4
  13. #define OZ_DBG_HUB 0x8
  14. #define OZ_DBG_RX_FRAMES 0x10
  15. #define OZ_DBG_TX_FRAMES 0x20
  16. #define OZ_DEFAULT_DBG_MASK \
  17. ( \
  18. /* OZ_DBG_STREAM | */ \
  19. /* OZ_DBG_URB | */ \
  20. /* OZ_DBG_CTRL_DETAIL | */ \
  21. OZ_DBG_HUB | \
  22. /* OZ_DBG_RX_FRAMES | */ \
  23. /* OZ_DBG_TX_FRAMES | */ \
  24. 0)
  25. extern unsigned int oz_dbg_mask;
  26. #define oz_want_dbg(mask) \
  27. ((OZ_WANT_DBG && (OZ_DBG_##mask == OZ_DBG_ON)) || \
  28. (OZ_WANT_VERBOSE_DBG && (OZ_DBG_##mask & oz_dbg_mask)))
  29. #define oz_dbg(mask, fmt, ...) \
  30. do { \
  31. if (oz_want_dbg(mask)) \
  32. pr_debug(fmt, ##__VA_ARGS__); \
  33. } while (0)
  34. #define oz_cdev_dbg(cdev, mask, fmt, ...) \
  35. do { \
  36. if (oz_want_dbg(mask)) \
  37. netdev_dbg((cdev)->dev, fmt, ##__VA_ARGS__); \
  38. } while (0)
  39. #define oz_pd_dbg(pd, mask, fmt, ...) \
  40. do { \
  41. if (oz_want_dbg(mask)) \
  42. pr_debug(fmt, ##__VA_ARGS__); \
  43. } while (0)
  44. #endif /* _OZDBG_H */