ccci_debug.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef __CCCI_DEBUG_H__
  2. #define __CCCI_DEBUG_H__
  3. /* tag defination */
  4. #define CORE "cor"
  5. #define BM "bfm"
  6. #define NET "net"
  7. #define CHAR "chr"
  8. #define SYSFS "sfs"
  9. #define KERN "ken"
  10. #define IPC "ipc"
  11. #define RPC "rpc"
  12. extern unsigned int ccci_debug_enable;
  13. extern int ccci_log_write(const char *fmt, ...);
  14. /* for detail log, default off (ccci_debug_enable == 0) */
  15. #define CCCI_DBG_MSG(idx, tag, fmt, args...) \
  16. do { \
  17. if (ccci_debug_enable == 1) \
  18. pr_debug("[md%d]" fmt, (idx+1), ##args); \
  19. else if (ccci_debug_enable == 2) \
  20. pr_warn("[md%d]" fmt, (idx+1), ##args); \
  21. else if (ccci_debug_enable == 6) \
  22. pr_err("[md%d]" fmt, (idx+1), ##args); \
  23. } while (0)
  24. /* for normal log, print to RAM by default, print to UART when needed */
  25. #define CCCI_INF_MSG(idx, tag, fmt, args...) \
  26. do { \
  27. if (ccci_debug_enable == 0 || ccci_debug_enable == 1) \
  28. pr_debug("[md%d]" fmt, (idx+1), ##args); \
  29. else if (ccci_debug_enable == 2) \
  30. pr_warn("[md%d]" fmt, (idx+1), ##args); \
  31. else if (ccci_debug_enable == 5 || ccci_debug_enable == 6) \
  32. pr_err("[md%d]" fmt, (idx+1), ##args); \
  33. } while (0)
  34. /* for traffic log, print to RAM by default, print to UART when needed */
  35. #define CCCI_REP_MSG(idx, tag, fmt, args...) \
  36. do { \
  37. if (ccci_debug_enable == 0 || ccci_debug_enable == 1) \
  38. pr_debug("[md%d]" fmt, (idx+1), ##args); \
  39. else if (ccci_debug_enable == 2) \
  40. pr_warn("[md%d]" fmt, (idx+1), ##args); \
  41. else if (ccci_debug_enable == 5 || ccci_debug_enable == 6) \
  42. pr_err("[md%d]" fmt, (idx+1), ##args); \
  43. } while (0)
  44. /* for critical init log*/
  45. #define CCCI_NOTICE_MSG(idx, tag, fmt, args...) pr_notice("[md%d/ntc]" fmt, (idx+1), ##args)
  46. /* for error log */
  47. #define CCCI_ERR_MSG(idx, tag, fmt, args...) pr_err("[md%d/err]" fmt, (idx+1), ##args)
  48. /* exception log: to uart */
  49. #define CCCI_EXP_MSG(idx, tag, fmt, args...) pr_warn("[md%d/err]" fmt, (idx+1), ##args)
  50. /* exception log: to kernel or ccci_dump of SYS_CCCI_DUMP in DB */
  51. #define CCCI_EXP_INF_MSG(idx, tag, fmt, args...) \
  52. do { \
  53. if (ccci_debug_enable == 0 || ccci_debug_enable == 1) \
  54. pr_debug("[md%d]" fmt, (idx+1), ##args); \
  55. else if (ccci_debug_enable == 2) \
  56. pr_warn("[md%d]" fmt, (idx+1), ##args); \
  57. else if (ccci_debug_enable == 5 || ccci_debug_enable == 6) \
  58. pr_err("[md%d]" fmt, (idx+1), ##args); \
  59. } while (0)
  60. /* exception log: to kernel or ccci_dump of SYS_CCCI_DUMP in DB, which had time stamp as head of dump */
  61. #define CCCI_DUMP_MSG1(idx, tag, fmt, args...) \
  62. do { \
  63. if (ccci_debug_enable == 0 || ccci_debug_enable == 1) \
  64. pr_debug("[md%d]" fmt, (idx+1), ##args); \
  65. else if (ccci_debug_enable == 2) \
  66. pr_warn("[md%d]" fmt, (idx+1), ##args); \
  67. else if (ccci_debug_enable == 5 || ccci_debug_enable == 6) \
  68. pr_err("[md%d]" fmt, (idx+1), ##args); \
  69. } while (0)
  70. /* exception log: to kernel or ccci_dump of SYS_CCCI_DUMP in DB, which had no time stamp */
  71. #define CCCI_DUMP_MSG2(idx, tag, fmt, args...) \
  72. do { \
  73. if (ccci_debug_enable == 0 || ccci_debug_enable == 1) \
  74. pr_debug("[md%d]" fmt, (idx+1), ##args); \
  75. else if (ccci_debug_enable == 2) \
  76. pr_warn("[md%d]" fmt, (idx+1), ##args); \
  77. else if (ccci_debug_enable == 5 || ccci_debug_enable == 6) \
  78. pr_err("[md%d]" fmt, (idx+1), ##args); \
  79. } while (0)
  80. #define CCCI_DBG_COM_MSG(fmt, args...) CCCI_DBG_MSG(0, "com", fmt, ##args)
  81. #define CCCI_INF_COM_MSG(fmt, args...) CCCI_INF_MSG(0, "com", fmt, ##args)
  82. #define CCCI_ERR_COM_MSG(fmt, args...) CCCI_ERR_MSG(0, "com", fmt, ##args)
  83. #define CLDMA_TRACE
  84. /* #define PORT_NET_TRACE */
  85. #define CCCI_SKB_TRACE
  86. /* #define CCCI_BM_TRACE */
  87. #endif /* __CCCI_DEBUG_H__ */