fm_dbg.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef __FM_DBG_H__
  2. #define __FM_DBG_H__
  3. /* #include <linux/kernel.h> //for printk() */
  4. #include <linux/printk.h>
  5. /* DBG zone */
  6. #define BASE 4
  7. #define MAIN (1 << (BASE+0))
  8. #define LINK (1 << (BASE+1))
  9. #define EINT (1 << (BASE+2))
  10. #define CHIP (1 << (BASE+3))
  11. #define RDSC (1 << (BASE+4))
  12. #define G0 (1 << (BASE+5))
  13. #define G1 (1 << (BASE+6))
  14. #define G2 (1 << (BASE+7))
  15. #define G3 (1 << (BASE+8))
  16. #define G4 (1 << (BASE+9))
  17. #define G14 (1 << (BASE+10))
  18. #define RAW (1 << (BASE+11))
  19. #define OPEN (1 << (BASE+12))
  20. #define IOCTL (1 << (BASE+13))
  21. #define READ_ (1 << (BASE+14))
  22. #define CLOSE (1 << (BASE+15))
  23. #define CQI (1 << (BASE+16))
  24. #define ALL 0xfffffff0
  25. /* DBG level */
  26. #define L0 0x00000000 /* EMERG, system will crush */
  27. #define L1 0x00000001 /* ALERT, need action in time */
  28. #define L2 0x00000002 /* CRIT, important HW or SW operation failed */
  29. #define L3 0x00000003 /* ERR, normal HW or SW ERR */
  30. #define L4 0x00000004 /* WARNING, importan path or somewhere may occurs err */
  31. #define L5 0x00000005 /* NOTICE, normal case */
  32. #define L6 0x00000006 /* INFO, print info if need */
  33. #define L7 0x00000007 /* DEBUG, for debug info */
  34. #define FM_EMG L0
  35. #define FM_ALT L1
  36. #define FM_CRT L2
  37. #define FM_ERR L3
  38. #define FM_WAR L4
  39. #define FM_NTC L5
  40. #define FM_INF L6
  41. #define FM_DBG L7
  42. extern fm_u32 g_dbg_level;
  43. #define WCN_DBG(flag, fmt, args...) \
  44. do { \
  45. if ((((flag)&0x0000000f) <= (g_dbg_level&0x0000000f)) && ((flag)&0xfffffff0) & g_dbg_level) { \
  46. pr_err("[" #flag "]" fmt, ## args); \
  47. } \
  48. } while (0)
  49. #define FM_LOG_DBG(flag, fmt, args...) \
  50. do { \
  51. if ((FM_DBG <= (g_dbg_level&0x0000000f)) && ((flag)&0xfffffff0) & g_dbg_level) { \
  52. pr_debug("[" #flag "]" fmt, ## args); \
  53. } \
  54. } while (0)
  55. #define FM_LOG_INF(flag, fmt, args...) \
  56. do { \
  57. if ((FM_INF <= (g_dbg_level&0x0000000f)) && ((flag)&0xfffffff0) & g_dbg_level) { \
  58. pr_err("[" #flag "]" fmt, ## args); \
  59. } \
  60. } while (0)
  61. #define FM_LOG_NTC(flag, fmt, args...) \
  62. do { \
  63. if ((FM_NTC <= (g_dbg_level&0x0000000f)) && ((flag)&0xfffffff0) & g_dbg_level) { \
  64. pr_err("[" #flag "]" fmt, ## args); \
  65. } \
  66. } while (0)
  67. #define FM_LOG_WAR(flag, fmt, args...) \
  68. do { \
  69. if ((FM_WAR <= (g_dbg_level&0x0000000f)) && ((flag)&0xfffffff0) & g_dbg_level) { \
  70. pr_warn("[" #flag "]" fmt, ## args); \
  71. } \
  72. } while (0)
  73. #define FM_LOG_ERR(flag, fmt, args...) \
  74. do { \
  75. if ((FM_ERR <= (g_dbg_level&0x0000000f)) && ((flag)&0xfffffff0) & g_dbg_level) { \
  76. pr_err("[" #flag "]" fmt, ## args); \
  77. } \
  78. } while (0)
  79. #define FM_LOG_CRT(flag, fmt, args...) \
  80. do { \
  81. if ((FM_CRT <= (g_dbg_level&0x0000000f)) && ((flag)&0xfffffff0) & g_dbg_level) { \
  82. pr_crit("[" #flag "]" fmt, ## args); \
  83. } \
  84. } while (0)
  85. #define FM_LOG_ALT(flag, fmt, args...) \
  86. do { \
  87. if ((FM_ALT <= (g_dbg_level&0x0000000f)) && ((flag)&0xfffffff0) & g_dbg_level) { \
  88. pr_alert("[" #flag "]" fmt, ## args); \
  89. } \
  90. } while (0)
  91. #define FM_LOG_EMG(flag, fmt, args...) \
  92. do { \
  93. if ((FM_EMG <= (g_dbg_level&0x0000000f)) && ((flag)&0xfffffff0) & g_dbg_level) { \
  94. pr_emerg("[" #flag "]" fmt, ## args); \
  95. } \
  96. } while (0)
  97. #endif /* __FM_DBG_H__ */