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