xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8189fs/include/Hal8814PhyCfg.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 __INC_HAL8814PHYCFG_H__
16 #define __INC_HAL8814PHYCFG_H__
17 
18 
19 /*--------------------------Define Parameters-------------------------------*/
20 #define LOOP_LIMIT				5
21 #define MAX_STALL_TIME			50		/* us */
22 #define AntennaDiversityValue	0x80	/* (Adapter->bSoftwareAntennaDiversity ? 0x00 : 0x80) */
23 #define MAX_TXPWR_IDX_NMODE_92S	63
24 #define Reset_Cnt_Limit			3
25 
26 
27 #ifdef CONFIG_PCI_HCI
28 	#define MAX_AGGR_NUM	0x0B
29 #else
30 	#define MAX_AGGR_NUM	0x07
31 #endif /* CONFIG_PCI_HCI */
32 
33 
34 /*--------------------------Define Parameters-------------------------------*/
35 
36 /*------------------------------Define structure----------------------------*/
37 
38 
39 /* BB/RF related */
40 
41 #define	SIC_ENABLE				0
42 
43 /*------------------------------Define structure----------------------------*/
44 
45 
46 /*------------------------Export global variable----------------------------*/
47 /*------------------------Export global variable----------------------------*/
48 
49 
50 /*------------------------Export Marco Definition---------------------------*/
51 /*------------------------Export Marco Definition---------------------------*/
52 
53 
54 /*--------------------------Exported Function prototype---------------------*/
55 /* 1. BB register R/W API */
56 
57 extern	u32
58 PHY_QueryBBReg8814A(PADAPTER	Adapter,
59 			u32		RegAddr,
60 			u32		BitMask);
61 
62 
63 void
64 PHY_SetBBReg8814A(PADAPTER	Adapter,
65 			u32		RegAddr,
66 			u32		BitMask,
67 			u32		Data);
68 
69 
70 extern	u32
71 PHY_QueryRFReg8814A(PADAPTER			Adapter,
72 			enum rf_path	eRFPath,
73 			u32			RegAddr,
74 			u32			BitMask);
75 
76 
77 void
78 PHY_SetRFReg8814A(PADAPTER			Adapter,
79 			enum rf_path		eRFPath,
80 			u32				RegAddr,
81 			u32				BitMask,
82 			u32				Data);
83 
84 /* 1 3. Initial BB/RF config by reading MAC/BB/RF txt. */
85 s32
86 phy_BB8814A_Config_ParaFile(
87 		PADAPTER	Adapter
88 );
89 
90 void
91 PHY_ConfigBB_8814A(
92 		PADAPTER	Adapter
93 );
94 
95 
96 void
97 phy_ADC_CLK_8814A(
98 		PADAPTER	Adapter
99 );
100 
101 s32
102 PHY_RFConfig8814A(
103 		PADAPTER	Adapter
104 );
105 
106 /*
107  * RF Power setting
108  *
109  * BOOLEAN	PHY_SetRFPowerState8814A(PADAPTER Adapter, rt_rf_power_state	eRFPowerState); */
110 
111 /* 1 5. Tx  Power setting API */
112 
113 void
114 PHY_SetTxPowerLevel8814(
115 		PADAPTER		Adapter,
116 		u8			Channel
117 );
118 
119 u8
120 phy_get_tx_power_index_8814a(
121 		PADAPTER		Adapter,
122 		enum rf_path		RFPath,
123 		u8				Rate,
124 		enum channel_width BandWidth,
125 		u8				Channel
126 );
127 
128 void
129 PHY_SetTxPowerIndex_8814A(
130 		PADAPTER		Adapter,
131 		u32				PowerIndex,
132 		enum rf_path		RFPath,
133 		u8				Rate
134 );
135 
136 u32
137 PHY_GetTxBBSwing_8814A(
138 		PADAPTER	Adapter,
139 		BAND_TYPE	Band,
140 		enum rf_path	RFPath
141 );
142 
143 
144 
145 /* 1 6. Channel setting API */
146 #if 0
147 void
148 PHY_SwChnlTimerCallback8814A(
149 		struct timer_list		*p_timer
150 );
151 #endif
152 void
153 PHY_SwChnlWorkItemCallback8814A(
154 		void *pContext
155 );
156 
157 
158 void
159 HAL_HandleSwChnl8814A(
160 		PADAPTER	pAdapter,
161 		u8		channel
162 );
163 
164 void
165 PHY_SwChnlSynchronously8814A(PADAPTER		pAdapter,
166 				u8			channel);
167 
168 void
169 PHY_HandleSwChnlAndSetBW8814A(
170 		PADAPTER			Adapter,
171 		BOOLEAN				bSwitchChannel,
172 		BOOLEAN				bSetBandWidth,
173 		u8					ChannelNum,
174 		enum channel_width	ChnlWidth,
175 		u8					ChnlOffsetOf40MHz,
176 		u8					ChnlOffsetOf80MHz,
177 		u8					CenterFrequencyIndex1
178 );
179 
180 
181 BOOLEAN
182 PHY_QueryRFPathSwitch_8814A(PADAPTER	pAdapter);
183 
184 
185 
186 #if (USE_WORKITEM)
187 void
188 RtCheckForHangWorkItemCallback8814A(
189 		void *pContext
190 );
191 #endif
192 
193 BOOLEAN
194 SetAntennaConfig8814A(
195 		PADAPTER	Adapter,
196 		u8		DefaultAnt
197 );
198 
199 void
200 PHY_SetRFEReg8814A(
201 		PADAPTER		Adapter,
202 		BOOLEAN		bInit,
203 		u8		Band
204 );
205 
206 
207 s32
208 PHY_SwitchWirelessBand8814A(
209 		PADAPTER		 Adapter,
210 		u8		Band
211 );
212 
213 void
214 PHY_SetIO_8814A(
215 	PADAPTER		pAdapter
216 );
217 
218 void
219 PHY_SetSwChnlBWMode8814(
220 		PADAPTER			Adapter,
221 		u8					channel,
222 		enum channel_width	Bandwidth,
223 		u8					Offset40,
224 		u8					Offset80
225 );
226 
227 s32 PHY_MACConfig8814(PADAPTER Adapter);
228 int PHY_BBConfig8814(PADAPTER	Adapter);
229 void PHY_Set_SecCCATH_by_RXANT_8814A(PADAPTER	pAdapter, u32 ulAntennaRx);
230 
231 
232 
233 /*--------------------------Exported Function prototype---------------------*/
234 
235 /*--------------------------Exported Function prototype---------------------*/
236 #endif /* __INC_HAL8192CPHYCFG_H */
237