2013-05-08 21:45:39 +00:00
/******************************************************************************
*
* Copyright ( c ) 2007 - 2011 Realtek Corporation . All rights reserved .
2014-12-19 06:59:46 +00:00
*
2013-05-08 21:45:39 +00:00
* This program is free software ; you can redistribute it and / or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation .
*
* This program is distributed in the hope that it will be useful , but WITHOUT
* ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License for
* more details .
*
* You should have received a copy of the GNU General Public License along with
* this program ; if not , write to the Free Software Foundation , Inc . ,
* 51 Franklin Street , Fifth Floor , Boston , MA 02110 , USA
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2015-02-20 00:51:33 +00:00
/* */
/* include files */
/* */
2013-05-08 21:45:39 +00:00
# include "odm_precomp.h"
2014-12-17 06:40:52 +00:00
u32 GlobalDebugLevel ;
2014-12-17 04:09:56 +00:00
2015-01-29 21:27:28 +00:00
static const u16 dB_Invert_Table [ 8 ] [ 12 ] = {
2014-12-17 04:09:56 +00:00
{ 1 , 1 , 1 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 4 , 4 } ,
{ 4 , 5 , 6 , 6 , 7 , 8 , 9 , 10 , 11 , 13 , 14 , 16 } ,
{ 18 , 20 , 22 , 25 , 28 , 32 , 35 , 40 , 45 , 50 , 56 , 63 } ,
{ 71 , 79 , 89 , 100 , 112 , 126 , 141 , 158 , 178 , 200 , 224 , 251 } ,
{ 282 , 316 , 355 , 398 , 447 , 501 , 562 , 631 , 708 , 794 , 891 , 1000 } ,
{ 1122 , 1259 , 1413 , 1585 , 1778 , 1995 , 2239 , 2512 , 2818 , 3162 , 3548 , 3981 } ,
{ 4467 , 5012 , 5623 , 6310 , 7079 , 7943 , 8913 , 10000 , 11220 , 12589 , 14125 , 15849 } ,
{ 17783 , 19953 , 22387 , 25119 , 28184 , 31623 , 35481 , 39811 , 44668 , 50119 , 56234 , 65535 } } ;
2015-02-20 00:51:33 +00:00
/* 20100515 Joseph: Add global variable to keep temporary scan list for antenna switching test. */
/* u8 tmpNumBssDesc; */
/* RT_WLAN_BSS tmpbssDesc[MAX_BSS_DESC]; */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* avoid to warn in FreeBSD ==> To DO modify */
2015-01-29 21:27:28 +00:00
static u32 EDCAParam [ HT_IOT_PEER_MAX ] [ 3 ] =
2015-02-20 00:51:33 +00:00
{ /* UL DL */
{ 0x5ea42b , 0x5ea42b , 0x5ea42b } , /* 0:unknown AP */
{ 0xa44f , 0x5ea44f , 0x5e431c } , /* 1:realtek AP */
{ 0x5ea42b , 0x5ea42b , 0x5ea42b } , /* 2:unknown AP => realtek_92SE */
{ 0x5ea32b , 0x5ea42b , 0x5e4322 } , /* 3:broadcom AP */
{ 0x5ea422 , 0x00a44f , 0x00a44f } , /* 4:ralink AP */
{ 0x5ea322 , 0x00a630 , 0x00a44f } , /* 5:atheros AP */
{ 0x5e4322 , 0x5e4322 , 0x5e4322 } , /* 6:cisco AP */
{ 0x5ea44f , 0x00a44f , 0x5ea42b } , /* 8:marvell AP */
{ 0x5ea42b , 0x5ea42b , 0x5ea42b } , /* 10:unknown AP=> 92U AP */
{ 0x5ea42b , 0xa630 , 0x5e431c } , /* 11:airgocap AP */
2013-05-08 21:45:39 +00:00
} ;
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* */
/* Global var */
/* */
2014-12-30 22:55:10 +00:00
u32 OFDMSwingTable [ OFDM_TABLE_SIZE_92D ] = {
2015-02-20 00:51:33 +00:00
0x7f8001fe , /* 0, +6.0dB */
0x788001e2 , /* 1, +5.5dB */
0x71c001c7 , /* 2, +5.0dB */
0x6b8001ae , /* 3, +4.5dB */
0x65400195 , /* 4, +4.0dB */
0x5fc0017f , /* 5, +3.5dB */
0x5a400169 , /* 6, +3.0dB */
0x55400155 , /* 7, +2.5dB */
0x50800142 , /* 8, +2.0dB */
0x4c000130 , /* 9, +1.5dB */
0x47c0011f , /* 10, +1.0dB */
0x43c0010f , /* 11, +0.5dB */
0x40000100 , /* 12, +0dB */
0x3c8000f2 , /* 13, -0.5dB */
0x390000e4 , /* 14, -1.0dB */
0x35c000d7 , /* 15, -1.5dB */
0x32c000cb , /* 16, -2.0dB */
0x300000c0 , /* 17, -2.5dB */
0x2d4000b5 , /* 18, -3.0dB */
0x2ac000ab , /* 19, -3.5dB */
0x288000a2 , /* 20, -4.0dB */
0x26000098 , /* 21, -4.5dB */
0x24000090 , /* 22, -5.0dB */
0x22000088 , /* 23, -5.5dB */
0x20000080 , /* 24, -6.0dB */
0x1e400079 , /* 25, -6.5dB */
0x1c800072 , /* 26, -7.0dB */
0x1b00006c , /* 27. -7.5dB */
0x19800066 , /* 28, -8.0dB */
0x18000060 , /* 29, -8.5dB */
0x16c0005b , /* 30, -9.0dB */
0x15800056 , /* 31, -9.5dB */
0x14400051 , /* 32, -10.0dB */
0x1300004c , /* 33, -10.5dB */
0x12000048 , /* 34, -11.0dB */
0x11000044 , /* 35, -11.5dB */
0x10000040 , /* 36, -12.0dB */
0x0f00003c , /* 37, -12.5dB */
0x0e400039 , /* 38, -13.0dB */
0x0d800036 , /* 39, -13.5dB */
0x0cc00033 , /* 40, -14.0dB */
0x0c000030 , /* 41, -14.5dB */
0x0b40002d , /* 42, -15.0dB */
2013-05-08 21:45:39 +00:00
} ;
2014-12-17 04:09:56 +00:00
2014-12-30 23:50:44 +00:00
u8 CCKSwingTable_Ch1_Ch13 [ CCK_TABLE_SIZE ] [ 8 ] = {
2015-02-20 00:51:33 +00:00
{ 0x36 , 0x35 , 0x2e , 0x25 , 0x1c , 0x12 , 0x09 , 0x04 } , /* 0, +0dB */
{ 0x33 , 0x32 , 0x2b , 0x23 , 0x1a , 0x11 , 0x08 , 0x04 } , /* 1, -0.5dB */
{ 0x30 , 0x2f , 0x29 , 0x21 , 0x19 , 0x10 , 0x08 , 0x03 } , /* 2, -1.0dB */
{ 0x2d , 0x2d , 0x27 , 0x1f , 0x18 , 0x0f , 0x08 , 0x03 } , /* 3, -1.5dB */
{ 0x2b , 0x2a , 0x25 , 0x1e , 0x16 , 0x0e , 0x07 , 0x03 } , /* 4, -2.0dB */
{ 0x28 , 0x28 , 0x22 , 0x1c , 0x15 , 0x0d , 0x07 , 0x03 } , /* 5, -2.5dB */
{ 0x26 , 0x25 , 0x21 , 0x1b , 0x14 , 0x0d , 0x06 , 0x03 } , /* 6, -3.0dB */
{ 0x24 , 0x23 , 0x1f , 0x19 , 0x13 , 0x0c , 0x06 , 0x03 } , /* 7, -3.5dB */
{ 0x22 , 0x21 , 0x1d , 0x18 , 0x11 , 0x0b , 0x06 , 0x02 } , /* 8, -4.0dB */
{ 0x20 , 0x20 , 0x1b , 0x16 , 0x11 , 0x08 , 0x05 , 0x02 } , /* 9, -4.5dB */
{ 0x1f , 0x1e , 0x1a , 0x15 , 0x10 , 0x0a , 0x05 , 0x02 } , /* 10, -5.0dB */
{ 0x1d , 0x1c , 0x18 , 0x14 , 0x0f , 0x0a , 0x05 , 0x02 } , /* 11, -5.5dB */
{ 0x1b , 0x1a , 0x17 , 0x13 , 0x0e , 0x09 , 0x04 , 0x02 } , /* 12, -6.0dB */
{ 0x1a , 0x19 , 0x16 , 0x12 , 0x0d , 0x09 , 0x04 , 0x02 } , /* 13, -6.5dB */
{ 0x18 , 0x17 , 0x15 , 0x11 , 0x0c , 0x08 , 0x04 , 0x02 } , /* 14, -7.0dB */
{ 0x17 , 0x16 , 0x13 , 0x10 , 0x0c , 0x08 , 0x04 , 0x02 } , /* 15, -7.5dB */
{ 0x16 , 0x15 , 0x12 , 0x0f , 0x0b , 0x07 , 0x04 , 0x01 } , /* 16, -8.0dB */
{ 0x14 , 0x14 , 0x11 , 0x0e , 0x0b , 0x07 , 0x03 , 0x02 } , /* 17, -8.5dB */
{ 0x13 , 0x13 , 0x10 , 0x0d , 0x0a , 0x06 , 0x03 , 0x01 } , /* 18, -9.0dB */
{ 0x12 , 0x12 , 0x0f , 0x0c , 0x09 , 0x06 , 0x03 , 0x01 } , /* 19, -9.5dB */
{ 0x11 , 0x11 , 0x0f , 0x0c , 0x09 , 0x06 , 0x03 , 0x01 } , /* 20, -10.0dB */
{ 0x10 , 0x10 , 0x0e , 0x0b , 0x08 , 0x05 , 0x03 , 0x01 } , /* 21, -10.5dB */
{ 0x0f , 0x0f , 0x0d , 0x0b , 0x08 , 0x05 , 0x03 , 0x01 } , /* 22, -11.0dB */
{ 0x0e , 0x0e , 0x0c , 0x0a , 0x08 , 0x05 , 0x02 , 0x01 } , /* 23, -11.5dB */
{ 0x0d , 0x0d , 0x0c , 0x0a , 0x07 , 0x05 , 0x02 , 0x01 } , /* 24, -12.0dB */
{ 0x0d , 0x0c , 0x0b , 0x09 , 0x07 , 0x04 , 0x02 , 0x01 } , /* 25, -12.5dB */
{ 0x0c , 0x0c , 0x0a , 0x09 , 0x06 , 0x04 , 0x02 , 0x01 } , /* 26, -13.0dB */
{ 0x0b , 0x0b , 0x0a , 0x08 , 0x06 , 0x04 , 0x02 , 0x01 } , /* 27, -13.5dB */
{ 0x0b , 0x0a , 0x09 , 0x08 , 0x06 , 0x04 , 0x02 , 0x01 } , /* 28, -14.0dB */
{ 0x0a , 0x0a , 0x09 , 0x07 , 0x05 , 0x03 , 0x02 , 0x01 } , /* 29, -14.5dB */
{ 0x0a , 0x09 , 0x08 , 0x07 , 0x05 , 0x03 , 0x02 , 0x01 } , /* 30, -15.0dB */
{ 0x09 , 0x09 , 0x08 , 0x06 , 0x05 , 0x03 , 0x01 , 0x01 } , /* 31, -15.5dB */
{ 0x09 , 0x08 , 0x07 , 0x06 , 0x04 , 0x03 , 0x01 , 0x01 } /* 32, -16.0dB */
2013-05-19 04:28:07 +00:00
} ;
2013-05-08 21:45:39 +00:00
2014-12-30 23:50:44 +00:00
u8 CCKSwingTable_Ch14 [ CCK_TABLE_SIZE ] [ 8 ] = {
2015-02-20 00:51:33 +00:00
{ 0x36 , 0x35 , 0x2e , 0x1b , 0x00 , 0x00 , 0x00 , 0x00 } , /* 0, +0dB */
{ 0x33 , 0x32 , 0x2b , 0x19 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 1, -0.5dB */
{ 0x30 , 0x2f , 0x29 , 0x18 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 2, -1.0dB */
{ 0x2d , 0x2d , 0x17 , 0x17 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 3, -1.5dB */
{ 0x2b , 0x2a , 0x25 , 0x15 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 4, -2.0dB */
{ 0x28 , 0x28 , 0x24 , 0x14 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 5, -2.5dB */
{ 0x26 , 0x25 , 0x21 , 0x13 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 6, -3.0dB */
{ 0x24 , 0x23 , 0x1f , 0x12 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 7, -3.5dB */
{ 0x22 , 0x21 , 0x1d , 0x11 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 8, -4.0dB */
{ 0x20 , 0x20 , 0x1b , 0x10 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 9, -4.5dB */
{ 0x1f , 0x1e , 0x1a , 0x0f , 0x00 , 0x00 , 0x00 , 0x00 } , /* 10, -5.0dB */
{ 0x1d , 0x1c , 0x18 , 0x0e , 0x00 , 0x00 , 0x00 , 0x00 } , /* 11, -5.5dB */
{ 0x1b , 0x1a , 0x17 , 0x0e , 0x00 , 0x00 , 0x00 , 0x00 } , /* 12, -6.0dB */
{ 0x1a , 0x19 , 0x16 , 0x0d , 0x00 , 0x00 , 0x00 , 0x00 } , /* 13, -6.5dB */
{ 0x18 , 0x17 , 0x15 , 0x0c , 0x00 , 0x00 , 0x00 , 0x00 } , /* 14, -7.0dB */
{ 0x17 , 0x16 , 0x13 , 0x0b , 0x00 , 0x00 , 0x00 , 0x00 } , /* 15, -7.5dB */
{ 0x16 , 0x15 , 0x12 , 0x0b , 0x00 , 0x00 , 0x00 , 0x00 } , /* 16, -8.0dB */
{ 0x14 , 0x14 , 0x11 , 0x0a , 0x00 , 0x00 , 0x00 , 0x00 } , /* 17, -8.5dB */
{ 0x13 , 0x13 , 0x10 , 0x0a , 0x00 , 0x00 , 0x00 , 0x00 } , /* 18, -9.0dB */
{ 0x12 , 0x12 , 0x0f , 0x09 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 19, -9.5dB */
{ 0x11 , 0x11 , 0x0f , 0x09 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 20, -10.0dB */
{ 0x10 , 0x10 , 0x0e , 0x08 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 21, -10.5dB */
{ 0x0f , 0x0f , 0x0d , 0x08 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 22, -11.0dB */
{ 0x0e , 0x0e , 0x0c , 0x07 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 23, -11.5dB */
{ 0x0d , 0x0d , 0x0c , 0x07 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 24, -12.0dB */
{ 0x0d , 0x0c , 0x0b , 0x06 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 25, -12.5dB */
{ 0x0c , 0x0c , 0x0a , 0x06 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 26, -13.0dB */
{ 0x0b , 0x0b , 0x0a , 0x06 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 27, -13.5dB */
{ 0x0b , 0x0a , 0x09 , 0x05 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 28, -14.0dB */
{ 0x0a , 0x0a , 0x09 , 0x05 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 29, -14.5dB */
{ 0x0a , 0x09 , 0x08 , 0x05 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 30, -15.0dB */
{ 0x09 , 0x09 , 0x08 , 0x05 , 0x00 , 0x00 , 0x00 , 0x00 } , /* 31, -15.5dB */
{ 0x09 , 0x08 , 0x07 , 0x04 , 0x00 , 0x00 , 0x00 , 0x00 } /* 32, -16.0dB */
2014-12-19 06:59:46 +00:00
} ;
2014-12-17 04:09:56 +00:00
# ifdef AP_BUILD_WORKAROUND
unsigned int TxPwrTrk_OFDM_SwingTbl [ TxPwrTrk_OFDM_SwingTbl_Len ] = {
/* +6.0dB */ 0x7f8001fe ,
/* +5.5dB */ 0x788001e2 ,
/* +5.0dB */ 0x71c001c7 ,
/* +4.5dB */ 0x6b8001ae ,
/* +4.0dB */ 0x65400195 ,
/* +3.5dB */ 0x5fc0017f ,
/* +3.0dB */ 0x5a400169 ,
/* +2.5dB */ 0x55400155 ,
/* +2.0dB */ 0x50800142 ,
/* +1.5dB */ 0x4c000130 ,
/* +1.0dB */ 0x47c0011f ,
/* +0.5dB */ 0x43c0010f ,
/* 0.0dB */ 0x40000100 ,
/* -0.5dB */ 0x3c8000f2 ,
/* -1.0dB */ 0x390000e4 ,
/* -1.5dB */ 0x35c000d7 ,
/* -2.0dB */ 0x32c000cb ,
/* -2.5dB */ 0x300000c0 ,
/* -3.0dB */ 0x2d4000b5 ,
/* -3.5dB */ 0x2ac000ab ,
/* -4.0dB */ 0x288000a2 ,
/* -4.5dB */ 0x26000098 ,
/* -5.0dB */ 0x24000090 ,
/* -5.5dB */ 0x22000088 ,
/* -6.0dB */ 0x20000080 ,
/* -6.5dB */ 0x1a00006c ,
/* -7.0dB */ 0x1c800072 ,
/* -7.5dB */ 0x18000060 ,
/* -8.0dB */ 0x19800066 ,
/* -8.5dB */ 0x15800056 ,
/* -9.0dB */ 0x26c0005b ,
/* -9.5dB */ 0x14400051 ,
/* -10.0dB */ 0x24400051 ,
/* -10.5dB */ 0x1300004c ,
/* -11.0dB */ 0x12000048 ,
/* -11.5dB */ 0x11000044 ,
/* -12.0dB */ 0x10000040
} ;
# endif
2015-02-20 00:51:33 +00:00
/* */
/* Local Function predefine. */
/* */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* START------------COMMON INFO RELATED--------------- */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CommonInfoSelfInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CommonInfoSelfUpdate (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CmnInfoInit_Debug (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CmnInfoHook_Debug (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CmnInfoUpdate_Debug (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
/*
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_FindMinimumRSSI (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_IsLinked (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
*/
2015-02-20 00:51:33 +00:00
/* END------------COMMON INFO RELATED--------------- */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* START---------------DIG--------------------------- */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_FalseAlarmCounterStatistics (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DIGInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DIG (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CCKPacketDetectionThresh (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2015-02-20 00:51:33 +00:00
/* END---------------DIG--------------------------- */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* START-------BB POWER SAVE----------------------- */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicBBPowerSavingInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicBBPowerSaving (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_1R_CCA (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_AdaptivityInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_Adaptivity (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 IGI
2014-12-17 04:09:56 +00:00
) ;
2015-02-20 00:51:33 +00:00
/* END---------BB POWER SAVE----------------------- */
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RefreshRateAdaptiveMaskMP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RefreshRateAdaptiveMaskCE (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RefreshRateAdaptiveMaskAPADSL (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerRestorePowerIndex (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerNIC (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerSavePowerIndex (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerWritePowerIndex (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 Value ) ;
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPower_92C (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPower_92D (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorCheckMP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorCheckCE (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorCheckAP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorCheck (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPower (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerAP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_SwAntDivInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_SwAntDivInit_NIC (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_SwAntDivChkAntSwitch (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 Step
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_SwAntDivChkAntSwitchNIC (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 Step
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void odm_SwAntDivChkAntSwitchCallback ( void * FunctionContext ) ;
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_GlobalAdapterCheck (
2015-03-13 17:06:38 +00:00
void
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RefreshRateAdaptiveMask (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_TXPowerTrackingCheck (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingCheckAP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RateAdaptiveMaskInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingThermalMeterInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingCheckMP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingCheckCE (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_EdcaTurboCheck (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_EdcaTurboInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_EdcaTurboCheckCE (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2014-12-19 06:59:46 +00:00
# define RxDefaultAnt1 0x65a9
2014-12-17 04:09:56 +00:00
# define RxDefaultAnt2 0x569a
2013-05-08 21:45:39 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_InitHybridAntDiv (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2015-03-02 23:21:23 +00:00
bool
2014-12-17 04:09:56 +00:00
odm_StaDefAntSel (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u32 OFDM_Ant1_Cnt ,
u32 OFDM_Ant2_Cnt ,
u32 CCK_Ant1_Cnt ,
u32 CCK_Ant2_Cnt ,
u8 * pDefAnt
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_SetRxIdleAnt (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 Ant ,
bool bDualPath
2014-12-17 04:09:56 +00:00
) ;
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_HwAntDiv (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
) ;
2015-02-20 00:51:33 +00:00
/* */
/* 3 Export Interface */
/* */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* */
/* 2011/09/21 MH Add to describe different team necessary resource allocate?? */
/* */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_DMInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2013-05-08 21:45:39 +00:00
{
2014-12-17 04:09:56 +00:00
# if (FPGA_TWO_MAC_VERIFICATION == 1)
odm_RateAdaptiveMaskInit ( pDM_Odm ) ;
return ;
# endif
2015-02-20 00:51:33 +00:00
/* 2012.05.03 Luke: For all IC series */
2013-05-08 21:45:39 +00:00
odm_CommonInfoSelfInit ( pDM_Odm ) ;
odm_CmnInfoInit_Debug ( pDM_Odm ) ;
odm_DIGInit ( pDM_Odm ) ;
2014-12-19 06:59:46 +00:00
odm_AdaptivityInit ( pDM_Odm ) ;
2013-05-08 21:45:39 +00:00
odm_RateAdaptiveMaskInit ( pDM_Odm ) ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ODM_IC_11AC_SERIES )
2014-12-17 04:09:56 +00:00
{
}
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > SupportICType & ODM_IC_11N_SERIES )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
odm_PrimaryCCA_Init ( pDM_Odm ) ; /* Gary */
2013-05-08 21:45:39 +00:00
odm_DynamicBBPowerSavingInit ( pDM_Odm ) ;
odm_DynamicTxPowerInit ( pDM_Odm ) ;
odm_TXPowerTrackingInit ( pDM_Odm ) ;
ODM_EdcaTurboInit ( pDM_Odm ) ;
ODM_RAInfo_Init_all ( pDM_Odm ) ;
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > AntDivType = = CG_TRX_HW_ANTDIV ) | |
2014-12-19 06:59:46 +00:00
( pDM_Odm - > AntDivType = = CGCS_RX_HW_ANTDIV ) | |
2014-12-17 04:09:56 +00:00
( pDM_Odm - > AntDivType = = CG_TRX_SMART_ANTDIV ) )
{
2013-05-08 21:45:39 +00:00
odm_InitHybridAntDiv ( pDM_Odm ) ;
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > AntDivType = = CGCS_RX_SW_ANTDIV )
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
odm_SwAntDivInit ( pDM_Odm ) ;
2014-12-17 04:09:56 +00:00
}
2013-05-08 21:45:39 +00:00
}
}
2015-02-20 00:51:33 +00:00
/* */
/* 2011/09/20 MH This is the entry pointer for all team to execute HW out source DM. */
/* You can not add any dummy function here, be care, you can only use DM structure */
/* to perform any new ODM_DM. */
/* */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_DMWatchdog (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2013-05-08 21:45:39 +00:00
{
2015-02-20 00:51:33 +00:00
/* 2012.05.03 Luke: For all IC series */
2013-05-08 21:45:39 +00:00
odm_GlobalAdapterCheck ( ) ;
odm_CmnInfoHook_Debug ( pDM_Odm ) ;
odm_CmnInfoUpdate_Debug ( pDM_Odm ) ;
2014-12-19 06:59:46 +00:00
odm_CommonInfoSelfUpdate ( pDM_Odm ) ;
odm_FalseAlarmCounterStatistics ( pDM_Odm ) ;
2013-05-08 21:45:39 +00:00
odm_RSSIMonitorCheck ( pDM_Odm ) ;
2015-02-20 00:51:33 +00:00
/* Fix Leave LPS issue */
2015-08-15 18:02:34 +00:00
if ( ( adapter_to_pwrctl ( pDM_Odm - > Adapter ) - > pwr_mode ! = PS_MODE_ACTIVE ) & & /* in LPS mode */
2014-12-19 06:59:46 +00:00
(
2014-12-17 04:09:56 +00:00
( pDM_Odm - > SupportICType & ( ODM_RTL8723A ) ) | |
2015-02-20 00:51:33 +00:00
( pDM_Odm - > SupportICType & ( ODM_RTL8188E ) ) /* pDM_Odm->SupportInterface == ODM_ITRF_SDIO)) ) */
2014-12-17 04:09:56 +00:00
2014-12-19 06:59:46 +00:00
)
2014-12-17 04:09:56 +00:00
)
{
2014-12-30 19:48:00 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " ----Step1: odm_DIG is in LPS mode \n " ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " ---Step2: 8723AS is in LPS mode \n " ) ) ;
odm_DIGbyRSSI_LPS ( pDM_Odm ) ;
} else {
2013-05-08 21:45:39 +00:00
odm_DIG ( pDM_Odm ) ;
}
2014-12-17 04:09:56 +00:00
2013-05-08 21:45:39 +00:00
odm_CCKPacketDetectionThresh ( pDM_Odm ) ;
2015-08-15 18:02:34 +00:00
if ( * ( pDM_Odm - > pbPowerSaving ) = = true )
2013-05-08 21:45:39 +00:00
return ;
2013-05-19 04:28:07 +00:00
2014-12-17 04:09:56 +00:00
odm_Adaptivity ( pDM_Odm , pDM_Odm - > DM_DigTable . CurIGValue ) ;
2014-12-19 06:59:46 +00:00
2013-05-08 21:45:39 +00:00
odm_RefreshRateAdaptiveMask ( pDM_Odm ) ;
2014-12-19 06:59:46 +00:00
odm_DynamicBBPowerSaving ( pDM_Odm ) ;
odm_DynamicPrimaryCCA ( pDM_Odm ) ;
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > AntDivType = = CG_TRX_HW_ANTDIV ) | |
2014-12-19 06:59:46 +00:00
( pDM_Odm - > AntDivType = = CGCS_RX_HW_ANTDIV ) | |
2014-12-17 04:09:56 +00:00
( pDM_Odm - > AntDivType = = CG_TRX_SMART_ANTDIV ) )
{
2013-05-08 21:45:39 +00:00
odm_HwAntDiv ( pDM_Odm ) ;
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > AntDivType = = CGCS_RX_SW_ANTDIV )
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
odm_SwAntDivChkAntSwitch ( pDM_Odm , SWAW_STEP_PEAK ) ;
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ODM_IC_11AC_SERIES )
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > SupportICType & ODM_IC_11N_SERIES )
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
ODM_TXPowerTrackingCheck ( pDM_Odm ) ;
2015-03-10 16:18:03 +00:00
odm_EdcaTurboCheck ( pDM_Odm ) ;
2013-05-08 21:45:39 +00:00
odm_DynamicTxPower ( pDM_Odm ) ;
}
2014-12-17 04:09:56 +00:00
2013-05-08 21:45:39 +00:00
odm_dtc ( pDM_Odm ) ;
2014-12-17 04:09:56 +00:00
}
2015-02-20 00:51:33 +00:00
/* */
/* Init /.. Fixed HW value. Only init time. */
/* */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_CmnInfoInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
ODM_CMNINFO_E CmnInfo ,
u32 Value
2014-12-17 04:09:56 +00:00
)
{
2015-02-20 00:51:33 +00:00
/* ODM_RT_TRACE(pDM_Odm,); */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* */
/* This section is used for init value */
/* */
2014-12-17 04:09:56 +00:00
switch ( CmnInfo )
{
2015-02-20 00:51:33 +00:00
/* */
/* Fixed ODM value. */
/* */
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_ABILITY :
2014-12-30 22:55:10 +00:00
pDM_Odm - > SupportAbility = ( u32 ) Value ;
2014-12-19 06:59:46 +00:00
break ;
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_PLATFORM :
2014-12-30 23:50:44 +00:00
pDM_Odm - > SupportPlatform = ( u8 ) Value ;
2016-04-09 19:30:01 +00:00
pr_info ( " SupportPlatform 0x%x \n " , Value ) ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_INTERFACE :
2014-12-30 23:50:44 +00:00
pDM_Odm - > SupportInterface = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_MP_TEST_CHIP :
2014-12-30 23:50:44 +00:00
pDM_Odm - > bIsMPChip = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_IC_TYPE :
pDM_Odm - > SupportICType = Value ;
break ;
case ODM_CMNINFO_CUT_VER :
2014-12-30 23:50:44 +00:00
pDM_Odm - > CutVersion = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_FAB_VER :
2014-12-30 23:50:44 +00:00
pDM_Odm - > FabVersion = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_RF_TYPE :
2014-12-30 23:50:44 +00:00
pDM_Odm - > RFType = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_RF_ANTENNA_TYPE :
2014-12-30 23:50:44 +00:00
pDM_Odm - > AntDivType = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_BOARD_TYPE :
2014-12-30 23:50:44 +00:00
pDM_Odm - > BoardType = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_EXT_LNA :
2014-12-30 23:50:44 +00:00
pDM_Odm - > ExtLNA = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_EXT_PA :
2014-12-30 23:50:44 +00:00
pDM_Odm - > ExtPA = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_EXT_TRSW :
2014-12-30 23:50:44 +00:00
pDM_Odm - > ExtTRSW = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
2014-12-19 06:59:46 +00:00
case ODM_CMNINFO_PATCH_ID :
2014-12-30 23:50:44 +00:00
pDM_Odm - > PatchID = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
2014-12-19 06:59:46 +00:00
case ODM_CMNINFO_BINHCT_TEST :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bInHctTest = ( bool ) Value ;
2014-12-17 04:09:56 +00:00
break ;
2014-12-19 06:59:46 +00:00
case ODM_CMNINFO_BWIFI_TEST :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bWIFITest = ( bool ) Value ;
2014-12-19 06:59:46 +00:00
break ;
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_SMART_CONCURRENT :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bDualMacSmartConcurrent = ( bool ) Value ;
2014-12-17 04:09:56 +00:00
break ;
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* To remove the compiler warning, must add an empty default statement to handle the other values. */
2014-12-17 04:09:56 +00:00
default :
2015-02-20 00:51:33 +00:00
/* do nothing */
2014-12-19 06:59:46 +00:00
break ;
2014-12-17 04:09:56 +00:00
}
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_CmnInfoHook (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
ODM_CMNINFO_E CmnInfo ,
void * pValue
2014-12-17 04:09:56 +00:00
)
{
2015-02-20 00:51:33 +00:00
/* */
/* Hook call by reference pointer. */
/* */
2014-12-17 04:09:56 +00:00
switch ( CmnInfo )
{
2015-02-20 00:51:33 +00:00
/* */
/* Dynamic call by reference pointer. */
/* */
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_MAC_PHY_MODE :
2014-12-30 23:50:44 +00:00
pDM_Odm - > pMacPhyMode = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_TX_UNI :
2014-12-30 23:52:40 +00:00
pDM_Odm - > pNumTxBytesUnicast = ( u64 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_RX_UNI :
2014-12-30 23:52:40 +00:00
pDM_Odm - > pNumRxBytesUnicast = ( u64 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_WM_MODE :
2014-12-30 23:50:44 +00:00
pDM_Odm - > pWirelessMode = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_BAND :
2014-12-30 23:50:44 +00:00
pDM_Odm - > pBandType = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_SEC_CHNL_OFFSET :
2014-12-30 23:50:44 +00:00
pDM_Odm - > pSecChOffset = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_SEC_MODE :
2014-12-30 23:50:44 +00:00
pDM_Odm - > pSecurity = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_BW :
2014-12-30 23:50:44 +00:00
pDM_Odm - > pBandWidth = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_CHNL :
2014-12-30 23:50:44 +00:00
pDM_Odm - > pChannel = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_DMSP_GET_VALUE :
2015-03-02 23:21:23 +00:00
pDM_Odm - > pbGetValueFromOtherMac = ( bool * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_BUDDY_ADAPTOR :
2014-12-17 23:13:53 +00:00
pDM_Odm - > pBuddyAdapter = ( struct adapter * * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_DMSP_IS_MASTER :
2015-03-02 23:21:23 +00:00
pDM_Odm - > pbMasterOfDMSP = ( bool * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_SCAN :
2015-03-02 23:21:23 +00:00
pDM_Odm - > pbScanInProcess = ( bool * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_POWER_SAVING :
2015-03-02 23:21:23 +00:00
pDM_Odm - > pbPowerSaving = ( bool * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_ONE_PATH_CCA :
2014-12-30 23:50:44 +00:00
pDM_Odm - > pOnePathCCA = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_DRV_STOP :
2015-03-02 23:21:23 +00:00
pDM_Odm - > pbDriverStopped = ( bool * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_PNP_IN :
2015-03-02 23:21:23 +00:00
pDM_Odm - > pbDriverIsGoingToPnpSetPowerSleep = ( bool * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_INIT_ON :
2015-03-02 23:21:23 +00:00
pDM_Odm - > pinit_adpt_in_progress = ( bool * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_ANT_TEST :
2014-12-30 23:50:44 +00:00
pDM_Odm - > pAntennaTest = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_NET_CLOSED :
2015-03-02 23:21:23 +00:00
pDM_Odm - > pbNet_closed = ( bool * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_MP_MODE :
2014-12-30 23:50:44 +00:00
pDM_Odm - > mp_mode = ( u8 * ) pValue ;
2014-12-17 04:09:56 +00:00
break ;
2015-02-20 00:51:33 +00:00
/* case ODM_CMNINFO_BT_COEXIST: */
2015-03-02 23:21:23 +00:00
/* pDM_Odm->BTCoexist = (bool *)pValue; */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* case ODM_CMNINFO_STA_STATUS: */
/* pDM_Odm->pODM_StaInfo[] = (PSTA_INFO_T)pValue; */
/* break; */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* case ODM_CMNINFO_PHY_STATUS: */
/* pDM_Odm->pPhyInfo = (ODM_PHY_INFO *)pValue; */
/* break; */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* case ODM_CMNINFO_MAC_STATUS: */
/* pDM_Odm->pMacInfo = (ODM_MAC_INFO *)pValue; */
/* break; */
/* To remove the compiler warning, must add an empty default statement to handle the other values. */
2014-12-17 04:09:56 +00:00
default :
2015-02-20 00:51:33 +00:00
/* do nothing */
2014-12-17 04:09:56 +00:00
break ;
}
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_CmnInfoPtrArrayHook (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
ODM_CMNINFO_E CmnInfo ,
u16 Index ,
void * pValue
2014-12-17 04:09:56 +00:00
)
{
2015-02-20 00:51:33 +00:00
/* */
/* Hook call by reference pointer. */
/* */
2014-12-17 04:09:56 +00:00
switch ( CmnInfo )
{
2015-02-20 00:51:33 +00:00
/* */
/* Dynamic call by reference pointer. */
/* */
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_STA_STATUS :
pDM_Odm - > pODM_StaInfo [ Index ] = ( PSTA_INFO_T ) pValue ;
2014-12-19 06:59:46 +00:00
break ;
2015-02-20 00:51:33 +00:00
/* To remove the compiler warning, must add an empty default statement to handle the other values. */
2014-12-17 04:09:56 +00:00
default :
2015-02-20 00:51:33 +00:00
/* do nothing */
2014-12-17 04:09:56 +00:00
break ;
}
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
}
2015-02-20 00:51:33 +00:00
/* */
/* Update Band/CHannel/.. The values are dynamic but non-per-packet. */
/* */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_CmnInfoUpdate (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u32 CmnInfo ,
u64 Value
2014-12-17 04:09:56 +00:00
)
{
2015-02-20 00:51:33 +00:00
/* */
/* This init variable may be changed in run time. */
/* */
2014-12-17 04:09:56 +00:00
switch ( CmnInfo )
{
case ODM_CMNINFO_ABILITY :
2014-12-30 22:55:10 +00:00
pDM_Odm - > SupportAbility = ( u32 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_RF_TYPE :
2014-12-30 23:50:44 +00:00
pDM_Odm - > RFType = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_WIFI_DIRECT :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bWIFI_Direct = ( bool ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_WIFI_DISPLAY :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bWIFI_Display = ( bool ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_LINK :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bLinked = ( bool ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_STATION_STATE :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bsta_state = ( bool ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_RSSI_MIN :
2014-12-30 23:50:44 +00:00
pDM_Odm - > RSSI_Min = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_DBG_COMP :
pDM_Odm - > DebugComponents = Value ;
break ;
case ODM_CMNINFO_DBG_LEVEL :
2014-12-30 22:55:10 +00:00
pDM_Odm - > DebugLevel = ( u32 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_RA_THRESHOLD_HIGH :
2014-12-30 23:50:44 +00:00
pDM_Odm - > RateAdaptive . HighRSSIThresh = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_RA_THRESHOLD_LOW :
2014-12-30 23:50:44 +00:00
pDM_Odm - > RateAdaptive . LowRSSIThresh = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
2015-08-15 18:02:34 +00:00
# if (BT_30_SUPPORT == 1)
2015-02-20 00:51:33 +00:00
/* The following is for BT HS mode and BT coexist mechanism. */
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_BT_DISABLED :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bBtDisabled = ( bool ) Value ;
2014-12-17 04:09:56 +00:00
break ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_BT_OPERATION :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bBtHsOperation = ( bool ) Value ;
2014-12-17 04:09:56 +00:00
break ;
case ODM_CMNINFO_BT_DIG :
2014-12-30 23:50:44 +00:00
pDM_Odm - > btHsDigVal = ( u8 ) Value ;
2014-12-17 04:09:56 +00:00
break ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_BT_BUSY :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bBtBusy = ( bool ) Value ;
2014-12-19 06:59:46 +00:00
break ;
2014-12-17 04:09:56 +00:00
case ODM_CMNINFO_BT_DISABLE_EDCA :
2015-03-02 23:21:23 +00:00
pDM_Odm - > bBtDisableEdcaTurbo = ( bool ) Value ;
2014-12-17 04:09:56 +00:00
break ;
# endif
}
2014-12-19 06:59:46 +00:00
2013-05-08 21:45:39 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CommonInfoSelfInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2015-03-02 23:21:23 +00:00
pDM_Odm - > bCckHighPower = ( bool ) ODM_GetBBReg ( pDM_Odm , 0x824 , BIT9 ) ;
2014-12-30 23:50:44 +00:00
pDM_Odm - > RFPathRxEnable = ( u8 ) ODM_GetBBReg ( pDM_Odm , 0xc04 , 0x0F ) ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ( ODM_RTL8192C | ODM_RTL8192D ) )
2013-05-08 21:45:39 +00:00
pDM_Odm - > AntDivType = CG_TRX_HW_ANTDIV ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ( ODM_RTL8723A ) )
2014-12-17 04:09:56 +00:00
pDM_Odm - > AntDivType = CGCS_RX_SW_ANTDIV ;
2014-12-19 06:59:46 +00:00
ODM_InitDebugSetting ( pDM_Odm ) ;
2013-05-08 21:45:39 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CommonInfoSelfUpdate (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2013-05-08 21:45:39 +00:00
{
2014-12-30 23:50:44 +00:00
u8 EntryCnt = 0 ;
u8 i ;
2014-12-19 06:59:46 +00:00
PSTA_INFO_T pEntry ;
2013-05-08 21:45:39 +00:00
2015-08-15 18:02:34 +00:00
if ( * ( pDM_Odm - > pBandWidth ) = = ODM_BW40M ) {
if ( * ( pDM_Odm - > pSecChOffset ) = = 1 )
2014-12-17 04:09:56 +00:00
pDM_Odm - > ControlChannel = * ( pDM_Odm - > pChannel ) - 2 ;
2015-08-15 18:02:34 +00:00
else if ( * ( pDM_Odm - > pSecChOffset ) = = 2 )
2014-12-17 04:09:56 +00:00
pDM_Odm - > ControlChannel = * ( pDM_Odm - > pChannel ) + 2 ;
2014-12-30 19:48:00 +00:00
} else
2014-12-17 04:09:56 +00:00
pDM_Odm - > ControlChannel = * ( pDM_Odm - > pChannel ) ;
2013-05-08 21:45:39 +00:00
2014-12-30 19:48:00 +00:00
for ( i = 0 ; i < ODM_ASSOCIATE_ENTRY_NUM ; i + + ) {
2013-05-08 21:45:39 +00:00
pEntry = pDM_Odm - > pODM_StaInfo [ i ] ;
2015-08-15 18:02:34 +00:00
if ( IS_STA_VALID ( pEntry ) )
2013-05-08 21:45:39 +00:00
EntryCnt + + ;
}
2015-08-15 18:02:34 +00:00
if ( EntryCnt = = 1 )
2015-03-02 23:25:27 +00:00
pDM_Odm - > bOneEntryOnly = true ;
2013-05-08 21:45:39 +00:00
else
2015-03-02 23:25:27 +00:00
pDM_Odm - > bOneEntryOnly = false ;
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CmnInfoInit_Debug (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " odm_CmnInfoInit_Debug==> \n " ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " SupportPlatform=%d \n " , pDM_Odm - > SupportPlatform ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " SupportAbility=0x%x \n " , pDM_Odm - > SupportAbility ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " SupportInterface=%d \n " , pDM_Odm - > SupportInterface ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " SupportICType=0x%x \n " , pDM_Odm - > SupportICType ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " CutVersion=%d \n " , pDM_Odm - > CutVersion ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " FabVersion=%d \n " , pDM_Odm - > FabVersion ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " RFType=%d \n " , pDM_Odm - > RFType ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " BoardType=%d \n " , pDM_Odm - > BoardType ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " ExtLNA=%d \n " , pDM_Odm - > ExtLNA ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " ExtPA=%d \n " , pDM_Odm - > ExtPA ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " ExtTRSW=%d \n " , pDM_Odm - > ExtTRSW ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " PatchID=%d \n " , pDM_Odm - > PatchID ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " bInHctTest=%d \n " , pDM_Odm - > bInHctTest ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " bWIFITest=%d \n " , pDM_Odm - > bWIFITest ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " bDualMacSmartConcurrent=%d \n " , pDM_Odm - > bDualMacSmartConcurrent ) ) ;
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CmnInfoHook_Debug (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2014-12-19 06:59:46 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " odm_CmnInfoHook_Debug==> \n " ) ) ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pNumTxBytesUnicast=%llu \n " , * ( pDM_Odm - > pNumTxBytesUnicast ) ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pNumRxBytesUnicast=%llu \n " , * ( pDM_Odm - > pNumRxBytesUnicast ) ) ) ;
2014-12-19 06:59:46 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pWirelessMode=0x%x \n " , * ( pDM_Odm - > pWirelessMode ) ) ) ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pSecChOffset=%d \n " , * ( pDM_Odm - > pSecChOffset ) ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pSecurity=%d \n " , * ( pDM_Odm - > pSecurity ) ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pBandWidth=%d \n " , * ( pDM_Odm - > pBandWidth ) ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pChannel=%d \n " , * ( pDM_Odm - > pChannel ) ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pbScanInProcess=%d \n " , * ( pDM_Odm - > pbScanInProcess ) ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pbPowerSaving=%d \n " , * ( pDM_Odm - > pbPowerSaving ) ) ) ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportPlatform & ( ODM_AP | ODM_ADSL ) )
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " pOnePathCCA=%d \n " , * ( pDM_Odm - > pOnePathCCA ) ) ) ;
2013-05-08 21:45:39 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CmnInfoUpdate_Debug (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2013-08-07 03:34:32 +00:00
{
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " odm_CmnInfoUpdate_Debug==> \n " ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " bWIFI_Direct=%d \n " , pDM_Odm - > bWIFI_Direct ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " bWIFI_Display=%d \n " , pDM_Odm - > bWIFI_Display ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " bLinked=%d \n " , pDM_Odm - > bLinked ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_COMMON , ODM_DBG_LOUD , ( " RSSI_Min=%d \n " , pDM_Odm - > RSSI_Min ) ) ;
}
2015-02-20 00:51:33 +00:00
/* 3============================================================ */
/* 3 DIG */
/* 3============================================================ */
2014-12-17 04:09:56 +00:00
/*-----------------------------------------------------------------------------
* Function : odm_DIGInit ( )
*
* Overview : Set DIG scheme init value .
*
* Input : NONE
*
* Output : NONE
*
* Return : NONE
*
* Revised History :
* When Who Remark
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2015-01-29 21:27:28 +00:00
static void
2014-12-17 04:09:56 +00:00
ODM_ChangeDynamicInitGainThresh (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u32 DM_Type ,
u32 DM_Value
2014-12-17 04:09:56 +00:00
)
{
pDIG_T pDM_DigTable = & pDM_Odm - > DM_DigTable ;
if ( DM_Type = = DIG_TYPE_THRESH_HIGH )
{
2014-12-19 06:59:46 +00:00
pDM_DigTable - > RssiHighThresh = DM_Value ;
2014-12-17 04:09:56 +00:00
}
else if ( DM_Type = = DIG_TYPE_THRESH_LOW )
{
pDM_DigTable - > RssiLowThresh = DM_Value ;
}
else if ( DM_Type = = DIG_TYPE_ENABLE )
{
2015-03-02 23:25:27 +00:00
pDM_DigTable - > Dig_Enable_Flag = true ;
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
else if ( DM_Type = = DIG_TYPE_DISABLE )
{
2015-03-02 23:25:27 +00:00
pDM_DigTable - > Dig_Enable_Flag = false ;
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
else if ( DM_Type = = DIG_TYPE_BACKOFF )
{
2015-08-15 18:02:34 +00:00
if ( DM_Value > 30 )
2014-12-17 04:09:56 +00:00
DM_Value = 30 ;
2014-12-30 23:50:44 +00:00
pDM_DigTable - > BackoffVal = ( u8 ) DM_Value ;
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:02:34 +00:00
else if ( DM_Type = = DIG_TYPE_RX_GAIN_MIN )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( DM_Value = = 0 )
2014-12-17 04:09:56 +00:00
DM_Value = 0x1 ;
2014-12-30 23:50:44 +00:00
pDM_DigTable - > rx_gain_range_min = ( u8 ) DM_Value ;
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:02:34 +00:00
else if ( DM_Type = = DIG_TYPE_RX_GAIN_MAX )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( DM_Value > 0x50 )
2014-12-17 04:09:56 +00:00
DM_Value = 0x50 ;
2014-12-30 23:50:44 +00:00
pDM_DigTable - > rx_gain_range_max = ( u8 ) DM_Value ;
2014-12-17 04:09:56 +00:00
}
} /* DM_ChangeDynamicInitGainThresh */
2013-05-08 21:45:39 +00:00
2015-01-29 21:27:28 +00:00
static int getIGIForDiff ( int value_IGI )
2013-05-08 21:45:39 +00:00
{
# define ONERCCA_LOW_TH 0x30
# define ONERCCA_LOW_DIFF 8
if ( value_IGI < ONERCCA_LOW_TH ) {
if ( ( ONERCCA_LOW_TH - value_IGI ) < ONERCCA_LOW_DIFF )
return ONERCCA_LOW_TH ;
else
return value_IGI + ONERCCA_LOW_DIFF ;
} else {
return value_IGI ;
}
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_Write_DIG (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 CurrentIGI
2014-12-17 04:09:56 +00:00
)
{
pDIG_T pDM_DigTable = & pDM_Odm - > DM_DigTable ;
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " ODM_REG(IGI_A,pDM_Odm)=0x%x, ODM_BIT(IGI,pDM_Odm)=0x%x \n " ,
2014-12-17 04:09:56 +00:00
ODM_REG ( IGI_A , pDM_Odm ) , ODM_BIT ( IGI , pDM_Odm ) ) ) ;
2015-08-15 18:02:34 +00:00
if ( pDM_DigTable - > CurIGValue ! = CurrentIGI ) /* if (pDM_DigTable->PreIGValue != CurrentIGI) */
2014-12-17 04:09:56 +00:00
{
2016-04-09 19:30:01 +00:00
if ( pDM_Odm - > SupportPlatform & ( ODM_CE ) ) {
2014-12-17 04:09:56 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG ( IGI_A , pDM_Odm ) , ODM_BIT ( IGI , pDM_Odm ) , CurrentIGI ) ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType ! = ODM_RTL8188E )
2014-12-17 04:09:56 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG ( IGI_B , pDM_Odm ) , ODM_BIT ( IGI , pDM_Odm ) , CurrentIGI ) ;
2013-05-08 21:45:39 +00:00
}
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " CurrentIGI(0x%02x). \n " , CurrentIGI ) ) ;
2015-02-20 00:51:33 +00:00
/* pDM_DigTable->PreIGValue = pDM_DigTable->CurIGValue; */
2013-05-08 21:45:39 +00:00
pDM_DigTable - > CurIGValue = CurrentIGI ;
}
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " ODM_Write_DIG():CurrentIGI=0x%x \n " , CurrentIGI ) ) ;
2013-05-08 21:45:39 +00:00
}
2015-02-20 00:51:33 +00:00
/* Need LPS mode for CE platform --2012--08--24--- */
/* 8723AS/8189ES */
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DIGbyRSSI_LPS (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2013-05-08 21:45:39 +00:00
{
2014-12-17 23:13:53 +00:00
struct adapter * pAdapter = pDM_Odm - > Adapter ;
2014-12-17 04:09:56 +00:00
pDIG_T pDM_DigTable = & pDM_Odm - > DM_DigTable ;
2015-03-02 23:25:27 +00:00
Pfalse_ALARM_STATISTICS pFalseAlmCnt = & pDM_Odm - > FalseAlmCnt ;
2015-02-20 00:51:33 +00:00
u8 RSSI_Lower = DM_DIG_MIN_NIC ; /* 0x1E or 0x1C */
2015-03-02 23:25:27 +00:00
u8 bFwCurrentInPSMode = false ;
2014-12-30 23:50:44 +00:00
u8 CurrentIGI = pDM_Odm - > RSSI_Min ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportICType & ( ODM_RTL8723A | ODM_RTL8188E ) ) )
2013-05-08 21:45:39 +00:00
return ;
2014-12-17 04:09:56 +00:00
CurrentIGI = CurrentIGI + RSSI_OFFSET_DIG ;
2014-12-19 06:59:46 +00:00
bFwCurrentInPSMode = adapter_to_pwrctl ( pAdapter ) - > bFwCurrentInPSMode ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " ==>pDM_Odm->RSSI_Min=%d () \n " , pDM_Odm - > RSSI_Min ) ) ;
2015-02-20 00:51:33 +00:00
/* Using FW PS mode to make IGI */
2015-08-15 18:02:34 +00:00
if ( bFwCurrentInPSMode )
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " ---Neil---odm_DIG is in LPS mode \n " ) ) ;
2015-02-20 00:51:33 +00:00
/* Adjust by FA in LPS MODE */
2015-08-15 18:02:34 +00:00
if ( pFalseAlmCnt - > Cnt_all > DM_DIG_FA_TH2_LPS )
2013-05-08 21:45:39 +00:00
CurrentIGI = CurrentIGI + 2 ;
else if ( pFalseAlmCnt - > Cnt_all > DM_DIG_FA_TH1_LPS )
CurrentIGI = CurrentIGI + 1 ;
2015-08-15 18:02:34 +00:00
else if ( pFalseAlmCnt - > Cnt_all < DM_DIG_FA_TH0_LPS )
2014-12-19 06:59:46 +00:00
CurrentIGI = CurrentIGI - 1 ;
2014-12-17 04:09:56 +00:00
}
2014-12-19 06:59:46 +00:00
else
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
CurrentIGI = RSSI_Lower ;
}
2015-02-20 00:51:33 +00:00
/* Lower bound checking */
2013-05-08 21:45:39 +00:00
2015-02-20 00:51:33 +00:00
/* RSSI Lower bound check */
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > RSSI_Min - 10 ) > DM_DIG_MIN_NIC )
2014-12-17 04:09:56 +00:00
RSSI_Lower = ( pDM_Odm - > RSSI_Min - 10 ) ;
2013-05-08 21:45:39 +00:00
else
2014-12-17 04:09:56 +00:00
RSSI_Lower = DM_DIG_MIN_NIC ;
2013-05-08 21:45:39 +00:00
2015-02-20 00:51:33 +00:00
/* Upper and Lower Bound checking */
2015-08-15 18:02:34 +00:00
if ( CurrentIGI > DM_DIG_MAX_NIC )
2014-12-19 06:59:46 +00:00
CurrentIGI = DM_DIG_MAX_NIC ;
2015-08-15 18:02:34 +00:00
else if ( CurrentIGI < RSSI_Lower )
2014-12-17 04:09:56 +00:00
CurrentIGI = RSSI_Lower ;
2015-02-20 00:51:33 +00:00
ODM_Write_DIG ( pDM_Odm , CurrentIGI ) ; /* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */
2013-05-08 21:45:39 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_AdaptivityInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2013-05-08 21:45:39 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8723B )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
pDM_Odm - > TH_L2H_ini = 0xf8 ; /* -8 */
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > SupportICType = = ODM_RTL8192E ) & & ( pDM_Odm - > SupportInterface = = ODM_ITRF_PCIE ) )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
pDM_Odm - > TH_L2H_ini = 0xf0 ; /* -16 */
2014-12-17 04:09:56 +00:00
}
else
{
2015-02-20 00:51:33 +00:00
pDM_Odm - > TH_L2H_ini = 0xf9 ; /* -7 */
2013-05-08 21:45:39 +00:00
}
2013-05-19 04:28:07 +00:00
2014-12-17 04:09:56 +00:00
pDM_Odm - > TH_EDCCA_HL_diff = 7 ;
pDM_Odm - > IGI_Base = 0x32 ;
pDM_Odm - > IGI_target = 0x1c ;
pDM_Odm - > ForceEDCCA = 0 ;
pDM_Odm - > AdapEn_RSSI = 20 ;
2013-05-08 21:45:39 +00:00
}
2013-08-07 03:34:32 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_Adaptivity (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 IGI
2014-12-17 04:09:56 +00:00
)
{
2014-12-30 23:58:53 +00:00
s8 TH_L2H_dmc , TH_H2L_dmc ;
s8 TH_L2H , TH_H2L , Diff , IGI_target ;
2014-12-30 22:55:10 +00:00
u32 value32 ;
2015-03-02 23:21:23 +00:00
bool EDCCA_State = 0 ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_ADAPTIVITY ) ) {
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " Go to odm_DynamicEDCCA() \n " ) ) ;
2013-05-08 21:45:39 +00:00
return ;
}
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_Adaptivity() =====> \n " ) ) ;
2014-12-17 04:09:56 +00:00
2014-12-19 06:59:46 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " ForceEDCCA=%d, IGI_Base=0x%x, TH_L2H_ini = %d, TH_EDCCA_HL_diff = %d, AdapEn_RSSI = %d \n " ,
2014-12-17 04:09:56 +00:00
pDM_Odm - > ForceEDCCA , pDM_Odm - > IGI_Base , pDM_Odm - > TH_L2H_ini , pDM_Odm - > TH_EDCCA_HL_diff , pDM_Odm - > AdapEn_RSSI ) ) ;
2013-05-19 04:28:07 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ODM_IC_11AC_SERIES )
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , 0x800 , BIT10 , 0 ) ; /* ADC_mask enable */
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( ( ! pDM_Odm - > bLinked ) | | ( * pDM_Odm - > pChannel > 149 ) ) /* Band4 doesn't need adaptivity */
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ODM_IC_11N_SERIES )
2014-12-17 04:09:56 +00:00
{
ODM_SetBBReg ( pDM_Odm , rOFDM0_ECCAThreshold , bMaskByte0 , 0x7f ) ;
ODM_SetBBReg ( pDM_Odm , rOFDM0_ECCAThreshold , bMaskByte2 , 0x7f ) ;
}
else
ODM_SetBBReg ( pDM_Odm , rFPGA0_XB_LSSIReadBack , 0xFFFF , ( 0x7f < < 8 ) | 0x7f ) ;
2013-05-19 04:28:07 +00:00
return ;
2013-05-08 21:45:39 +00:00
}
2015-08-15 18:02:34 +00:00
if ( ! pDM_Odm - > ForceEDCCA ) {
if ( pDM_Odm - > RSSI_Min > pDM_Odm - > AdapEn_RSSI )
2014-12-17 04:09:56 +00:00
EDCCA_State = 1 ;
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > RSSI_Min < ( pDM_Odm - > AdapEn_RSSI - 5 ) )
2014-12-17 04:09:56 +00:00
EDCCA_State = 0 ;
}
else
EDCCA_State = 1 ;
{
2015-08-15 18:02:34 +00:00
if ( * pDM_Odm - > pBandWidth = = ODM_BW20M ) /* CHANNEL_WIDTH_20 */
2014-12-17 04:09:56 +00:00
IGI_target = pDM_Odm - > IGI_Base ;
2015-08-15 18:02:34 +00:00
else if ( * pDM_Odm - > pBandWidth = = ODM_BW40M )
2014-12-17 04:09:56 +00:00
IGI_target = pDM_Odm - > IGI_Base + 2 ;
2015-08-15 18:02:34 +00:00
else if ( * pDM_Odm - > pBandWidth = = ODM_BW80M )
2014-12-17 04:09:56 +00:00
IGI_target = pDM_Odm - > IGI_Base + 6 ;
else
IGI_target = pDM_Odm - > IGI_Base ;
}
2014-12-30 23:50:44 +00:00
pDM_Odm - > IGI_target = ( u8 ) IGI_target ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " BandWidth=%s, IGI_target=0x%x, EDCCA_State=%d \n " ,
( * pDM_Odm - > pBandWidth = = ODM_BW80M ) ? " 80M " : ( ( * pDM_Odm - > pBandWidth = = ODM_BW40M ) ? " 40M " : " 20M " ) , IGI_target , EDCCA_State ) ) ;
2015-08-15 18:02:34 +00:00
if ( EDCCA_State = = 1 )
2014-12-17 04:09:56 +00:00
{
2014-12-30 23:58:53 +00:00
Diff = IGI_target - ( s8 ) IGI ;
2014-12-17 04:09:56 +00:00
TH_L2H_dmc = pDM_Odm - > TH_L2H_ini + Diff ;
2015-08-15 18:02:34 +00:00
if ( TH_L2H_dmc > 10 ) TH_L2H_dmc = 10 ;
2014-12-17 04:09:56 +00:00
TH_H2L_dmc = TH_L2H_dmc - pDM_Odm - > TH_EDCCA_HL_diff ;
}
else
{
TH_L2H_dmc = 0x7f ;
TH_H2L_dmc = 0x7f ;
}
2014-12-19 06:59:46 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " IGI=0x%x, TH_L2H_dmc = %d, TH_H2L_dmc = %d \n " ,
2014-12-17 04:09:56 +00:00
IGI , TH_L2H_dmc , TH_H2L_dmc ) ) ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ODM_IC_11N_SERIES )
2014-12-17 04:09:56 +00:00
{
2014-12-30 23:50:44 +00:00
ODM_SetBBReg ( pDM_Odm , rOFDM0_ECCAThreshold , bMaskByte0 , ( u8 ) TH_L2H_dmc ) ;
ODM_SetBBReg ( pDM_Odm , rOFDM0_ECCAThreshold , bMaskByte2 , ( u8 ) TH_H2L_dmc ) ;
2014-12-17 04:09:56 +00:00
}
else
2014-12-30 23:50:44 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_XB_LSSIReadBack , 0xFFFF , ( ( u8 ) TH_H2L_dmc < < 8 ) | ( u8 ) TH_L2H_dmc ) ;
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DIGInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
pDIG_T pDM_DigTable = & pDM_Odm - > DM_DigTable ;
2015-03-02 23:25:27 +00:00
/* pDM_DigTable->Dig_Enable_Flag = true; */
2015-02-20 00:51:33 +00:00
/* pDM_DigTable->Dig_Ext_Port_Stage = DIG_EXT_PORT_STAGE_MAX; */
2014-12-30 23:50:44 +00:00
pDM_DigTable - > CurIGValue = ( u8 ) ODM_GetBBReg ( pDM_Odm , ODM_REG ( IGI_A , pDM_Odm ) , ODM_BIT ( IGI , pDM_Odm ) ) ;
2015-02-20 00:51:33 +00:00
/* pDM_DigTable->PreIGValue = 0x0; */
/* pDM_DigTable->CurSTAConnectState = pDM_DigTable->PreSTAConnectState = DIG_STA_DISCONNECT; */
/* pDM_DigTable->CurMultiSTAConnectState = DIG_MultiSTA_DISCONNECT; */
2014-12-19 06:59:46 +00:00
pDM_DigTable - > RssiLowThresh = DM_DIG_THRESH_LOW ;
pDM_DigTable - > RssiHighThresh = DM_DIG_THRESH_HIGH ;
2014-12-29 02:13:24 +00:00
pDM_DigTable - > FALowThresh = DMfalseALARM_THRESH_LOW ;
pDM_DigTable - > FAHighThresh = DMfalseALARM_THRESH_HIGH ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > BoardType & ( ODM_BOARD_EXT_PA | ODM_BOARD_EXT_LNA ) )
2014-12-17 04:09:56 +00:00
{
pDM_DigTable - > rx_gain_range_max = DM_DIG_MAX_NIC ;
pDM_DigTable - > rx_gain_range_min = DM_DIG_MIN_NIC ;
}
else
{
pDM_DigTable - > rx_gain_range_max = DM_DIG_MAX_NIC ;
pDM_DigTable - > rx_gain_range_min = DM_DIG_MIN_NIC ;
}
pDM_DigTable - > BackoffVal = DM_DIG_BACKOFF_DEFAULT ;
pDM_DigTable - > BackoffVal_range_max = DM_DIG_BACKOFF_MAX ;
pDM_DigTable - > BackoffVal_range_min = DM_DIG_BACKOFF_MIN ;
pDM_DigTable - > PreCCK_CCAThres = 0xFF ;
pDM_DigTable - > CurCCK_CCAThres = 0x83 ;
pDM_DigTable - > ForbiddenIGI = DM_DIG_MIN_NIC ;
pDM_DigTable - > LargeFAHit = 0 ;
pDM_DigTable - > Recover_cnt = 0 ;
pDM_DigTable - > DIG_Dynamic_MIN_0 = DM_DIG_MIN_NIC ;
pDM_DigTable - > DIG_Dynamic_MIN_1 = DM_DIG_MIN_NIC ;
2015-03-02 23:25:27 +00:00
pDM_DigTable - > bMediaConnect_0 = false ;
pDM_DigTable - > bMediaConnect_1 = false ;
2014-12-19 06:59:46 +00:00
2015-03-02 23:25:27 +00:00
/* To Initialize pDM_Odm->bDMInitialGainEnable == false to avoid DIG error */
pDM_Odm - > bDMInitialGainEnable = true ;
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* To Initi BT30 IGI */
2014-12-17 04:09:56 +00:00
pDM_DigTable - > BT30_CurIGI = 0x32 ;
}
2015-01-29 21:27:28 +00:00
static void
2014-12-17 04:09:56 +00:00
odm_DigForBtHsMode (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DIG (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
pDIG_T pDM_DigTable = & pDM_Odm - > DM_DigTable ;
2015-03-02 23:25:27 +00:00
Pfalse_ALARM_STATISTICS pFalseAlmCnt = & pDM_Odm - > FalseAlmCnt ;
2014-12-17 04:09:56 +00:00
pRXHP_T pRX_HP_Table = & pDM_Odm - > DM_RXHP_Table ;
2014-12-30 23:50:44 +00:00
u8 DIG_Dynamic_MIN ;
u8 DIG_MaxOfMin ;
2015-03-02 23:21:23 +00:00
bool FirstConnect , FirstDisConnect ;
2014-12-30 23:50:44 +00:00
u8 dm_dig_max , dm_dig_min , offset ;
u8 CurrentIGI = pDM_DigTable - > CurIGValue ;
u8 Adap_IGI_Upper = pDM_Odm - > IGI_target + 30 + ( u8 ) pDM_Odm - > TH_L2H_ini - ( u8 ) pDM_Odm - > TH_EDCCA_HL_diff ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG()==> \n " ) ) ;
2015-08-15 18:02:34 +00:00
if ( ( ! ( pDM_Odm - > SupportAbility & ODM_BB_DIG ) ) | | ( ! ( pDM_Odm - > SupportAbility & ODM_BB_FA_CNT ) ) )
2014-12-17 04:09:56 +00:00
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG() Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled \n " ) ) ;
return ;
}
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( * ( pDM_Odm - > pbScanInProcess ) )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG() Return: In Scan Progress \n " ) ) ;
2014-12-19 06:59:46 +00:00
return ;
2014-12-17 04:09:56 +00:00
}
2013-05-19 04:28:07 +00:00
2015-02-20 00:51:33 +00:00
/* add by Neil Chen to avoid PSD is processing */
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8723A )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > bDMInitialGainEnable = = false )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG() Return: PSD is Processing \n " ) ) ;
2014-12-17 04:09:56 +00:00
return ;
}
}
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8192D )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( * ( pDM_Odm - > pMacPhyMode ) = = ODM_DMSP )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( * ( pDM_Odm - > pbMasterOfDMSP ) )
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
DIG_Dynamic_MIN = pDM_DigTable - > DIG_Dynamic_MIN_0 ;
2015-03-02 23:25:27 +00:00
FirstConnect = ( pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_0 = = false ) ;
FirstDisConnect = ( ! pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_0 = = true ) ;
2014-12-17 04:09:56 +00:00
}
else
{
2013-05-08 21:45:39 +00:00
DIG_Dynamic_MIN = pDM_DigTable - > DIG_Dynamic_MIN_1 ;
2015-03-02 23:25:27 +00:00
FirstConnect = ( pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_1 = = false ) ;
FirstDisConnect = ( ! pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_1 = = true ) ;
2013-05-08 21:45:39 +00:00
}
2014-12-17 04:09:56 +00:00
}
else
{
2015-08-15 18:02:34 +00:00
if ( * ( pDM_Odm - > pBandType ) = = ODM_BAND_5G )
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
DIG_Dynamic_MIN = pDM_DigTable - > DIG_Dynamic_MIN_0 ;
2015-03-02 23:25:27 +00:00
FirstConnect = ( pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_0 = = false ) ;
FirstDisConnect = ( ! pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_0 = = true ) ;
2014-12-17 04:09:56 +00:00
}
else
{
2013-05-08 21:45:39 +00:00
DIG_Dynamic_MIN = pDM_DigTable - > DIG_Dynamic_MIN_1 ;
2015-03-02 23:25:27 +00:00
FirstConnect = ( pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_1 = = false ) ;
FirstDisConnect = ( ! pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_1 = = true ) ;
2013-05-08 21:45:39 +00:00
}
}
2014-12-17 04:09:56 +00:00
}
else
2014-12-19 06:59:46 +00:00
{
2013-05-08 21:45:39 +00:00
DIG_Dynamic_MIN = pDM_DigTable - > DIG_Dynamic_MIN_0 ;
2015-03-02 23:25:27 +00:00
FirstConnect = ( pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_0 = = false ) ;
FirstDisConnect = ( ! pDM_Odm - > bLinked ) & & ( pDM_DigTable - > bMediaConnect_0 = = true ) ;
2013-05-08 21:45:39 +00:00
}
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* 1 Boundary Decision */
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ( ODM_RTL8192C ) & & ( pDM_Odm - > BoardType & ( ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA ) ) )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportPlatform & ( ODM_AP | ODM_ADSL ) )
2014-12-17 04:09:56 +00:00
{
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
dm_dig_max = DM_DIG_MAX_AP_HP ;
dm_dig_min = DM_DIG_MIN_AP_HP ;
2014-12-17 04:09:56 +00:00
}
else
{
2013-05-08 21:45:39 +00:00
dm_dig_max = DM_DIG_MAX_NIC_HP ;
dm_dig_min = DM_DIG_MIN_NIC_HP ;
}
DIG_MaxOfMin = DM_DIG_MAX_AP_HP ;
2014-12-17 04:09:56 +00:00
}
else
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportPlatform & ( ODM_AP | ODM_ADSL ) )
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
dm_dig_max = DM_DIG_MAX_AP ;
dm_dig_min = DM_DIG_MIN_AP ;
DIG_MaxOfMin = dm_dig_max ;
2014-12-17 04:09:56 +00:00
}
else
{
2016-04-09 19:30:01 +00:00
if ( ( pDM_Odm - > SupportICType > = ODM_RTL8188E ) & & ( pDM_Odm - > SupportPlatform & ( ODM_CE ) ) )
2014-12-17 04:09:56 +00:00
dm_dig_max = 0x5A ;
else
dm_dig_max = DM_DIG_MAX_NIC ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType ! = ODM_RTL8821 )
2014-12-17 04:09:56 +00:00
dm_dig_min = DM_DIG_MIN_NIC ;
else
dm_dig_min = 0x1C ;
2013-05-08 21:45:39 +00:00
DIG_MaxOfMin = DM_DIG_MAX_AP ;
}
}
2014-12-17 04:09:56 +00:00
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > bLinked )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ( ODM_RTL8723A /*|ODM_RTL8821*/ ) )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
/* 2 Upper Bound */
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > RSSI_Min + 10 ) > DM_DIG_MAX_NIC )
2013-05-08 21:45:39 +00:00
pDM_DigTable - > rx_gain_range_max = DM_DIG_MAX_NIC ;
2015-08-15 18:02:34 +00:00
else if ( ( pDM_Odm - > RSSI_Min + 10 ) < DM_DIG_MIN_NIC )
2013-05-08 21:45:39 +00:00
pDM_DigTable - > rx_gain_range_max = DM_DIG_MIN_NIC ;
else
pDM_DigTable - > rx_gain_range_max = pDM_Odm - > RSSI_Min + 10 ;
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* BT is Concurrent */
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > bBtLimitedDig )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min > 10 )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > RSSI_Min - 10 ) > DM_DIG_MAX_NIC )
2014-12-17 04:09:56 +00:00
DIG_Dynamic_MIN = DM_DIG_MAX_NIC ;
2015-08-15 18:02:34 +00:00
else if ( ( pDM_Odm - > RSSI_Min - 10 ) < DM_DIG_MIN_NIC )
2014-12-17 04:09:56 +00:00
DIG_Dynamic_MIN = DM_DIG_MIN_NIC ;
else
DIG_Dynamic_MIN = pDM_Odm - > RSSI_Min - 10 ;
}
else
DIG_Dynamic_MIN = DM_DIG_MIN_NIC ;
}
else
{
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > RSSI_Min + 20 ) > dm_dig_max )
2014-12-17 04:09:56 +00:00
pDM_DigTable - > rx_gain_range_max = dm_dig_max ;
2015-08-15 18:02:34 +00:00
else if ( ( pDM_Odm - > RSSI_Min + 20 ) < dm_dig_min )
2014-12-17 04:09:56 +00:00
pDM_DigTable - > rx_gain_range_max = dm_dig_min ;
else
pDM_DigTable - > rx_gain_range_max = pDM_Odm - > RSSI_Min + 20 ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
}
}
else
{
2015-08-15 18:24:16 +00:00
if ( ( pDM_Odm - > SupportICType & ( ODM_RTL8192E | ODM_RTL8723B | ODM_RTL8812 | ODM_RTL8821 ) ) & & ( pDM_Odm - > bBtLimitedDig = = 1 ) ) {
2015-02-20 00:51:33 +00:00
/* 2 Modify DIG upper bound for 92E, 8723B, 8821 & 8812 BT */
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > RSSI_Min + 10 ) > dm_dig_max )
2014-12-17 04:09:56 +00:00
pDM_DigTable - > rx_gain_range_max = dm_dig_max ;
2015-08-15 18:02:34 +00:00
else if ( ( pDM_Odm - > RSSI_Min + 10 ) < dm_dig_min )
2014-12-17 04:09:56 +00:00
pDM_DigTable - > rx_gain_range_max = dm_dig_min ;
else
pDM_DigTable - > rx_gain_range_max = pDM_Odm - > RSSI_Min + 10 ;
}
2015-08-15 18:27:00 +00:00
else {
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* 2 Modify DIG upper bound */
/* 2013.03.19 Luke: Modified upper bound for Netgear rental house test */
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType ! = ODM_RTL8821 )
2014-12-17 04:09:56 +00:00
offset = 20 ;
else
offset = 10 ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > RSSI_Min + offset ) > dm_dig_max )
2013-05-08 21:45:39 +00:00
pDM_DigTable - > rx_gain_range_max = dm_dig_max ;
2015-08-15 18:02:34 +00:00
else if ( ( pDM_Odm - > RSSI_Min + offset ) < dm_dig_min )
2013-05-08 21:45:39 +00:00
pDM_DigTable - > rx_gain_range_max = dm_dig_min ;
else
2014-12-17 04:09:56 +00:00
pDM_DigTable - > rx_gain_range_max = pDM_Odm - > RSSI_Min + offset ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
}
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* 1 Lower Bound for 88E AntDiv */
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > SupportICType = = ODM_RTL8188E ) & & ( pDM_Odm - > SupportAbility & ODM_BB_ANT_DIV ) )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > AntDivType = = CG_TRX_HW_ANTDIV ) | | ( pDM_Odm - > AntDivType = = CGCS_RX_HW_ANTDIV ) )
2014-12-17 04:09:56 +00:00
{
2014-12-30 23:50:44 +00:00
DIG_Dynamic_MIN = ( u8 ) pDM_DigTable - > AntDiv_RSSI_max ;
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " odm_DIG(): pDM_DigTable->AntDiv_RSSI_max=%d \n " , pDM_DigTable - > AntDiv_RSSI_max ) ) ;
2014-12-17 04:09:56 +00:00
}
}
else
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType ! = ODM_RTL8723B )
2014-12-17 04:09:56 +00:00
offset = 0 ;
else
offset = 12 ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min - offset < dm_dig_min )
2013-05-08 21:45:39 +00:00
DIG_Dynamic_MIN = dm_dig_min ;
2014-12-17 04:09:56 +00:00
else if ( pDM_Odm - > RSSI_Min - offset > DIG_MaxOfMin )
2013-05-08 21:45:39 +00:00
DIG_Dynamic_MIN = DIG_MaxOfMin ;
else
2014-12-17 04:09:56 +00:00
DIG_Dynamic_MIN = pDM_Odm - > RSSI_Min - offset ;
2015-03-02 23:25:27 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG() : bOneEntryOnly=true, DIG_Dynamic_MIN=0x%x \n " , DIG_Dynamic_MIN ) ) ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG() : pDM_Odm->RSSI_Min=%d \n " , pDM_Odm - > RSSI_Min ) ) ;
2013-05-08 21:45:39 +00:00
}
2014-12-17 04:09:56 +00:00
2014-12-19 06:59:46 +00:00
2013-05-08 21:45:39 +00:00
}
2014-12-17 04:09:56 +00:00
}
else
{
2013-05-08 21:45:39 +00:00
pDM_DigTable - > rx_gain_range_max = dm_dig_max ;
DIG_Dynamic_MIN = dm_dig_min ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG() : No Link \n " ) ) ;
2013-05-08 21:45:39 +00:00
}
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* 1 Modify DIG lower bound, deal with abnorally large false alarm */
2015-08-15 18:02:34 +00:00
if ( pFalseAlmCnt - > Cnt_all > 10000 )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " dm_DIG(): Abnornally false alarm case. \n " ) ) ;
2013-05-19 04:28:07 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_DigTable - > LargeFAHit ! = 3 )
2013-08-07 03:34:32 +00:00
pDM_DigTable - > LargeFAHit + + ;
2015-08-15 18:02:34 +00:00
if ( pDM_DigTable - > ForbiddenIGI < CurrentIGI ) /* if (pDM_DigTable->ForbiddenIGI < pDM_DigTable->CurIGValue) */
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
pDM_DigTable - > ForbiddenIGI = ( u8 ) CurrentIGI ; /* pDM_DigTable->ForbiddenIGI = pDM_DigTable->CurIGValue; */
2013-05-08 21:45:39 +00:00
pDM_DigTable - > LargeFAHit = 1 ;
}
2015-08-15 18:02:34 +00:00
if ( pDM_DigTable - > LargeFAHit > = 3 )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( ( pDM_DigTable - > ForbiddenIGI + 1 ) > pDM_DigTable - > rx_gain_range_max )
2013-05-08 21:45:39 +00:00
pDM_DigTable - > rx_gain_range_min = pDM_DigTable - > rx_gain_range_max ;
else
pDM_DigTable - > rx_gain_range_min = ( pDM_DigTable - > ForbiddenIGI + 1 ) ;
2015-02-20 00:51:33 +00:00
pDM_DigTable - > Recover_cnt = 3600 ; /* 3600=2hr */
2013-05-08 21:45:39 +00:00
}
2014-12-17 04:09:56 +00:00
}
else
{
2015-02-20 00:51:33 +00:00
/* Recovery mechanism for IGI lower bound */
2015-08-15 18:02:34 +00:00
if ( pDM_DigTable - > Recover_cnt ! = 0 )
2014-12-17 04:09:56 +00:00
pDM_DigTable - > Recover_cnt - - ;
else
{
2015-08-15 18:02:34 +00:00
if ( pDM_DigTable - > LargeFAHit < 3 )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( ( pDM_DigTable - > ForbiddenIGI - 1 ) < DIG_Dynamic_MIN ) /* DM_DIG_MIN) */
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
pDM_DigTable - > ForbiddenIGI = DIG_Dynamic_MIN ; /* DM_DIG_MIN; */
pDM_DigTable - > rx_gain_range_min = DIG_Dynamic_MIN ; /* DM_DIG_MIN; */
2013-05-08 21:45:39 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): Normal Case: At Lower Bound \n " ) ) ;
2014-12-17 04:09:56 +00:00
}
else
{
pDM_DigTable - > ForbiddenIGI - - ;
2013-05-08 21:45:39 +00:00
pDM_DigTable - > rx_gain_range_min = ( pDM_DigTable - > ForbiddenIGI + 1 ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): Normal Case: Approach Lower Bound \n " ) ) ;
}
2014-12-17 04:09:56 +00:00
}
else
{
2013-05-08 21:45:39 +00:00
pDM_DigTable - > LargeFAHit = 0 ;
}
}
}
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): pDM_DigTable->LargeFAHit=%d \n " , pDM_DigTable - > LargeFAHit ) ) ;
2016-04-09 19:30:01 +00:00
if ( ( pDM_Odm - > SupportPlatform & ( ODM_CE ) ) & & ( pDM_Odm - > PhyDbgInfo . NumQryBeaconPkt < 10 ) & & ( pDM_Odm - > bsta_state ) )
2014-12-17 04:09:56 +00:00
pDM_DigTable - > rx_gain_range_min = dm_dig_min ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_DigTable - > rx_gain_range_min > pDM_DigTable - > rx_gain_range_max )
2014-12-17 04:09:56 +00:00
pDM_DigTable - > rx_gain_range_min = pDM_DigTable - > rx_gain_range_max ;
2013-05-08 21:45:39 +00:00
2015-02-20 00:51:33 +00:00
/* 1 Adjust initial gain by false alarm */
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > bLinked )
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): DIG AfterLink \n " ) ) ;
2015-08-15 18:02:34 +00:00
if ( FirstConnect )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min < = DIG_MaxOfMin )
2014-12-17 04:09:56 +00:00
CurrentIGI = pDM_Odm - > RSSI_Min ;
else
CurrentIGI = DIG_MaxOfMin ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " DIG: First Connect \n " ) ) ;
2015-02-20 00:51:33 +00:00
/* ODM_ConfigBBWithHeaderFile(pDM_Odm, CONFIG_BB_AGC_TAB_DIFF); */
2014-12-17 04:09:56 +00:00
}
else
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8192D )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pFalseAlmCnt - > Cnt_all > DM_DIG_FA_TH2_92D )
2015-02-20 00:51:33 +00:00
CurrentIGI = CurrentIGI + 4 ; /* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; */
2013-05-08 21:45:39 +00:00
else if ( pFalseAlmCnt - > Cnt_all > DM_DIG_FA_TH1_92D )
2015-02-20 00:51:33 +00:00
CurrentIGI = CurrentIGI + 2 ; /* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; */
2015-08-15 18:02:34 +00:00
else if ( pFalseAlmCnt - > Cnt_all < DM_DIG_FA_TH0_92D )
2015-02-20 00:51:33 +00:00
CurrentIGI = CurrentIGI - 2 ; /* pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; */
2014-12-17 04:09:56 +00:00
}
else
{
2015-02-20 00:51:33 +00:00
/* FA for Combo IC--NeilChen--2012--09--28 */
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8723A )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
/* WLAN and BT ConCurrent */
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > bBtLimitedDig )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pFalseAlmCnt - > Cnt_all > 0x300 )
2014-12-17 04:09:56 +00:00
CurrentIGI = CurrentIGI + 4 ;
else if ( pFalseAlmCnt - > Cnt_all > 0x250 )
CurrentIGI = CurrentIGI + 2 ;
2015-08-15 18:02:34 +00:00
else if ( pFalseAlmCnt - > Cnt_all < DM_DIG_FA_TH0 )
2014-12-17 04:09:56 +00:00
CurrentIGI = CurrentIGI - 2 ;
}
2015-02-20 00:51:33 +00:00
else /* Not Concurrent */
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pFalseAlmCnt - > Cnt_all > DM_DIG_FA_TH2 )
2015-02-20 00:51:33 +00:00
CurrentIGI = CurrentIGI + 4 ; /* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; */
2014-12-17 04:09:56 +00:00
else if ( pFalseAlmCnt - > Cnt_all > DM_DIG_FA_TH1 )
2015-02-20 00:51:33 +00:00
CurrentIGI = CurrentIGI + 2 ; /* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; */
2015-08-15 18:02:34 +00:00
else if ( pFalseAlmCnt - > Cnt_all < DM_DIG_FA_TH0 )
2015-02-20 00:51:33 +00:00
CurrentIGI = CurrentIGI - 2 ; /* pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; */
2014-12-17 04:09:56 +00:00
}
}
else
{
2015-08-15 18:02:34 +00:00
if ( pFalseAlmCnt - > Cnt_all > DM_DIG_FA_TH2 )
2015-02-20 00:51:33 +00:00
CurrentIGI = CurrentIGI + 4 ; /* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; */
2014-12-17 04:09:56 +00:00
else if ( pFalseAlmCnt - > Cnt_all > DM_DIG_FA_TH1 )
2015-02-20 00:51:33 +00:00
CurrentIGI = CurrentIGI + 2 ; /* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; */
2015-08-15 18:02:34 +00:00
else if ( pFalseAlmCnt - > Cnt_all < DM_DIG_FA_TH0 )
2015-02-20 00:51:33 +00:00
CurrentIGI = CurrentIGI - 2 ; /* pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; */
2014-12-17 04:09:56 +00:00
2016-04-09 19:30:01 +00:00
if ( ( pDM_Odm - > SupportPlatform & ( ODM_CE ) ) & & ( pDM_Odm - > PhyDbgInfo . NumQryBeaconPkt < 10 )
2014-12-17 04:09:56 +00:00
& & ( pFalseAlmCnt - > Cnt_all < DM_DIG_FA_TH1 ) & & ( pDM_Odm - > bsta_state ) )
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
CurrentIGI = pDM_DigTable - > rx_gain_range_min ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): Beacon is less than 10 and FA is less than 768, IGI GOES TO 0x1E!!!!!!!!!!!! \n " ) ) ;
}
}
2013-05-08 21:45:39 +00:00
}
}
2015-02-20 00:51:33 +00:00
} else {
2013-05-08 21:45:39 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): DIG BeforeLink \n " ) ) ;
2015-08-15 18:02:34 +00:00
if ( FirstDisConnect )
2014-12-17 04:09:56 +00:00
{
2013-05-08 21:45:39 +00:00
CurrentIGI = pDM_DigTable - > rx_gain_range_min ;
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): First DisConnect \n " ) ) ;
2014-12-17 04:09:56 +00:00
}
else
{
2015-02-20 00:51:33 +00:00
/* 2012.03.30 LukeLee: enable DIG before link but with very high thresholds */
2015-08-15 18:02:34 +00:00
if ( pFalseAlmCnt - > Cnt_all > 10000 )
2014-12-17 04:09:56 +00:00
CurrentIGI = CurrentIGI + 4 ;
2013-08-07 03:34:32 +00:00
else if ( pFalseAlmCnt - > Cnt_all > 8000 )
2014-12-17 04:09:56 +00:00
CurrentIGI = CurrentIGI + 2 ;
2015-08-15 18:02:34 +00:00
else if ( pFalseAlmCnt - > Cnt_all < 500 )
2014-12-17 04:09:56 +00:00
CurrentIGI = CurrentIGI - 2 ;
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): England DIG \n " ) ) ;
2013-05-08 21:45:39 +00:00
}
}
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): DIG End Adjust IGI \n " ) ) ;
2015-02-20 00:51:33 +00:00
/* 1 Check initial gain by upper/lower bound */
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( CurrentIGI > pDM_DigTable - > rx_gain_range_max )
2013-05-08 21:45:39 +00:00
CurrentIGI = pDM_DigTable - > rx_gain_range_max ;
2015-08-15 18:02:34 +00:00
if ( CurrentIGI < pDM_DigTable - > rx_gain_range_min )
2013-05-08 21:45:39 +00:00
CurrentIGI = pDM_DigTable - > rx_gain_range_min ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportAbility & ODM_BB_ADAPTIVITY )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( CurrentIGI > Adap_IGI_Upper )
2014-12-17 04:09:56 +00:00
CurrentIGI = Adap_IGI_Upper ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( CurrentIGI > ( pDM_Odm - > IGI_target + 4 ) )
2014-12-30 23:50:44 +00:00
CurrentIGI = ( u8 ) pDM_Odm - > IGI_target + 4 ;
2014-12-17 04:09:56 +00:00
}
2014-12-19 06:59:46 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): rx_gain_range_max=0x%x, rx_gain_range_min=0x%x \n " ,
2014-12-17 04:09:56 +00:00
pDM_DigTable - > rx_gain_range_max , pDM_DigTable - > rx_gain_range_min ) ) ;
2013-05-08 21:45:39 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): TotalFA=%d \n " , pFalseAlmCnt - > Cnt_all ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_DIG , ODM_DBG_LOUD , ( " odm_DIG(): CurIGValue=0x%x \n " , CurrentIGI ) ) ;
2015-02-20 00:51:33 +00:00
/* 2 High power RSSI threshold */
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
# if (BT_30_SUPPORT == 1)
if ( pDM_Odm - > bBtHsOperation )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > bLinked )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_DigTable - > BT30_CurIGI > ( CurrentIGI ) )
2014-12-17 04:09:56 +00:00
{
ODM_Write_DIG ( pDM_Odm , CurrentIGI ) ;
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
else
{
ODM_Write_DIG ( pDM_Odm , pDM_DigTable - > BT30_CurIGI ) ;
}
pDM_DigTable - > bMediaConnect_0 = pDM_Odm - > bLinked ;
pDM_DigTable - > DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN ;
}
else
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > bLinkInProcess )
2014-12-17 04:09:56 +00:00
{
ODM_Write_DIG ( pDM_Odm , 0x1c ) ;
}
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > bBtConnectProcess )
2014-12-17 04:09:56 +00:00
{
ODM_Write_DIG ( pDM_Odm , 0x28 ) ;
}
else
{
2015-02-20 00:51:33 +00:00
ODM_Write_DIG ( pDM_Odm , pDM_DigTable - > BT30_CurIGI ) ; /* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */
2014-12-17 04:09:56 +00:00
}
}
2014-12-19 06:59:46 +00:00
}
2015-02-20 00:51:33 +00:00
else /* BT is not using */
2014-12-19 06:59:46 +00:00
# endif
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
ODM_Write_DIG ( pDM_Odm , CurrentIGI ) ; /* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */
2014-12-17 04:09:56 +00:00
pDM_DigTable - > bMediaConnect_0 = pDM_Odm - > bLinked ;
pDM_DigTable - > DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN ;
2013-07-10 18:25:07 +00:00
}
2014-12-17 04:09:56 +00:00
}
}
2013-05-08 21:45:39 +00:00
2013-05-19 04:28:07 +00:00
2015-03-02 23:21:23 +00:00
static bool
2014-12-17 04:09:56 +00:00
odm_DigAbort (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2015-03-02 23:25:27 +00:00
return false ;
2014-12-17 04:09:56 +00:00
}
2013-05-08 21:45:39 +00:00
2015-02-20 00:51:33 +00:00
/* 3============================================================ */
/* 3 FASLE ALARM CHECK */
/* 3============================================================ */
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_FalseAlarmCounterStatistics (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2014-12-30 22:55:10 +00:00
u32 ret_value ;
2015-03-02 23:25:27 +00:00
Pfalse_ALARM_STATISTICS FalseAlmCnt = & ( pDM_Odm - > FalseAlmCnt ) ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_FA_CNT ) )
2014-12-17 04:09:56 +00:00
return ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ODM_IC_11N_SERIES ) {
2015-03-10 16:18:03 +00:00
/* hold ofdm counter */
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_HOLDC_11N , BIT31 , 1 ) ; /* hold page C counter */
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_RSTD_11N , BIT31 , 1 ) ; /* hold page D counter */
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
ret_value = ODM_GetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_TYPE1_11N , bMaskDWord ) ;
2015-03-10 16:18:03 +00:00
FalseAlmCnt - > Cnt_Fast_Fsync = ( ret_value & 0xffff ) ;
FalseAlmCnt - > Cnt_SB_Search_fail = ( ( ret_value & 0xffff0000 ) > > 16 ) ;
2014-12-17 04:09:56 +00:00
ret_value = ODM_GetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_TYPE2_11N , bMaskDWord ) ;
2015-03-10 16:18:03 +00:00
FalseAlmCnt - > Cnt_OFDM_CCA = ( ret_value & 0xffff ) ;
FalseAlmCnt - > Cnt_Parity_Fail = ( ( ret_value & 0xffff0000 ) > > 16 ) ;
2014-12-17 04:09:56 +00:00
ret_value = ODM_GetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_TYPE3_11N , bMaskDWord ) ;
2015-03-10 16:18:03 +00:00
FalseAlmCnt - > Cnt_Rate_Illegal = ( ret_value & 0xffff ) ;
FalseAlmCnt - > Cnt_Crc8_fail = ( ( ret_value & 0xffff0000 ) > > 16 ) ;
2014-12-17 04:09:56 +00:00
ret_value = ODM_GetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_TYPE4_11N , bMaskDWord ) ;
2015-03-10 16:18:03 +00:00
FalseAlmCnt - > Cnt_Mcs_fail = ( ret_value & 0xffff ) ;
2014-12-17 04:09:56 +00:00
2015-03-10 16:18:03 +00:00
FalseAlmCnt - > Cnt_Ofdm_fail = FalseAlmCnt - > Cnt_Parity_Fail + FalseAlmCnt - > Cnt_Rate_Illegal +
2014-12-17 04:09:56 +00:00
FalseAlmCnt - > Cnt_Crc8_fail + FalseAlmCnt - > Cnt_Mcs_fail +
FalseAlmCnt - > Cnt_Fast_Fsync + FalseAlmCnt - > Cnt_SB_Search_fail ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8188E )
2015-03-10 16:18:03 +00:00
{
2014-12-17 04:09:56 +00:00
ret_value = ODM_GetBBReg ( pDM_Odm , ODM_REG_SC_CNT_11N , bMaskDWord ) ;
2015-03-10 16:18:03 +00:00
FalseAlmCnt - > Cnt_BW_LSC = ( ret_value & 0xffff ) ;
FalseAlmCnt - > Cnt_BW_USC = ( ( ret_value & 0xffff0000 ) > > 16 ) ;
}
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* hold cck counter */
2015-03-10 16:18:03 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_FA_RST_11N , BIT12 , 1 ) ;
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_FA_RST_11N , BIT14 , 1 ) ;
2014-12-19 06:59:46 +00:00
2015-03-10 16:18:03 +00:00
ret_value = ODM_GetBBReg ( pDM_Odm , ODM_REG_CCK_FA_LSB_11N , bMaskByte0 ) ;
2014-12-17 04:09:56 +00:00
FalseAlmCnt - > Cnt_Cck_fail = ret_value ;
2015-03-10 16:18:03 +00:00
ret_value = ODM_GetBBReg ( pDM_Odm , ODM_REG_CCK_FA_MSB_11N , bMaskByte3 ) ;
2014-12-17 04:09:56 +00:00
FalseAlmCnt - > Cnt_Cck_fail + = ( ret_value & 0xff ) < < 8 ;
2015-03-10 16:18:03 +00:00
ret_value = ODM_GetBBReg ( pDM_Odm , ODM_REG_CCK_CCA_CNT_11N , bMaskDWord ) ;
2014-12-17 04:09:56 +00:00
FalseAlmCnt - > Cnt_CCK_CCA = ( ( ret_value & 0xFF ) < < 8 ) | ( ( ret_value & 0xFF00 ) > > 8 ) ;
2014-12-19 06:59:46 +00:00
2015-03-10 16:18:03 +00:00
FalseAlmCnt - > Cnt_all = ( FalseAlmCnt - > Cnt_Fast_Fsync +
2014-12-17 04:09:56 +00:00
FalseAlmCnt - > Cnt_SB_Search_fail +
FalseAlmCnt - > Cnt_Parity_Fail +
FalseAlmCnt - > Cnt_Rate_Illegal +
FalseAlmCnt - > Cnt_Crc8_fail +
FalseAlmCnt - > Cnt_Mcs_fail +
2014-12-19 06:59:46 +00:00
FalseAlmCnt - > Cnt_Cck_fail ) ;
2014-12-17 04:09:56 +00:00
2015-03-10 16:18:03 +00:00
FalseAlmCnt - > Cnt_CCA_all = FalseAlmCnt - > Cnt_OFDM_CCA + FalseAlmCnt - > Cnt_CCK_CCA ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType > = ODM_RTL8723A )
2015-03-10 16:18:03 +00:00
{
/* reset false alarm counter registers */
2014-12-17 04:09:56 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_RSTC_11N , BIT31 , 1 ) ;
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_RSTC_11N , BIT31 , 0 ) ;
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_RSTD_11N , BIT27 , 1 ) ;
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_RSTD_11N , BIT27 , 0 ) ;
2015-03-10 16:18:03 +00:00
/* update ofdm counter */
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_HOLDC_11N , BIT31 , 0 ) ; /* update page C counter */
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_RSTD_11N , BIT31 , 0 ) ; /* update page D counter */
2014-12-17 04:09:56 +00:00
2015-03-10 16:18:03 +00:00
/* reset CCK CCA counter */
2014-12-19 06:59:46 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_FA_RST_11N , BIT13 | BIT12 , 0 ) ;
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_FA_RST_11N , BIT13 | BIT12 , 2 ) ;
2015-03-10 16:18:03 +00:00
/* reset CCK FA counter */
2014-12-19 06:59:46 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_FA_RST_11N , BIT15 | BIT14 , 0 ) ;
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_FA_RST_11N , BIT15 | BIT14 , 2 ) ;
2015-03-10 16:18:03 +00:00
}
2014-12-19 06:59:46 +00:00
2015-03-10 16:18:03 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_FA_CNT , ODM_DBG_LOUD , ( " Enter odm_FalseAlarmCounterStatistics \n " ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_FA_CNT , ODM_DBG_LOUD , ( " Cnt_Fast_Fsync=%d, Cnt_SB_Search_fail=%d \n " ,
2014-12-17 04:09:56 +00:00
FalseAlmCnt - > Cnt_Fast_Fsync , FalseAlmCnt - > Cnt_SB_Search_fail ) ) ;
2015-03-10 16:18:03 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_FA_CNT , ODM_DBG_LOUD , ( " Cnt_Parity_Fail=%d, Cnt_Rate_Illegal=%d \n " ,
2014-12-17 04:09:56 +00:00
FalseAlmCnt - > Cnt_Parity_Fail , FalseAlmCnt - > Cnt_Rate_Illegal ) ) ;
2015-03-10 16:18:03 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_FA_CNT , ODM_DBG_LOUD , ( " Cnt_Crc8_fail=%d, Cnt_Mcs_fail=%d \n " ,
2014-12-17 04:09:56 +00:00
FalseAlmCnt - > Cnt_Crc8_fail , FalseAlmCnt - > Cnt_Mcs_fail ) ) ;
}
2015-02-20 00:51:33 +00:00
else /* FOR ODM_IC_11AC_SERIES */
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
/* read OFDM FA counter */
2014-12-17 04:09:56 +00:00
FalseAlmCnt - > Cnt_Ofdm_fail = ODM_GetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_11AC , bMaskLWord ) ;
FalseAlmCnt - > Cnt_Cck_fail = ODM_GetBBReg ( pDM_Odm , ODM_REG_CCK_FA_11AC , bMaskLWord ) ;
FalseAlmCnt - > Cnt_all = FalseAlmCnt - > Cnt_Ofdm_fail + FalseAlmCnt - > Cnt_Cck_fail ;
2015-02-20 00:51:33 +00:00
/* reset OFDM FA coutner */
2014-12-17 04:09:56 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_RST_11AC , BIT17 , 1 ) ;
ODM_SetBBReg ( pDM_Odm , ODM_REG_OFDM_FA_RST_11AC , BIT17 , 0 ) ;
2015-02-20 00:51:33 +00:00
/* reset CCK FA counter */
2014-12-17 04:09:56 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_FA_RST_11AC , BIT15 , 0 ) ;
2014-12-19 06:59:46 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_FA_RST_11AC , BIT15 , 1 ) ;
2014-12-17 04:09:56 +00:00
}
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_FA_CNT , ODM_DBG_LOUD , ( " Cnt_Cck_fail=%d \n " , FalseAlmCnt - > Cnt_Cck_fail ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_FA_CNT , ODM_DBG_LOUD , ( " Cnt_Ofdm_fail=%d \n " , FalseAlmCnt - > Cnt_Ofdm_fail ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_FA_CNT , ODM_DBG_LOUD , ( " Total False Alarm=%d \n " , FalseAlmCnt - > Cnt_all ) ) ;
}
2015-02-20 00:51:33 +00:00
/* 3============================================================ */
/* 3 CCK Packet Detect Threshold */
/* 3============================================================ */
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_CCKPacketDetectionThresh (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
pDIG_T pDM_DigTable = & pDM_Odm - > DM_DigTable ;
2014-12-30 23:50:44 +00:00
u8 CurCCK_CCAThres ;
2015-03-02 23:25:27 +00:00
Pfalse_ALARM_STATISTICS FalseAlmCnt = & ( pDM_Odm - > FalseAlmCnt ) ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ( ODM_BB_CCK_PD | ODM_BB_FA_CNT ) ) )
2014-12-17 04:09:56 +00:00
return ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > ExtLNA )
2014-12-17 04:09:56 +00:00
return ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > bLinked )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min > 25 )
2014-12-17 04:09:56 +00:00
CurCCK_CCAThres = 0xcd ;
2015-08-15 18:02:34 +00:00
else if ( ( pDM_Odm - > RSSI_Min < = 25 ) & & ( pDM_Odm - > RSSI_Min > 10 ) )
2014-12-17 04:09:56 +00:00
CurCCK_CCAThres = 0x83 ;
else
{
2015-08-15 18:02:34 +00:00
if ( FalseAlmCnt - > Cnt_Cck_fail > 1000 )
2014-12-17 04:09:56 +00:00
CurCCK_CCAThres = 0x83 ;
else
CurCCK_CCAThres = 0x40 ;
}
}
else
{
2015-08-15 18:02:34 +00:00
if ( FalseAlmCnt - > Cnt_Cck_fail > 1000 )
2014-12-17 04:09:56 +00:00
CurCCK_CCAThres = 0x83 ;
else
CurCCK_CCAThres = 0x40 ;
}
2014-12-19 06:59:46 +00:00
2014-12-30 20:52:15 +00:00
ODM_Write_CCK_CCA_Thres ( pDM_Odm , CurCCK_CCAThres ) ;
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_Write_CCK_CCA_Thres (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 CurCCK_CCAThres
2014-12-17 04:09:56 +00:00
)
{
pDIG_T pDM_DigTable = & pDM_Odm - > DM_DigTable ;
2015-08-15 18:02:34 +00:00
if ( pDM_DigTable - > CurCCK_CCAThres ! = CurCCK_CCAThres ) /* modify by Guo.Mingzhi 2012-01-03 */
2014-12-17 04:09:56 +00:00
{
ODM_Write1Byte ( pDM_Odm , ODM_REG ( CCK_CCA , pDM_Odm ) , CurCCK_CCAThres ) ;
}
pDM_DigTable - > PreCCK_CCAThres = pDM_DigTable - > CurCCK_CCAThres ;
pDM_DigTable - > CurCCK_CCAThres = CurCCK_CCAThres ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
}
2015-02-20 00:51:33 +00:00
/* 3============================================================ */
/* 3 BB Power Save */
/* 3============================================================ */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicBBPowerSavingInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2013-05-08 21:45:39 +00:00
{
2014-12-17 04:09:56 +00:00
pPS_T pDM_PSTable = & pDM_Odm - > DM_PSTable ;
2013-05-08 21:45:39 +00:00
pDM_PSTable - > PreCCAState = CCA_MAX ;
pDM_PSTable - > CurCCAState = CCA_MAX ;
pDM_PSTable - > PreRFState = RF_MAX ;
pDM_PSTable - > CurRFState = RF_MAX ;
pDM_PSTable - > Rssi_val_min = 0 ;
pDM_PSTable - > initialize = 0 ;
}
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicBBPowerSaving (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
if ( ( pDM_Odm - > SupportICType ! = ODM_RTL8192C ) & & ( pDM_Odm - > SupportICType ! = ODM_RTL8723A ) )
return ;
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_PWR_SAVE ) )
2014-12-17 04:09:56 +00:00
return ;
2016-04-09 19:30:01 +00:00
if ( ! ( pDM_Odm - > SupportPlatform & ( ODM_CE ) ) )
2014-12-17 04:09:56 +00:00
return ;
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* 1 2.Power Saving for 92C */
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > SupportICType = = ODM_RTL8192C ) & & ( pDM_Odm - > RFType = = ODM_2T2R ) )
2014-12-17 04:09:56 +00:00
{
odm_1R_CCA ( pDM_Odm ) ;
}
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* 20100628 Joseph: Turn off BB power save for 88CE because it makesthroughput unstable. */
/* 20100831 Joseph: Turn ON BB power save again after modifying AGC delay from 900ns ot 600ns. */
/* 1 3.Power Saving for 88C */
2014-12-17 04:09:56 +00:00
else
{
2015-03-02 23:25:27 +00:00
ODM_RF_Saving ( pDM_Odm , false ) ;
2014-12-17 04:09:56 +00:00
}
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_1R_CCA (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
pPS_T pDM_PSTable = & pDM_Odm - > DM_PSTable ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min ! = 0xFF )
2014-12-17 04:09:56 +00:00
{
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_PSTable - > PreCCAState = = CCA_2R )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min > = 35 )
2014-12-17 04:09:56 +00:00
pDM_PSTable - > CurCCAState = CCA_1R ;
else
pDM_PSTable - > CurCCAState = CCA_2R ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:27:00 +00:00
else {
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min < = 30 )
2014-12-17 04:09:56 +00:00
pDM_PSTable - > CurCCAState = CCA_2R ;
else
pDM_PSTable - > CurCCAState = CCA_1R ;
}
2015-08-15 18:27:00 +00:00
} else {
2014-12-17 04:09:56 +00:00
pDM_PSTable - > CurCCAState = CCA_MAX ;
}
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_PSTable - > PreCCAState ! = pDM_PSTable - > CurCCAState ) {
if ( pDM_PSTable - > CurCCAState = = CCA_1R ) {
if ( pDM_Odm - > RFType = = ODM_2T2R )
2014-12-17 04:09:56 +00:00
ODM_SetBBReg ( pDM_Odm , 0xc04 , bMaskByte0 , 0x13 ) ;
else
ODM_SetBBReg ( pDM_Odm , 0xc04 , bMaskByte0 , 0x23 ) ;
2015-02-20 00:51:33 +00:00
} else {
2014-12-17 04:09:56 +00:00
ODM_SetBBReg ( pDM_Odm , 0xc04 , bMaskByte0 , 0x33 ) ;
2015-02-20 00:51:33 +00:00
/* PHY_SetBBReg(pAdapter,0xe70, bMaskByte3, 0x63); */
2014-12-17 04:09:56 +00:00
}
pDM_PSTable - > PreCCAState = pDM_PSTable - > CurCCAState ;
}
}
void
ODM_RF_Saving (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 bForceInNormal
2014-12-17 04:09:56 +00:00
)
{
pPS_T pDM_PSTable = & pDM_Odm - > DM_PSTable ;
2014-12-30 23:50:44 +00:00
u8 Rssi_Up_bound = 30 ;
u8 Rssi_Low_bound = 25 ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > PatchID = = 40 ) /* RT_CID_819x_FUNAI_TV */
2014-12-17 04:09:56 +00:00
{
Rssi_Up_bound = 50 ;
Rssi_Low_bound = 45 ;
}
2015-08-15 18:24:16 +00:00
if ( pDM_PSTable - > initialize = = 0 ) {
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
pDM_PSTable - > Reg874 = ( ODM_GetBBReg ( pDM_Odm , 0x874 , bMaskDWord ) & 0x1CC000 ) > > 14 ;
pDM_PSTable - > RegC70 = ( ODM_GetBBReg ( pDM_Odm , 0xc70 , bMaskDWord ) & BIT3 ) > > 3 ;
pDM_PSTable - > Reg85C = ( ODM_GetBBReg ( pDM_Odm , 0x85c , bMaskDWord ) & 0xFF000000 ) > > 24 ;
pDM_PSTable - > RegA74 = ( ODM_GetBBReg ( pDM_Odm , 0xa74 , bMaskDWord ) & 0xF000 ) > > 12 ;
2015-02-20 00:51:33 +00:00
/* Reg818 = PHY_QueryBBReg(pAdapter, 0x818, bMaskDWord); */
2014-12-17 04:09:56 +00:00
pDM_PSTable - > initialize = 1 ;
}
2015-08-15 18:02:34 +00:00
if ( ! bForceInNormal )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min ! = 0xFF )
2014-12-19 06:59:46 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_PSTable - > PreRFState = = RF_Normal )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min > = Rssi_Up_bound )
2014-12-17 04:09:56 +00:00
pDM_PSTable - > CurRFState = RF_Save ;
else
pDM_PSTable - > CurRFState = RF_Normal ;
}
2015-08-15 18:27:00 +00:00
else {
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RSSI_Min < = Rssi_Low_bound )
2014-12-17 04:09:56 +00:00
pDM_PSTable - > CurRFState = RF_Normal ;
else
pDM_PSTable - > CurRFState = RF_Save ;
}
}
else
pDM_PSTable - > CurRFState = RF_MAX ;
}
else
{
pDM_PSTable - > CurRFState = RF_Normal ;
}
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_PSTable - > PreRFState ! = pDM_PSTable - > CurRFState )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( pDM_PSTable - > CurRFState = = RF_Save )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
/* <tynli_note> 8723 RSSI report will be wrong. Set 0x874[5]=1 when enter BB power saving mode. */
/* Suggested by SD3 Yu-Nan. 2011.01.20. */
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8723A )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , 0x874 , BIT5 , 0x1 ) ; /* Reg874[5]=1b'1 */
2014-12-17 04:09:56 +00:00
}
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , 0x874 , 0x1C0000 , 0x2 ) ; /* Reg874[20:18]=3'b010 */
ODM_SetBBReg ( pDM_Odm , 0xc70 , BIT3 , 0 ) ; /* RegC70[3]=1'b0 */
ODM_SetBBReg ( pDM_Odm , 0x85c , 0xFF000000 , 0x63 ) ; /* Reg85C[31:24]=0x63 */
ODM_SetBBReg ( pDM_Odm , 0x874 , 0xC000 , 0x2 ) ; /* Reg874[15:14]=2'b10 */
ODM_SetBBReg ( pDM_Odm , 0xa74 , 0xF000 , 0x3 ) ; /* RegA75[7:4]=0x3 */
ODM_SetBBReg ( pDM_Odm , 0x818 , BIT28 , 0x0 ) ; /* Reg818[28]=1'b0 */
ODM_SetBBReg ( pDM_Odm , 0x818 , BIT28 , 0x1 ) ; /* Reg818[28]=1'b1 */
/* ODM_RT_TRACE(pDM_Odm, COMP_BB_POWERSAVING, DBG_LOUD, (" RF_Save")); */
2014-12-17 04:09:56 +00:00
}
else
{
2014-12-19 06:59:46 +00:00
ODM_SetBBReg ( pDM_Odm , 0x874 , 0x1CC000 , pDM_PSTable - > Reg874 ) ;
ODM_SetBBReg ( pDM_Odm , 0xc70 , BIT3 , pDM_PSTable - > RegC70 ) ;
2014-12-17 04:09:56 +00:00
ODM_SetBBReg ( pDM_Odm , 0x85c , 0xFF000000 , pDM_PSTable - > Reg85C ) ;
2014-12-19 06:59:46 +00:00
ODM_SetBBReg ( pDM_Odm , 0xa74 , 0xF000 , pDM_PSTable - > RegA74 ) ;
ODM_SetBBReg ( pDM_Odm , 0x818 , BIT28 , 0x0 ) ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8723A )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , 0x874 , BIT5 , 0x0 ) ; /* Reg874[5]=1b'0 */
2014-12-17 04:09:56 +00:00
}
2015-02-20 00:51:33 +00:00
/* ODM_RT_TRACE(pDM_Odm, COMP_BB_POWERSAVING, DBG_LOUD, (" RF_Normal")); */
2014-12-17 04:09:56 +00:00
}
pDM_PSTable - > PreRFState = pDM_PSTable - > CurRFState ;
}
}
2015-02-20 00:51:33 +00:00
/* 3============================================================ */
/* 3 RATR MASK */
/* 3============================================================ */
/* 3============================================================ */
/* 3 Rate Adaptive */
/* 3============================================================ */
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RateAdaptiveMaskInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
PODM_RATE_ADAPTIVE pOdmRA = & pDM_Odm - > RateAdaptive ;
pOdmRA - > Type = DM_Type_ByDriver ;
if ( pOdmRA - > Type = = DM_Type_ByDriver )
2014-12-29 02:13:24 +00:00
pDM_Odm - > bUseRAMask = true ;
2014-12-17 04:09:56 +00:00
else
2014-12-29 02:13:24 +00:00
pDM_Odm - > bUseRAMask = false ;
2014-12-17 04:09:56 +00:00
pOdmRA - > RATRState = DM_RATR_STA_INIT ;
pOdmRA - > HighRSSIThresh = 50 ;
pOdmRA - > LowRSSIThresh = 20 ;
}
2014-12-30 22:55:10 +00:00
u32 ODM_Get_Rate_Bitmap (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u32 macid ,
u32 ra_mask ,
u8 rssi_level )
2014-12-19 06:59:46 +00:00
{
PSTA_INFO_T pEntry ;
2014-12-30 22:55:10 +00:00
u32 rate_bitmap = 0x0fffffff ;
2014-12-30 23:50:44 +00:00
u8 WirelessMode ;
2015-02-20 00:51:33 +00:00
/* u8 WirelessMode =*(pDM_Odm->pWirelessMode); */
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
pEntry = pDM_Odm - > pODM_StaInfo [ macid ] ;
2015-08-15 18:02:34 +00:00
if ( ! IS_STA_VALID ( pEntry ) )
2014-12-17 04:09:56 +00:00
return ra_mask ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
WirelessMode = pEntry - > wireless_mode ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:05:44 +00:00
switch ( WirelessMode )
2014-12-17 04:09:56 +00:00
{
case ODM_WM_B :
2015-08-15 18:02:34 +00:00
if ( ra_mask & 0x0000000c ) /* 11M or 5.5M enable */
2014-12-17 04:09:56 +00:00
rate_bitmap = 0x0000000d ;
else
rate_bitmap = 0x0000000f ;
break ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
case ( ODM_WM_A | ODM_WM_G ) :
2015-08-15 18:02:34 +00:00
if ( rssi_level = = DM_RATR_STA_HIGH )
2014-12-17 04:09:56 +00:00
rate_bitmap = 0x00000f00 ;
else
rate_bitmap = 0x00000ff0 ;
break ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
case ( ODM_WM_B | ODM_WM_G ) :
2015-08-15 18:02:34 +00:00
if ( rssi_level = = DM_RATR_STA_HIGH )
2014-12-17 04:09:56 +00:00
rate_bitmap = 0x00000f00 ;
2015-08-15 18:02:34 +00:00
else if ( rssi_level = = DM_RATR_STA_MIDDLE )
2014-12-17 04:09:56 +00:00
rate_bitmap = 0x00000ff0 ;
else
rate_bitmap = 0x00000ff5 ;
2014-12-19 06:59:46 +00:00
break ;
2014-12-17 04:09:56 +00:00
case ( ODM_WM_G | ODM_WM_N24G ) :
case ( ODM_WM_B | ODM_WM_G | ODM_WM_N24G ) :
case ( ODM_WM_A | ODM_WM_B | ODM_WM_G | ODM_WM_N24G ) :
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
if ( pDM_Odm - > RFType = = ODM_1T2R | | pDM_Odm - > RFType = = ODM_1T1R )
{
2015-08-15 18:02:34 +00:00
if ( rssi_level = = DM_RATR_STA_HIGH )
2014-12-17 04:09:56 +00:00
{
rate_bitmap = 0x000f0000 ;
}
2015-08-15 18:02:34 +00:00
else if ( rssi_level = = DM_RATR_STA_MIDDLE )
2014-12-17 04:09:56 +00:00
{
rate_bitmap = 0x000ff000 ;
}
2015-08-15 18:27:00 +00:00
else {
2014-12-17 04:09:56 +00:00
if ( * ( pDM_Odm - > pBandWidth ) = = ODM_BW40M )
rate_bitmap = 0x000ff015 ;
else
rate_bitmap = 0x000ff005 ;
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
}
else
{
2015-08-15 18:02:34 +00:00
if ( rssi_level = = DM_RATR_STA_HIGH )
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
rate_bitmap = 0x0f8f0000 ;
}
2015-08-15 18:02:34 +00:00
else if ( rssi_level = = DM_RATR_STA_MIDDLE )
2014-12-17 04:09:56 +00:00
{
rate_bitmap = 0x0f8ff000 ;
}
else
{
if ( * ( pDM_Odm - > pBandWidth ) = = ODM_BW40M )
rate_bitmap = 0x0f8ff015 ;
else
rate_bitmap = 0x0f8ff005 ;
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
}
}
break ;
default :
2015-02-20 00:51:33 +00:00
/* case WIRELESS_11_24N: */
/* case WIRELESS_11_5N: */
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > RFType = = RF_1T2R )
2014-12-17 04:09:56 +00:00
rate_bitmap = 0x000fffff ;
else
rate_bitmap = 0x0fffffff ;
2014-12-19 06:59:46 +00:00
break ;
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:00:19 +00:00
/* printk("%s ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x\n",__FUNCTION__,rssi_level,WirelessMode,rate_bitmap); */
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_RA_MASK , ODM_DBG_LOUD , ( " ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x \n " , rssi_level , WirelessMode , rate_bitmap ) ) ;
2014-12-17 04:09:56 +00:00
return rate_bitmap ;
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
/*-----------------------------------------------------------------------------
* Function : odm_RefreshRateAdaptiveMask ( )
*
* Overview : Update rate table mask according to rssi
*
* Input : NONE
*
* Output : NONE
*
* Return : NONE
*
* Revised History :
* When Who Remark
2014-12-19 06:59:46 +00:00
* 05 / 27 / 2009 hpfan Create Version 0.
2014-12-17 04:09:56 +00:00
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RefreshRateAdaptiveMask (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_RA_MASK ) )
2014-12-19 06:59:46 +00:00
return ;
2015-02-20 00:51:33 +00:00
/* */
/* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */
/* at the same time. In the stage2/3, we need to prive universal interface and merge all */
/* HW dynamic mechanism. */
/* */
2016-04-09 19:30:01 +00:00
odm_RefreshRateAdaptiveMaskCE ( pDM_Odm ) ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RefreshRateAdaptiveMaskMP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RefreshRateAdaptiveMaskCE (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2014-12-30 23:50:44 +00:00
u8 i ;
2014-12-19 06:59:46 +00:00
struct adapter * pAdapter = pDM_Odm - > Adapter ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( pAdapter - > bDriverStopped )
2014-12-17 04:09:56 +00:00
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_RA_MASK , ODM_DBG_TRACE , ( " <---- odm_RefreshRateAdaptiveMask(): driver is going to unload \n " ) ) ;
return ;
}
2015-08-15 18:02:34 +00:00
if ( ! pDM_Odm - > bUseRAMask ) {
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_RA_MASK , ODM_DBG_LOUD , ( " <---- odm_RefreshRateAdaptiveMask(): driver does not control rate adaptive mask \n " ) ) ;
return ;
}
2015-08-15 18:24:16 +00:00
for ( i = 0 ; i < ODM_ASSOCIATE_ENTRY_NUM ; i + + ) {
2014-12-17 04:09:56 +00:00
PSTA_INFO_T pstat = pDM_Odm - > pODM_StaInfo [ i ] ;
2015-08-15 18:02:34 +00:00
if ( IS_STA_VALID ( pstat ) ) {
if ( IS_MCAST ( pstat - > hwaddr ) ) /* if (psta->mac_id ==1) */
2014-12-17 04:09:56 +00:00
continue ;
2015-08-15 18:02:34 +00:00
if ( true = = ODM_RAStateCheck ( pDM_Odm , pstat - > rssi_stat . UndecoratedSmoothedPWDB , false , & pstat - > rssi_level ) )
2014-12-17 04:09:56 +00:00
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_RA_MASK , ODM_DBG_LOUD , ( " RSSI:%d, RSSI_LEVEL:%d \n " , pstat - > rssi_stat . UndecoratedSmoothedPWDB , pstat - > rssi_level ) ) ;
2015-02-20 00:51:33 +00:00
/* printk("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level); */
2014-12-17 04:09:56 +00:00
rtw_hal_update_ra_mask ( pstat , pstat - > rssi_level ) ;
}
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
}
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RefreshRateAdaptiveMaskAPADSL (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2015-03-02 23:21:23 +00:00
/* Return Value: bool */
2015-03-02 23:25:27 +00:00
/* - true: RATRState is changed. */
2015-03-02 23:21:23 +00:00
bool
2014-12-17 04:09:56 +00:00
ODM_RAStateCheck (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
s32 RSSI ,
bool bForceUpdate ,
u8 * pRATRState
2014-12-17 04:09:56 +00:00
)
{
PODM_RATE_ADAPTIVE pRA = & pDM_Odm - > RateAdaptive ;
2014-12-30 23:50:44 +00:00
const u8 GoUpGap = 5 ;
u8 HighRSSIThreshForRA = pRA - > HighRSSIThresh ;
u8 LowRSSIThreshForRA = pRA - > LowRSSIThresh ;
u8 RATRState ;
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* Threshold Adjustment: */
/* when RSSI state trends to go up one or two levels, make sure RSSI is high enough. */
/* Here GoUpGap is added to solve the boundary's level alternation issue. */
2014-12-17 04:09:56 +00:00
switch ( * pRATRState )
{
case DM_RATR_STA_INIT :
case DM_RATR_STA_HIGH :
break ;
case DM_RATR_STA_MIDDLE :
HighRSSIThreshForRA + = GoUpGap ;
break ;
case DM_RATR_STA_LOW :
HighRSSIThreshForRA + = GoUpGap ;
LowRSSIThreshForRA + = GoUpGap ;
break ;
2014-12-19 06:59:46 +00:00
default :
2015-03-02 23:25:27 +00:00
ODM_RT_ASSERT ( pDM_Odm , false , ( " wrong rssi level setting %d ! " , * pRATRState ) ) ;
2014-12-17 04:09:56 +00:00
break ;
}
2015-02-20 00:51:33 +00:00
/* Decide RATRState by RSSI. */
2015-08-15 18:02:34 +00:00
if ( RSSI > HighRSSIThreshForRA )
2014-12-17 04:09:56 +00:00
RATRState = DM_RATR_STA_HIGH ;
2015-08-15 18:02:34 +00:00
else if ( RSSI > LowRSSIThreshForRA )
2014-12-17 04:09:56 +00:00
RATRState = DM_RATR_STA_MIDDLE ;
else
RATRState = DM_RATR_STA_LOW ;
2015-08-15 18:00:19 +00:00
/* printk("==>%s,RATRState:0x%02x ,RSSI:%d\n",__FUNCTION__,RATRState,RSSI); */
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( * pRATRState ! = RATRState | | bForceUpdate )
2014-12-17 04:09:56 +00:00
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_RA_MASK , ODM_DBG_LOUD , ( " RSSI Level %d -> %d \n " , * pRATRState , RATRState ) ) ;
* pRATRState = RATRState ;
2015-03-02 23:25:27 +00:00
return true ;
2014-12-17 04:09:56 +00:00
}
2015-03-02 23:25:27 +00:00
return false ;
2014-12-17 04:09:56 +00:00
}
2015-02-20 00:51:33 +00:00
/* */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* 3============================================================ */
/* 3 Dynamic Tx Power */
/* 3============================================================ */
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2014-12-17 23:13:53 +00:00
struct adapter * Adapter = pDM_Odm - > Adapter ;
2014-12-17 04:09:56 +00:00
HAL_DATA_TYPE * pHalData = GET_HAL_DATA ( Adapter ) ;
struct dm_priv * pdmpriv = & pHalData - > dmpriv ;
2014-12-29 02:13:24 +00:00
pdmpriv - > bDynamicTxPowerEnable = false ;
2014-12-17 04:09:56 +00:00
pdmpriv - > LastDTPLvl = TxHighPwrLevel_Normal ;
2014-12-19 06:59:46 +00:00
pdmpriv - > DynamicTxHighPowerLvl = TxHighPwrLevel_Normal ;
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerSavePowerIndex (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2014-12-19 06:59:46 +00:00
{
2014-12-30 23:50:44 +00:00
u8 index ;
2014-12-30 22:55:10 +00:00
u32 Power_Index_REG [ 6 ] = { 0xc90 , 0xc91 , 0xc92 , 0xc98 , 0xc99 , 0xc9a } ;
2014-12-19 06:59:46 +00:00
2014-12-17 23:13:53 +00:00
struct adapter * Adapter = pDM_Odm - > Adapter ;
2014-12-17 04:09:56 +00:00
HAL_DATA_TYPE * pHalData = GET_HAL_DATA ( Adapter ) ;
struct dm_priv * pdmpriv = & pHalData - > dmpriv ;
2015-08-15 18:06:32 +00:00
for ( index = 0 ; index < 6 ; index + + )
2014-12-17 04:09:56 +00:00
pdmpriv - > PowerIndex_backup [ index ] = rtw_read8 ( Adapter , Power_Index_REG [ index ] ) ;
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerRestorePowerIndex (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2014-12-30 23:50:44 +00:00
u8 index ;
2014-12-17 23:13:53 +00:00
struct adapter * Adapter = pDM_Odm - > Adapter ;
2014-12-17 04:09:56 +00:00
HAL_DATA_TYPE * pHalData = GET_HAL_DATA ( Adapter ) ;
2014-12-30 22:55:10 +00:00
u32 Power_Index_REG [ 6 ] = { 0xc90 , 0xc91 , 0xc92 , 0xc98 , 0xc99 , 0xc9a } ;
2014-12-17 04:09:56 +00:00
struct dm_priv * pdmpriv = & pHalData - > dmpriv ;
2015-08-15 18:06:32 +00:00
for ( index = 0 ; index < 6 ; index + + )
2014-12-17 04:09:56 +00:00
rtw_write8 ( Adapter , Power_Index_REG [ index ] , pdmpriv - > PowerIndex_backup [ index ] ) ;
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerWritePowerIndex (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 Value )
2014-12-17 04:09:56 +00:00
{
2014-12-30 23:50:44 +00:00
u8 index ;
2014-12-30 22:55:10 +00:00
u32 Power_Index_REG [ 6 ] = { 0xc90 , 0xc91 , 0xc92 , 0xc98 , 0xc99 , 0xc9a } ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:06:32 +00:00
for ( index = 0 ; index < 6 ; index + + )
2015-02-20 00:51:33 +00:00
/* PlatformEFIOWrite1Byte(Adapter, Power_Index_REG[index], Value); */
2014-12-17 04:09:56 +00:00
ODM_Write1Byte ( pDM_Odm , Power_Index_REG [ index ] , Value ) ;
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPower (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2015-02-20 00:51:33 +00:00
/* */
/* For AP/ADSL use prtl8192cd_priv */
/* For CE/NIC use PADAPTER */
/* */
/* struct adapter * pAdapter = pDM_Odm->Adapter; */
/* prtl8192cd_priv priv = pDM_Odm->priv; */
2014-12-17 04:09:56 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_DYNAMIC_TXPWR ) )
return ;
2015-02-20 00:51:33 +00:00
/* 2012/01/12 MH According to Luke's suggestion, only high power will support the feature. */
2015-03-02 23:25:27 +00:00
if ( pDM_Odm - > ExtPA = = false )
2014-12-17 04:09:56 +00:00
return ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* */
/* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */
/* at the same time. In the stage2/3, we need to prive universal interface and merge all */
/* HW dynamic mechanism. */
/* */
2016-04-09 19:30:01 +00:00
odm_DynamicTxPowerNIC ( pDM_Odm ) ;
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerNIC (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_DYNAMIC_TXPWR ) )
return ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8192C )
2014-12-17 04:09:56 +00:00
{
odm_DynamicTxPower_92C ( pDM_Odm ) ;
}
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > SupportICType = = ODM_RTL8192D )
2014-12-17 04:09:56 +00:00
{
odm_DynamicTxPower_92D ( pDM_Odm ) ;
}
else if ( pDM_Odm - > SupportICType & ODM_RTL8188E )
{
2015-02-20 00:51:33 +00:00
/* Add Later. */
2014-12-17 04:09:56 +00:00
}
else if ( pDM_Odm - > SupportICType = = ODM_RTL8188E )
{
2015-02-20 00:51:33 +00:00
/* ??? */
/* This part need to be redefined. */
2014-12-17 04:09:56 +00:00
}
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPowerAP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPower_92C (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_DynamicTxPower_92D (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2015-02-20 00:51:33 +00:00
/* 3============================================================ */
/* 3 RSSI Monitor */
/* 3============================================================ */
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorCheck (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2015-02-20 00:51:33 +00:00
/* */
/* For AP/ADSL use prtl8192cd_priv */
/* For CE/NIC use PADAPTER */
/* */
2014-12-17 23:13:53 +00:00
struct adapter * pAdapter = pDM_Odm - > Adapter ;
2014-12-17 04:09:56 +00:00
prtl8192cd_priv priv = pDM_Odm - > priv ;
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_RSSI_MONITOR ) )
return ;
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* */
/* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */
/* at the same time. In the stage2/3, we need to prive universal interface and merge all */
/* HW dynamic mechanism. */
/* */
2016-04-09 19:30:01 +00:00
odm_RSSIMonitorCheckCE ( pDM_Odm ) ;
2015-02-20 00:51:33 +00:00
} /* odm_RSSIMonitorCheck */
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorCheckMP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2015-02-20 00:51:33 +00:00
/* */
/* sherry move from DUSC to here 20110517 */
/* */
2014-12-29 02:06:17 +00:00
static void
2014-12-17 04:09:56 +00:00
FindMinimumRSSI_Dmsp (
2015-03-13 17:06:38 +00:00
struct adapter * pAdapter
2014-12-17 04:09:56 +00:00
)
{
}
static void
FindMinimumRSSI (
2015-03-13 17:06:38 +00:00
struct adapter * pAdapter
2014-12-17 04:09:56 +00:00
)
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
HAL_DATA_TYPE * pHalData = GET_HAL_DATA ( pAdapter ) ;
struct dm_priv * pdmpriv = & pHalData - > dmpriv ;
PDM_ODM_T pDM_Odm = & ( pHalData - > odmpriv ) ;
2015-02-20 00:51:33 +00:00
/* 1 1.Determine the minimum RSSI */
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > bLinked ! = true ) & &
2014-12-17 04:09:56 +00:00
( pdmpriv - > EntryMinUndecoratedSmoothedPWDB = = 0 ) )
pdmpriv - > MinUndecoratedPWDBForDM = 0 ;
else
pdmpriv - > MinUndecoratedPWDBForDM = pdmpriv - > EntryMinUndecoratedSmoothedPWDB ;
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorCheckCE (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2014-12-17 23:13:53 +00:00
struct adapter * Adapter = pDM_Odm - > Adapter ;
2014-12-17 04:09:56 +00:00
HAL_DATA_TYPE * pHalData = GET_HAL_DATA ( Adapter ) ;
struct dm_priv * pdmpriv = & pHalData - > dmpriv ;
int i ;
int tmpEntryMaxPWDB = 0 , tmpEntryMinPWDB = 0xff ;
2014-12-19 06:59:46 +00:00
u8 sta_cnt = 0 ;
2015-02-20 00:51:33 +00:00
u32 PWDB_rssi [ NUM_STA ] = { 0 } ; /* 0~15]:MACID, [16~31]:PWDB_rssi */
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > bLinked ! = true )
2014-12-17 04:09:56 +00:00
return ;
{
struct sta_info * psta ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:06:32 +00:00
for ( i = 0 ; i < ODM_ASSOCIATE_ENTRY_NUM ; i + + ) {
2014-12-30 19:48:00 +00:00
if ( IS_STA_VALID ( psta = pDM_Odm - > pODM_StaInfo [ i ] ) ) {
2015-08-15 18:02:34 +00:00
if ( IS_MCAST ( psta - > hwaddr ) ) /* if (psta->mac_id ==1) */
2014-12-30 19:48:00 +00:00
continue ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( psta - > rssi_stat . UndecoratedSmoothedPWDB < tmpEntryMinPWDB )
2014-12-30 19:48:00 +00:00
tmpEntryMinPWDB = psta - > rssi_stat . UndecoratedSmoothedPWDB ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( psta - > rssi_stat . UndecoratedSmoothedPWDB > tmpEntryMaxPWDB )
2014-12-30 19:48:00 +00:00
tmpEntryMaxPWDB = psta - > rssi_stat . UndecoratedSmoothedPWDB ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( psta - > rssi_stat . UndecoratedSmoothedPWDB ! = ( - 1 ) ) {
2014-12-30 19:48:00 +00:00
PWDB_rssi [ sta_cnt + + ] = ( psta - > mac_id | ( psta - > rssi_stat . UndecoratedSmoothedPWDB < < 16 ) ) ;
2014-12-17 04:09:56 +00:00
}
}
}
2014-12-19 06:59:46 +00:00
2015-08-15 18:06:32 +00:00
for ( i = 0 ; i < sta_cnt ; i + + )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:24:16 +00:00
if ( PWDB_rssi [ i ] ! = ( 0 ) ) {
2015-08-15 18:02:34 +00:00
if ( pHalData - > fw_ractrl = = true ) /* Report every sta's RSSI to FW */
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:27:00 +00:00
else {
2015-08-15 18:02:34 +00:00
# if (RATE_ADAPTIVE_SUPPORT == 1)
2014-12-17 04:09:56 +00:00
ODM_RA_SetRSSI_8188E (
& ( pHalData - > odmpriv ) , ( PWDB_rssi [ i ] & 0xFF ) , ( u8 ) ( ( PWDB_rssi [ i ] > > 16 ) & 0xFF ) ) ;
# endif
}
}
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:02:34 +00:00
if ( tmpEntryMaxPWDB ! = 0 ) /* If associated entry is found */
2014-12-17 04:09:56 +00:00
{
2014-12-19 06:59:46 +00:00
pdmpriv - > EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB ;
2014-12-17 04:09:56 +00:00
}
else
{
pdmpriv - > EntryMaxUndecoratedSmoothedPWDB = 0 ;
}
2015-08-15 18:02:34 +00:00
if ( tmpEntryMinPWDB ! = 0xff ) /* If associated entry is found */
2014-12-17 04:09:56 +00:00
{
2014-12-19 06:59:46 +00:00
pdmpriv - > EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB ;
2014-12-17 04:09:56 +00:00
}
else
{
pdmpriv - > EntryMinUndecoratedSmoothedPWDB = 0 ;
}
2015-02-20 00:51:33 +00:00
FindMinimumRSSI ( Adapter ) ; /* get pdmpriv->MinUndecoratedPWDBForDM */
2014-12-17 04:09:56 +00:00
pDM_Odm - > RSSI_Min = pdmpriv - > MinUndecoratedPWDBForDM ;
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_RSSIMonitorCheckAP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_InitAllTimers (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
ODM_InitializeTimer ( pDM_Odm , & pDM_Odm - > DM_SWAT_Table . SwAntennaSwitchTimer ,
( RT_TIMER_CALL_BACK ) odm_SwAntDivChkAntSwitchCallback , NULL , " SwAntennaSwitchTimer " ) ;
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_CancelAllTimers (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
ODM_CancelTimer ( pDM_Odm , & pDM_Odm - > DM_SWAT_Table . SwAntennaSwitchTimer ) ;
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_ReleaseAllTimers (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
ODM_ReleaseTimer ( pDM_Odm , & pDM_Odm - > DM_SWAT_Table . SwAntennaSwitchTimer ) ;
ODM_ReleaseTimer ( pDM_Odm , & pDM_Odm - > FastAntTrainingTimer ) ;
}
2015-02-20 00:51:33 +00:00
/* 3============================================================ */
/* 3 Tx Power Tracking */
/* 3============================================================ */
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
odm_TXPowerTrackingThermalMeterInit ( pDM_Odm ) ;
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingThermalMeterInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2014-12-19 06:59:46 +00:00
{
2014-12-17 04:09:56 +00:00
{
2014-12-29 02:13:24 +00:00
pDM_Odm - > RFCalibrateInfo . bTXPowerTracking = true ;
2014-12-17 04:09:56 +00:00
pDM_Odm - > RFCalibrateInfo . TXPowercount = 0 ;
2014-12-29 02:13:24 +00:00
pDM_Odm - > RFCalibrateInfo . bTXPowerTrackingInit = false ;
2014-12-17 04:09:56 +00:00
if ( * ( pDM_Odm - > mp_mode ) ! = 1 )
2014-12-29 02:13:24 +00:00
pDM_Odm - > RFCalibrateInfo . TxPowerTrackControl = true ;
2014-12-17 04:09:56 +00:00
MSG_8192C ( " pDM_Odm TxPowerTrackControl = %d \n " , pDM_Odm - > RFCalibrateInfo . TxPowerTrackControl ) ;
}
2015-03-02 23:25:27 +00:00
pDM_Odm - > RFCalibrateInfo . TxPowerTrackControl = true ;
2014-12-17 04:09:56 +00:00
pDM_Odm - > RFCalibrateInfo . DeltaPowerIndex = 0 ;
pDM_Odm - > RFCalibrateInfo . DeltaPowerIndexLast = 0 ;
pDM_Odm - > RFCalibrateInfo . PowerIndexOffset = 0 ;
pDM_Odm - > RFCalibrateInfo . ThermalValue = 0 ;
pDM_Odm - > DefaultOfdmIndex = 12 ;
2014-12-19 06:59:46 +00:00
pDM_Odm - > DefaultCckIndex = 12 ;
2014-12-17 04:09:56 +00:00
pDM_Odm - > BbSwingIdxOfdmBase = pDM_Odm - > DefaultOfdmIndex ;
pDM_Odm - > BbSwingIdxCckBase = pDM_Odm - > DefaultCckIndex ;
pDM_Odm - > BbSwingIdxOfdm = pDM_Odm - > DefaultOfdmIndex ;
pDM_Odm - > BbSwingIdxCck = pDM_Odm - > DefaultCckIndex ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
pDM_Odm - > RFCalibrateInfo . CCK_index = pDM_Odm - > DefaultCckIndex ;
2014-12-19 06:59:46 +00:00
pDM_Odm - > RFCalibrateInfo . OFDM_index [ RF_PATH_A ] = pDM_Odm - > DefaultOfdmIndex ;
pDM_Odm - > RFCalibrateInfo . OFDM_index [ RF_PATH_B ] = pDM_Odm - > DefaultOfdmIndex ;
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_TXPowerTrackingCheck (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2015-02-20 00:51:33 +00:00
/* */
/* For AP/ADSL use prtl8192cd_priv */
/* For CE/NIC use PADAPTER */
/* */
2014-12-17 23:13:53 +00:00
struct adapter * pAdapter = pDM_Odm - > Adapter ;
2014-12-17 04:09:56 +00:00
prtl8192cd_priv priv = pDM_Odm - > priv ;
2015-02-20 00:51:33 +00:00
/* if (!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK)) */
/* return; */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* */
/* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */
/* at the same time. In the stage2/3, we need to prive universal interface and merge all */
/* HW dynamic mechanism. */
/* */
2016-04-09 19:30:01 +00:00
odm_TXPowerTrackingCheckCE ( pDM_Odm ) ;
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingCheckCE (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2014-12-17 23:13:53 +00:00
struct adapter * Adapter = pDM_Odm - > Adapter ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_RF_TX_PWR_TRACK ) )
2014-12-17 04:09:56 +00:00
{
return ;
}
2015-08-15 18:02:34 +00:00
if ( ! pDM_Odm - > RFCalibrateInfo . TM_Trigger ) /* at least delay 1 sec */
2014-12-17 04:09:56 +00:00
{
PHY_SetRFReg ( Adapter , RF_PATH_A , RF_T_METER_88E , BIT17 | BIT16 , 0x03 ) ;
pDM_Odm - > RFCalibrateInfo . TM_Trigger = 1 ;
return ;
}
else
{
odm_TXPowerTrackingCallback_ThermalMeter_8188E ( Adapter ) ;
pDM_Odm - > RFCalibrateInfo . TM_Trigger = 0 ;
}
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingCheckMP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2014-12-30 19:48:00 +00:00
}
2014-12-17 04:09:56 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_TXPowerTrackingCheckAP (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2015-02-20 00:51:33 +00:00
/* antenna mapping info */
/* 1: right-side antenna */
/* 2/0: left-side antenna */
/* PDM_SWAT_Table->CCK_Ant1_Cnt /OFDM_Ant1_Cnt: for right-side antenna: Ant:1 RxDefaultAnt1 */
/* PDM_SWAT_Table->CCK_Ant2_Cnt /OFDM_Ant2_Cnt: for left-side antenna: Ant:0 RxDefaultAnt2 */
/* We select left antenna as default antenna in initial process, modify it as needed */
/* */
/* 3============================================================ */
/* 3 SW Antenna Diversity */
/* 3============================================================ */
2015-03-13 17:06:38 +00:00
void odm_SwAntDivInit ( PDM_ODM_T pDM_Odm ) { }
2014-12-29 02:06:17 +00:00
void ODM_SwAntDivChkPerPktRssi (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 StationID ,
PODM_PHY_INFO_T pPhyInfo
2014-12-17 04:09:56 +00:00
) { }
2014-12-29 02:06:17 +00:00
void odm_SwAntDivChkAntSwitch (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 Step
2014-12-17 04:09:56 +00:00
) { }
2015-08-15 18:24:16 +00:00
static void ODM_SwAntDivResetBeforeLink ( PDM_ODM_T pDM_Odm ) { }
void ODM_SwAntDivRestAfterLink ( PDM_ODM_T pDM_Odm ) { }
void odm_SwAntDivChkAntSwitchCallback ( void * FunctionContext ) { }
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* 3============================================================ */
/* 3 SW Antenna Diversity */
/* 3============================================================ */
2014-12-17 04:09:56 +00:00
2015-01-29 21:27:28 +00:00
static void
2014-12-17 04:09:56 +00:00
odm_InitHybridAntDiv_88C_92D (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
SWAT_T * pDM_SWAT_Table = & pDM_Odm - > DM_SWAT_Table ;
2015-02-20 00:51:33 +00:00
u8 bTxPathSel = 0 ; /* 0:Path-A 1:Path-B */
2014-12-30 23:50:44 +00:00
u8 i ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " odm_InitHybridAntDiv==============> \n " ) ) ;
2015-02-20 00:51:33 +00:00
/* whether to do antenna diversity or not */
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > SupportICType ! = ODM_RTL8192C ) & & ( pDM_Odm - > SupportICType ! = ODM_RTL8192D ) )
2014-12-17 04:09:56 +00:00
return ;
2015-03-02 23:25:27 +00:00
bTxPathSel = ( pDM_Odm - > RFType = = ODM_1T1R ) ? false : true ;
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_BB_PWR_SAV1_11N , BIT23 , 0 ) ; /* No update ANTSEL during GNT_BT=1 */
ODM_SetBBReg ( pDM_Odm , ODM_REG_TX_ANT_CTRL_11N , BIT21 , 1 ) ; /* TX atenna selection from tx_info */
ODM_SetBBReg ( pDM_Odm , ODM_REG_ANTSEL_PIN_11N , BIT23 , 1 ) ; /* enable LED[1:0] pin as ANTSEL */
ODM_SetBBReg ( pDM_Odm , ODM_REG_ANTSEL_CTRL_11N , BIT8 | BIT9 , 0x01 ) ; /* 0x01: left antenna, 0x02: right antenna */
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* only AP support different path selection temperarly */
2015-08-15 18:24:16 +00:00
if ( ! bTxPathSel ) { /* PATH-A */
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_PIN_CTRL_11N , BIT8 | BIT9 , 0 ) ; /* ANTSEL as HW control */
ODM_SetBBReg ( pDM_Odm , ODM_REG_ANTSEL_PATH_11N , BIT13 , 1 ) ; /* select TX ANTESEL from path A */
2014-12-17 04:09:56 +00:00
}
else {
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_PIN_CTRL_11N , BIT24 | BIT25 , 0 ) ; /* ANTSEL as HW control */
ODM_SetBBReg ( pDM_Odm , ODM_REG_ANTSEL_PATH_11N , BIT13 , 0 ) ; /* select ANTESEL from path B */
2014-12-17 04:09:56 +00:00
}
2015-02-20 00:51:33 +00:00
/* Set OFDM HW RX Antenna Diversity */
ODM_SetBBReg ( pDM_Odm , ODM_REG_ANTDIV_PARA1_11N , 0x7FF , 0x0c0 ) ; /* Pwdb threshold=8dB */
ODM_SetBBReg ( pDM_Odm , ODM_REG_ANTDIV_PARA1_11N , BIT11 , 0 ) ; /* Switch to another antenna by checking pwdb threshold */
ODM_SetBBReg ( pDM_Odm , ODM_REG_ANTDIV_PARA3_11N , BIT23 , 1 ) ; /* Decide final antenna by comparing 2 antennas' pwdb */
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* Set CCK HW RX Antenna Diversity */
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_ANTDIV_PARA2_11N , BIT4 , 0 ) ; /* Antenna diversity decision period = 32 sample */
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_ANTDIV_PARA2_11N , 0xf , 0xf ) ; /* Threshold for antenna diversity. Check another antenna power if input power < ANT_lim*4 */
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_ANTDIV_PARA3_11N , BIT13 , 1 ) ; /* polarity ana_A=1 and ana_B=0 */
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_ANTDIV_PARA4_11N , 0x1f , 0x8 ) ; /* default antenna power = inpwr*(0.5 + r_ant_step/16) */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* Enable HW Antenna Diversity */
2015-08-15 18:02:34 +00:00
if ( ! bTxPathSel ) /* PATH-A */
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_IGI_A_11N , BIT7 , 1 ) ; /* Enable Hardware antenna switch */
2014-12-17 04:09:56 +00:00
else
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_IGI_B_11N , BIT7 , 1 ) ; /* Enable Hardware antenna switch */
ODM_SetBBReg ( pDM_Odm , ODM_REG_CCK_ANTDIV_PARA1_11N , BIT15 , 1 ) ; /* Enable antenna diversity */
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
pDM_SWAT_Table - > CurAntenna = 0 ; /* choose left antenna as default antenna */
2014-12-17 04:09:56 +00:00
pDM_SWAT_Table - > PreAntenna = 0 ;
2015-08-15 18:06:32 +00:00
for ( i = 0 ; i < ASSOCIATE_ENTRY_NUM ; i + + )
2014-12-17 04:09:56 +00:00
{
pDM_SWAT_Table - > CCK_Ant1_Cnt [ i ] = 0 ;
pDM_SWAT_Table - > CCK_Ant2_Cnt [ i ] = 0 ;
pDM_SWAT_Table - > OFDM_Ant1_Cnt [ i ] = 0 ;
pDM_SWAT_Table - > OFDM_Ant2_Cnt [ i ] = 0 ;
pDM_SWAT_Table - > RSSI_Ant1_Sum [ i ] = 0 ;
pDM_SWAT_Table - > RSSI_Ant2_Sum [ i ] = 0 ;
}
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " <==============odm_InitHybridAntDiv \n " ) ) ;
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_InitHybridAntDiv (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_ANT_DIV ) )
2014-12-17 04:09:56 +00:00
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " Return: Not Support HW AntDiv \n " ) ) ;
return ;
}
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ( ODM_RTL8192C | ODM_RTL8192D ) )
2014-12-17 04:09:56 +00:00
{
}
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > SupportICType = = ODM_RTL8188E )
2014-12-17 04:09:56 +00:00
{
ODM_AntennaDiversityInit_88E ( pDM_Odm ) ;
}
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
}
2015-03-02 23:21:23 +00:00
bool
2014-12-17 04:09:56 +00:00
odm_StaDefAntSel (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u32 OFDM_Ant1_Cnt ,
u32 OFDM_Ant2_Cnt ,
u32 CCK_Ant1_Cnt ,
u32 CCK_Ant2_Cnt ,
u8 * pDefAnt
2014-12-17 04:09:56 +00:00
)
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " odm_StaDefAntSelect==============> \n " ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " OFDM_Ant1_Cnt:%d, OFDM_Ant2_Cnt:%d \n " , OFDM_Ant1_Cnt , OFDM_Ant2_Cnt ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " CCK_Ant1_Cnt:%d, CCK_Ant2_Cnt:%d \n " , CCK_Ant1_Cnt , CCK_Ant2_Cnt ) ) ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:24:16 +00:00
if ( ( ( OFDM_Ant1_Cnt + OFDM_Ant2_Cnt ) = = 0 ) & & ( ( CCK_Ant1_Cnt + CCK_Ant2_Cnt ) < 10 ) ) {
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " odm_StaDefAntSelect Fail: No enough packet info! \n " ) ) ;
2015-03-02 23:25:27 +00:00
return false ;
2014-12-17 04:09:56 +00:00
}
2015-08-15 18:02:34 +00:00
if ( OFDM_Ant1_Cnt | | OFDM_Ant2_Cnt ) {
2015-02-20 00:51:33 +00:00
/* if RX OFDM packet number larger than 0 */
2015-08-15 18:02:34 +00:00
if ( OFDM_Ant1_Cnt > OFDM_Ant2_Cnt )
2014-12-17 04:09:56 +00:00
( * pDefAnt ) = 1 ;
else
( * pDefAnt ) = 0 ;
}
2015-02-20 00:51:33 +00:00
/* else if RX CCK packet number larger than 10 */
2015-08-15 18:02:34 +00:00
else if ( ( CCK_Ant1_Cnt + CCK_Ant2_Cnt ) > = 10 )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( CCK_Ant1_Cnt > ( 5 * CCK_Ant2_Cnt ) )
2014-12-17 04:09:56 +00:00
( * pDefAnt ) = 1 ;
2015-08-15 18:02:34 +00:00
else if ( CCK_Ant2_Cnt > ( 5 * CCK_Ant1_Cnt ) )
2014-12-17 04:09:56 +00:00
( * pDefAnt ) = 0 ;
2015-08-15 18:02:34 +00:00
else if ( CCK_Ant1_Cnt > CCK_Ant2_Cnt )
2014-12-17 04:09:56 +00:00
( * pDefAnt ) = 0 ;
else
( * pDefAnt ) = 1 ;
}
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " TxAnt = %s \n " , ( ( * pDefAnt ) = = 1 ) ? " Ant1 " : " Ant2 " ) ) ;
2014-12-19 06:59:46 +00:00
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " <==============odm_StaDefAntSelect \n " ) ) ;
2015-03-02 23:25:27 +00:00
return true ;
2014-12-17 04:09:56 +00:00
}
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
odm_SetRxIdleAnt (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 Ant ,
bool bDualPath
2014-12-17 04:09:56 +00:00
)
{
SWAT_T * pDM_SWAT_Table = & pDM_Odm - > DM_SWAT_Table ;
2015-08-15 18:02:34 +00:00
if ( Ant ! = pDM_SWAT_Table - > RxIdleAnt ) {
2015-03-10 16:18:03 +00:00
/* for path-A */
2015-08-15 18:02:34 +00:00
if ( Ant = = 1 )
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_RX_DEFUALT_A_11N , 0xFFFF , 0x65a9 ) ; /* right-side antenna */
2015-03-10 16:18:03 +00:00
else
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_RX_DEFUALT_A_11N , 0xFFFF , 0x569a ) ; /* left-side antenna */
2014-12-17 04:09:56 +00:00
2015-03-10 16:18:03 +00:00
/* for path-B */
2015-08-15 18:24:16 +00:00
if ( bDualPath ) {
2015-08-15 18:22:58 +00:00
if ( Ant = = 0 )
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_RX_DEFUALT_A_11N , 0xFFFF0000 , 0x65a9 ) ; /* right-side antenna */
2015-03-10 16:18:03 +00:00
else
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , ODM_REG_RX_DEFUALT_A_11N , 0xFFFF0000 , 0x569a ) ; /* left-side antenna */
2014-12-17 04:09:56 +00:00
}
}
2015-03-10 16:18:03 +00:00
pDM_SWAT_Table - > RxIdleAnt = Ant ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " RxIdleAnt: %s Reg858=0x%x \n " , ( Ant = = 1 ) ? " Ant1 " : " Ant2 " , ( Ant = = 1 ) ? 0x65a9 : 0x569a ) ) ;
2015-03-10 16:18:03 +00:00
}
2014-12-19 06:59:46 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_AntselStatistics_88C (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 MacId ,
u32 PWDBAll ,
bool isCCKrate
2014-12-17 04:09:56 +00:00
)
{
SWAT_T * pDM_SWAT_Table = & pDM_Odm - > DM_SWAT_Table ;
2015-08-15 18:02:34 +00:00
if ( pDM_SWAT_Table - > antsel = = 1 )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( isCCKrate )
2014-12-17 04:09:56 +00:00
pDM_SWAT_Table - > CCK_Ant1_Cnt [ MacId ] + + ;
else
{
pDM_SWAT_Table - > OFDM_Ant1_Cnt [ MacId ] + + ;
pDM_SWAT_Table - > RSSI_Ant1_Sum [ MacId ] + = PWDBAll ;
}
}
else
{
2015-08-15 18:02:34 +00:00
if ( isCCKrate )
2014-12-17 04:09:56 +00:00
pDM_SWAT_Table - > CCK_Ant2_Cnt [ MacId ] + + ;
else
{
pDM_SWAT_Table - > OFDM_Ant2_Cnt [ MacId ] + + ;
pDM_SWAT_Table - > RSSI_Ant2_Sum [ MacId ] + = PWDBAll ;
}
}
}
2015-01-29 21:27:28 +00:00
static void
2014-12-17 04:09:56 +00:00
ODM_SetTxAntByTxInfo_88C_92D (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
}
2015-01-29 21:27:28 +00:00
static void
2014-12-17 04:09:56 +00:00
odm_HwAntDiv_92C_92D (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
{
SWAT_T * pDM_SWAT_Table = & pDM_Odm - > DM_SWAT_Table ;
2014-12-30 22:55:10 +00:00
u32 RSSI_Min = 0xFF , RSSI , RSSI_Ant1 , RSSI_Ant2 ;
2014-12-30 23:50:44 +00:00
u8 RxIdleAnt , i ;
2015-03-02 23:25:27 +00:00
bool bRet = false ;
2014-12-19 06:59:46 +00:00
PSTA_INFO_T pEntry ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " odm_HwAntDiv==============> \n " ) ) ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_ANT_DIV ) ) /* if don't support antenna diveristy */
2014-12-17 04:09:56 +00:00
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " odm_HwAntDiv: Not supported! \n " ) ) ;
return ;
}
2015-08-15 18:02:34 +00:00
if ( ( pDM_Odm - > SupportICType ! = ODM_RTL8192C ) & & ( pDM_Odm - > SupportICType ! = ODM_RTL8192D ) ) {
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " Return: IC Type is not 92C or 92D \n " ) ) ;
return ;
}
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( ! pDM_Odm - > bLinked ) {
2015-03-02 23:25:27 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " Return: bLinked is false \n " ) ) ;
2014-12-17 04:09:56 +00:00
return ;
}
for ( i = 0 ; i < ODM_ASSOCIATE_ENTRY_NUM ; i + + )
{
pEntry = pDM_Odm - > pODM_StaInfo [ i ] ;
2015-08-15 18:02:34 +00:00
if ( IS_STA_VALID ( pEntry ) )
2014-12-17 04:09:56 +00:00
{
RSSI_Ant1 = ( pDM_SWAT_Table - > OFDM_Ant1_Cnt [ i ] = = 0 ) ? 0 : ( pDM_SWAT_Table - > RSSI_Ant1_Sum [ i ] / pDM_SWAT_Table - > OFDM_Ant1_Cnt [ i ] ) ;
RSSI_Ant2 = ( pDM_SWAT_Table - > OFDM_Ant2_Cnt [ i ] = = 0 ) ? 0 : ( pDM_SWAT_Table - > RSSI_Ant2_Sum [ i ] / pDM_SWAT_Table - > OFDM_Ant2_Cnt [ i ] ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " RSSI_Ant1=%d, RSSI_Ant2=%d \n " , RSSI_Ant1 , RSSI_Ant2 ) ) ;
2014-12-19 06:59:46 +00:00
2015-08-15 18:02:34 +00:00
if ( RSSI_Ant1 | | RSSI_Ant2 )
2014-12-17 04:09:56 +00:00
{
2014-12-30 19:48:00 +00:00
RSSI = ( RSSI_Ant1 < RSSI_Ant2 ) ? RSSI_Ant1 : RSSI_Ant2 ;
2015-08-15 18:02:34 +00:00
if ( ( ! RSSI ) | | ( RSSI < RSSI_Min ) ) {
2014-12-30 19:48:00 +00:00
pDM_SWAT_Table - > TargetSTA = i ;
RSSI_Min = RSSI ;
2014-12-17 04:09:56 +00:00
}
2014-12-30 19:48:00 +00:00
}
2015-02-20 00:51:33 +00:00
/* STA: found out default antenna */
2014-12-19 06:59:46 +00:00
bRet = odm_StaDefAntSel ( pDM_Odm ,
pDM_SWAT_Table - > OFDM_Ant1_Cnt [ i ] ,
pDM_SWAT_Table - > OFDM_Ant2_Cnt [ i ] ,
pDM_SWAT_Table - > CCK_Ant1_Cnt [ i ] ,
pDM_SWAT_Table - > CCK_Ant2_Cnt [ i ] ,
2014-12-17 04:09:56 +00:00
& pDM_SWAT_Table - > TxAnt [ i ] ) ;
2015-02-20 00:51:33 +00:00
/* if Tx antenna selection: successful */
2015-08-15 18:24:16 +00:00
if ( bRet ) {
2014-12-17 04:09:56 +00:00
pDM_SWAT_Table - > RSSI_Ant1_Sum [ i ] = 0 ;
pDM_SWAT_Table - > RSSI_Ant2_Sum [ i ] = 0 ;
pDM_SWAT_Table - > OFDM_Ant1_Cnt [ i ] = 0 ;
2014-12-19 06:59:46 +00:00
pDM_SWAT_Table - > OFDM_Ant2_Cnt [ i ] = 0 ;
pDM_SWAT_Table - > CCK_Ant1_Cnt [ i ] = 0 ;
pDM_SWAT_Table - > CCK_Ant2_Cnt [ i ] = 0 ;
2014-12-17 04:09:56 +00:00
}
}
}
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* set RX Idle Ant */
2014-12-30 19:48:00 +00:00
RxIdleAnt = pDM_SWAT_Table - > TxAnt [ pDM_SWAT_Table - > TargetSTA ] ;
2015-03-02 23:25:27 +00:00
odm_SetRxIdleAnt ( pDM_Odm , RxIdleAnt , false ) ;
2014-12-19 06:59:46 +00:00
2014-12-30 19:48:00 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " <==============odm_HwAntDiv \n " ) ) ;
}
2013-05-08 21:45:39 +00:00
2014-12-30 19:48:00 +00:00
void
odm_HwAntDiv (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-30 19:48:00 +00:00
)
{
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_ANT_DIV ) )
2014-12-30 19:48:00 +00:00
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " Return: Not Support HW AntDiv \n " ) ) ;
2014-12-17 04:09:56 +00:00
return ;
2014-12-30 19:48:00 +00:00
}
2013-07-15 04:50:52 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType & ( ODM_RTL8192C | ODM_RTL8192D ) )
2014-12-17 04:09:56 +00:00
{
}
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > SupportICType = = ODM_RTL8188E )
2014-12-17 04:09:56 +00:00
{
2014-12-30 19:48:00 +00:00
ODM_AntennaDiversity_88E ( pDM_Odm ) ;
2013-07-15 04:50:52 +00:00
}
2014-12-30 19:48:00 +00:00
2013-07-15 04:50:52 +00:00
}
2013-05-19 04:28:07 +00:00
2015-02-20 00:51:33 +00:00
/* */
/* EDCA Turbo */
/* */
2014-12-30 19:48:00 +00:00
void
ODM_EdcaTurboInit (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm )
2014-12-30 19:48:00 +00:00
{
struct adapter * Adapter = pDM_Odm - > Adapter ;
2015-03-02 23:25:27 +00:00
pDM_Odm - > DM_EDCA_Table . bCurrentTurboEDCA = false ;
pDM_Odm - > DM_EDCA_Table . bIsCurRDLState = false ;
Adapter - > recvpriv . bIsAnyNonBEPkts = false ;
2014-12-30 19:48:00 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_EDCA_TURBO , ODM_DBG_LOUD , ( " Orginial VO PARAM: 0x%x \n " , ODM_Read4Byte ( pDM_Odm , ODM_EDCA_VO_PARAM ) ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_EDCA_TURBO , ODM_DBG_LOUD , ( " Orginial VI PARAM: 0x%x \n " , ODM_Read4Byte ( pDM_Odm , ODM_EDCA_VI_PARAM ) ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_EDCA_TURBO , ODM_DBG_LOUD , ( " Orginial BE PARAM: 0x%x \n " , ODM_Read4Byte ( pDM_Odm , ODM_EDCA_BE_PARAM ) ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_EDCA_TURBO , ODM_DBG_LOUD , ( " Orginial BK PARAM: 0x%x \n " , ODM_Read4Byte ( pDM_Odm , ODM_EDCA_BK_PARAM ) ) ) ;
2015-02-20 00:51:33 +00:00
} /* ODM_InitEdcaTurbo */
2013-05-08 21:45:39 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-30 19:48:00 +00:00
odm_EdcaTurboCheck (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2013-07-15 04:50:52 +00:00
{
2015-02-20 00:51:33 +00:00
/* */
/* For AP/ADSL use prtl8192cd_priv */
/* For CE/NIC use PADAPTER */
/* */
2014-12-30 19:48:00 +00:00
struct adapter * pAdapter = pDM_Odm - > Adapter ;
prtl8192cd_priv priv = pDM_Odm - > priv ;
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* */
/* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */
/* at the same time. In the stage2/3, we need to prive universal interface and merge all */
/* HW dynamic mechanism. */
/* */
2014-12-30 19:48:00 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_EDCA_TURBO , ODM_DBG_LOUD , ( " odm_EdcaTurboCheck========================> \n " ) ) ;
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_MAC_EDCA_TURBO ) )
2014-12-30 19:48:00 +00:00
return ;
2016-04-09 19:30:01 +00:00
odm_EdcaTurboCheckCE ( pDM_Odm ) ;
2014-12-30 19:48:00 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_EDCA_TURBO , ODM_DBG_LOUD , ( " <========================odm_EdcaTurboCheck \n " ) ) ;
2013-05-08 21:45:39 +00:00
2015-02-20 00:51:33 +00:00
} /* odm_CheckEdcaTurbo */
2013-05-19 04:28:07 +00:00
2014-12-29 02:06:17 +00:00
void
2014-12-30 19:48:00 +00:00
odm_EdcaTurboCheckCE (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-30 19:48:00 +00:00
)
2014-12-17 04:09:56 +00:00
{
2014-12-30 19:48:00 +00:00
struct adapter * Adapter = pDM_Odm - > Adapter ;
u32 trafficIndex ;
u32 edca_param ;
u64 cur_tx_bytes = 0 ;
u64 cur_rx_bytes = 0 ;
u8 bbtchange = false ;
HAL_DATA_TYPE * pHalData = GET_HAL_DATA ( Adapter ) ;
struct xmit_priv * pxmitpriv = & ( Adapter - > xmitpriv ) ;
struct recv_priv * precvpriv = & ( Adapter - > recvpriv ) ;
struct registry_priv * pregpriv = & Adapter - > registrypriv ;
struct mlme_ext_priv * pmlmeext = & ( Adapter - > mlmeextpriv ) ;
struct mlme_ext_info * pmlmeinfo = & ( pmlmeext - > mlmext_info ) ;
2015-02-20 00:51:33 +00:00
if ( ( pregpriv - > wifi_spec = = 1 ) ) /* (pmlmeinfo->HT_enable == 0)) */
2014-12-30 19:48:00 +00:00
{
goto dm_CheckEdcaTurbo_EXIT ;
}
if ( pmlmeinfo - > assoc_AP_vendor > = HT_IOT_PEER_MAX )
{
goto dm_CheckEdcaTurbo_EXIT ;
}
# ifdef CONFIG_BT_COEXIST
if ( BT_DisableEDCATurbo ( Adapter ) )
{
goto dm_CheckEdcaTurbo_EXIT ;
}
# endif
2015-02-20 00:51:33 +00:00
/* Check if the status needs to be changed. */
2015-08-15 18:02:34 +00:00
if ( ( bbtchange ) | | ( ! precvpriv - > bIsAnyNonBEPkts ) )
2014-12-19 06:59:46 +00:00
{
2014-12-30 19:48:00 +00:00
cur_tx_bytes = pxmitpriv - > tx_bytes - pxmitpriv - > last_tx_bytes ;
cur_rx_bytes = precvpriv - > rx_bytes - precvpriv - > last_rx_bytes ;
2015-02-20 00:51:33 +00:00
/* traffic, TX or RX */
2015-08-15 18:02:34 +00:00
if ( ( pmlmeinfo - > assoc_AP_vendor = = HT_IOT_PEER_RALINK ) | | ( pmlmeinfo - > assoc_AP_vendor = = HT_IOT_PEER_ATHEROS ) )
2014-12-17 04:09:56 +00:00
{
2014-12-30 19:48:00 +00:00
if ( cur_tx_bytes > ( cur_rx_bytes < < 2 ) )
2015-02-20 00:51:33 +00:00
{ /* Uplink TP is present. */
2014-12-30 19:48:00 +00:00
trafficIndex = UP_LINK ;
}
else
2015-02-20 00:51:33 +00:00
{ /* Balance TP is present. */
2014-12-30 19:48:00 +00:00
trafficIndex = DOWN_LINK ;
}
2014-12-17 04:09:56 +00:00
}
else
{
2014-12-30 19:48:00 +00:00
if ( cur_rx_bytes > ( cur_tx_bytes < < 2 ) )
2015-02-20 00:51:33 +00:00
{ /* Downlink TP is present. */
2014-12-30 19:48:00 +00:00
trafficIndex = DOWN_LINK ;
}
else
2015-02-20 00:51:33 +00:00
{ /* Balance TP is present. */
2014-12-30 19:48:00 +00:00
trafficIndex = UP_LINK ;
}
2014-12-17 04:09:56 +00:00
}
2014-12-30 19:48:00 +00:00
if ( ( pDM_Odm - > DM_EDCA_Table . prv_traffic_idx ! = trafficIndex ) | | ( ! pDM_Odm - > DM_EDCA_Table . bCurrentTurboEDCA ) )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( ( pmlmeinfo - > assoc_AP_vendor = = HT_IOT_PEER_CISCO ) & & ( pmlmeext - > cur_wireless_mode & WIRELESS_11_24N ) )
2014-12-30 19:48:00 +00:00
{
edca_param = EDCAParam [ pmlmeinfo - > assoc_AP_vendor ] [ trafficIndex ] ;
}
else
{
edca_param = EDCAParam [ HT_IOT_PEER_UNKNOWN ] [ trafficIndex ] ;
}
2015-08-15 18:02:34 +00:00
if ( IS_92C_SERIAL ( pHalData - > VersionID ) )
2014-12-30 19:48:00 +00:00
edca_param = 0x60a42b ;
else
edca_param = 0x6ea42b ;
rtw_write32 ( Adapter , REG_EDCA_BE_PARAM , edca_param ) ;
pDM_Odm - > DM_EDCA_Table . prv_traffic_idx = trafficIndex ;
2014-12-17 04:09:56 +00:00
}
2014-12-30 19:48:00 +00:00
pDM_Odm - > DM_EDCA_Table . bCurrentTurboEDCA = true ;
} else {
2015-02-20 00:51:33 +00:00
/* */
/* Turn Off EDCA turbo here. */
/* Restore original EDCA according to the declaration of AP. */
/* */
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > DM_EDCA_Table . bCurrentTurboEDCA )
2014-12-17 04:09:56 +00:00
{
2014-12-30 19:48:00 +00:00
rtw_write32 ( Adapter , REG_EDCA_BE_PARAM , pHalData - > AcParam_BE ) ;
pDM_Odm - > DM_EDCA_Table . bCurrentTurboEDCA = false ;
2014-12-17 04:09:56 +00:00
}
2013-05-08 21:45:39 +00:00
}
2014-12-30 19:48:00 +00:00
dm_CheckEdcaTurbo_EXIT :
2015-02-20 00:51:33 +00:00
/* Set variables for next time. */
2014-12-30 19:48:00 +00:00
precvpriv - > bIsAnyNonBEPkts = false ;
pxmitpriv - > last_tx_bytes = pxmitpriv - > tx_bytes ;
precvpriv - > last_rx_bytes = precvpriv - > rx_bytes ;
2014-12-17 04:09:56 +00:00
}
2013-05-08 21:45:39 +00:00
2015-02-20 00:51:33 +00:00
/* move to here for ANT detection mechanism using */
2014-12-30 19:48:00 +00:00
2014-12-30 22:55:10 +00:00
u32
2014-12-30 19:48:00 +00:00
GetPSDData (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
2014-12-30 19:48:00 +00:00
unsigned int point ,
2014-12-30 23:50:44 +00:00
u8 initial_gain_psd )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
/* unsigned int val, rfval; */
/* int psd_report; */
2014-12-30 22:55:10 +00:00
u32 psd_report ;
2014-12-30 19:48:00 +00:00
2015-02-20 00:51:33 +00:00
/* Set DCO frequency index, offset=(40MHz/SamplePts)*point */
2014-12-30 19:48:00 +00:00
ODM_SetBBReg ( pDM_Odm , 0x808 , 0x3FF , point ) ;
2015-02-20 00:51:33 +00:00
/* Start PSD calculation, Reg808[22]=0->1 */
2014-12-30 19:48:00 +00:00
ODM_SetBBReg ( pDM_Odm , 0x808 , BIT22 , 1 ) ;
2015-02-20 00:51:33 +00:00
/* Need to wait for HW PSD report */
2014-12-30 19:48:00 +00:00
ODM_StallExecution ( 30 ) ;
ODM_SetBBReg ( pDM_Odm , 0x808 , BIT22 , 0 ) ;
2015-02-20 00:51:33 +00:00
/* Read PSD report, Reg8B4[15:0] */
2014-12-30 19:48:00 +00:00
psd_report = ODM_GetBBReg ( pDM_Odm , 0x8B4 , bMaskDWord ) & 0x0000FFFF ;
2014-12-30 22:55:10 +00:00
psd_report = ( u32 ) ( ConvertTo_dB ( psd_report ) ) + ( u32 ) ( initial_gain_psd - 0x1c ) ;
2013-05-08 21:45:39 +00:00
2014-12-30 19:48:00 +00:00
return psd_report ;
2014-12-17 04:09:56 +00:00
}
2013-05-08 21:45:39 +00:00
2014-12-30 22:55:10 +00:00
u32
2014-12-30 19:48:00 +00:00
ConvertTo_dB (
2014-12-30 22:55:10 +00:00
u32 Value )
2014-12-30 19:48:00 +00:00
{
2014-12-30 23:50:44 +00:00
u8 i ;
u8 j ;
2014-12-30 22:55:10 +00:00
u32 dB ;
2014-12-30 19:48:00 +00:00
Value = Value & 0xFFFF ;
for ( i = 0 ; i < 8 ; i + + ) {
if ( Value < = dB_Invert_Table [ i ] [ 11 ] )
break ;
}
if ( i > = 8 )
2015-02-20 00:51:33 +00:00
return 96 ; /* maximum 96 dB */
2014-12-30 19:48:00 +00:00
for ( j = 0 ; j < 12 ; j + + ) {
if ( Value < = dB_Invert_Table [ i ] [ j ] )
break ;
}
dB = i * 12 + j + 1 ;
return dB ;
}
2013-05-08 21:45:39 +00:00
2015-02-20 00:51:33 +00:00
/* */
/* 2011/09/22 MH Add for 92D global spin lock utilization. */
/* */
2014-12-30 19:48:00 +00:00
void
odm_GlobalAdapterCheck (
2015-03-13 17:06:38 +00:00
void
2014-12-30 19:48:00 +00:00
)
{
2015-02-20 00:51:33 +00:00
} /* odm_GlobalAdapterCheck */
/* */
/* Description: */
/* Set Single/Dual Antenna default setting for products that do not do detection in advance. */
/* */
/* Added by Joseph, 2012.03.22 */
/* */
2014-12-29 02:06:17 +00:00
void
2014-12-17 04:09:56 +00:00
ODM_SingleDualAntennaDefaultSetting (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm
2014-12-17 04:09:56 +00:00
)
2013-05-08 21:45:39 +00:00
{
2014-12-17 04:09:56 +00:00
pSWAT_T pDM_SWAT_Table = & pDM_Odm - > DM_SWAT_Table ;
2015-03-02 23:25:27 +00:00
pDM_SWAT_Table - > ANTA_ON = true ;
pDM_SWAT_Table - > ANTB_ON = true ;
2014-12-17 04:09:56 +00:00
}
2013-05-08 21:45:39 +00:00
2013-08-07 03:34:32 +00:00
2015-02-20 00:51:33 +00:00
/* 2 8723A ANT DETECT */
2013-05-08 21:45:39 +00:00
2015-01-29 21:27:28 +00:00
static void
2014-12-17 04:09:56 +00:00
odm_PHY_SaveAFERegisters (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u32 * AFEReg ,
u32 * AFEBackup ,
u32 RegisterNum
2014-12-17 04:09:56 +00:00
)
2013-05-08 21:45:39 +00:00
{
2014-12-30 22:55:10 +00:00
u32 i ;
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* RTPRINT(FINIT, INIT_IQK, ("Save ADDA parameters.\n")); */
2015-08-15 18:24:16 +00:00
for ( i = 0 ; i < RegisterNum ; i + + ) {
2013-05-08 21:45:39 +00:00
AFEBackup [ i ] = ODM_GetBBReg ( pDM_Odm , AFEReg [ i ] , bMaskDWord ) ;
2014-12-17 04:09:56 +00:00
}
2013-05-08 21:45:39 +00:00
}
2015-01-29 21:27:28 +00:00
static void
2014-12-17 04:09:56 +00:00
odm_PHY_ReloadAFERegisters (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u32 * AFEReg ,
u32 * AFEBackup ,
u32 RegiesterNum
2014-12-17 04:09:56 +00:00
)
2013-05-08 21:45:39 +00:00
{
2014-12-30 22:55:10 +00:00
u32 i ;
2013-05-19 04:28:07 +00:00
2015-02-20 00:51:33 +00:00
/* RTPRINT(FINIT, INIT_IQK, ("Reload ADDA power saving parameters !\n")); */
2015-08-15 18:06:32 +00:00
for ( i = 0 ; i < RegiesterNum ; i + + )
2014-12-17 04:09:56 +00:00
{
2014-12-19 06:59:46 +00:00
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , AFEReg [ i ] , bMaskDWord , AFEBackup [ i ] ) ;
2014-12-17 04:09:56 +00:00
}
2013-05-08 21:45:39 +00:00
}
2015-02-20 00:51:33 +00:00
/* 2 8723A ANT DETECT */
/* */
/* Description: */
/* Implement IQK single tone for RF DPK loopback and BB PSD scanning. */
/* This function is cooperated with BB team Neil. */
/* */
/* Added by Roger, 2011.12.15 */
/* */
2015-03-02 23:21:23 +00:00
bool
2014-12-17 04:09:56 +00:00
ODM_SingleDualAntennaDetection (
2015-03-13 17:06:38 +00:00
PDM_ODM_T pDM_Odm ,
u8 mode
2014-12-17 04:09:56 +00:00
)
{
2015-02-20 00:51:33 +00:00
/* HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); */
/* PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; */
2014-12-17 04:09:56 +00:00
pSWAT_T pDM_SWAT_Table = & pDM_Odm - > DM_SWAT_Table ;
2014-12-30 22:55:10 +00:00
u32 CurrentChannel , RfLoopReg ;
2014-12-30 23:50:44 +00:00
u8 n ;
2014-12-30 22:55:10 +00:00
u32 Reg88c , Regc08 , Reg874 , Regc50 ;
2014-12-30 23:50:44 +00:00
u8 initial_gain = 0x5a ;
2014-12-30 22:55:10 +00:00
u32 PSD_report_tmp ;
u32 AntA_report = 0x0 , AntB_report = 0x0 , AntO_report = 0x0 ;
2015-03-02 23:25:27 +00:00
bool bResult = true ;
2014-12-30 22:55:10 +00:00
u32 AFE_Backup [ 16 ] ;
u32 AFE_REG_8723A [ 16 ] = {
2014-12-19 06:59:46 +00:00
rRx_Wait_CCA , rTx_CCK_RFON ,
rTx_CCK_BBON , rTx_OFDM_RFON ,
rTx_OFDM_BBON , rTx_To_Rx ,
rTx_To_Tx , rRx_CCK ,
rRx_OFDM , rRx_Wait_RIFS ,
2014-12-17 04:09:56 +00:00
rRx_TO_Rx , rStandby ,
2014-12-19 06:59:46 +00:00
rSleep , rPMPD_ANAEN ,
2014-12-17 04:09:56 +00:00
rFPGA0_XCD_SwitchControl , rBlue_Tooth } ;
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportICType & ( ODM_RTL8723A | ODM_RTL8192C ) ) )
2013-05-08 21:45:39 +00:00
return bResult ;
2015-08-15 18:02:34 +00:00
if ( ! ( pDM_Odm - > SupportAbility & ODM_BB_ANT_DIV ) )
2013-05-08 21:45:39 +00:00
return bResult ;
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8192C )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
/* Which path in ADC/DAC is turnned on for PSD: both I/Q */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , 0x808 , BIT10 | BIT11 , 0x3 ) ;
2015-02-20 00:51:33 +00:00
/* Ageraged number: 8 */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , 0x808 , BIT12 | BIT13 , 0x1 ) ;
2015-02-20 00:51:33 +00:00
/* pts = 128; */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , 0x808 , BIT14 | BIT15 , 0x0 ) ;
}
2015-02-20 00:51:33 +00:00
/* 1 Backup Current RF/BB Settings */
2014-12-19 06:59:46 +00:00
2013-05-08 21:45:39 +00:00
CurrentChannel = ODM_GetRFReg ( pDM_Odm , RF_PATH_A , ODM_CHANNEL , bRFRegOffsetMask ) ;
RfLoopReg = ODM_GetRFReg ( pDM_Odm , RF_PATH_A , 0x00 , bRFRegOffsetMask ) ;
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_XA_RFInterfaceOE , ODM_DPDT , Antenna_A ) ; /* change to Antenna A */
/* Step 1: USE IQK to transmitter single tone */
2013-05-08 21:45:39 +00:00
ODM_StallExecution ( 10 ) ;
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* Store A Path Register 88c, c08, 874, c50 */
2013-05-08 21:45:39 +00:00
Reg88c = ODM_GetBBReg ( pDM_Odm , rFPGA0_AnalogParameter4 , bMaskDWord ) ;
Regc08 = ODM_GetBBReg ( pDM_Odm , rOFDM0_TRMuxPar , bMaskDWord ) ;
Reg874 = ODM_GetBBReg ( pDM_Odm , rFPGA0_XCD_RFInterfaceSW , bMaskDWord ) ;
2014-12-19 06:59:46 +00:00
Regc50 = ODM_GetBBReg ( pDM_Odm , rOFDM0_XAAGCCore1 , bMaskDWord ) ;
2015-02-20 00:51:33 +00:00
/* Store AFE Registers */
2014-12-19 06:59:46 +00:00
odm_PHY_SaveAFERegisters ( pDM_Odm , AFE_REG_8723A , AFE_Backup , 16 ) ;
2015-02-20 00:51:33 +00:00
/* Set PSD 128 pts */
ODM_SetBBReg ( pDM_Odm , rFPGA0_PSDFunction , BIT14 | BIT15 , 0x0 ) ; /* 128 pts */
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* To SET CH1 to do */
ODM_SetRFReg ( pDM_Odm , RF_PATH_A , ODM_CHANNEL , bRFRegOffsetMask , 0x01 ) ; /* Channel 1 */
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* AFE all on step */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rRx_Wait_CCA , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rTx_CCK_RFON , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rTx_CCK_BBON , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rTx_OFDM_RFON , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rTx_OFDM_BBON , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rTx_To_Rx , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rTx_To_Tx , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rRx_CCK , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rRx_OFDM , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rRx_Wait_RIFS , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rRx_TO_Rx , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rStandby , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rSleep , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rPMPD_ANAEN , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rFPGA0_XCD_SwitchControl , bMaskDWord , 0x6FDB25A4 ) ;
ODM_SetBBReg ( pDM_Odm , rBlue_Tooth , bMaskDWord , 0x6FDB25A4 ) ;
2015-02-20 00:51:33 +00:00
/* 3 wire Disable */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_AnalogParameter4 , bMaskDWord , 0xCCF000C0 ) ;
2014-12-19 06:59:46 +00:00
2015-02-20 00:51:33 +00:00
/* BB IQK Setting */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rOFDM0_TRMuxPar , bMaskDWord , 0x000800E4 ) ;
ODM_SetBBReg ( pDM_Odm , rFPGA0_XCD_RFInterfaceSW , bMaskDWord , 0x22208000 ) ;
2015-02-20 00:51:33 +00:00
/* IQK setting tone@ 4.34Mhz */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rTx_IQK_Tone_A , bMaskDWord , 0x10008C1C ) ;
2014-12-19 06:59:46 +00:00
ODM_SetBBReg ( pDM_Odm , rTx_IQK , bMaskDWord , 0x01007c00 ) ;
2013-05-08 21:45:39 +00:00
2014-12-17 04:09:56 +00:00
2015-02-20 00:51:33 +00:00
/* Page B init */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rConfig_AntA , bMaskDWord , 0x00080000 ) ;
ODM_SetBBReg ( pDM_Odm , rConfig_AntA , bMaskDWord , 0x0f600000 ) ;
ODM_SetBBReg ( pDM_Odm , rRx_IQK , bMaskDWord , 0x01004800 ) ;
ODM_SetBBReg ( pDM_Odm , rRx_IQK_Tone_A , bMaskDWord , 0x10008c1f ) ;
ODM_SetBBReg ( pDM_Odm , rTx_IQK_PI_A , bMaskDWord , 0x82150008 ) ;
ODM_SetBBReg ( pDM_Odm , rRx_IQK_PI_A , bMaskDWord , 0x28150008 ) ;
2014-12-19 06:59:46 +00:00
ODM_SetBBReg ( pDM_Odm , rIQK_AGC_Rsp , bMaskDWord , 0x001028d0 ) ;
2013-05-19 04:28:07 +00:00
2015-02-20 00:51:33 +00:00
/* RF loop Setting */
2014-12-19 06:59:46 +00:00
ODM_SetRFReg ( pDM_Odm , RF_PATH_A , 0x0 , 0xFFFFF , 0x50008 ) ;
2015-02-20 00:51:33 +00:00
/* IQK Single tone start */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_IQK , bMaskDWord , 0x80800000 ) ;
ODM_SetBBReg ( pDM_Odm , rIQK_AGC_Pts , bMaskDWord , 0xf8000000 ) ;
ODM_StallExecution ( 1000 ) ;
2014-12-17 04:09:56 +00:00
PSD_report_tmp = 0x0 ;
2013-05-08 21:45:39 +00:00
2014-12-17 04:09:56 +00:00
for ( n = 0 ; n < 2 ; n + + )
2014-12-19 06:59:46 +00:00
{
PSD_report_tmp = GetPSDData ( pDM_Odm , 14 , initial_gain ) ;
2015-08-15 18:02:34 +00:00
if ( PSD_report_tmp > AntA_report )
2014-12-17 04:09:56 +00:00
AntA_report = PSD_report_tmp ;
2013-05-08 21:45:39 +00:00
}
2014-12-17 04:09:56 +00:00
PSD_report_tmp = 0x0 ;
2013-05-08 21:45:39 +00:00
2015-02-20 00:51:33 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_XA_RFInterfaceOE , 0x300 , Antenna_B ) ; /* change to Antenna B */
2014-12-19 06:59:46 +00:00
ODM_StallExecution ( 10 ) ;
2013-05-19 04:28:07 +00:00
2014-12-17 04:09:56 +00:00
for ( n = 0 ; n < 2 ; n + + )
2014-12-19 06:59:46 +00:00
{
PSD_report_tmp = GetPSDData ( pDM_Odm , 14 , initial_gain ) ;
2015-08-15 18:02:34 +00:00
if ( PSD_report_tmp > AntB_report )
2014-12-17 04:09:56 +00:00
AntB_report = PSD_report_tmp ;
2013-05-08 21:45:39 +00:00
}
2015-02-20 00:51:33 +00:00
/* change to open case */
ODM_SetBBReg ( pDM_Odm , rFPGA0_XA_RFInterfaceOE , 0x300 , 0 ) ; /* change to Ant A and B all open case */
2014-12-19 06:59:46 +00:00
ODM_StallExecution ( 10 ) ;
2014-12-17 04:09:56 +00:00
for ( n = 0 ; n < 2 ; n + + )
2014-12-19 06:59:46 +00:00
{
PSD_report_tmp = GetPSDData ( pDM_Odm , 14 , initial_gain ) ;
2015-08-15 18:02:34 +00:00
if ( PSD_report_tmp > AntO_report )
2014-12-17 04:09:56 +00:00
AntO_report = PSD_report_tmp ;
2013-05-08 21:45:39 +00:00
}
2015-02-20 00:51:33 +00:00
/* Close IQK Single Tone function */
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_IQK , bMaskDWord , 0x00000000 ) ;
PSD_report_tmp = 0x0 ;
2015-02-20 00:51:33 +00:00
/* 1 Return to antanna A */
2014-12-19 06:59:46 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_XA_RFInterfaceOE , 0x300 , Antenna_A ) ;
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_AnalogParameter4 , bMaskDWord , Reg88c ) ;
ODM_SetBBReg ( pDM_Odm , rOFDM0_TRMuxPar , bMaskDWord , Regc08 ) ;
ODM_SetBBReg ( pDM_Odm , rFPGA0_XCD_RFInterfaceSW , bMaskDWord , Reg874 ) ;
ODM_SetBBReg ( pDM_Odm , rOFDM0_XAAGCCore1 , 0x7F , 0x40 ) ;
ODM_SetBBReg ( pDM_Odm , rOFDM0_XAAGCCore1 , bMaskDWord , Regc50 ) ;
2014-12-17 04:09:56 +00:00
ODM_SetRFReg ( pDM_Odm , RF_PATH_A , RF_CHNLBW , bRFRegOffsetMask , CurrentChannel ) ;
ODM_SetRFReg ( pDM_Odm , RF_PATH_A , 0x00 , bRFRegOffsetMask , RfLoopReg ) ;
2015-02-20 00:51:33 +00:00
/* Reload AFE Registers */
2014-12-19 06:59:46 +00:00
odm_PHY_ReloadAFERegisters ( pDM_Odm , AFE_REG_8723A , AFE_Backup , 16 ) ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:00:19 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " psd_report_A[%d]= %d \n " , 2416 , AntA_report ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " psd_report_B[%d]= %d \n " , 2416 , AntB_report ) ) ;
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " psd_report_O[%d]= %d \n " , 2416 , AntO_report ) ) ;
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( pDM_Odm - > SupportICType = = ODM_RTL8723A )
2014-12-17 04:09:56 +00:00
{
2015-02-20 00:51:33 +00:00
/* 2 Test Ant B based on Ant A is ON */
2015-08-15 18:02:34 +00:00
if ( mode = = ANTTESTB ) {
if ( AntA_report > = 100 ) {
if ( AntB_report > ( AntA_report + 1 ) ) {
2015-03-10 16:18:03 +00:00
pDM_SWAT_Table - > ANTB_ON = false ;
2014-12-19 06:59:46 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " ODM_SingleDualAntennaDetection(): Single Antenna A \n " ) ) ;
2015-03-10 16:18:03 +00:00
} else {
pDM_SWAT_Table - > ANTB_ON = true ;
2014-12-19 06:59:46 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " ODM_SingleDualAntennaDetection(): Dual Antenna is A and B \n " ) ) ;
2015-03-10 16:18:03 +00:00
}
} else {
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " ODM_SingleDualAntennaDetection(): Need to check again \n " ) ) ;
pDM_SWAT_Table - > ANTB_ON = false ; /* Set Antenna B off as default */
bResult = false ;
}
2014-12-19 06:59:46 +00:00
}
2015-03-10 16:18:03 +00:00
/* 2 Test Ant A and B based on DPDT Open */
2015-08-15 18:02:34 +00:00
else if ( mode = = ANTTESTALL ) {
if ( ( AntO_report > = 100 ) & ( AntO_report < 118 ) ) {
if ( AntA_report > ( AntO_report + 1 ) ) {
2015-03-10 16:18:03 +00:00
pDM_SWAT_Table - > ANTA_ON = false ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " Ant A is OFF " ) ) ;
2015-03-10 16:18:03 +00:00
} else {
pDM_SWAT_Table - > ANTA_ON = true ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " Ant A is ON " ) ) ;
2015-03-10 16:18:03 +00:00
}
2014-12-17 04:09:56 +00:00
2015-08-15 18:02:34 +00:00
if ( AntB_report > ( AntO_report + 2 ) ) {
2015-03-10 16:18:03 +00:00
pDM_SWAT_Table - > ANTB_ON = false ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " Ant B is OFF " ) ) ;
2015-03-10 16:18:03 +00:00
} else {
pDM_SWAT_Table - > ANTB_ON = true ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " Ant B is ON " ) ) ;
2015-03-10 16:18:03 +00:00
}
2014-12-17 04:09:56 +00:00
}
}
}
2015-08-15 18:02:34 +00:00
else if ( pDM_Odm - > SupportICType = = ODM_RTL8192C )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( AntA_report > = 100 )
2014-12-17 04:09:56 +00:00
{
2015-08-15 18:02:34 +00:00
if ( AntB_report > ( AntA_report + 2 ) )
2014-12-17 04:09:56 +00:00
{
2015-03-02 23:25:27 +00:00
pDM_SWAT_Table - > ANTA_ON = false ;
pDM_SWAT_Table - > ANTB_ON = true ;
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_XA_RFInterfaceOE , 0x300 , Antenna_B ) ;
2014-12-19 06:59:46 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " ODM_SingleDualAntennaDetection(): Single Antenna B \n " ) ) ;
}
2015-08-15 18:02:34 +00:00
else if ( AntA_report > ( AntB_report + 2 ) )
2014-12-17 04:09:56 +00:00
{
2015-03-02 23:25:27 +00:00
pDM_SWAT_Table - > ANTA_ON = true ;
pDM_SWAT_Table - > ANTB_ON = false ;
2013-05-08 21:45:39 +00:00
ODM_SetBBReg ( pDM_Odm , rFPGA0_XA_RFInterfaceOE , 0x300 , Antenna_A ) ;
2014-12-17 04:09:56 +00:00
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " ODM_SingleDualAntennaDetection(): Single Antenna A \n " ) ) ;
2014-12-19 06:59:46 +00:00
}
2014-12-17 04:09:56 +00:00
else
{
2015-03-02 23:25:27 +00:00
pDM_SWAT_Table - > ANTA_ON = true ;
pDM_SWAT_Table - > ANTB_ON = true ;
2015-08-15 18:00:19 +00:00
RT_TRACE ( COMP_ANTENNA , DBG_LOUD , ( " ODM_SingleDualAntennaDetection(): Dual Antenna \n " ) ) ;
2013-05-08 21:45:39 +00:00
}
2014-12-17 04:09:56 +00:00
}
else
{
ODM_RT_TRACE ( pDM_Odm , ODM_COMP_ANT_DIV , ODM_DBG_LOUD , ( " ODM_SingleDualAntennaDetection(): Need to check again \n " ) ) ;
2015-03-02 23:25:27 +00:00
pDM_SWAT_Table - > ANTA_ON = true ; /* Set Antenna A on as default */
pDM_SWAT_Table - > ANTB_ON = false ; /* Set Antenna B off as default */
bResult = false ;
2013-05-08 21:45:39 +00:00
}
}
return bResult ;
2014-12-17 04:09:56 +00:00
2013-05-08 21:45:39 +00:00
}
/* Justin: According to the current RRSI to adjust Response Frame TX power, 2012/11/05 */
2014-12-17 04:09:56 +00:00
void odm_dtc ( PDM_ODM_T pDM_Odm )
2013-05-08 21:45:39 +00:00
{
2014-12-17 04:09:56 +00:00
# ifdef CONFIG_DM_RESP_TXAGC
# define DTC_BASE 35 /* RSSI higher than this value, start to decade TX power */
# define DTC_DWN_BASE (DTC_BASE-5) /* RSSI lower than this value, start to increase TX power */
/* RSSI vs TX power step mapping: decade TX power */
static const u8 dtc_table_down [ ] = {
DTC_BASE ,
( DTC_BASE + 5 ) ,
( DTC_BASE + 10 ) ,
( DTC_BASE + 15 ) ,
( DTC_BASE + 20 ) ,
( DTC_BASE + 25 )
} ;
/* RSSI vs TX power step mapping: increase TX power */
static const u8 dtc_table_up [ ] = {
DTC_DWN_BASE ,
( DTC_DWN_BASE - 5 ) ,
( DTC_DWN_BASE - 10 ) ,
( DTC_DWN_BASE - 15 ) ,
( DTC_DWN_BASE - 15 ) ,
( DTC_DWN_BASE - 20 ) ,
( DTC_DWN_BASE - 20 ) ,
( DTC_DWN_BASE - 25 ) ,
( DTC_DWN_BASE - 25 ) ,
( DTC_DWN_BASE - 30 ) ,
( DTC_DWN_BASE - 35 )
} ;
u8 i ;
u8 dtc_steps = 0 ;
u8 sign ;
u8 resp_txagc = 0 ;
if ( DTC_BASE < pDM_Odm - > RSSI_Min ) {
/* need to decade the CTS TX power */
sign = 1 ;
2014-12-29 02:00:11 +00:00
for ( i = 0 ; i < ARRAY_SIZE ( dtc_table_down ) ; i + + ) {
2014-12-17 04:09:56 +00:00
if ( ( dtc_table_down [ i ] > = pDM_Odm - > RSSI_Min ) | | ( dtc_steps > = 6 ) )
break ;
else
dtc_steps + + ;
}
2014-12-29 02:00:11 +00:00
} else {
2014-12-17 04:09:56 +00:00
sign = 0 ;
dtc_steps = 0 ;
}
resp_txagc = dtc_steps | ( sign < < 4 ) ;
resp_txagc = resp_txagc | ( resp_txagc < < 5 ) ;
ODM_Write1Byte ( pDM_Odm , 0x06d9 , resp_txagc ) ;
2015-08-15 21:38:30 +00:00
DBG_88E ( " %s RSSI_Min:%u, set RESP_TXAGC to %s %u \n " ,
2014-12-17 04:09:56 +00:00
__func__ , pDM_Odm - > RSSI_Min , sign ? " minus " : " plus " , dtc_steps ) ;
# endif /* CONFIG_RESP_TXAGC_ADJUST */
2013-05-08 21:45:39 +00:00
}