linux/drivers/staging/rtl8723bs/include/hal_com_phycfg.h
<<
>>
Prefs
   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 ******************************************************************************/
  15#ifndef __HAL_COM_PHYCFG_H__
  16#define __HAL_COM_PHYCFG_H__
  17
  18#define         PathA           0x0     /*  Useless */
  19#define         PathB           0x1
  20#define         PathC           0x2
  21#define         PathD           0x3
  22
  23enum RATE_SECTION {
  24        CCK = 0,
  25        OFDM,
  26        HT_MCS0_MCS7,
  27        HT_MCS8_MCS15,
  28        HT_MCS16_MCS23,
  29        HT_MCS24_MCS31,
  30        VHT_1SSMCS0_1SSMCS9,
  31        VHT_2SSMCS0_2SSMCS9,
  32        VHT_3SSMCS0_3SSMCS9,
  33        VHT_4SSMCS0_4SSMCS9,
  34};
  35
  36enum RF_TX_NUM {
  37        RF_1TX = 0,
  38        RF_2TX,
  39        RF_3TX,
  40        RF_4TX,
  41        RF_MAX_TX_NUM,
  42        RF_TX_NUM_NONIMPLEMENT,
  43};
  44
  45#define MAX_POWER_INDEX                 0x3F
  46
  47enum _REGULATION_TXPWR_LMT {
  48        TXPWR_LMT_FCC = 0,
  49        TXPWR_LMT_MKK,
  50        TXPWR_LMT_ETSI,
  51        TXPWR_LMT_WW,
  52        TXPWR_LMT_MAX_REGULATION_NUM,
  53};
  54
  55/*------------------------------Define structure----------------------------*/
  56struct bb_register_def {
  57        u32 rfintfs;                    /*  set software control: */
  58                                        /*      0x870~0x877[8 bytes] */
  59
  60        u32 rfintfo;                    /*  output data: */
  61                                        /*      0x860~0x86f [16 bytes] */
  62
  63        u32 rfintfe;                    /*  output enable: */
  64                                        /*      0x860~0x86f [16 bytes] */
  65
  66        u32 rf3wireOffset;              /*  LSSI data: */
  67                                        /*      0x840~0x84f [16 bytes] */
  68
  69        u32 rfHSSIPara2;                /*  wire parameter control2 : */
  70                                        /*      0x824~0x827, 0x82c~0x82f,
  71                                         *      0x834~0x837, 0x83c~0x83f
  72                                         */
  73        u32 rfLSSIReadBack;             /* LSSI RF readback data SI mode */
  74                                        /*      0x8a0~0x8af [16 bytes] */
  75
  76        u32 rfLSSIReadBackPi;           /* LSSI RF readback data PI mode
  77                                         *      0x8b8-8bc for Path A and B */
  78
  79};
  80
  81u8
  82PHY_GetTxPowerByRateBase(
  83struct adapter *        Adapter,
  84u8              Band,
  85u8              RfPath,
  86u8              TxNum,
  87enum RATE_SECTION       RateSection
  88        );
  89
  90u8
  91PHY_GetRateSectionIndexOfTxPowerByRate(
  92struct adapter *padapter,
  93u32             RegAddr,
  94u32             BitMask
  95        );
  96
  97void
  98PHY_GetRateValuesOfTxPowerByRate(
  99struct adapter *padapter,
 100u32             RegAddr,
 101u32             BitMask,
 102u32             Value,
 103        u8*             RateIndex,
 104        s8*             PwrByRateVal,
 105        u8*             RateNum
 106        );
 107
 108u8
 109PHY_GetRateIndexOfTxPowerByRate(
 110u8 Rate
 111        );
 112
 113void
 114PHY_SetTxPowerIndexByRateSection(
 115struct adapter *        padapter,
 116u8              RFPath,
 117u8              Channel,
 118u8              RateSection
 119        );
 120
 121s8
 122PHY_GetTxPowerByRate(
 123struct adapter *padapter,
 124u8      Band,
 125u8      RFPath,
 126u8      TxNum,
 127u8      RateIndex
 128        );
 129
 130void
 131PHY_SetTxPowerByRate(
 132struct adapter *padapter,
 133u8      Band,
 134u8      RFPath,
 135u8      TxNum,
 136u8      Rate,
 137s8                      Value
 138        );
 139
 140void
 141PHY_SetTxPowerLevelByPath(
 142struct adapter *Adapter,
 143u8      channel,
 144u8      path
 145        );
 146
 147void
 148PHY_SetTxPowerIndexByRateArray(
 149struct adapter *        padapter,
 150u8              RFPath,
 151enum CHANNEL_WIDTH      BandWidth,
 152u8              Channel,
 153u8*                     Rates,
 154u8              RateArraySize
 155        );
 156
 157void
 158PHY_InitTxPowerByRate(
 159struct adapter *padapter
 160        );
 161
 162void
 163PHY_StoreTxPowerByRate(
 164struct adapter *padapter,
 165u32             Band,
 166u32             RfPath,
 167u32             TxNum,
 168u32             RegAddr,
 169u32             BitMask,
 170u32             Data
 171        );
 172
 173void
 174PHY_TxPowerByRateConfiguration(
 175        struct adapter *                padapter
 176        );
 177
 178u8
 179PHY_GetTxPowerIndexBase(
 180struct adapter *        padapter,
 181u8              RFPath,
 182u8              Rate,
 183enum CHANNEL_WIDTH      BandWidth,
 184u8              Channel,
 185        bool            *bIn24G
 186        );
 187
 188s8 PHY_GetTxPowerLimit (struct adapter *adapter, u32 RegPwrTblSel,
 189                        enum BAND_TYPE Band, enum CHANNEL_WIDTH Bandwidth,
 190u8              RfPath,
 191u8              DataRate,
 192u8              Channel
 193        );
 194
 195void
 196PHY_SetTxPowerLimit(
 197struct adapter *                Adapter,
 198u8                      *Regulation,
 199u8                      *Band,
 200u8                      *Bandwidth,
 201u8                      *RateSection,
 202u8                      *RfPath,
 203u8                      *Channel,
 204u8                      *PowerLimit
 205        );
 206
 207void
 208PHY_ConvertTxPowerLimitToPowerIndex(
 209struct adapter *                Adapter
 210        );
 211
 212void
 213PHY_InitTxPowerLimit(
 214struct adapter *                Adapter
 215        );
 216
 217s8
 218PHY_GetTxPowerTrackingOffset(
 219        struct adapter *padapter,
 220        u8      Rate,
 221        u8      RFPath
 222        );
 223
 224u8
 225PHY_GetTxPowerIndex(
 226struct adapter *                padapter,
 227u8                      RFPath,
 228u8                      Rate,
 229enum CHANNEL_WIDTH              BandWidth,
 230u8                      Channel
 231        );
 232
 233void
 234PHY_SetTxPowerIndex(
 235struct adapter *        padapter,
 236u32                     PowerIndex,
 237u8              RFPath,
 238u8              Rate
 239        );
 240
 241void
 242Hal_ChannelPlanToRegulation(
 243struct adapter *        Adapter,
 244u16                     ChannelPlan
 245        );
 246
 247#define MAX_PARA_FILE_BUF_LEN   25600
 248
 249#define LOAD_MAC_PARA_FILE                              BIT0
 250#define LOAD_BB_PARA_FILE                                       BIT1
 251#define LOAD_BB_PG_PARA_FILE                            BIT2
 252#define LOAD_BB_MP_PARA_FILE                            BIT3
 253#define LOAD_RF_PARA_FILE                                       BIT4
 254#define LOAD_RF_TXPWR_TRACK_PARA_FILE   BIT5
 255#define LOAD_RF_TXPWR_LMT_PARA_FILE             BIT6
 256
 257int phy_ConfigMACWithParaFile(struct adapter *Adapter, char*pFileName);
 258
 259int phy_ConfigBBWithParaFile(struct adapter *Adapter, char*pFileName, u32 ConfigType);
 260
 261int phy_ConfigBBWithPgParaFile(struct adapter *Adapter, char*pFileName);
 262
 263int phy_ConfigBBWithMpParaFile(struct adapter *Adapter, char*pFileName);
 264
 265int PHY_ConfigRFWithParaFile(struct adapter *Adapter, char*pFileName, u8 eRFPath);
 266
 267int PHY_ConfigRFWithTxPwrTrackParaFile(struct adapter *Adapter, char*pFileName);
 268
 269int PHY_ConfigRFWithPowerLimitTableParaFile(struct adapter *Adapter, char*pFileName);
 270
 271void phy_free_filebuf(struct adapter *padapter);
 272
 273#endif /* __HAL_COMMON_H__ */
 274