Merge branch android-common-3.10
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723bu / hal / OUTSRC / phydm_debug.h
1 /******************************************************************************\r
2  *\r
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.\r
4  *                                        \r
5  * This program is free software; you can redistribute it and/or modify it\r
6  * under the terms of version 2 of the GNU General Public License as\r
7  * published by the Free Software Foundation.\r
8  *\r
9  * This program is distributed in the hope that it will be useful, but WITHOUT\r
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
12  * more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License along with\r
15  * this program; if not, write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA\r
17  *\r
18  *\r
19  ******************************************************************************/\r
20 \r
21 \r
22 #ifndef __ODM_DBG_H__\r
23 #define __ODM_DBG_H__\r
24 \r
25 \r
26 //-----------------------------------------------------------------------------\r
27 //      Define the debug levels\r
28 //\r
29 //      1.      DBG_TRACE and DBG_LOUD are used for normal cases.\r
30 //      So that, they can help SW engineer to develope or trace states changed \r
31 //      and also help HW enginner to trace every operation to and from HW, \r
32 //      e.g IO, Tx, Rx. \r
33 //\r
34 //      2.      DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases, \r
35 //      which help us to debug SW or HW.\r
36 //\r
37 //-----------------------------------------------------------------------------\r
38 //\r
39 //      Never used in a call to ODM_RT_TRACE()!\r
40 //\r
41 #define ODM_DBG_OFF                                     1\r
42 \r
43 //\r
44 //      Fatal bug. \r
45 //      For example, Tx/Rx/IO locked up, OS hangs, memory access violation, \r
46 //      resource allocation failed, unexpected HW behavior, HW BUG and so on.\r
47 //\r
48 #define ODM_DBG_SERIOUS                         2\r
49 \r
50 //\r
51 //      Abnormal, rare, or unexpeted cases.\r
52 //      For example, IRP/Packet/OID canceled, device suprisely unremoved and so on.\r
53 //\r
54 #define ODM_DBG_WARNING                         3\r
55 \r
56 //\r
57 //      Normal case with useful information about current SW or HW state. \r
58 //      For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status, \r
59 //      SW protocol state change, dynamic mechanism state change and so on.\r
60 //\r
61 #define ODM_DBG_LOUD                                    4\r
62 \r
63 //\r
64 //      Normal case with detail execution flow or information.\r
65 //\r
66 #define ODM_DBG_TRACE                                   5\r
67 \r
68 //-----------------------------------------------------------------------------\r
69 // Define the tracing components\r
70 //\r
71 //-----------------------------------------------------------------------------\r
72 //BB Functions\r
73 #define ODM_COMP_DIG                                    BIT0    \r
74 #define ODM_COMP_RA_MASK                                BIT1    \r
75 #define ODM_COMP_DYNAMIC_TXPWR          BIT2\r
76 #define ODM_COMP_FA_CNT                         BIT3\r
77 #define ODM_COMP_RSSI_MONITOR           BIT4\r
78 #define ODM_COMP_CCK_PD                         BIT5\r
79 #define ODM_COMP_ANT_DIV                                BIT6\r
80 #define ODM_COMP_PWR_SAVE                       BIT7\r
81 #define ODM_COMP_PWR_TRAIN                      BIT8\r
82 #define ODM_COMP_RATE_ADAPTIVE          BIT9\r
83 #define ODM_COMP_PATH_DIV                               BIT10\r
84 #define ODM_COMP_PSD                                    BIT11\r
85 #define ODM_COMP_DYNAMIC_PRICCA         BIT12\r
86 #define ODM_COMP_RXHP                                   BIT13\r
87 #define ODM_COMP_MP                                     BIT14\r
88 #define ODM_COMP_CFO_TRACKING           BIT15\r
89 #define ODM_COMP_ACS                                    BIT16\r
90 #define PHYDM_COMP_ADAPTIVITY                   BIT17\r
91 //MAC Functions\r
92 #define ODM_COMP_EDCA_TURBO                     BIT20\r
93 #define ODM_COMP_EARLY_MODE                     BIT21\r
94 //RF Functions\r
95 #define ODM_COMP_TX_PWR_TRACK           BIT24\r
96 #define ODM_COMP_RX_GAIN_TRACK          BIT25\r
97 #define ODM_COMP_CALIBRATION                    BIT26\r
98 //Common Functions\r
99 #define ODM_COMP_COMMON                         BIT30\r
100 #define ODM_COMP_INIT                                   BIT31\r
101 \r
102 /*------------------------Export Marco Definition---------------------------*/\r
103 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)\r
104         #define RT_PRINTK                               DbgPrint\r
105 #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)\r
106         #define DbgPrint        printk\r
107         #define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);\r
108         #define RT_DISP(dbgtype, dbgflag, printstr)\r
109 #else\r
110         #define DbgPrint        panic_printk\r
111         #define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);\r
112 #endif\r
113 \r
114 #ifndef ASSERT\r
115         #define ASSERT(expr)\r
116 #endif\r
117 \r
118 #if DBG\r
119 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)                                                                 \\r
120                 if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS))   \\r
121                 {                                                                                                                                                       \\r
122                         if(pDM_Odm->SupportICType == ODM_RTL8192C)                                                              \\r
123                                 DbgPrint("[ODM-92C] ");                                                                                         \\r
124                         else if(pDM_Odm->SupportICType == ODM_RTL8192D)                                                 \\r
125                                 DbgPrint("[ODM-92D] ");                                                                                         \\r
126                         else if(pDM_Odm->SupportICType == ODM_RTL8723A)                                                 \\r
127                                 DbgPrint("[ODM-8723A] ");                                                                                       \\r
128                         else if(pDM_Odm->SupportICType == ODM_RTL8188E)                                                 \\r
129                                 DbgPrint("[ODM-8188E] ");                                                                                       \\r
130                         else if(pDM_Odm->SupportICType == ODM_RTL8192E)                                                 \\r
131                                 DbgPrint("[ODM-8192E] ");                                                                                       \\r
132                         else if(pDM_Odm->SupportICType == ODM_RTL8812)                                                  \\r
133                                 DbgPrint("[ODM-8812] ");                                                                                        \\r
134                         else if(pDM_Odm->SupportICType == ODM_RTL8821)                                                  \\r
135                                 DbgPrint("[ODM-8821] ");                                                                                        \\r
136                         else if(pDM_Odm->SupportICType == ODM_RTL8814A)                                                 \\r
137                                 DbgPrint("[ODM-8814] ");                                                                                        \\r
138                         RT_PRINTK fmt;                                                                                                                  \\r
139                 }\r
140 \r
141 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)                                                                       \\r
142                 if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel))       \\r
143                 {                                                                                                                                                       \\r
144                         RT_PRINTK fmt;                                                                                                                  \\r
145                 }\r
146 \r
147 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)                                                                                       \\r
148                 if(!(expr)) {                                                                                                                                   \\r
149                         DbgPrint( "Assertion failed! %s at ......\n", #expr);                                                           \\r
150                         DbgPrint( "      ......%s,%s,line=%d\n",__FILE__,__FUNCTION__,__LINE__);                        \\r
151                         RT_PRINTK fmt;                                                                                                                  \\r
152                         ASSERT(FALSE);                                                                                                                  \\r
153                 }\r
154 #define ODM_dbg_enter() { DbgPrint("==> %s\n", __FUNCTION__); }\r
155 #define ODM_dbg_exit() { DbgPrint("<== %s\n", __FUNCTION__); }\r
156 #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __FUNCTION__, str); }\r
157 \r
158 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)                                                    \\r
159                         if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel))       \\r
160                         {                                                                                                                                               \\r
161                                 int __i;                                                                                                                                \\r
162                                 pu1Byte __ptr = (pu1Byte)ptr;                                                                                   \\r
163                                 DbgPrint("[ODM] ");                                                                                                     \\r
164                                 DbgPrint(title_str);                                                                                                    \\r
165                                 DbgPrint(" ");                                                                                                          \\r
166                                 for( __i=0; __i<6; __i++ )                                                                                              \\r
167                                         DbgPrint("%02X%s", __ptr[__i], (__i==5)?"":"-");                                                \\r
168                                 DbgPrint("\n");                                                                                                         \\r
169                         }\r
170 #else\r
171 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)\r
172 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)\r
173 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)\r
174 #define ODM_dbg_enter()\r
175 #define ODM_dbg_exit()\r
176 #define ODM_dbg_trace(str)\r
177 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)\r
178 #endif\r
179 \r
180 \r
181 VOID \r
182 PHYDM_InitDebugSetting(IN               PDM_ODM_T               pDM_Odm);\r
183 \r
184 #define BB_TMP_BUF_SIZE         100\r
185 VOID phydm_BB_Debug_Info(IN PDM_ODM_T pDM_Odm);\r
186 VOID phydm_BasicProfile(IN              PVOID                   pDM_VOID);\r
187 VOID phydm_BasicDbgMessage(     IN              PVOID                   pDM_VOID);\r
188 \r
189 #if (DM_ODM_SUPPORT_TYPE == ODM_CE)\r
190 s4Byte\r
191 PhyDM_Cmd(\r
192         IN PDM_ODM_T    pDM_Odm,\r
193         IN char         *input,\r
194         IN u4Byte       in_len,\r
195         IN u1Byte       flag,\r
196         OUT char        *output,\r
197         IN u4Byte       out_len\r
198 );\r
199 #endif\r
200 \r
201 #endif  // __ODM_DBG_H__\r
202 \r