linux/drivers/staging/rtl8723bs/hal/odm_AntDiv.c
<<
>>
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
  16//============================================================
  17// include files
  18//============================================================
  19
  20#include "odm_precomp.h"
  21
  22//======================================================
  23// when antenna test utility is on or some testing
  24// need to disable antenna diversity
  25// call this function to disable all ODM related mechanisms
  26// which will switch antenna.
  27//======================================================
  28void ODM_StopAntennaSwitchDm(PDM_ODM_T pDM_Odm)
  29{
  30        // disable ODM antenna diversity
  31        pDM_Odm->SupportAbility &= ~ODM_BB_ANT_DIV;
  32        ODM_RT_TRACE(
  33                pDM_Odm,
  34                ODM_COMP_ANT_DIV,
  35                ODM_DBG_LOUD,
  36                ("STOP Antenna Diversity\n")
  37        );
  38}
  39
  40void ODM_SetAntConfig(PDM_ODM_T pDM_Odm, u8 antSetting)// 0=A, 1=B, 2=C, ....
  41{
  42        if (antSetting == 0) // ant A
  43                PHY_SetBBReg(pDM_Odm->Adapter, 0x948, bMaskDWord, 0x00000000);
  44        else if (antSetting == 1)
  45                PHY_SetBBReg(pDM_Odm->Adapter, 0x948, bMaskDWord, 0x00000280);
  46}
  47
  48//======================================================
  49
  50
  51void ODM_SwAntDivRestAfterLink(PDM_ODM_T pDM_Odm)
  52{
  53        pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
  54        pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
  55        u32 i;
  56
  57        pDM_Odm->RSSI_test = false;
  58        pDM_SWAT_Table->try_flag = 0xff;
  59        pDM_SWAT_Table->RSSI_Trying = 0;
  60        pDM_SWAT_Table->Double_chk_flag = 0;
  61
  62        pDM_FatTable->RxIdleAnt = MAIN_ANT;
  63
  64        for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) {
  65                pDM_FatTable->MainAnt_Sum[i] = 0;
  66                pDM_FatTable->AuxAnt_Sum[i] = 0;
  67                pDM_FatTable->MainAnt_Cnt[i] = 0;
  68                pDM_FatTable->AuxAnt_Cnt[i] = 0;
  69        }
  70}
  71