]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - drivers/staging/rtl8723au/include/odm_debug.h
Merge tag 'pm+acpi-3.15-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafae...
[mirror_ubuntu-hirsute-kernel.git] / drivers / staging / rtl8723au / 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 /* So that, they can help SW engineer to develope 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 /* */
33 /* */
34 /* Never used in a call to ODM_RT_TRACE()! */
35 /* */
36 #define ODM_DBG_OFF 1
37
38 /* */
39 /* Fatal bug. */
40 /* For example, Tx/Rx/IO locked up, OS hangs, memory access violation, */
41 /* resource allocation failed, unexpected HW behavior, HW BUG and so on. */
42 /* */
43 #define ODM_DBG_SERIOUS 2
44
45 /* */
46 /* Abnormal, rare, or unexpeted cases. */
47 /* For example, IRP/Packet/OID canceled, device suprisely unremoved and so on. */
48 /* */
49 #define ODM_DBG_WARNING 3
50
51 /* */
52 /* Normal case with useful information about current SW or HW state. */
53 /* For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status, */
54 /* SW protocol state change, dynamic mechanism state change and so on. */
55 /* */
56 #define ODM_DBG_LOUD 4
57
58 /* */
59 /* Normal case with detail execution flow or information. */
60 /* */
61 #define ODM_DBG_TRACE 5
62
63 /* */
64 /* Define the tracing components */
65 /* */
66 /* */
67 /* BB Functions */
68 #define ODM_COMP_DIG BIT0
69 #define ODM_COMP_RA_MASK BIT1
70 #define ODM_COMP_DYNAMIC_TXPWR BIT2
71 #define ODM_COMP_FA_CNT BIT3
72 #define ODM_COMP_RSSI_MONITOR BIT4
73 #define ODM_COMP_CCK_PD BIT5
74 #define ODM_COMP_ANT_DIV BIT6
75 #define ODM_COMP_PWR_SAVE BIT7
76 #define ODM_COMP_PWR_TRAIN BIT8
77 #define ODM_COMP_RATE_ADAPTIVE BIT9
78 #define ODM_COMP_PATH_DIV BIT10
79 #define ODM_COMP_PSD BIT11
80 #define ODM_COMP_DYNAMIC_PRICCA BIT12
81 #define ODM_COMP_RXHP BIT13
82 /* MAC Functions */
83 #define ODM_COMP_EDCA_TURBO BIT16
84 #define ODM_COMP_EARLY_MODE BIT17
85 /* RF Functions */
86 #define ODM_COMP_TX_PWR_TRACK BIT24
87 #define ODM_COMP_RX_GAIN_TRACK BIT25
88 #define ODM_COMP_CALIBRATION BIT26
89 /* Common Functions */
90 #define ODM_COMP_COMMON BIT30
91 #define ODM_COMP_INIT BIT31
92
93 /*------------------------Export Macro Definition---------------------------*/
94 #define DbgPrint printk
95 #define RT_PRINTK(fmt, args...) DbgPrint("%s(): " fmt, __func__, ## args);
96
97 #ifndef ASSERT
98 #define ASSERT(expr)
99 #endif
100
101 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
102 if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
103 { \
104 DbgPrint("[ODM-8723A] "); \
105 RT_PRINTK fmt; \
106 }
107
108 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \
109 if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
110 { \
111 RT_PRINTK fmt; \
112 }
113
114 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
115 if(!(expr)) { \
116 DbgPrint("Assertion failed! %s at ......\n", #expr); \
117 DbgPrint(" ......%s,%s,line=%d\n", __FILE__, __func__, __LINE__);\
118 RT_PRINTK fmt; \
119 ASSERT(false); \
120 }
121 #define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); }
122 #define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); }
123 #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); }
124
125 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \
126 if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel){ \
127 int __i; \
128 u8 * __ptr = (u8 *)ptr; \
129 DbgPrint("[ODM] "); \
130 DbgPrint(title_str); \
131 DbgPrint(" "); \
132 for (__i=0; __i < 6; __i++) \
133 DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-"); \
134 DbgPrint("\n"); \
135 }
136
137 void ODM_InitDebugSetting23a(struct dm_odm_t *pDM_Odm);
138
139 #endif /* __ODM_DBG_H__ */