OSDN Git Service

Add rtl8723bu driver version 4.4.5
[android-x86/external-kernel-drivers.git] / rtl8723bu / include / hal_com_phycfg.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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #ifndef __HAL_COM_PHYCFG_H__
21 #define __HAL_COM_PHYCFG_H__
22
23 #define         PathA                                           0x0     // Useless
24 #define         PathB                                           0x1
25 #define         PathC                                           0x2
26 #define         PathD                                           0x3
27
28 typedef enum _RF_TX_NUM {
29         RF_1TX = 0,
30         RF_MAX_TX_NUM,
31         RF_TX_NUM_NONIMPLEMENT,
32 } RF_TX_NUM;
33
34 #define MAX_POWER_INDEX                 0x3F
35
36 typedef enum _REGULATION_TXPWR_LMT {
37         TXPWR_LMT_FCC = 0,
38         TXPWR_LMT_MKK = 1,
39         TXPWR_LMT_ETSI = 2,
40         TXPWR_LMT_WW = 3,
41
42         TXPWR_LMT_MAX_REGULATION_NUM = 4
43 } REGULATION_TXPWR_LMT;
44
45 #define TX_PWR_LMT_REF_VHT_FROM_HT      BIT0
46 #define TX_PWR_LMT_REF_HT_FROM_VHT      BIT1
47
48 /*------------------------------Define structure----------------------------*/
49 typedef struct _BB_REGISTER_DEFINITION{
50         u32 rfintfs;                    // set software control:
51                                                 //              0x870~0x877[8 bytes]
52
53         u32 rfintfo;                    // output data:
54                                                 //              0x860~0x86f [16 bytes]
55
56         u32 rfintfe;                    // output enable:
57                                                 //              0x860~0x86f [16 bytes]
58
59         u32 rf3wireOffset;      // LSSI data:
60                                                 //              0x840~0x84f [16 bytes]
61
62         u32 rfHSSIPara2;        // wire parameter control2 :
63                                                 //              0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes]
64
65         u32 rfLSSIReadBack;     //LSSI RF readback data SI mode
66                                                 //              0x8a0~0x8af [16 bytes]
67
68         u32 rfLSSIReadBackPi;   //LSSI RF readback data PI mode 0x8b8-8bc for Path A and B
69
70 }BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T;
71
72
73 //----------------------------------------------------------------------
74 u8
75 PHY_GetTxPowerByRateBase(
76         IN      PADAPTER                Adapter,
77         IN      u8                              Band,
78         IN      u8                              RfPath,
79         IN      u8                              TxNum,
80         IN      RATE_SECTION    RateSection
81         );
82
83 #ifdef TX_POWER_BY_RATE_OLD
84 u8
85 PHY_GetRateSectionIndexOfTxPowerByRate(
86         IN      PADAPTER        pAdapter,
87         IN      u32                     RegAddr,
88         IN      u32                     BitMask
89         );
90 #endif /* TX_POWER_BY_RATE_OLD */
91
92 VOID
93 PHY_GetRateValuesOfTxPowerByRate(
94         IN      PADAPTER pAdapter,
95         IN      u32 RegAddr,
96         IN      u32 BitMask,
97         IN      u32 Value,
98         OUT     u8 *Rate,
99         OUT     s8 *PwrByRateVal,
100         OUT     u8 *RateNum
101         );
102
103 u8
104 PHY_GetRateIndexOfTxPowerByRate(
105         IN      u8      Rate
106         );
107
108 VOID
109 PHY_SetTxPowerIndexByRateSection(
110         IN      PADAPTER                pAdapter,
111         IN      u8                              RFPath,
112         IN      u8                              Channel,
113         IN      u8                              RateSection
114         );
115
116 s8
117 _PHY_GetTxPowerByRate(
118         IN      PADAPTER        pAdapter,
119         IN      u8                      Band,
120         IN      u8                      RFPath,
121         IN      u8                      TxNum,
122         IN      u8                      RateIndex
123         );
124
125 s8
126 PHY_GetTxPowerByRate(
127         IN      PADAPTER        pAdapter,
128         IN      u8                      Band,
129         IN      u8                      RFPath,
130         IN      u8                      TxNum,
131         IN      u8                      RateIndex
132         );
133
134 VOID
135 PHY_SetTxPowerByRate(
136         IN      PADAPTER        pAdapter,
137         IN      u8                      Band,
138         IN      u8                      RFPath,
139         IN      u8                      TxNum,
140         IN      u8                      Rate,
141         IN      s8                      Value
142         );
143
144 VOID
145 PHY_SetTxPowerLevelByPath(
146         IN      PADAPTER        Adapter,
147         IN      u8                      channel,
148         IN      u8                      path
149         );
150
151 VOID
152 PHY_SetTxPowerIndexByRateArray(
153         IN      PADAPTER                pAdapter,
154         IN      u8                              RFPath,
155         IN      CHANNEL_WIDTH   BandWidth,
156         IN      u8                              Channel,
157         IN      u8*                             Rates,
158         IN      u8                              RateArraySize
159         );
160
161 VOID
162 PHY_InitTxPowerByRate(
163         IN      PADAPTER        pAdapter
164         );
165
166 VOID
167 PHY_StoreTxPowerByRate(
168         IN      PADAPTER        pAdapter,
169         IN      u32                     Band,
170         IN      u32                     RfPath,
171         IN      u32                     TxNum,
172         IN      u32                     RegAddr,
173         IN      u32                     BitMask,
174         IN      u32                     Data
175         );
176
177 VOID
178 PHY_TxPowerByRateConfiguration(
179         IN  PADAPTER                    pAdapter
180         );
181
182 u8
183 PHY_GetTxPowerIndexBase(
184         IN      PADAPTER                pAdapter,
185         IN      u8                              RFPath,
186         IN      u8                              Rate,
187         IN      CHANNEL_WIDTH   BandWidth,
188         IN      u8                              Channel,
189         OUT PBOOLEAN            bIn24G
190         );
191
192 s8
193 PHY_GetTxPowerLimit(
194         IN      PADAPTER                Adapter,
195         IN      u32                             RegPwrTblSel,
196         IN      BAND_TYPE               Band,
197         IN      CHANNEL_WIDTH   Bandwidth,
198         IN      u8                              RfPath,
199         IN      u8                              DataRate,
200         IN      u8                              Channel
201         );
202
203 VOID
204 PHY_ConvertTxPowerLimitToPowerIndex(
205         IN      PADAPTER                        Adapter
206         );
207
208 VOID
209 PHY_InitTxPowerLimit(
210         IN      PADAPTER                        Adapter
211         );
212
213 s8
214 PHY_GetTxPowerTrackingOffset(
215         PADAPTER        pAdapter,
216         u8                      Rate,
217         u8                      RFPath
218         );
219
220 u8
221 PHY_GetTxPowerIndex(
222         IN      PADAPTER                        pAdapter,
223         IN      u8                                      RFPath,
224         IN      u8                                      Rate,
225         IN      CHANNEL_WIDTH           BandWidth,
226         IN      u8                                      Channel
227         );
228
229 VOID
230 PHY_SetTxPowerIndex(
231         IN      PADAPTER                pAdapter,
232         IN      u32                             PowerIndex,
233         IN      u8                              RFPath,
234         IN      u8                              Rate
235         );
236
237 int phy_load_tx_power_by_rate(_adapter *adapter);
238 int phy_load_tx_power_limit(_adapter *adapter);
239 void phy_load_tx_power_ext_info(_adapter *adapter);
240
241 void dump_tx_power_ext_info(void *sel, _adapter *adapter);
242 void dump_target_tx_power(void *sel, _adapter *adapter);
243 void dump_tx_power_by_rate(void *sel, _adapter *adapter);
244 void dump_tx_power_limit(void *sel, _adapter *adapter);
245
246 #endif /* __HAL_COMMON_H__ */