1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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.
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
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
19 ******************************************************************************/
20 #ifndef __HAL_COM_PHYCFG_H__
21 #define __HAL_COM_PHYCFG_H__
23 #define PathA 0x0 // Useless
28 typedef enum _RF_TX_NUM {
34 RF_TX_NUM_NONIMPLEMENT,
37 #define MAX_POWER_INDEX 0x3F
39 typedef enum _REGULATION_TXPWR_LMT {
45 TXPWR_LMT_MAX_REGULATION_NUM = 4
46 } REGULATION_TXPWR_LMT;
48 #define TX_PWR_LMT_REF_VHT_FROM_HT BIT0
49 #define TX_PWR_LMT_REF_HT_FROM_VHT BIT1
51 /*------------------------------Define structure----------------------------*/
52 typedef struct _BB_REGISTER_DEFINITION{
53 u32 rfintfs; // set software control:
54 // 0x870~0x877[8 bytes]
56 u32 rfintfo; // output data:
57 // 0x860~0x86f [16 bytes]
59 u32 rfintfe; // output enable:
60 // 0x860~0x86f [16 bytes]
62 u32 rf3wireOffset; // LSSI data:
63 // 0x840~0x84f [16 bytes]
65 u32 rfHSSIPara2; // wire parameter control2 :
66 // 0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes]
68 u32 rfLSSIReadBack; //LSSI RF readback data SI mode
69 // 0x8a0~0x8af [16 bytes]
71 u32 rfLSSIReadBackPi; //LSSI RF readback data PI mode 0x8b8-8bc for Path A and B
73 }BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T;
76 //----------------------------------------------------------------------
78 PHY_GetTxPowerByRateBase(
83 IN RATE_SECTION RateSection
86 #ifdef TX_POWER_BY_RATE_OLD
88 PHY_GetRateSectionIndexOfTxPowerByRate(
93 #endif /* TX_POWER_BY_RATE_OLD */
96 PHY_GetRateValuesOfTxPowerByRate(
102 OUT s8 *PwrByRateVal,
107 PHY_GetRateIndexOfTxPowerByRate(
112 PHY_SetTxPowerIndexByRateSection(
113 IN PADAPTER pAdapter,
120 _PHY_GetTxPowerByRate(
121 IN PADAPTER pAdapter,
129 PHY_GetTxPowerByRate(
130 IN PADAPTER pAdapter,
138 PHY_SetTxPowerByRate(
139 IN PADAPTER pAdapter,
148 PHY_SetTxPowerLevelByPath(
155 PHY_SetTxPowerIndexByRateArray(
156 IN PADAPTER pAdapter,
158 IN CHANNEL_WIDTH BandWidth,
165 PHY_InitTxPowerByRate(
170 PHY_StoreTxPowerByRate(
171 IN PADAPTER pAdapter,
181 PHY_TxPowerByRateConfiguration(
186 PHY_GetTxPowerIndexBase(
187 IN PADAPTER pAdapter,
190 IN CHANNEL_WIDTH BandWidth,
200 IN CHANNEL_WIDTH Bandwidth,
207 PHY_ConvertTxPowerLimitToPowerIndex(
212 PHY_InitTxPowerLimit(
217 PHY_GetTxPowerTrackingOffset(
225 IN PADAPTER pAdapter,
228 IN CHANNEL_WIDTH BandWidth,
234 IN PADAPTER pAdapter,
240 bool phy_is_tx_power_limit_needed(_adapter *adapter);
241 bool phy_is_tx_power_by_rate_needed(_adapter *adapter);
242 int phy_load_tx_power_by_rate(_adapter *adapter, const char *hal_file_name, u8 force);
243 int phy_load_tx_power_limit(_adapter *adapter, const char *hal_file_name, u8 force);
244 void phy_load_tx_power_ext_info(_adapter *adapter, u8 chk_file, u8 force);
245 void phy_reload_tx_power_ext_info(_adapter *adapter);
246 void phy_reload_default_tx_power_ext_info(_adapter *adapter);
248 void dump_tx_power_ext_info(void *sel, _adapter *adapter);
249 void dump_target_tx_power(void *sel, _adapter *adapter);
250 void dump_tx_power_by_rate(void *sel, _adapter *adapter);
251 void dump_tx_power_limit(void *sel, _adapter *adapter);
253 int rtw_is_phy_file_readable(const char *hal_file_name);
255 #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
256 #define MAX_PARA_FILE_BUF_LEN 25600
258 #define LOAD_MAC_PARA_FILE BIT0
259 #define LOAD_BB_PARA_FILE BIT1
260 #define LOAD_BB_PG_PARA_FILE BIT2
261 #define LOAD_BB_MP_PARA_FILE BIT3
262 #define LOAD_RF_PARA_FILE BIT4
263 #define LOAD_RF_TXPWR_TRACK_PARA_FILE BIT5
264 #define LOAD_RF_TXPWR_LMT_PARA_FILE BIT6
266 int phy_ConfigMACWithParaFile(IN PADAPTER Adapter, IN char* pFileName);
268 int phy_ConfigBBWithParaFile(IN PADAPTER Adapter, IN char* pFileName, IN u32 ConfigType);
270 int phy_ConfigBBWithPgParaFile(IN PADAPTER Adapter, IN const char *pFileName);
272 int phy_ConfigBBWithMpParaFile(IN PADAPTER Adapter, IN char* pFileName);
274 int PHY_ConfigRFWithParaFile(IN PADAPTER Adapter, IN char* pFileName, IN u8 eRFPath);
276 int PHY_ConfigRFWithTxPwrTrackParaFile(IN PADAPTER Adapter, IN char* pFileName);
278 int PHY_ConfigRFWithPowerLimitTableParaFile(IN PADAPTER Adapter, IN const char *pFileName);
280 void phy_free_filebuf_mask(_adapter *padapter, u8 mask);
281 void phy_free_filebuf(_adapter *padapter);
282 #endif /* CONFIG_LOAD_PHY_PARA_FROM_FILE */
284 #endif /* __HAL_COMMON_H__ */