1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2 of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 * 14 ******************************************************************************/ 15 16 #ifndef __ODMDIG_H__ 17 #define __ODMDIG_H__ 18 19 typedef struct _Dynamic_Initial_Gain_Threshold_ { 20 bool bStopDIG; 21 bool bPSDInProgress; 22 23 u8 Dig_Enable_Flag; 24 u8 Dig_Ext_Port_Stage; 25 26 int RssiLowThresh; 27 int RssiHighThresh; 28 29 u32 FALowThresh; 30 u32 FAHighThresh; 31 32 u8 CurSTAConnectState; 33 u8 PreSTAConnectState; 34 u8 CurMultiSTAConnectState; 35 36 u8 PreIGValue; 37 u8 CurIGValue; 38 u8 BackupIGValue; /* MP DIG */ 39 u8 BT30_CurIGI; 40 u8 IGIBackup; 41 42 s8 BackoffVal; 43 s8 BackoffVal_range_max; 44 s8 BackoffVal_range_min; 45 u8 rx_gain_range_max; 46 u8 rx_gain_range_min; 47 u8 Rssi_val_min; 48 49 u8 PreCCK_CCAThres; 50 u8 CurCCK_CCAThres; 51 u8 PreCCKPDState; 52 u8 CurCCKPDState; 53 u8 CCKPDBackup; 54 55 u8 LargeFAHit; 56 u8 ForbiddenIGI; 57 u32 Recover_cnt; 58 59 u8 DIG_Dynamic_MIN_0; 60 u8 DIG_Dynamic_MIN_1; 61 bool bMediaConnect_0; 62 bool bMediaConnect_1; 63 64 u32 AntDiv_RSSI_max; 65 u32 RSSI_max; 66 67 u8 *pbP2pLinkInProgress; 68 } DIG_T, *pDIG_T; 69 70 typedef struct false_ALARM_STATISTICS { 71 u32 Cnt_Parity_Fail; 72 u32 Cnt_Rate_Illegal; 73 u32 Cnt_Crc8_fail; 74 u32 Cnt_Mcs_fail; 75 u32 Cnt_Ofdm_fail; 76 u32 Cnt_Ofdm_fail_pre; /* For RTL8881A */ 77 u32 Cnt_Cck_fail; 78 u32 Cnt_all; 79 u32 Cnt_Fast_Fsync; 80 u32 Cnt_SB_Search_fail; 81 u32 Cnt_OFDM_CCA; 82 u32 Cnt_CCK_CCA; 83 u32 Cnt_CCA_all; 84 u32 Cnt_BW_USC; /* Gary */ 85 u32 Cnt_BW_LSC; /* Gary */ 86 } false_ALARM_STATISTICS, *Pfalse_ALARM_STATISTICS; 87 88 typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition { 89 DIG_TYPE_THRESH_HIGH = 0, 90 DIG_TYPE_THRESH_LOW = 1, 91 DIG_TYPE_BACKOFF = 2, 92 DIG_TYPE_RX_GAIN_MIN = 3, 93 DIG_TYPE_RX_GAIN_MAX = 4, 94 DIG_TYPE_ENABLE = 5, 95 DIG_TYPE_DISABLE = 6, 96 DIG_OP_TYPE_MAX 97 } DM_DIG_OP_E; 98 99 typedef enum tag_ODM_PauseDIG_Type { 100 ODM_PAUSE_DIG = BIT0, 101 ODM_RESUME_DIG = BIT1 102 } ODM_Pause_DIG_TYPE; 103 104 typedef enum tag_ODM_PauseCCKPD_Type { 105 ODM_PAUSE_CCKPD = BIT0, 106 ODM_RESUME_CCKPD = BIT1 107 } ODM_Pause_CCKPD_TYPE; 108 109 #define DM_DIG_THRESH_HIGH 40 110 #define DM_DIG_THRESH_LOW 35 111 112 #define DMfalseALARM_THRESH_LOW 400 113 #define DMfalseALARM_THRESH_HIGH 1000 114 115 #define DM_DIG_MAX_NIC 0x3e 116 #define DM_DIG_MIN_NIC 0x1e /* 0x22//0x1c */ 117 #define DM_DIG_MAX_OF_MIN_NIC 0x3e 118 119 #define DM_DIG_MAX_AP 0x3e 120 #define DM_DIG_MIN_AP 0x1c 121 #define DM_DIG_MAX_OF_MIN 0x2A /* 0x32 */ 122 #define DM_DIG_MIN_AP_DFS 0x20 123 124 #define DM_DIG_MAX_NIC_HP 0x46 125 #define DM_DIG_MIN_NIC_HP 0x2e 126 127 #define DM_DIG_MAX_AP_HP 0x42 128 #define DM_DIG_MIN_AP_HP 0x30 129 130 #define DM_DIG_FA_TH0 0x200/* 0x20 */ 131 132 #define DM_DIG_FA_TH1 0x300 133 #define DM_DIG_FA_TH2 0x400 134 /* this is for 92d */ 135 #define DM_DIG_FA_TH0_92D 0x100 136 #define DM_DIG_FA_TH1_92D 0x400 137 #define DM_DIG_FA_TH2_92D 0x600 138 139 #define DM_DIG_BACKOFF_MAX 12 140 #define DM_DIG_BACKOFF_MIN -4 141 #define DM_DIG_BACKOFF_DEFAULT 10 142 143 #define DM_DIG_FA_TH0_LPS 4 /* 4 in lps */ 144 #define DM_DIG_FA_TH1_LPS 15 /* 15 lps */ 145 #define DM_DIG_FA_TH2_LPS 30 /* 30 lps */ 146 #define RSSI_OFFSET_DIG 0x05 147 148 void odm_NHMCounterStatisticsInit(void *pDM_VOID); 149 150 void odm_NHMCounterStatistics(void *pDM_VOID); 151 152 void odm_NHMBBInit(void *pDM_VOID); 153 154 void odm_NHMBB(void *pDM_VOID); 155 156 void odm_NHMCounterStatisticsReset(void *pDM_VOID); 157 158 void odm_GetNHMCounterStatistics(void *pDM_VOID); 159 160 void odm_SearchPwdBLowerBound(void *pDM_VOID, u8 IGI_target); 161 162 void odm_AdaptivityInit(void *pDM_VOID); 163 164 void odm_Adaptivity(void *pDM_VOID, u8 IGI); 165 166 void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI); 167 168 void odm_PauseDIG(void *pDM_VOID, ODM_Pause_DIG_TYPE PauseType, u8 IGIValue); 169 170 void odm_DIGInit(void *pDM_VOID); 171 172 void odm_DIG(void *pDM_VOID); 173 174 void odm_DIGbyRSSI_LPS(void *pDM_VOID); 175 176 void odm_FalseAlarmCounterStatistics(void *pDM_VOID); 177 178 void odm_FAThresholdCheck( 179 void *pDM_VOID, 180 bool bDFSBand, 181 bool bPerformance, 182 u32 RxTp, 183 u32 TxTp, 184 u32 *dm_FA_thres 185 ); 186 187 u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI); 188 189 bool odm_DigAbort(void *pDM_VOID); 190 191 void odm_CCKPacketDetectionThresh(void *pDM_VOID); 192 193 void ODM_Write_CCK_CCA_Thres(void *pDM_VOID, u8 CurCCK_CCAThres); 194 195 #endif 196