Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / staging / rtl8188eu / include / odm_debug.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *
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.
8  *
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
12  * more details.
13  *
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
17  *
18  *
19  ******************************************************************************/
20
21
22 #ifndef __ODM_DBG_H__
23 #define __ODM_DBG_H__
24
25
26 /*  */
27 /*      Define the debug levels */
28 /*  */
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, */
32 /*      e.g IO, Tx, Rx. */
33 /*  */
34 /*      2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases, */
35 /*      which help us to debug SW or HW. */
36
37 /*      Never used in a call to ODM_RT_TRACE()! */
38 #define ODM_DBG_OFF                             1
39
40 /*      Fatal bug. */
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
44
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
48
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. */
52 /*  */
53 #define ODM_DBG_LOUD                                    4
54
55 /*      Normal case with detail execution flow or information. */
56 #define ODM_DBG_TRACE                                   5
57
58 /*  Define the tracing components */
59 /* BB Functions */
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
74 /* MAC Functions */
75 #define ODM_COMP_EDCA_TURBO                             BIT16
76 #define ODM_COMP_EARLY_MODE                             BIT17
77 /* RF Functions */
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
84
85 /*------------------------Export Marco Definition---------------------------*/
86 #define RT_PRINTK(fmt, args...)                         \
87         pr_info("%s(): " fmt, __func__, ## args);
88
89 #ifndef ASSERT
90         #define ASSERT(expr)
91 #endif
92
93 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)                         \
94         if (((comp) & pDM_Odm->DebugComponents) &&                      \
95             (level <= pDM_Odm->DebugLevel)) {                           \
96                 pr_info("[ODM-8188E] ");                                \
97                 RT_PRINTK fmt;                                          \
98         }
99
100 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)                               \
101         if (!(expr)) {                                                  \
102                 pr_info("Assertion failed! %s at ......\n", #expr);     \
103                 pr_info("      ......%s,%s,line=%d\n", __FILE__,        \
104                         __func__, __LINE__);                            \
105                 RT_PRINTK fmt;                                          \
106                 ASSERT(false);                                          \
107         }
108
109 void ODM_InitDebugSetting(struct odm_dm_struct *pDM_Odm);
110
111 #endif  /*  __ODM_DBG_H__ */