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 ******************************************************************************/
27 /* Define the debug levels */
29 /* 1. DBG_TRACE and DBG_LOUD are used for normal cases. */
30 /* They can help SW engineer to develop 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 /* Never used in a call to ODM_RT_TRACE()! */
41 /* For example, Tx/Rx/IO locked up, OS hangs, memory access violation, */
42 /* resource allocation failed, unexpected HW behavior, HW BUG and so on. */
43 #define ODM_DBG_SERIOUS 2
45 /* Abnormal, rare, or unexpeted cases. */
46 /* For example, IRP/Packet/OID canceled, device suprisely unremoved and so on. */
47 #define ODM_DBG_WARNING 3
49 /* Normal case with useful information about current SW or HW state. */
50 /* For example, Tx/Rx descriptor to fill, Tx/Rx descr. completed status, */
51 /* SW protocol state change, dynamic mechanism state change and so on. */
53 #define ODM_DBG_LOUD 4
55 /* Normal case with detail execution flow or information. */
56 #define ODM_DBG_TRACE 5
58 /* Define the tracing components */
60 #define ODM_COMP_DIG BIT0
61 #define ODM_COMP_RA_MASK BIT1
62 #define ODM_COMP_DYNAMIC_TXPWR BIT2
63 #define ODM_COMP_FA_CNT BIT3
64 #define ODM_COMP_RSSI_MONITOR BIT4
65 #define ODM_COMP_CCK_PD BIT5
66 #define ODM_COMP_ANT_DIV BIT6
67 #define ODM_COMP_PWR_SAVE BIT7
68 #define ODM_COMP_PWR_TRA BIT8
69 #define ODM_COMP_RATE_ADAPTIVE BIT9
70 #define ODM_COMP_PATH_DIV BIT10
71 #define ODM_COMP_PSD BIT11
72 #define ODM_COMP_DYNAMIC_PRICCA BIT12
73 #define ODM_COMP_RXHP BIT13
75 #define ODM_COMP_EDCA_TURBO BIT16
76 #define ODM_COMP_EARLY_MODE BIT17
78 #define ODM_COMP_TX_PWR_TRACK BIT24
79 #define ODM_COMP_RX_GAIN_TRACK BIT25
80 #define ODM_COMP_CALIBRATION BIT26
81 /* Common Functions */
82 #define ODM_COMP_COMMON BIT30
83 #define ODM_COMP_INIT BIT31
85 /*------------------------Export Marco Definition---------------------------*/
86 #define DbgPrint pr_info
87 #define RT_PRINTK(fmt, args...) \
88 DbgPrint( "%s(): " fmt, __func__, ## args);
94 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
95 if (((comp) & pDM_Odm->DebugComponents) && \
96 (level <= pDM_Odm->DebugLevel)) { \
97 DbgPrint("[ODM-8188E] "); \
101 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \
102 if (((comp) & pDM_Odm->DebugComponents) && \
103 (level <= pDM_Odm->DebugLevel)) { \
107 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
109 DbgPrint( "Assertion failed! %s at ......\n", #expr); \
110 DbgPrint( " ......%s,%s,line=%d\n", __FILE__, \
111 __func__, __LINE__); \
115 #define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); }
116 #define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); }
117 #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); }
119 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \
120 if (((comp) & pDM_Odm->DebugComponents) && \
121 (level <= pDM_Odm->DebugLevel)) { \
123 u8 *__ptr = (u8 *)ptr; \
124 DbgPrint("[ODM] "); \
125 DbgPrint(title_str); \
127 for (__i = 0; __i < 6; __i++) \
128 DbgPrint("%02X%s", __ptr[__i], (__i == 5)?"":"-");\
132 void ODM_InitDebugSetting(struct odm_dm_struct *pDM_Odm);
134 #endif /* __ODM_DBG_H__ */