OSDN Git Service

staging: rtl8723bs: update to the latest driver
[android-x86/kernel.git] / drivers / staging / rtl8723bs / hal / odm_DIG.h
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 {
21         bool            bStopDIG;
22         bool            bPSDInProgress;
23
24         u8 Dig_Enable_Flag;
25         u8 Dig_Ext_Port_Stage;
26
27         int                     RssiLowThresh;
28         int                     RssiHighThresh;
29
30         u32     FALowThresh;
31         u32     FAHighThresh;
32
33         u8 CurSTAConnectState;
34         u8 PreSTAConnectState;
35         u8 CurMultiSTAConnectState;
36
37         u8 PreIGValue;
38         u8 CurIGValue;
39         u8 BackupIGValue;               /* MP DIG */
40         u8 BT30_CurIGI;
41         u8 IGIBackup;
42
43         s8              BackoffVal;
44         s8              BackoffVal_range_max;
45         s8              BackoffVal_range_min;
46         u8 rx_gain_range_max;
47         u8 rx_gain_range_min;
48         u8 Rssi_val_min;
49
50         u8 PreCCK_CCAThres;
51         u8 CurCCK_CCAThres;
52         u8 PreCCKPDState;
53         u8 CurCCKPDState;
54         u8 CCKPDBackup;
55
56         u8 LargeFAHit;
57         u8 ForbiddenIGI;
58         u32     Recover_cnt;
59
60         u8 DIG_Dynamic_MIN_0;
61         u8 DIG_Dynamic_MIN_1;
62         bool            bMediaConnect_0;
63         bool            bMediaConnect_1;
64
65         u32     AntDiv_RSSI_max;
66         u32     RSSI_max;
67
68         u8 *pbP2pLinkInProgress;
69 }DIG_T,*pDIG_T;
70
71 typedef struct false_ALARM_STATISTICS{
72         u32 Cnt_Parity_Fail;
73         u32 Cnt_Rate_Illegal;
74         u32 Cnt_Crc8_fail;
75         u32 Cnt_Mcs_fail;
76         u32 Cnt_Ofdm_fail;
77         u32 Cnt_Ofdm_fail_pre;  /* For RTL8881A */
78         u32 Cnt_Cck_fail;
79         u32 Cnt_all;
80         u32 Cnt_Fast_Fsync;
81         u32 Cnt_SB_Search_fail;
82         u32 Cnt_OFDM_CCA;
83         u32 Cnt_CCK_CCA;
84         u32 Cnt_CCA_all;
85         u32 Cnt_BW_USC; /* Gary */
86         u32 Cnt_BW_LSC; /* Gary */
87 }false_ALARM_STATISTICS, *Pfalse_ALARM_STATISTICS;
88
89 typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition
90 {
91         DIG_TYPE_THRESH_HIGH    = 0,
92         DIG_TYPE_THRESH_LOW     = 1,
93         DIG_TYPE_BACKOFF                = 2,
94         DIG_TYPE_RX_GAIN_MIN    = 3,
95         DIG_TYPE_RX_GAIN_MAX    = 4,
96         DIG_TYPE_ENABLE                 = 5,
97         DIG_TYPE_DISABLE                = 6,
98         DIG_OP_TYPE_MAX
99 }DM_DIG_OP_E;
100
101 typedef enum tag_ODM_PauseDIG_Type {
102         ODM_PAUSE_DIG                   =       BIT0,
103         ODM_RESUME_DIG                  =       BIT1
104 } ODM_Pause_DIG_TYPE;
105
106 typedef enum tag_ODM_PauseCCKPD_Type {
107         ODM_PAUSE_CCKPD         =       BIT0,
108         ODM_RESUME_CCKPD        =       BIT1
109 } ODM_Pause_CCKPD_TYPE;
110
111 #define         DM_DIG_THRESH_HIGH                      40
112 #define         DM_DIG_THRESH_LOW                       35
113
114 #define         DMfalseALARM_THRESH_LOW 400
115 #define         DMfalseALARM_THRESH_HIGH        1000
116
117 #define         DM_DIG_MAX_NIC                          0x3e
118 #define         DM_DIG_MIN_NIC                          0x1e /* 0x22//0x1c */
119 #define         DM_DIG_MAX_OF_MIN_NIC           0x3e
120
121 #define         DM_DIG_MAX_AP                                   0x3e
122 #define         DM_DIG_MIN_AP                                   0x1c
123 #define         DM_DIG_MAX_OF_MIN                       0x2A    /* 0x32 */
124 #define         DM_DIG_MIN_AP_DFS                               0x20
125
126 #define         DM_DIG_MAX_NIC_HP                       0x46
127 #define         DM_DIG_MIN_NIC_HP                               0x2e
128
129 #define         DM_DIG_MAX_AP_HP                                0x42
130 #define         DM_DIG_MIN_AP_HP                                0x30
131
132 #define         DM_DIG_FA_TH0                           0x200/* 0x20 */
133
134 #define         DM_DIG_FA_TH1                                   0x300
135 #define         DM_DIG_FA_TH2                                   0x400
136 /* this is for 92d */
137 #define         DM_DIG_FA_TH0_92D                               0x100
138 #define         DM_DIG_FA_TH1_92D                               0x400
139 #define         DM_DIG_FA_TH2_92D                               0x600
140
141 #define         DM_DIG_BACKOFF_MAX                      12
142 #define         DM_DIG_BACKOFF_MIN                      -4
143 #define         DM_DIG_BACKOFF_DEFAULT          10
144
145 #define                 DM_DIG_FA_TH0_LPS                               4 /*  4 in lps */
146 #define                 DM_DIG_FA_TH1_LPS                               15 /*  15 lps */
147 #define                 DM_DIG_FA_TH2_LPS                               30 /*  30 lps */
148 #define                 RSSI_OFFSET_DIG                         0x05
149
150 void
151 odm_NHMCounterStatisticsInit(
152         void *                          pDM_VOID
153         );
154
155 void
156 odm_NHMCounterStatistics(
157         void *                          pDM_VOID
158         );
159
160 void
161 odm_NHMBBInit(
162         void *                          pDM_VOID
163 );
164
165 void
166 odm_NHMBB(
167         void *                          pDM_VOID
168 );
169
170 void
171 odm_NHMCounterStatisticsReset(
172         void *          pDM_VOID
173 );
174
175 void
176 odm_GetNHMCounterStatistics(
177         void *          pDM_VOID
178 );
179
180 void
181 odm_SearchPwdBLowerBound(
182         void *                          pDM_VOID,
183         u8                      IGI_target
184 );
185
186 void
187 odm_AdaptivityInit(
188         void *                          pDM_VOID
189         );
190
191 void
192 odm_Adaptivity(
193         void *                          pDM_VOID,
194         u8                      IGI
195         );
196
197 void
198 ODM_Write_DIG(
199         void *                          pDM_VOID,
200         u8                      CurrentIGI
201         );
202
203 void
204 odm_PauseDIG(
205         void *                          pDM_VOID,
206         ODM_Pause_DIG_TYPE              PauseType,
207         u8                      IGIValue
208         );
209
210 void
211 odm_DIGInit(
212         void *                          pDM_VOID
213         );
214
215 void
216 odm_DIG(
217         void *                          pDM_VOID
218         );
219
220 void
221 odm_DIGbyRSSI_LPS(
222         void *                          pDM_VOID
223         );
224
225 void
226 odm_FalseAlarmCounterStatistics(
227         void *                          pDM_VOID
228         );
229
230 void
231 odm_FAThresholdCheck(
232         void *                          pDM_VOID,
233         bool                                    bDFSBand,
234         bool                                    bPerformance,
235         u32                             RxTp,
236         u32                             TxTp,
237         u32*                            dm_FA_thres
238         );
239
240 u8
241 odm_ForbiddenIGICheck(
242         void *                          pDM_VOID,
243         u8                      DIG_Dynamic_MIN,
244         u8                      CurrentIGI
245         );
246
247 bool
248 odm_DigAbort(
249         void *                          pDM_VOID
250         );
251
252 void
253 odm_CCKPacketDetectionThresh(
254         void *                          pDM_VOID
255         );
256
257 void
258 ODM_Write_CCK_CCA_Thres(
259         void *                          pDM_VOID,
260         u8                      CurCCK_CCAThres
261         );
262
263 #endif