Commit | Line | Data |
---|---|---|
aa45a673 LF |
1 | /****************************************************************************** |
2 | * | |
3 | * Copyright(c) 2009-2012 Realtek Corporation. | |
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 | * The full GNU General Public License is included in this distribution in the | |
15 | * file called LICENSE. | |
16 | * | |
17 | * Contact Information: | |
18 | * wlanfae <wlanfae@realtek.com> | |
19 | * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, | |
20 | * Hsinchu 300, Taiwan. | |
21 | * | |
22 | * Larry Finger <Larry.Finger@lwfinger.net> | |
23 | * | |
24 | *****************************************************************************/ | |
25 | #ifndef __HALBTC_OUT_SRC_H__ | |
26 | #define __HALBTC_OUT_SRC_H__ | |
27 | ||
28 | #include "../wifi.h" | |
29 | ||
30 | #define NORMAL_EXEC false | |
31 | #define FORCE_EXEC true | |
32 | ||
33 | #define BTC_RF_A RF90_PATH_A | |
34 | #define BTC_RF_B RF90_PATH_B | |
35 | #define BTC_RF_C RF90_PATH_C | |
36 | #define BTC_RF_D RF90_PATH_D | |
37 | ||
38 | #define BTC_SMSP SINGLEMAC_SINGLEPHY | |
39 | #define BTC_DMDP DUALMAC_DUALPHY | |
40 | #define BTC_DMSP DUALMAC_SINGLEPHY | |
41 | #define BTC_MP_UNKNOWN 0xff | |
42 | ||
43 | #define IN | |
44 | #define OUT | |
45 | ||
46 | #define BT_TMP_BUF_SIZE 100 | |
47 | ||
48 | #define BT_COEX_ANT_TYPE_PG 0 | |
49 | #define BT_COEX_ANT_TYPE_ANTDIV 1 | |
50 | #define BT_COEX_ANT_TYPE_DETECTED 2 | |
51 | ||
52 | #define BTC_MIMO_PS_STATIC 0 | |
53 | #define BTC_MIMO_PS_DYNAMIC 1 | |
54 | ||
55 | #define BTC_RATE_DISABLE 0 | |
56 | #define BTC_RATE_ENABLE 1 | |
57 | ||
e79fff28 LF |
58 | /* single Antenna definition */ |
59 | #define BTC_ANT_PATH_WIFI 0 | |
60 | #define BTC_ANT_PATH_BT 1 | |
61 | #define BTC_ANT_PATH_PTA 2 | |
62 | /* dual Antenna definition */ | |
63 | #define BTC_ANT_WIFI_AT_MAIN 0 | |
64 | #define BTC_ANT_WIFI_AT_AUX 1 | |
65 | /* coupler Antenna definition */ | |
66 | #define BTC_ANT_WIFI_AT_CPL_MAIN 0 | |
67 | #define BTC_ANT_WIFI_AT_CPL_AUX 1 | |
68 | ||
aa45a673 LF |
69 | #define BTC_ANT_PATH_WIFI 0 |
70 | #define BTC_ANT_PATH_BT 1 | |
71 | #define BTC_ANT_PATH_PTA 2 | |
72 | ||
73 | enum btc_chip_interface { | |
74 | BTC_INTF_UNKNOWN = 0, | |
75 | BTC_INTF_PCI = 1, | |
76 | BTC_INTF_USB = 2, | |
77 | BTC_INTF_SDIO = 3, | |
78 | BTC_INTF_GSPI = 4, | |
79 | BTC_INTF_MAX | |
80 | }; | |
81 | ||
82 | enum BTC_CHIP_TYPE { | |
83 | BTC_CHIP_UNDEF = 0, | |
84 | BTC_CHIP_CSR_BC4 = 1, | |
85 | BTC_CHIP_CSR_BC8 = 2, | |
86 | BTC_CHIP_RTL8723A = 3, | |
87 | BTC_CHIP_RTL8821 = 4, | |
88 | BTC_CHIP_RTL8723B = 5, | |
89 | BTC_CHIP_MAX | |
90 | }; | |
91 | ||
92 | enum BTC_MSG_TYPE { | |
93 | BTC_MSG_INTERFACE = 0x0, | |
94 | BTC_MSG_ALGORITHM = 0x1, | |
95 | BTC_MSG_MAX | |
96 | }; | |
97 | extern u32 btc_dbg_type[]; | |
98 | ||
99 | /* following is for BTC_MSG_INTERFACE */ | |
100 | #define INTF_INIT BIT0 | |
101 | #define INTF_NOTIFY BIT2 | |
102 | ||
103 | /* following is for BTC_ALGORITHM */ | |
104 | #define ALGO_BT_RSSI_STATE BIT0 | |
105 | #define ALGO_WIFI_RSSI_STATE BIT1 | |
106 | #define ALGO_BT_MONITOR BIT2 | |
107 | #define ALGO_TRACE BIT3 | |
108 | #define ALGO_TRACE_FW BIT4 | |
109 | #define ALGO_TRACE_FW_DETAIL BIT5 | |
110 | #define ALGO_TRACE_FW_EXEC BIT6 | |
111 | #define ALGO_TRACE_SW BIT7 | |
112 | #define ALGO_TRACE_SW_DETAIL BIT8 | |
113 | #define ALGO_TRACE_SW_EXEC BIT9 | |
114 | ||
115 | #define BT_COEX_ANT_TYPE_PG 0 | |
116 | #define BT_COEX_ANT_TYPE_ANTDIV 1 | |
117 | #define BT_COEX_ANT_TYPE_DETECTED 2 | |
118 | #define BTC_MIMO_PS_STATIC 0 | |
119 | #define BTC_MIMO_PS_DYNAMIC 1 | |
120 | #define BTC_RATE_DISABLE 0 | |
121 | #define BTC_RATE_ENABLE 1 | |
122 | #define BTC_ANT_PATH_WIFI 0 | |
123 | #define BTC_ANT_PATH_BT 1 | |
124 | #define BTC_ANT_PATH_PTA 2 | |
125 | ||
126 | ||
127 | #define CL_SPRINTF snprintf | |
6437f51e | 128 | #define CL_PRINTF(buf) printk("%s", buf) |
aa45a673 LF |
129 | |
130 | #define BTC_PRINT(dbgtype, dbgflag, printstr, ...) \ | |
131 | do { \ | |
132 | if (unlikely(btc_dbg_type[dbgtype] & dbgflag)) {\ | |
133 | printk(printstr, ##__VA_ARGS__); \ | |
134 | } \ | |
135 | } while (0) | |
136 | ||
137 | #define BTC_PRINT_F(dbgtype, dbgflag, printstr, ...) \ | |
138 | do { \ | |
139 | if (unlikely(btc_dbg_type[dbgtype] & dbgflag)) {\ | |
140 | pr_info("%s: ", __func__); \ | |
141 | printk(printstr, ##__VA_ARGS__); \ | |
142 | } \ | |
143 | } while (0) | |
144 | ||
145 | #define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _ptr) \ | |
146 | do { \ | |
147 | if (unlikely(btc_dbg_type[dbgtype] & dbgflag)) { \ | |
148 | int __i; \ | |
149 | u8 *__ptr = (u8 *)_ptr; \ | |
150 | printk printstr; \ | |
151 | for (__i = 0; __i < 6; __i++) \ | |
152 | printk("%02X%s", __ptr[__i], (__i == 5) ? \ | |
153 | "" : "-"); \ | |
154 | pr_info("\n"); \ | |
155 | } \ | |
156 | } while (0) | |
157 | ||
158 | #define BTC_PRINT_DATA(dbgtype, dbgflag, _titlestring, _hexdata, _hexdatalen) \ | |
159 | do { \ | |
160 | if (unlikely(btc_dbg_type[dbgtype] & dbgflag)) { \ | |
161 | int __i; \ | |
162 | u8 *__ptr = (u8 *)_hexdata; \ | |
163 | printk(_titlestring); \ | |
164 | for (__i = 0; __i < (int)_hexdatalen; __i++) { \ | |
165 | printk("%02X%s", __ptr[__i], (((__i + 1) % 4) \ | |
166 | == 0) ? " " : " ");\ | |
167 | if (((__i + 1) % 16) == 0) \ | |
168 | printk("\n"); \ | |
169 | } \ | |
170 | pr_debug("\n"); \ | |
171 | } \ | |
172 | } while (0) | |
173 | ||
174 | #define BTC_ANT_PATH_WIFI 0 | |
175 | #define BTC_ANT_PATH_BT 1 | |
176 | #define BTC_ANT_PATH_PTA 2 | |
177 | ||
e79fff28 LF |
178 | #define BTC_RSSI_HIGH(_rssi_) \ |
179 | ((_rssi_ == BTC_RSSI_STATE_HIGH || \ | |
180 | _rssi_ == BTC_RSSI_STATE_STAY_HIGH) ? true : false) | |
181 | #define BTC_RSSI_MEDIUM(_rssi_) \ | |
182 | ((_rssi_ == BTC_RSSI_STATE_MEDIUM || \ | |
183 | _rssi_ == BTC_RSSI_STATE_STAY_MEDIUM) ? true : false) | |
184 | #define BTC_RSSI_LOW(_rssi_) \ | |
185 | ((_rssi_ == BTC_RSSI_STATE_LOW || \ | |
186 | _rssi_ == BTC_RSSI_STATE_STAY_LOW) ? true : false) | |
187 | ||
aa45a673 LF |
188 | enum btc_power_save_type { |
189 | BTC_PS_WIFI_NATIVE = 0, | |
190 | BTC_PS_LPS_ON = 1, | |
191 | BTC_PS_LPS_OFF = 2, | |
192 | BTC_PS_LPS_MAX | |
193 | }; | |
194 | ||
195 | struct btc_board_info { | |
196 | /* The following is some board information */ | |
197 | u8 bt_chip_type; | |
198 | u8 pg_ant_num; /* pg ant number */ | |
199 | u8 btdm_ant_num; /* ant number for btdm */ | |
200 | u8 btdm_ant_pos; | |
201 | bool bt_exist; | |
202 | }; | |
203 | ||
204 | enum btc_dbg_opcode { | |
205 | BTC_DBG_SET_COEX_NORMAL = 0x0, | |
206 | BTC_DBG_SET_COEX_WIFI_ONLY = 0x1, | |
207 | BTC_DBG_SET_COEX_BT_ONLY = 0x2, | |
208 | BTC_DBG_MAX | |
209 | }; | |
210 | ||
211 | enum btc_rssi_state { | |
212 | BTC_RSSI_STATE_HIGH = 0x0, | |
213 | BTC_RSSI_STATE_MEDIUM = 0x1, | |
214 | BTC_RSSI_STATE_LOW = 0x2, | |
215 | BTC_RSSI_STATE_STAY_HIGH = 0x3, | |
216 | BTC_RSSI_STATE_STAY_MEDIUM = 0x4, | |
217 | BTC_RSSI_STATE_STAY_LOW = 0x5, | |
218 | BTC_RSSI_MAX | |
219 | }; | |
220 | ||
221 | enum btc_wifi_role { | |
222 | BTC_ROLE_STATION = 0x0, | |
223 | BTC_ROLE_AP = 0x1, | |
224 | BTC_ROLE_IBSS = 0x2, | |
225 | BTC_ROLE_HS_MODE = 0x3, | |
226 | BTC_ROLE_MAX | |
227 | }; | |
228 | ||
229 | enum btc_wifi_bw_mode { | |
230 | BTC_WIFI_BW_LEGACY = 0x0, | |
231 | BTC_WIFI_BW_HT20 = 0x1, | |
232 | BTC_WIFI_BW_HT40 = 0x2, | |
233 | BTC_WIFI_BW_MAX | |
234 | }; | |
235 | ||
236 | enum btc_wifi_traffic_dir { | |
237 | BTC_WIFI_TRAFFIC_TX = 0x0, | |
238 | BTC_WIFI_TRAFFIC_RX = 0x1, | |
239 | BTC_WIFI_TRAFFIC_MAX | |
240 | }; | |
241 | ||
242 | enum btc_wifi_pnp { | |
243 | BTC_WIFI_PNP_WAKE_UP = 0x0, | |
244 | BTC_WIFI_PNP_SLEEP = 0x1, | |
245 | BTC_WIFI_PNP_MAX | |
246 | }; | |
247 | ||
248 | ||
249 | enum btc_get_type { | |
250 | /* type bool */ | |
251 | BTC_GET_BL_HS_OPERATION, | |
252 | BTC_GET_BL_HS_CONNECTING, | |
253 | BTC_GET_BL_WIFI_CONNECTED, | |
254 | BTC_GET_BL_WIFI_BUSY, | |
255 | BTC_GET_BL_WIFI_SCAN, | |
256 | BTC_GET_BL_WIFI_LINK, | |
257 | BTC_GET_BL_WIFI_DHCP, | |
258 | BTC_GET_BL_WIFI_SOFTAP_IDLE, | |
259 | BTC_GET_BL_WIFI_SOFTAP_LINKING, | |
260 | BTC_GET_BL_WIFI_IN_EARLY_SUSPEND, | |
261 | BTC_GET_BL_WIFI_ROAM, | |
262 | BTC_GET_BL_WIFI_4_WAY_PROGRESS, | |
263 | BTC_GET_BL_WIFI_UNDER_5G, | |
264 | BTC_GET_BL_WIFI_AP_MODE_ENABLE, | |
265 | BTC_GET_BL_WIFI_ENABLE_ENCRYPTION, | |
266 | BTC_GET_BL_WIFI_UNDER_B_MODE, | |
267 | BTC_GET_BL_EXT_SWITCH, | |
268 | ||
269 | /* type s4Byte */ | |
270 | BTC_GET_S4_WIFI_RSSI, | |
271 | BTC_GET_S4_HS_RSSI, | |
272 | ||
273 | /* type u32 */ | |
274 | BTC_GET_U4_WIFI_BW, | |
275 | BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, | |
276 | BTC_GET_U4_WIFI_FW_VER, | |
277 | BTC_GET_U4_BT_PATCH_VER, | |
278 | ||
279 | /* type u1Byte */ | |
280 | BTC_GET_U1_WIFI_DOT11_CHNL, | |
281 | BTC_GET_U1_WIFI_CENTRAL_CHNL, | |
282 | BTC_GET_U1_WIFI_HS_CHNL, | |
283 | BTC_GET_U1_MAC_PHY_MODE, | |
e79fff28 | 284 | BTC_GET_U1_AP_NUM, |
aa45a673 LF |
285 | |
286 | /* for 1Ant */ | |
287 | BTC_GET_U1_LPS_MODE, | |
288 | BTC_GET_BL_BT_SCO_BUSY, | |
289 | ||
290 | /* for test mode */ | |
291 | BTC_GET_DRIVER_TEST_CFG, | |
292 | BTC_GET_MAX | |
293 | }; | |
294 | ||
295 | ||
296 | enum btc_set_type { | |
297 | /* type bool */ | |
298 | BTC_SET_BL_BT_DISABLE, | |
299 | BTC_SET_BL_BT_TRAFFIC_BUSY, | |
300 | BTC_SET_BL_BT_LIMITED_DIG, | |
301 | BTC_SET_BL_FORCE_TO_ROAM, | |
302 | BTC_SET_BL_TO_REJ_AP_AGG_PKT, | |
303 | BTC_SET_BL_BT_CTRL_AGG_SIZE, | |
304 | BTC_SET_BL_INC_SCAN_DEV_NUM, | |
305 | ||
306 | /* type u1Byte */ | |
307 | BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, | |
308 | BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, | |
309 | BTC_SET_UI_SCAN_SIG_COMPENSATION, | |
310 | BTC_SET_U1_AGG_BUF_SIZE, | |
311 | ||
312 | /* type trigger some action */ | |
313 | BTC_SET_ACT_GET_BT_RSSI, | |
314 | BTC_SET_ACT_AGGREGATE_CTRL, | |
315 | ||
316 | /********* for 1Ant **********/ | |
317 | /* type bool */ | |
318 | BTC_SET_BL_BT_SCO_BUSY, | |
319 | /* type u1Byte */ | |
320 | BTC_SET_U1_1ANT_LPS, | |
321 | BTC_SET_U1_1ANT_RPWM, | |
322 | /* type trigger some action */ | |
323 | BTC_SET_ACT_LEAVE_LPS, | |
324 | BTC_SET_ACT_ENTER_LPS, | |
325 | BTC_SET_ACT_NORMAL_LPS, | |
326 | BTC_SET_ACT_INC_FORCE_EXEC_PWR_CMD_CNT, | |
327 | BTC_SET_ACT_DISABLE_LOW_POWER, | |
328 | BTC_SET_ACT_UPDATE_ra_mask, | |
329 | BTC_SET_ACT_SEND_MIMO_PS, | |
330 | /* BT Coex related */ | |
331 | BTC_SET_ACT_CTRL_BT_INFO, | |
332 | BTC_SET_ACT_CTRL_BT_COEX, | |
333 | /***************************/ | |
334 | BTC_SET_MAX | |
335 | }; | |
336 | ||
337 | enum btc_dbg_disp_type { | |
338 | BTC_DBG_DISP_COEX_STATISTICS = 0x0, | |
339 | BTC_DBG_DISP_BT_LINK_INFO = 0x1, | |
340 | BTC_DBG_DISP_BT_FW_VER = 0x2, | |
341 | BTC_DBG_DISP_FW_PWR_MODE_CMD = 0x3, | |
342 | BTC_DBG_DISP_MAX | |
343 | }; | |
344 | ||
345 | enum btc_notify_type_ips { | |
346 | BTC_IPS_LEAVE = 0x0, | |
347 | BTC_IPS_ENTER = 0x1, | |
348 | BTC_IPS_MAX | |
349 | }; | |
350 | ||
351 | enum btc_notify_type_lps { | |
352 | BTC_LPS_DISABLE = 0x0, | |
353 | BTC_LPS_ENABLE = 0x1, | |
354 | BTC_LPS_MAX | |
355 | }; | |
356 | ||
357 | enum btc_notify_type_scan { | |
358 | BTC_SCAN_FINISH = 0x0, | |
359 | BTC_SCAN_START = 0x1, | |
360 | BTC_SCAN_MAX | |
361 | }; | |
362 | ||
363 | enum btc_notify_type_associate { | |
364 | BTC_ASSOCIATE_FINISH = 0x0, | |
365 | BTC_ASSOCIATE_START = 0x1, | |
366 | BTC_ASSOCIATE_MAX | |
367 | }; | |
368 | ||
369 | enum btc_notify_type_media_status { | |
370 | BTC_MEDIA_DISCONNECT = 0x0, | |
371 | BTC_MEDIA_CONNECT = 0x1, | |
372 | BTC_MEDIA_MAX | |
373 | }; | |
374 | ||
375 | enum btc_notify_type_special_packet { | |
376 | BTC_PACKET_UNKNOWN = 0x0, | |
377 | BTC_PACKET_DHCP = 0x1, | |
378 | BTC_PACKET_ARP = 0x2, | |
379 | BTC_PACKET_EAPOL = 0x3, | |
380 | BTC_PACKET_MAX | |
381 | }; | |
382 | ||
383 | enum btc_notify_type_stack_operation { | |
384 | BTC_STACK_OP_NONE = 0x0, | |
385 | BTC_STACK_OP_INQ_PAGE_PAIR_START = 0x1, | |
386 | BTC_STACK_OP_INQ_PAGE_PAIR_FINISH = 0x2, | |
387 | BTC_STACK_OP_MAX | |
388 | }; | |
389 | ||
390 | ||
391 | typedef u8 (*bfp_btc_r1)(void *btc_context, u32 reg_addr); | |
392 | ||
393 | typedef u16 (*bfp_btc_r2)(void *btc_context, u32 reg_addr); | |
394 | ||
395 | typedef u32 (*bfp_btc_r4)(void *btc_context, u32 reg_addr); | |
396 | ||
397 | typedef void (*bfp_btc_w1)(void *btc_context, u32 reg_addr, u8 data); | |
398 | ||
399 | typedef void (*bfp_btc_w1_bit_mak)(void *btc_context, u32 reg_addr, | |
400 | u32 bit_mask, u8 data1b); | |
401 | ||
402 | typedef void (*bfp_btc_w2)(void *btc_context, u32 reg_addr, u16 data); | |
403 | ||
404 | typedef void (*bfp_btc_w4)(void *btc_context, u32 reg_addr, u32 data); | |
405 | ||
406 | typedef void (*bfp_btc_wr_1byte_bit_mask)(void *btc_context, u32 reg_addr, | |
407 | u8 bit_mask, u8 data); | |
408 | ||
409 | typedef void (*bfp_btc_set_bb_reg)(void *btc_context, u32 reg_addr, | |
410 | u32 bit_mask, u32 data); | |
411 | ||
412 | typedef u32 (*bfp_btc_get_bb_reg)(void *btc_context, u32 reg_addr, | |
413 | u32 bit_mask); | |
414 | ||
415 | typedef void (*bfp_btc_set_rf_reg)(void *btc_context, u8 rf_path, u32 reg_addr, | |
416 | u32 bit_mask, u32 data); | |
417 | ||
418 | typedef u32 (*bfp_btc_get_rf_reg)(void *btc_context, u8 rf_path, | |
419 | u32 reg_addr, u32 bit_mask); | |
420 | ||
421 | typedef void (*bfp_btc_fill_h2c)(void *btc_context, u8 element_id, | |
422 | u32 cmd_len, u8 *cmd_buffer); | |
423 | ||
424 | typedef bool (*bfp_btc_get)(void *btcoexist, u8 get_type, void *out_buf); | |
425 | ||
426 | typedef bool (*bfp_btc_set)(void *btcoexist, u8 set_type, void *in_buf); | |
427 | ||
428 | typedef void (*bfp_btc_disp_dbg_msg)(void *btcoexist, u8 disp_type); | |
429 | ||
430 | struct btc_bt_info { | |
431 | bool bt_disabled; | |
432 | u8 rssi_adjust_for_agc_table_on; | |
433 | u8 rssi_adjust_for_1ant_coex_type; | |
434 | bool bt_busy; | |
435 | u8 agg_buf_size; | |
436 | bool limited_dig; | |
437 | bool reject_agg_pkt; | |
438 | bool b_bt_ctrl_buf_size; | |
439 | bool increase_scan_dev_num; | |
440 | u16 bt_hci_ver; | |
441 | u16 bt_real_fw_ver; | |
442 | u8 bt_fw_ver; | |
443 | ||
444 | /* the following is for 1Ant solution */ | |
445 | bool bt_ctrl_lps; | |
446 | bool bt_pwr_save_mode; | |
447 | bool bt_lps_on; | |
448 | bool force_to_roam; | |
449 | u8 force_exec_pwr_cmd_cnt; | |
450 | u8 lps_1ant; | |
451 | u8 rpwm_1ant; | |
452 | u32 ra_mask; | |
453 | }; | |
454 | ||
455 | struct btc_stack_info { | |
456 | bool profile_notified; | |
457 | u16 hci_version; /* stack hci version */ | |
458 | u8 num_of_link; | |
459 | bool bt_link_exist; | |
460 | bool sco_exist; | |
461 | bool acl_exist; | |
462 | bool a2dp_exist; | |
463 | bool hid_exist; | |
464 | u8 num_of_hid; | |
465 | bool pan_exist; | |
466 | bool unknown_acl_exist; | |
467 | char min_bt_rssi; | |
468 | }; | |
469 | ||
470 | struct btc_statistics { | |
471 | u32 cnt_bind; | |
472 | u32 cnt_init_hw_config; | |
473 | u32 cnt_init_coex_dm; | |
474 | u32 cnt_ips_notify; | |
475 | u32 cnt_lps_notify; | |
476 | u32 cnt_scan_notify; | |
477 | u32 cnt_connect_notify; | |
478 | u32 cnt_media_status_notify; | |
479 | u32 cnt_special_packet_notify; | |
480 | u32 cnt_bt_info_notify; | |
481 | u32 cnt_periodical; | |
482 | u32 cnt_stack_operation_notify; | |
483 | u32 cnt_dbg_ctrl; | |
484 | }; | |
485 | ||
486 | struct btc_bt_link_info { | |
487 | bool bt_link_exist; | |
488 | bool sco_exist; | |
489 | bool sco_only; | |
490 | bool a2dp_exist; | |
491 | bool a2dp_only; | |
492 | bool hid_exist; | |
493 | bool hid_only; | |
494 | bool pan_exist; | |
495 | bool pan_only; | |
496 | }; | |
497 | ||
498 | enum btc_antenna_pos { | |
499 | BTC_ANTENNA_AT_MAIN_PORT = 0x1, | |
500 | BTC_ANTENNA_AT_AUX_PORT = 0x2, | |
501 | }; | |
502 | ||
503 | struct btc_coexist { | |
504 | /* make sure only one adapter can bind the data context */ | |
505 | bool binded; | |
506 | /* default adapter */ | |
507 | void *adapter; | |
508 | struct btc_board_info board_info; | |
509 | /* some bt info referenced by non-bt module */ | |
510 | struct btc_bt_info bt_info; | |
511 | struct btc_stack_info stack_info; | |
512 | enum btc_chip_interface chip_interface; | |
513 | struct btc_bt_link_info bt_link_info; | |
514 | ||
515 | bool initilized; | |
516 | bool stop_coex_dm; | |
517 | bool manual_control; | |
518 | u8 *cli_buf; | |
519 | struct btc_statistics statistics; | |
520 | u8 pwr_mode_val[10]; | |
521 | ||
522 | /* function pointers - io related */ | |
523 | bfp_btc_r1 btc_read_1byte; | |
524 | bfp_btc_w1 btc_write_1byte; | |
525 | bfp_btc_w1_bit_mak btc_write_1byte_bitmask; | |
526 | bfp_btc_r2 btc_read_2byte; | |
527 | bfp_btc_w2 btc_write_2byte; | |
528 | bfp_btc_r4 btc_read_4byte; | |
529 | bfp_btc_w4 btc_write_4byte; | |
530 | ||
531 | bfp_btc_set_bb_reg btc_set_bb_reg; | |
532 | bfp_btc_get_bb_reg btc_get_bb_reg; | |
533 | ||
534 | ||
535 | bfp_btc_set_rf_reg btc_set_rf_reg; | |
536 | bfp_btc_get_rf_reg btc_get_rf_reg; | |
537 | ||
538 | bfp_btc_fill_h2c btc_fill_h2c; | |
539 | ||
540 | bfp_btc_disp_dbg_msg btc_disp_dbg_msg; | |
541 | ||
542 | bfp_btc_get btc_get; | |
543 | bfp_btc_set btc_set; | |
544 | }; | |
545 | ||
546 | bool halbtc_is_wifi_uplink(struct rtl_priv *adapter); | |
547 | ||
548 | extern struct btc_coexist gl_bt_coexist; | |
549 | ||
550 | bool exhalbtc_initlize_variables(struct rtl_priv *adapter); | |
551 | void exhalbtc_init_hw_config(struct btc_coexist *btcoexist); | |
552 | void exhalbtc_init_coex_dm(struct btc_coexist *btcoexist); | |
553 | void exhalbtc_ips_notify(struct btc_coexist *btcoexist, u8 type); | |
554 | void exhalbtc_lps_notify(struct btc_coexist *btcoexist, u8 type); | |
555 | void exhalbtc_scan_notify(struct btc_coexist *btcoexist, u8 type); | |
556 | void exhalbtc_connect_notify(struct btc_coexist *btcoexist, u8 action); | |
557 | void exhalbtc_mediastatus_notify(struct btc_coexist *btcoexist, | |
558 | enum _RT_MEDIA_STATUS media_status); | |
559 | void exhalbtc_special_packet_notify(struct btc_coexist *btcoexist, u8 pkt_type); | |
560 | void exhalbtc_bt_info_notify(struct btc_coexist *btcoexist, u8 *tmp_buf, | |
561 | u8 length); | |
562 | void exhalbtc_stack_operation_notify(struct btc_coexist *btcoexist, u8 type); | |
563 | void exhalbtc_halt_notify(struct btc_coexist *btcoexist); | |
564 | void exhalbtc_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state); | |
565 | void exhalbtc_periodical(struct btc_coexist *btcoexist); | |
566 | void exhalbtc_dbg_control(struct btc_coexist *btcoexist, u8 code, u8 len, | |
567 | u8 *data); | |
568 | void exhalbtc_stack_update_profile_info(void); | |
569 | void exhalbtc_set_hci_version(u16 hci_version); | |
570 | void exhalbtc_set_bt_patch_version(u16 bt_hci_version, u16 bt_patch_version); | |
571 | void exhalbtc_update_min_bt_rssi(char bt_rssi); | |
572 | void exhalbtc_set_bt_exist(bool bt_exist); | |
573 | void exhalbtc_set_chip_type(u8 chip_type); | |
574 | void exhalbtc_set_ant_num(u8 type, u8 ant_num); | |
575 | void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist); | |
576 | void exhalbtc_signal_compensation(struct btc_coexist *btcoexist, | |
577 | u8 *rssi_wifi, u8 *rssi_bt); | |
578 | void exhalbtc_lps_leave(struct btc_coexist *btcoexist); | |
579 | void exhalbtc_low_wifi_traffic_notify(struct btc_coexist *btcoexist); | |
580 | ||
581 | #endif |