net: wireless: rockchip_wlan: add rtl8188eu support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8188eu / hal / btc / HalBtc8192e1Ant.h
1 //===========================================
2 // The following is for 8192E 1ANT BT Co-exist definition
3 //===========================================
4 #define BT_AUTO_REPORT_ONLY_8192E_1ANT                          1
5
6 #define BT_INFO_8192E_1ANT_B_FTP                                                BIT7
7 #define BT_INFO_8192E_1ANT_B_A2DP                                       BIT6
8 #define BT_INFO_8192E_1ANT_B_HID                                                BIT5
9 #define BT_INFO_8192E_1ANT_B_SCO_BUSY                           BIT4
10 #define BT_INFO_8192E_1ANT_B_ACL_BUSY                           BIT3
11 #define BT_INFO_8192E_1ANT_B_INQ_PAGE                           BIT2
12 #define BT_INFO_8192E_1ANT_B_SCO_ESCO                           BIT1
13 #define BT_INFO_8192E_1ANT_B_CONNECTION                         BIT0
14
15 #define BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)       \
16                 (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
17
18 #define BTC_RSSI_COEX_THRESH_TOL_8192E_1ANT             2
19
20 #define  BT_8192E_1ANT_WIFI_NOISY_THRESH                                                                30   //max: 255
21
22 typedef enum _BT_INFO_SRC_8192E_1ANT{
23         BT_INFO_SRC_8192E_1ANT_WIFI_FW                  = 0x0,
24         BT_INFO_SRC_8192E_1ANT_BT_RSP                           = 0x1,
25         BT_INFO_SRC_8192E_1ANT_BT_ACTIVE_SEND           = 0x2,
26         BT_INFO_SRC_8192E_1ANT_MAX
27 }BT_INFO_SRC_8192E_1ANT,*PBT_INFO_SRC_8192E_1ANT;
28
29 typedef enum _BT_8192E_1ANT_BT_STATUS{
30         BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE      = 0x0,
31         BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE          = 0x1,
32         BT_8192E_1ANT_BT_STATUS_INQ_PAGE                                = 0x2,
33         BT_8192E_1ANT_BT_STATUS_ACL_BUSY                                = 0x3,
34         BT_8192E_1ANT_BT_STATUS_SCO_BUSY                                = 0x4,
35         BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY                    = 0x5,
36         BT_8192E_1ANT_BT_STATUS_MAX
37 }BT_8192E_1ANT_BT_STATUS,*PBT_8192E_1ANT_BT_STATUS;
38
39 typedef enum _BT_8192E_1ANT_WIFI_STATUS{
40         BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE                            = 0x0,
41         BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN          = 0x1,
42         BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN                                        = 0x2,
43         BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT                         = 0x3,
44         BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE                                        = 0x4,
45         BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY                                        = 0x5,
46         BT_8192E_1ANT_WIFI_STATUS_MAX
47 }BT_8192E_1ANT_WIFI_STATUS,*PBT_8192E_1ANT_WIFI_STATUS;
48
49 typedef enum _BT_8192E_1ANT_COEX_ALGO{
50         BT_8192E_1ANT_COEX_ALGO_UNDEFINED                       = 0x0,
51         BT_8192E_1ANT_COEX_ALGO_SCO                             = 0x1,
52         BT_8192E_1ANT_COEX_ALGO_HID                             = 0x2,
53         BT_8192E_1ANT_COEX_ALGO_A2DP                            = 0x3,
54         BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS              = 0x4,
55         BT_8192E_1ANT_COEX_ALGO_PANEDR                  = 0x5,
56         BT_8192E_1ANT_COEX_ALGO_PANHS                   = 0x6,
57         BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP             = 0x7,
58         BT_8192E_1ANT_COEX_ALGO_PANEDR_HID              = 0x8,
59         BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
60         BT_8192E_1ANT_COEX_ALGO_HID_A2DP                        = 0xa,
61         BT_8192E_1ANT_COEX_ALGO_MAX                             = 0xb,
62 }BT_8192E_1ANT_COEX_ALGO,*PBT_8192E_1ANT_COEX_ALGO;
63
64 typedef struct _COEX_DM_8192E_1ANT{
65         // fw mechanism
66         BOOLEAN         bCurIgnoreWlanAct;
67         BOOLEAN         bPreIgnoreWlanAct;
68         u1Byte          prePsTdma;
69         u1Byte          curPsTdma;
70         u1Byte          psTdmaPara[5];
71         u1Byte          psTdmaDuAdjType;
72         BOOLEAN         bAutoTdmaAdjust;
73         BOOLEAN         bPrePsTdmaOn;
74         BOOLEAN         bCurPsTdmaOn;
75         BOOLEAN         bPreBtAutoReport;
76         BOOLEAN         bCurBtAutoReport;
77         u1Byte          preLps;
78         u1Byte          curLps;
79         u1Byte          preRpwm;
80         u1Byte          curRpwm;
81
82         // sw mechanism
83         BOOLEAN         bPreLowPenaltyRa;
84         BOOLEAN         bCurLowPenaltyRa;
85         u4Byte          preVal0x6c0;
86         u4Byte          curVal0x6c0;
87         u4Byte          preVal0x6c4;
88         u4Byte          curVal0x6c4;
89         u4Byte          preVal0x6c8;
90         u4Byte          curVal0x6c8;
91         u1Byte          preVal0x6cc;
92         u1Byte          curVal0x6cc;
93         BOOLEAN         bLimitedDig;
94
95         u4Byte          backupArfrCnt1; // Auto Rate Fallback Retry cnt
96         u4Byte          backupArfrCnt2; // Auto Rate Fallback Retry cnt
97         u2Byte          backupRetryLimit;
98         u1Byte          backupAmpduMaxTime;
99
100         // algorithm related
101         u1Byte          preAlgorithm;
102         u1Byte          curAlgorithm;
103         u1Byte          btStatus;
104         u1Byte          wifiChnlInfo[3];
105
106         u4Byte          preRaMask;
107         u4Byte          curRaMask;
108         u1Byte          preArfrType;
109         u1Byte          curArfrType;
110         u1Byte          preRetryLimitType;
111         u1Byte          curRetryLimitType;
112         u1Byte          preAmpduTimeType;
113         u1Byte          curAmpduTimeType;
114         u4Byte          nArpCnt;
115
116         u1Byte          errorCondition;
117 } COEX_DM_8192E_1ANT, *PCOEX_DM_8192E_1ANT;
118
119 typedef struct _COEX_STA_8192E_1ANT{
120         BOOLEAN                                 bBtLinkExist;
121         BOOLEAN                                 bScoExist;
122         BOOLEAN                                 bA2dpExist;
123         BOOLEAN                                 bHidExist;
124         BOOLEAN                                 bPanExist;
125
126         BOOLEAN                                 bUnderLps;
127         BOOLEAN                                 bUnderIps;
128         u4Byte                                  specialPktPeriodCnt;
129         u4Byte                                  highPriorityTx;
130         u4Byte                                  highPriorityRx;
131         u4Byte                                  lowPriorityTx;
132         u4Byte                                  lowPriorityRx;
133         s1Byte                                  btRssi;
134         BOOLEAN                                 bBtTxRxMask;
135         u1Byte                                  preBtRssiState;
136         u1Byte                                  preWifiRssiState[4];
137         BOOLEAN                                 bC2hBtInfoReqSent;
138         u1Byte                                  btInfoC2h[BT_INFO_SRC_8192E_1ANT_MAX][10];
139         u4Byte                                  btInfoC2hCnt[BT_INFO_SRC_8192E_1ANT_MAX];
140         BOOLEAN                                 bC2hBtInquiryPage;
141         BOOLEAN                                 bC2hBtPage;                             //Add for win8.1 page out issue
142         BOOLEAN                                 bWiFiIsHighPriTask;             //Add for win8.1 page out issue
143         u1Byte                                  btRetryCnt;
144         u1Byte                                  btInfoExt;
145         u4Byte                                  popEventCnt;
146         u1Byte                                  nScanAPNum;
147
148         u4Byte                                  nCRCOK_CCK;
149         u4Byte                                  nCRCOK_11g;
150         u4Byte                                  nCRCOK_11n;
151         u4Byte                                  nCRCOK_11nAgg;
152         
153         u4Byte                                  nCRCErr_CCK;
154         u4Byte                                  nCRCErr_11g;
155         u4Byte                                  nCRCErr_11n;
156         u4Byte                                  nCRCErr_11nAgg; 
157
158         BOOLEAN                                 bCCKLock;
159         BOOLEAN                                 bPreCCKLock;
160         u1Byte                                  nCoexTableType;
161
162         BOOLEAN                                 bForceLpsOn;
163 }COEX_STA_8192E_1ANT, *PCOEX_STA_8192E_1ANT;
164
165 //===========================================
166 // The following is interface which will notify coex module.
167 //===========================================
168 VOID
169 EXhalbtc8192e1ant_PowerOnSetting(
170         IN      PBTC_COEXIST            pBtCoexist
171         );
172 VOID
173 EXhalbtc8192e1ant_PreLoadFirmware(
174         IN      PBTC_COEXIST            pBtCoexist
175         );
176 VOID
177 EXhalbtc8192e1ant_InitHwConfig(
178         IN      PBTC_COEXIST            pBtCoexist,
179         IN      BOOLEAN                         bWifiOnly
180         );
181 VOID
182 EXhalbtc8192e1ant_InitCoexDm(
183         IN      PBTC_COEXIST            pBtCoexist
184         );
185 VOID
186 EXhalbtc8192e1ant_IpsNotify(
187         IN      PBTC_COEXIST            pBtCoexist,
188         IN      u1Byte                  type
189         );
190 VOID
191 EXhalbtc8192e1ant_LpsNotify(
192         IN      PBTC_COEXIST            pBtCoexist,
193         IN      u1Byte                  type
194         );
195 VOID
196 EXhalbtc8192e1ant_ScanNotify(
197         IN      PBTC_COEXIST            pBtCoexist,
198         IN      u1Byte                  type
199         );
200 VOID
201 EXhalbtc8192e1ant_ConnectNotify(
202         IN      PBTC_COEXIST            pBtCoexist,
203         IN      u1Byte                  type
204         );
205 VOID
206 EXhalbtc8192e1ant_MediaStatusNotify(
207         IN      PBTC_COEXIST                    pBtCoexist,
208         IN      u1Byte                          type
209         );
210 VOID
211 EXhalbtc8192e1ant_SpecialPacketNotify(
212         IN      PBTC_COEXIST                    pBtCoexist,
213         IN      u1Byte                          type
214         );
215 VOID
216 EXhalbtc8192e1ant_BtInfoNotify(
217         IN      PBTC_COEXIST            pBtCoexist,
218         IN      pu1Byte                 tmpBuf,
219         IN      u1Byte                  length
220         );
221 VOID
222 EXhalbtc8192e1ant_RfStatusNotify(
223         IN      PBTC_COEXIST                    pBtCoexist,
224         IN      u1Byte                                  type
225         );
226 VOID
227 EXhalbtc8192e1ant_HaltNotify(
228         IN      PBTC_COEXIST                    pBtCoexist
229         );
230 VOID
231 EXhalbtc8192e1ant_PnpNotify(
232         IN      PBTC_COEXIST                    pBtCoexist,
233         IN      u1Byte                          pnpState
234         );
235 VOID
236 EXhalbtc8192e1ant_CoexDmReset(
237         IN      PBTC_COEXIST                    pBtCoexist
238         );
239 VOID
240 EXhalbtc8192e1ant_Periodical(
241         IN      PBTC_COEXIST                    pBtCoexist
242         );
243 VOID
244 EXhalbtc8192e1ant_DisplayCoexInfo(
245         IN      PBTC_COEXIST            pBtCoexist
246         );
247 VOID
248 EXhalbtc8192e1ant_DbgControl(
249         IN      PBTC_COEXIST                    pBtCoexist,
250         IN      u1Byte                          opCode,
251         IN      u1Byte                          opLen,
252         IN      pu1Byte                         pData
253         );
254