summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/eswin/ecrnx_debug.h
blob: b322487851c03b71400b402d8bb49fbe1c3f7138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
 ****************************************************************************************
 *
 * @file ecrnx_debug.h
 *
 * @brief ecrnx driver debug structure declarations
 *
 * Copyright (C) ESWIN 2015-2020
 *
 ****************************************************************************************
 */

#ifndef ECRNX_DEBUG_H_
#define ECRNX_DEBUG_H_

#ifdef CONFIG_ECRNX_SOFTMAC
#define FW_STR  "lmac"
#elif defined CONFIG_ECRNX_FULLMAC
#define FW_STR  "fmac"
#endif
#if 0
#ifdef CONFIG_ECRNX_DBG
/*  #define ECRNX_DBG(format, arg...) pr_warn(format, ## arg) */
#define ECRNX_DBG printk
#else
#define ECRNX_DBG(a...) do {} while (0)
#endif
#endif

#ifdef CONFIG_ECRNX_DBG

#define ECRNX_FN_ENTRY_STR "%s() enter, line:%d\n", __func__, __LINE__
#define DBG_PREFIX "[ecrnx] "
#define DBG_PREFIX_IW_CFM "[ecrnx] iwpriv cfm:"
#define DBG_PREFIX_PAT "[ecrnx] pattern error:"
#define DBG_PREFIX_CRC_CHECK "[ecrnx] crc check:"
#define DBG_PREFIX_SDIO_RX "[ecrnx] sdio rx:"
#define DBG_PREFIX_SDIO_TX "[ecrnx] sdio tx:"

/* driver log level*/
enum ECRNX_DRV_DBG_TYEP{
    DRV_DBG_TYPE_NONE,
    DRV_DBG_TYPE_ALWAYS,
    DRV_DBG_TYPE_ERR,
    DRV_DBG_TYPE_WARNING,
    DRV_DBG_TYPE_INFO,
    DRV_DBG_TYPE_DEBUG,
    DRV_DBG_TYPE_MAX,
};

#define ECRNX_PRINT(fmt, arg...)     \
    do {\
        if (DRV_DBG_TYPE_ALWAYS <= ecrnx_dbg_level) {\
            printk(DBG_PREFIX fmt, ##arg);\
        } \
    } while (0)

#define ECRNX_ERR(fmt, arg...)     \
    do {\
        if (DRV_DBG_TYPE_ERR <= ecrnx_dbg_level) {\
            printk(DBG_PREFIX " ERROR " fmt, ##arg);\
        } \
    } while (0)

#define ECRNX_WARN(fmt, arg...)     \
    do {\
        if (DRV_DBG_TYPE_WARNING <= ecrnx_dbg_level) {\
            printk(DBG_PREFIX " WARN " fmt, ##arg);\
        } \
    } while (0)

#define ECRNX_INFO(fmt, arg...)     \
    do {\
        if (DRV_DBG_TYPE_INFO <= ecrnx_dbg_level) {\
            printk(DBG_PREFIX fmt, ##arg);\
        } \
    } while (0)

#define ECRNX_DBG(fmt, arg...)     \
    do {\
        if (DRV_DBG_TYPE_DEBUG <= ecrnx_dbg_level) {\
            printk(DBG_PREFIX fmt, ##arg);\
        } \
    } while (0)

#else
#define ECRNX_PRINT(...)
#define ECRNX_ERR(...)
#define ECRNX_WARN(...)
#define ECRNX_INFO(...)
#define ECRNX_DBG(...)
#endif

typedef struct {
    u32 level;
    u32 dir;
} LOG_CTL_ST;

extern int ecrnx_dbg_level;
extern LOG_CTL_ST log_ctl;

#ifndef CONFIG_ECRNX_DEBUGFS_CUSTOM
int ecrnx_fw_log_level_set(u32 level, u32 dir);
#endif

#endif /* ECRNX_DEBUG_H_ */