diag_ipc_logging.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Copyright (c) 2015, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef DIAGIPCLOG_H
  13. #define DIAGIPCLOG_H
  14. #include <linux/ipc_logging.h>
  15. #define DIAG_IPC_LOG_PAGES 50
  16. #define DIAG_DEBUG_USERSPACE 0x0001
  17. #define DIAG_DEBUG_MUX 0x0002
  18. #define DIAG_DEBUG_DCI 0x0004
  19. #define DIAG_DEBUG_PERIPHERALS 0x0008
  20. #define DIAG_DEBUG_MASKS 0x0010
  21. #define DIAG_DEBUG_POWER 0x0020
  22. #define DIAG_DEBUG_BRIDGE 0x0040
  23. #define DIAG_DEBUG
  24. #ifdef DIAG_DEBUG
  25. extern uint16_t diag_debug_mask;
  26. extern void *diag_ipc_log;
  27. #define DIAG_LOG(log_lvl, msg, ...) \
  28. do { \
  29. if (diag_ipc_log && (log_lvl & diag_debug_mask)) { \
  30. ipc_log_string(diag_ipc_log, \
  31. "[%s] " msg, __func__, ##__VA_ARGS__); \
  32. } \
  33. } while (0)
  34. #else
  35. #define DIAG_LOG(log_lvl, msg, ...)
  36. #endif
  37. #endif