1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
25 #define DEBUG_VERSION "1.0" /*2015.01.13 Dino*/
26 //-----------------------------------------------------------------------------
27 // Define the debug levels
29 // 1. DBG_TRACE and DBG_LOUD are used for normal cases.
30 // So that, they can help SW engineer to develope or trace states changed
31 // and also help HW enginner to trace every operation to and from HW,
34 // 2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases,
35 // which help us to debug SW or HW.
37 //-----------------------------------------------------------------------------
39 // Never used in a call to ODM_RT_TRACE()!
45 // For example, Tx/Rx/IO locked up, OS hangs, memory access violation,
46 // resource allocation failed, unexpected HW behavior, HW BUG and so on.
48 #define ODM_DBG_SERIOUS 2
51 // Abnormal, rare, or unexpeted cases.
52 // For example, IRP/Packet/OID canceled, device suprisely unremoved and so on.
54 #define ODM_DBG_WARNING 3
57 // Normal case with useful information about current SW or HW state.
58 // For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status,
59 // SW protocol state change, dynamic mechanism state change and so on.
61 #define ODM_DBG_LOUD 4
64 // Normal case with detail execution flow or information.
66 #define ODM_DBG_TRACE 5
69 #define RATE_DECISION BIT0
70 #define INIT_RA_TABLE BIT1
72 #define RATE_DOWN BIT3
74 #define F_RATE_AP_RPT BIT7
76 //-----------------------------------------------------------------------------
77 // Define the tracing components
79 //-----------------------------------------------------------------------------
81 #define ODM_COMP_DIG BIT0
82 #define ODM_COMP_RA_MASK BIT1
83 #define ODM_COMP_DYNAMIC_TXPWR BIT2
84 #define ODM_COMP_FA_CNT BIT3
85 #define ODM_COMP_RSSI_MONITOR BIT4
86 #define ODM_COMP_CCK_PD BIT5
87 #define ODM_COMP_ANT_DIV BIT6
88 #define ODM_COMP_PWR_SAVE BIT7
89 #define ODM_COMP_PWR_TRAIN BIT8
90 #define ODM_COMP_RATE_ADAPTIVE BIT9
91 #define ODM_COMP_PATH_DIV BIT10
92 #define ODM_COMP_PSD BIT11
93 #define ODM_COMP_DYNAMIC_PRICCA BIT12
94 #define ODM_COMP_RXHP BIT13
95 #define ODM_COMP_MP BIT14
96 #define ODM_COMP_CFO_TRACKING BIT15
97 #define ODM_COMP_ACS BIT16
98 #define PHYDM_COMP_ADAPTIVITY BIT17
99 #define PHYDM_COMP_RA_DBG BIT18
100 #define PHYDM_COMP_TXBF BIT19
102 #define ODM_COMP_EDCA_TURBO BIT20
103 #define ODM_COMP_EARLY_MODE BIT21
104 #define ODM_FW_DEBUG_TRACE BIT22
106 #define ODM_COMP_TX_PWR_TRACK BIT24
107 #define ODM_COMP_RX_GAIN_TRACK BIT25
108 #define ODM_COMP_CALIBRATION BIT26
110 #define ODM_PHY_CONFIG BIT28
111 #define BEAMFORMING_DEBUG BIT29
112 #define ODM_COMP_COMMON BIT30
113 #define ODM_COMP_INIT BIT31
114 #define ODM_COMP_NOISY_DETECT BIT32
116 /*------------------------Export Marco Definition---------------------------*/
117 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
118 #define RT_PRINTK DbgPrint
119 #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
120 #define DbgPrint printk
121 #define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);
122 #define RT_DISP(dbgtype, dbgflag, printstr)
124 #define DbgPrint panic_printk
125 #define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);
133 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
135 if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)) \
137 if(pDM_Odm->SupportICType == ODM_RTL8192C) \
138 DbgPrint("[ODM-92C] "); \
139 else if(pDM_Odm->SupportICType == ODM_RTL8192D) \
140 DbgPrint("[ODM-92D] "); \
141 else if(pDM_Odm->SupportICType == ODM_RTL8723A) \
142 DbgPrint("[ODM-8723A] "); \
143 else if(pDM_Odm->SupportICType == ODM_RTL8188E) \
144 DbgPrint("[ODM-8188E] "); \
145 else if(pDM_Odm->SupportICType == ODM_RTL8192E) \
146 DbgPrint("[ODM-8192E] "); \
147 else if(pDM_Odm->SupportICType == ODM_RTL8812) \
148 DbgPrint("[ODM-8812] "); \
149 else if(pDM_Odm->SupportICType == ODM_RTL8821) \
150 DbgPrint("[ODM-8821] "); \
151 else if(pDM_Odm->SupportICType == ODM_RTL8814A) \
152 DbgPrint("[ODM-8814] "); \
153 else if(pDM_Odm->SupportICType == ODM_RTL8703B) \
154 DbgPrint("[ODM-8703B] "); \
155 else if(pDM_Odm->SupportICType == ODM_RTL8822B) \
156 DbgPrint("[ODM-8822] "); \
157 else if (pDM_Odm->SupportICType == ODM_RTL8188F) \
158 DbgPrint("[ODM-8188F] "); \
163 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \
164 if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
169 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
171 DbgPrint( "Assertion failed! %s at ......\n", #expr); \
172 DbgPrint( " ......%s,%s,line=%d\n",__FILE__,__FUNCTION__,__LINE__); \
176 #define ODM_dbg_enter() { DbgPrint("==> %s\n", __FUNCTION__); }
177 #define ODM_dbg_exit() { DbgPrint("<== %s\n", __FUNCTION__); }
178 #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __FUNCTION__, str); }
180 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \
181 if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
184 pu1Byte __ptr = (pu1Byte)ptr; \
185 DbgPrint("[ODM] "); \
186 DbgPrint(title_str); \
188 for( __i=0; __i<6; __i++ ) \
189 DbgPrint("%02X%s", __ptr[__i], (__i==5)?"":"-"); \
193 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)
194 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)
195 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)
196 #define ODM_dbg_enter()
197 #define ODM_dbg_exit()
198 #define ODM_dbg_trace(str)
199 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)
204 PHYDM_InitDebugSetting(IN PDM_ODM_T pDM_Odm);
206 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
207 VOID phydm_BB_RxHang_Info(IN PDM_ODM_T pDM_Odm);
210 #define BB_TMP_BUF_SIZE 100
211 VOID phydm_BB_Debug_Info(IN PDM_ODM_T pDM_Odm);
212 VOID phydm_BasicDbgMessage( IN PVOID pDM_VOID);
214 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
215 #define PHYDM_DBGPRINT 0
216 #define PHYDM_SSCANF(x, y, z) DCMD_Scanf(x, y, z)
217 #if (PHYDM_DBGPRINT == 1)
218 #define PHYDM_SNPRINTF(msg) \
224 #define PHYDM_SNPRINTF(msg) \
227 DCMD_Printf(output);\
231 #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
232 #define PHYDM_DBGPRINT 0
234 #define PHYDM_DBGPRINT 1
238 #define DCMD_DECIMAL "%d"
239 #define DCMD_CHAR "%c"
240 #define DCMD_HEX "%x"
242 #define PHYDM_SSCANF(x, y, z) sscanf(x, y, z)
243 #if (PHYDM_DBGPRINT == 1)
244 #define PHYDM_SNPRINTF(msg)\
250 #define PHYDM_SNPRINTF(msg)\
259 VOID phydm_BasicProfile(
265 #if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_AP))
268 IN PDM_ODM_T pDM_Odm,
278 IN PDM_ODM_T pDM_Odm,
286 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
287 void phydm_sbd_check(
291 void phydm_sbd_callback(
295 void phydm_sbd_workitem_callback(
301 phydm_fw_trace_en_h2c(
304 IN u4Byte monitor_mode,
309 phydm_fw_trace_handler(
316 phydm_fw_trace_handler_code(
323 phydm_fw_trace_handler_8051(
329 #endif // __ODM_DBG_H__