• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2017 Realtek Corporation.
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 #ifndef __HAL_PHY_H__
16 #define __HAL_PHY_H__
17 
18 
19 #if DISABLE_BB_RF
20 	#define	HAL_FW_ENABLE				0
21 	#define	HAL_MAC_ENABLE			0
22 	#define	HAL_BB_ENABLE				0
23 	#define	HAL_RF_ENABLE				0
24 #else /* FPGA_PHY and ASIC */
25 	#define	HAL_FW_ENABLE				1
26 	#define	HAL_MAC_ENABLE			1
27 	#define	HAL_BB_ENABLE				1
28 	#define	HAL_RF_ENABLE				1
29 #endif
30 
31 #define	RF6052_MAX_TX_PWR			0x3F
32 #define	RF6052_MAX_REG_88E			0xFF
33 #define	RF6052_MAX_REG_92C			0x7F
34 
35 #define	RF6052_MAX_REG	\
36 	((RF6052_MAX_REG_88E > RF6052_MAX_REG_92C) ? RF6052_MAX_REG_88E : RF6052_MAX_REG_92C)
37 
38 #define GET_RF6052_REAL_MAX_REG(_Adapter)	\
39 	(IS_HARDWARE_TYPE_8188E(_Adapter) ? RF6052_MAX_REG_88E : RF6052_MAX_REG_92C)
40 
41 #define	RF6052_MAX_PATH				2
42 
43 /*
44  * Antenna detection method, i.e., using single tone detection or RSSI reported from each antenna detected.
45  * Added by Roger, 2013.05.22.
46  *   */
47 #define ANT_DETECT_BY_SINGLE_TONE	BIT0
48 #define ANT_DETECT_BY_RSSI				BIT1
49 #define IS_ANT_DETECT_SUPPORT_SINGLE_TONE(__Adapter)		((GET_HAL_DATA(__Adapter)->AntDetection) & ANT_DETECT_BY_SINGLE_TONE)
50 #define IS_ANT_DETECT_SUPPORT_RSSI(__Adapter)		((GET_HAL_DATA(__Adapter)->AntDetection) & ANT_DETECT_BY_RSSI)
51 
52 
53 /*--------------------------Define Parameters-------------------------------*/
54 typedef	enum _RF_CHIP {
55 	RF_CHIP_MIN = 0,	/* 0 */
56 	RF_8225 = 1,			/* 1 11b/g RF for verification only */
57 	RF_8256 = 2,			/* 2 11b/g/n */
58 	RF_8258 = 3,			/* 3 11a/b/g/n RF */
59 	RF_6052 = 4,			/* 4 11b/g/n RF */
60 	RF_PSEUDO_11N = 5,	/* 5, It is a temporality RF. */
61 	RF_CHIP_MAX
62 } RF_CHIP_E, *PRF_CHIP_E;
63 
64 typedef enum _ANTENNA_PATH {
65 	ANTENNA_NONE	= 0,
66 	ANTENNA_D		= 1,
67 	ANTENNA_C		= 2,
68 	ANTENNA_CD	= 3,
69 	ANTENNA_B		= 4,
70 	ANTENNA_BD	= 5,
71 	ANTENNA_BC	= 6,
72 	ANTENNA_BCD	= 7,
73 	ANTENNA_A		= 8,
74 	ANTENNA_AD	= 9,
75 	ANTENNA_AC	= 10,
76 	ANTENNA_ACD	= 11,
77 	ANTENNA_AB	= 12,
78 	ANTENNA_ABD	= 13,
79 	ANTENNA_ABC	= 14,
80 	ANTENNA_ABCD	= 15
81 } ANTENNA_PATH;
82 
83 typedef enum _RF_CONTENT {
84 	radioa_txt = 0x1000,
85 	radiob_txt = 0x1001,
86 	radioc_txt = 0x1002,
87 	radiod_txt = 0x1003
88 } RF_CONTENT;
89 
90 typedef enum _BaseBand_Config_Type {
91 	BaseBand_Config_PHY_REG = 0,			/* Radio Path A */
92 	BaseBand_Config_AGC_TAB = 1,			/* Radio Path B */
93 	BaseBand_Config_AGC_TAB_2G = 2,
94 	BaseBand_Config_AGC_TAB_5G = 3,
95 	BaseBand_Config_PHY_REG_PG
96 } BaseBand_Config_Type, *PBaseBand_Config_Type;
97 
98 typedef enum _HW_BLOCK {
99 	HW_BLOCK_MAC = 0,
100 	HW_BLOCK_PHY0 = 1,
101 	HW_BLOCK_PHY1 = 2,
102 	HW_BLOCK_RF = 3,
103 	HW_BLOCK_MAXIMUM = 4, /* Never use this */
104 } HW_BLOCK_E, *PHW_BLOCK_E;
105 
106 typedef enum _WIRELESS_MODE {
107 	WIRELESS_MODE_UNKNOWN = 0x00,
108 	WIRELESS_MODE_A = 0x01,
109 	WIRELESS_MODE_B = 0x02,
110 	WIRELESS_MODE_G = 0x04,
111 	WIRELESS_MODE_AUTO = 0x08,
112 	WIRELESS_MODE_N_24G = 0x10,
113 	WIRELESS_MODE_N_5G = 0x20,
114 	WIRELESS_MODE_AC_5G = 0x40,
115 	WIRELESS_MODE_AC_24G  = 0x80,
116 	WIRELESS_MODE_AC_ONLY  = 0x100,
117 } WIRELESS_MODE;
118 
119 typedef enum _SwChnlCmdID {
120 	CmdID_End,
121 	CmdID_SetTxPowerLevel,
122 	CmdID_BBRegWrite10,
123 	CmdID_WritePortUlong,
124 	CmdID_WritePortUshort,
125 	CmdID_WritePortUchar,
126 	CmdID_RF_WriteReg,
127 } SwChnlCmdID;
128 
129 typedef struct _SwChnlCmd {
130 	SwChnlCmdID	CmdID;
131 	u32				Para1;
132 	u32				Para2;
133 	u32				msDelay;
134 } SwChnlCmd;
135 
136 typedef struct _R_ANTENNA_SELECT_OFDM {
137 	u32			r_tx_antenna:4;
138 	u32			r_ant_l:4;
139 	u32			r_ant_non_ht:4;
140 	u32			r_ant_ht1:4;
141 	u32			r_ant_ht2:4;
142 	u32			r_ant_ht_s1:4;
143 	u32			r_ant_non_ht_s1:4;
144 	u32			OFDM_TXSC:2;
145 	u32			Reserved:2;
146 } R_ANTENNA_SELECT_OFDM;
147 
148 typedef struct _R_ANTENNA_SELECT_CCK {
149 	u8			r_cckrx_enable_2:2;
150 	u8			r_cckrx_enable:2;
151 	u8			r_ccktx_enable:4;
152 } R_ANTENNA_SELECT_CCK;
153 
154 
155 /*--------------------------Exported Function prototype---------------------*/
156 u32
157 PHY_CalculateBitShift(
158 	u32 BitMask
159 );
160 
161 #ifdef CONFIG_RF_SHADOW_RW
162 typedef struct RF_Shadow_Compare_Map {
163 	/* Shadow register value */
164 	u32		Value;
165 	/* Compare or not flag */
166 	u8		Compare;
167 	/* Record If it had ever modified unpredicted */
168 	u8		ErrorOrNot;
169 	/* Recorver Flag */
170 	u8		Recorver;
171 	/*  */
172 	u8		Driver_Write;
173 } RF_SHADOW_T;
174 
175 u32
176 PHY_RFShadowRead(
177 		PADAPTER		Adapter,
178 		enum rf_path		eRFPath,
179 		u32				Offset);
180 
181 void
182 PHY_RFShadowWrite(
183 		PADAPTER		Adapter,
184 		enum rf_path		eRFPath,
185 		u32				Offset,
186 		u32				Data);
187 
188 BOOLEAN
189 PHY_RFShadowCompare(
190 		PADAPTER		Adapter,
191 		enum rf_path		eRFPath,
192 		u32				Offset);
193 
194 void
195 PHY_RFShadowRecorver(
196 		PADAPTER		Adapter,
197 		enum rf_path		eRFPath,
198 		u32				Offset);
199 
200 void
201 PHY_RFShadowCompareAll(
202 		PADAPTER		Adapter);
203 
204 void
205 PHY_RFShadowRecorverAll(
206 		PADAPTER		Adapter);
207 
208 void
209 PHY_RFShadowCompareFlagSet(
210 		PADAPTER		Adapter,
211 		enum rf_path		eRFPath,
212 		u32				Offset,
213 		u8				Type);
214 
215 void
216 PHY_RFShadowRecorverFlagSet(
217 		PADAPTER		Adapter,
218 		enum rf_path		eRFPath,
219 		u32				Offset,
220 		u8				Type);
221 
222 void
223 PHY_RFShadowCompareFlagSetAll(
224 		PADAPTER		Adapter);
225 
226 void
227 PHY_RFShadowRecorverFlagSetAll(
228 		PADAPTER		Adapter);
229 
230 void
231 PHY_RFShadowRefresh(
232 		PADAPTER		Adapter);
233 #endif /*#CONFIG_RF_SHADOW_RW*/
234 #endif /* __HAL_COMMON_H__ */
235