OSDN Git Service

staging: rtl8723bs: update to the latest driver
[android-x86/kernel.git] / drivers / staging / rtl8723bs / hal / odm_AntDiv.c
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 need to disable antenna diversity
24 // call this function to disable all ODM related mechanisms which will switch antenna.
25 //======================================================
26 void
27 ODM_StopAntennaSwitchDm(
28 PDM_ODM_T       pDM_Odm
29         )
30 {
31         // disable ODM antenna diversity
32         pDM_Odm->SupportAbility &= ~ODM_BB_ANT_DIV;
33         ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("STOP Antenna Diversity\n"));
34 }
35
36 void
37 ODM_SetAntConfig(
38 PDM_ODM_T       pDM_Odm,
39 u8 antSetting   // 0=A, 1=B, 2=C, ....
40         )
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
51 void
52 ODM_SwAntDivRestAfterLink(
53         PDM_ODM_T               pDM_Odm
54         )
55 {
56         pSWAT_T         pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
57         pFAT_T          pDM_FatTable = &pDM_Odm->DM_FatTable;
58         u32             i;
59
60         pDM_Odm->RSSI_test = false;
61         pDM_SWAT_Table->try_flag = 0xff;
62         pDM_SWAT_Table->RSSI_Trying = 0;
63         pDM_SWAT_Table->Double_chk_flag= 0;
64
65         pDM_FatTable->RxIdleAnt=MAIN_ANT;
66
67         for (i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
68         {
69                 pDM_FatTable->MainAnt_Sum[i] = 0;
70                 pDM_FatTable->AuxAnt_Sum[i] = 0;
71                 pDM_FatTable->MainAnt_Cnt[i] = 0;
72                 pDM_FatTable->AuxAnt_Cnt[i] = 0;
73         }
74 }