net:wireless:Support eswin usb wifi ECR6600U
[platform/kernel/linux-starfive.git] / drivers / net / wireless / eswin / ecrnx_debug.h
1 /**
2  ****************************************************************************************
3  *
4  * @file ecrnx_debug.h
5  *
6  * @brief ecrnx driver debug structure declarations
7  *
8  * Copyright (C) ESWIN 2015-2020
9  *
10  ****************************************************************************************
11  */
12
13 #ifndef ECRNX_DEBUG_H_
14 #define ECRNX_DEBUG_H_
15
16 #ifdef CONFIG_ECRNX_SOFTMAC
17 #define FW_STR  "lmac"
18 #elif defined CONFIG_ECRNX_FULLMAC
19 #define FW_STR  "fmac"
20 #endif
21 #if 0
22 #ifdef CONFIG_ECRNX_DBG
23 /*  #define ECRNX_DBG(format, arg...) pr_warn(format, ## arg) */
24 #define ECRNX_DBG printk
25 #else
26 #define ECRNX_DBG(a...) do {} while (0)
27 #endif
28 #endif
29
30 #ifdef CONFIG_ECRNX_DBG
31
32 #define ECRNX_FN_ENTRY_STR "%s() enter, line:%d\n", __func__, __LINE__
33 #define DBG_PREFIX "[ecrnx] "
34 #define DBG_PREFIX_IW_CFM "[ecrnx] iwpriv cfm:"
35 #define DBG_PREFIX_PAT "[ecrnx] pattern error:"
36 #define DBG_PREFIX_CRC_CHECK "[ecrnx] crc check:"
37 #define DBG_PREFIX_SDIO_RX "[ecrnx] sdio rx:"
38 #define DBG_PREFIX_SDIO_TX "[ecrnx] sdio tx:"
39
40 /* driver log level*/
41 enum ECRNX_DRV_DBG_TYEP{
42     DRV_DBG_TYPE_NONE,
43     DRV_DBG_TYPE_ALWAYS,
44     DRV_DBG_TYPE_ERR,
45     DRV_DBG_TYPE_WARNING,
46     DRV_DBG_TYPE_INFO,
47     DRV_DBG_TYPE_DEBUG,
48     DRV_DBG_TYPE_MAX,
49 };
50
51 #define ECRNX_PRINT(fmt, arg...)     \
52     do {\
53         if (DRV_DBG_TYPE_ALWAYS <= ecrnx_dbg_level) {\
54             printk(DBG_PREFIX fmt, ##arg);\
55         } \
56     } while (0)
57
58 #define ECRNX_ERR(fmt, arg...)     \
59     do {\
60         if (DRV_DBG_TYPE_ERR <= ecrnx_dbg_level) {\
61             printk(DBG_PREFIX " ERROR " fmt, ##arg);\
62         } \
63     } while (0)
64
65 #define ECRNX_WARN(fmt, arg...)     \
66     do {\
67         if (DRV_DBG_TYPE_WARNING <= ecrnx_dbg_level) {\
68             printk(DBG_PREFIX " WARN " fmt, ##arg);\
69         } \
70     } while (0)
71
72 #define ECRNX_INFO(fmt, arg...)     \
73     do {\
74         if (DRV_DBG_TYPE_INFO <= ecrnx_dbg_level) {\
75             printk(DBG_PREFIX fmt, ##arg);\
76         } \
77     } while (0)
78
79 #define ECRNX_DBG(fmt, arg...)     \
80     do {\
81         if (DRV_DBG_TYPE_DEBUG <= ecrnx_dbg_level) {\
82             printk(DBG_PREFIX fmt, ##arg);\
83         } \
84     } while (0)
85
86 #else
87 #define ECRNX_PRINT(...)
88 #define ECRNX_ERR(...)
89 #define ECRNX_WARN(...)
90 #define ECRNX_INFO(...)
91 #define ECRNX_DBG(...)
92 #endif
93
94 typedef struct {
95     u32 level;
96     u32 dir;
97 } LOG_CTL_ST;
98
99 extern int ecrnx_dbg_level;
100 extern LOG_CTL_ST log_ctl;
101
102 #ifndef CONFIG_ECRNX_DEBUGFS_CUSTOM
103 int ecrnx_fw_log_level_set(u32 level, u32 dir);
104 #endif
105
106 #endif /* ECRNX_DEBUG_H_ */