Linux-libre 4.14.12-gnu
[librecmc/linux-libre.git] / 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  ******************************************************************************/
15
16
17 #ifndef __ODM_DBG_H__
18 #define __ODM_DBG_H__
19
20
21 /*  */
22 /*      Define the debug levels */
23 /*  */
24 /*      1. DBG_TRACE and DBG_LOUD are used for normal cases. */
25 /*      They can help SW engineer to develop or trace states changed */
26 /*      and also help HW enginner to trace every operation to and from HW, */
27 /*      e.g IO, Tx, Rx. */
28 /*  */
29 /*      2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases, */
30 /*      which help us to debug SW or HW. */
31
32 /*      Never used in a call to ODM_RT_TRACE()! */
33 #define ODM_DBG_OFF                             1
34
35 /*      Fatal bug. */
36 /*      For example, Tx/Rx/IO locked up, OS hangs, memory access violation, */
37 /*      resource allocation failed, unexpected HW behavior, HW BUG and so on. */
38 #define ODM_DBG_SERIOUS                         2
39
40 /*      Abnormal, rare, or unexpected cases. */
41 /*      For example, IRP/Packet/OID canceled, device suprisely unremoved and so on. */
42 #define ODM_DBG_WARNING                         3
43
44 /*      Normal case with useful information about current SW or HW state. */
45 /*      For example, Tx/Rx descriptor to fill, Tx/Rx descr. completed status, */
46 /*      SW protocol state change, dynamic mechanism state change and so on. */
47 /*  */
48 #define ODM_DBG_LOUD                                    4
49
50 /*      Normal case with detail execution flow or information. */
51 #define ODM_DBG_TRACE                                   5
52
53 /*  Define the tracing components */
54 /* BB Functions */
55 #define ODM_COMP_DIG                                    BIT(0)
56 #define ODM_COMP_RA_MASK                                BIT(1)
57 #define ODM_COMP_DYNAMIC_TXPWR                          BIT(2)
58 #define ODM_COMP_FA_CNT                                 BIT(3)
59 #define ODM_COMP_RSSI_MONITOR                           BIT(4)
60 #define ODM_COMP_CCK_PD                                 BIT(5)
61 #define ODM_COMP_ANT_DIV                                BIT(6)
62 #define ODM_COMP_PWR_SAVE                               BIT(7)
63 #define ODM_COMP_PWR_TRA                                BIT(8)
64 #define ODM_COMP_RATE_ADAPTIVE                          BIT(9)
65 #define ODM_COMP_PATH_DIV                               BIT(10)
66 #define ODM_COMP_PSD                                    BIT(11)
67 #define ODM_COMP_DYNAMIC_PRICCA                         BIT(12)
68 #define ODM_COMP_RXHP                                   BIT(13)
69 /* MAC Functions */
70 #define ODM_COMP_EDCA_TURBO                             BIT(16)
71 #define ODM_COMP_EARLY_MODE                             BIT(17)
72 /* RF Functions */
73 #define ODM_COMP_TX_PWR_TRACK                           BIT(24)
74 #define ODM_COMP_RX_GAIN_TRACK                          BIT(25)
75 #define ODM_COMP_CALIBRATION                            BIT(26)
76 /* Common Functions */
77 #define ODM_COMP_COMMON                                 BIT(30)
78 #define ODM_COMP_INIT                                   BIT(31)
79
80 /*------------------------Export Marco Definition---------------------------*/
81 #define RT_PRINTK(fmt, args...)                         \
82         pr_info("%s(): " fmt, __func__, ## args);
83
84 #ifndef ASSERT
85         #define ASSERT(expr)
86 #endif
87
88 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)                         \
89         if (((comp) & pDM_Odm->DebugComponents) &&                      \
90             (level <= pDM_Odm->DebugLevel)) {                           \
91                 pr_info("[ODM-8188E] ");                                \
92                 RT_PRINTK fmt;                                          \
93         }
94
95 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)                               \
96         if (!(expr)) {                                                  \
97                 pr_info("Assertion failed! %s at ......\n", #expr);     \
98                 pr_info("      ......%s,%s,line=%d\n", __FILE__,        \
99                         __func__, __LINE__);                            \
100                 RT_PRINTK fmt;                                          \
101                 ASSERT(false);                                          \
102         }
103
104 void ODM_InitDebugSetting(struct odm_dm_struct *pDM_Odm);
105
106 #endif  /*  __ODM_DBG_H__ */