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 ******************************************************************************/
21 /* Define the debug levels */
23 /* 1. DBG_TRACE and DBG_LOUD are used for normal cases. */
24 /* So that, they can help SW engineer to develope or trace states changed */
25 /* and also help HW enginner to trace every operation to and from HW, */
28 /* 2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases, */
29 /* which help us to debug SW or HW. */
33 /* Never used in a call to ODM_RT_TRACE()! */
39 /* For example, Tx/Rx/IO locked up, OS hangs, memory access violation, */
40 /* resource allocation failed, unexpected HW behavior, HW BUG and so on. */
42 #define ODM_DBG_SERIOUS 2
45 /* Abnormal, rare, or unexpeted cases. */
47 /* IRP/Packet/OID canceled, */
48 /* device suprisely unremoved and so on. */
50 #define ODM_DBG_WARNING 3
53 /* Normal case with useful information about current SW or HW state. */
54 /* For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status, */
55 /* SW protocol state change, dynamic mechanism state change and so on. */
57 #define ODM_DBG_LOUD 4
60 /* Normal case with detail execution flow or information. */
62 #define ODM_DBG_TRACE 5
65 /* Define the tracing components */
69 #define ODM_COMP_DIG BIT0
70 #define ODM_COMP_RA_MASK BIT1
71 #define ODM_COMP_DYNAMIC_TXPWR BIT2
72 #define ODM_COMP_FA_CNT BIT3
73 #define ODM_COMP_RSSI_MONITOR BIT4
74 #define ODM_COMP_CCK_PD BIT5
75 #define ODM_COMP_ANT_DIV BIT6
76 #define ODM_COMP_PWR_SAVE BIT7
77 #define ODM_COMP_PWR_TRAIN BIT8
78 #define ODM_COMP_RATE_ADAPTIVE BIT9
79 #define ODM_COMP_PATH_DIV BIT10
80 #define ODM_COMP_PSD BIT11
81 #define ODM_COMP_DYNAMIC_PRICCA BIT12
82 #define ODM_COMP_RXHP BIT13
83 #define ODM_COMP_MP BIT14
84 #define ODM_COMP_CFO_TRACKING BIT15
86 #define ODM_COMP_EDCA_TURBO BIT16
87 #define ODM_COMP_EARLY_MODE BIT17
89 #define ODM_COMP_TX_PWR_TRACK BIT24
90 #define ODM_COMP_RX_GAIN_TRACK BIT25
91 #define ODM_COMP_CALIBRATION BIT26
92 /* Common Functions */
93 #define ODM_COMP_COMMON BIT30
94 #define ODM_COMP_INIT BIT31
96 /*------------------------Export Marco Definition---------------------------*/
97 #define DbgPrint printk
98 #define RT_PRINTK(fmt, args...)\
99 DbgPrint("%s(): " fmt, __func__, ## args)
100 #define RT_DISP(dbgtype, dbgflag, printstr)
107 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)\
110 (comp & pDM_Odm->DebugComponents) &&\
111 (level <= pDM_Odm->DebugLevel ||\
112 level == ODM_DBG_SERIOUS)\
118 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)\
121 (comp & pDM_Odm->DebugComponents) &&\
122 (level <= pDM_Odm->DebugLevel)\
128 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)\
131 DbgPrint("Assertion failed! %s at ......\n", #expr);\
133 " ......%s,%s, line =%d\n",\
142 #define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); }
143 #define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); }
144 #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); }
146 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)\
149 (comp & pDM_Odm->DebugComponents) &&\
150 (level <= pDM_Odm->DebugLevel)\
153 u8 *__ptr = (u8 *)ptr;\
155 DbgPrint(title_str);\
157 for (__i = 0; __i < 6; __i++)\
158 DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-");\
163 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) no_printk fmt
164 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) no_printk fmt
165 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) no_printk fmt
166 #define ODM_dbg_enter() do {} while (0)
167 #define ODM_dbg_exit() do {} while (0)
168 #define ODM_dbg_trace(str) no_printk("%s", str)
169 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \
170 no_printk("%s %p", title_str, ptr)
173 void ODM_InitDebugSetting(PDM_ODM_T pDM_Odm);
175 #endif /* __ODM_DBG_H__ */