1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
4 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
6 ******************************************************************************/
13 /* Define the debug levels */
15 /* 1. DBG_TRACE and DBG_LOUD are used for normal cases. */
16 /* So that, they can help SW engineer to develope or trace states changed */
17 /* and also help HW enginner to trace every operation to and from HW, */
20 /* 2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases, */
21 /* which help us to debug SW or HW. */
25 /* Never used in a call to ODM_RT_TRACE()! */
31 /* For example, Tx/Rx/IO locked up, OS hangs, memory access violation, */
32 /* resource allocation failed, unexpected HW behavior, HW BUG and so on. */
34 #define ODM_DBG_SERIOUS 2
37 /* Abnormal, rare, or unexpeted cases. */
39 /* IRP/Packet/OID canceled, */
40 /* device suprisely unremoved and so on. */
42 #define ODM_DBG_WARNING 3
45 /* Normal case with useful information about current SW or HW state. */
46 /* For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status, */
47 /* SW protocol state change, dynamic mechanism state change and so on. */
49 #define ODM_DBG_LOUD 4
52 /* Normal case with detail execution flow or information. */
54 #define ODM_DBG_TRACE 5
57 /* Define the tracing components */
61 #define ODM_COMP_DIG BIT0
62 #define ODM_COMP_RA_MASK BIT1
63 #define ODM_COMP_DYNAMIC_TXPWR BIT2
64 #define ODM_COMP_FA_CNT BIT3
65 #define ODM_COMP_RSSI_MONITOR BIT4
66 #define ODM_COMP_CCK_PD BIT5
67 #define ODM_COMP_ANT_DIV BIT6
68 #define ODM_COMP_PWR_SAVE BIT7
69 #define ODM_COMP_PWR_TRAIN BIT8
70 #define ODM_COMP_RATE_ADAPTIVE BIT9
71 #define ODM_COMP_PATH_DIV BIT10
72 #define ODM_COMP_PSD BIT11
73 #define ODM_COMP_DYNAMIC_PRICCA BIT12
74 #define ODM_COMP_RXHP BIT13
75 #define ODM_COMP_MP BIT14
76 #define ODM_COMP_CFO_TRACKING BIT15
78 #define ODM_COMP_EDCA_TURBO BIT16
79 #define ODM_COMP_EARLY_MODE BIT17
81 #define ODM_COMP_TX_PWR_TRACK BIT24
82 #define ODM_COMP_RX_GAIN_TRACK BIT25
83 #define ODM_COMP_CALIBRATION BIT26
84 /* Common Functions */
85 #define ODM_COMP_COMMON BIT30
86 #define ODM_COMP_INIT BIT31
88 /*------------------------Export Marco Definition---------------------------*/
89 #define DbgPrint printk
90 #define RT_PRINTK(fmt, args...)\
91 DbgPrint("%s(): " fmt, __func__, ## args)
92 #define RT_DISP(dbgtype, dbgflag, printstr)
99 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)\
102 (comp & pDM_Odm->DebugComponents) &&\
103 (level <= pDM_Odm->DebugLevel ||\
104 level == ODM_DBG_SERIOUS)\
110 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)\
113 (comp & pDM_Odm->DebugComponents) &&\
114 (level <= pDM_Odm->DebugLevel)\
120 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)\
123 DbgPrint("Assertion failed! %s at ......\n", #expr);\
125 " ......%s,%s, line =%d\n",\
134 #define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); }
135 #define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); }
136 #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); }
138 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)\
141 (comp & pDM_Odm->DebugComponents) &&\
142 (level <= pDM_Odm->DebugLevel)\
145 u8 *__ptr = (u8 *)ptr;\
147 DbgPrint(title_str);\
149 for (__i = 0; __i < 6; __i++)\
150 DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-");\
155 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) no_printk fmt
156 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) no_printk fmt
157 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) no_printk fmt
158 #define ODM_dbg_enter() do {} while (0)
159 #define ODM_dbg_exit() do {} while (0)
160 #define ODM_dbg_trace(str) no_printk("%s", str)
161 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \
162 no_printk("%s %p", title_str, ptr)
165 void ODM_InitDebugSetting(PDM_ODM_T pDM_Odm);
167 #endif /* __ODM_DBG_H__ */