1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2012 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 #ifndef __RTL8723A_BT_COEXIST_H__ 16 #define __RTL8723A_BT_COEXIST_H__ 17 18 #include <drv_types.h> 19 #include "odm_precomp.h" 20 21 22 /* HEADER/PlatformDef.h */ 23 enum rt_media_status { 24 RT_MEDIA_DISCONNECT = 0, 25 RT_MEDIA_CONNECT = 1 26 }; 27 28 /* ===== Below this line is sync from SD7 driver COMMON/BT.h ===== */ 29 30 #define BT_TMP_BUF_SIZE 100 31 32 void BT_SignalCompensation(struct rtw_adapter *padapter, 33 u8 *rssi_wifi, u8 *rssi_bt); 34 void BT_HaltProcess(struct rtw_adapter * padapter); 35 void BT_LpsLeave(struct rtw_adapter * padapter); 36 37 38 #define BT_HsConnectionEstablished(Adapter) false 39 /* ===== End of sync from SD7 driver COMMON/BT.h ===== */ 40 41 /* HEADER/SecurityType.h */ 42 #define TKIP_ENC_KEY_POS 32 /* KEK_LEN+KEK_LEN) */ 43 #define MAXRSNIELEN 256 44 45 /* COMMON/Protocol802_11.h */ 46 /* */ 47 /* 802.11 Management frame Status Code field */ 48 /* */ 49 struct octet_string { 50 u8 *Octet; 51 u16 Length; 52 }; 53 54 55 /* AES_CCMP specific */ 56 enum { 57 AESCCMP_BLK_SIZE = 16, /* # octets in an AES block */ 58 AESCCMP_MAX_PACKET = 4*512, /* largest packet size */ 59 AESCCMP_N_RESERVED = 0, /* reserved nonce octet value */ 60 AESCCMP_A_DATA = 0x40, /* the Adata bit in the flags */ 61 AESCCMP_M_SHIFT = 3, /* how much to shift the 3-bit M field */ 62 AESCCMP_L_SHIFT = 0, /* how much to shift the 3-bit L field */ 63 AESCCMP_L_SIZE = 2, /* size of the l(m) length field (in octets) */ 64 AESCCMP_OFFSET_SC = 22, 65 AESCCMP_OFFSET_DURATION = 4, 66 AESCCMP_OFFSET_A2 = 10, 67 AESCCMP_OFFSET_A4 = 24, 68 AESCCMP_QC_TID_MASK = 0x0f, 69 AESCCMP_BLK_SIZE_TOTAL = 16*16, /* Added by Annie for CKIP AES MIC BSOD, 2006-08-17. */ 70 /* 16*8 < 4*60 Resove to 16*16 */ 71 }; 72 73 /* Key Length */ 74 #define PMK_LEN 32 75 #define PTK_LEN_TKIP 64 76 #define GTK_LEN 32 77 #define KEY_NONCE_LEN 32 78 79 80 /* COMMON/Dot11d.h */ 81 struct chnl_txpower_triple { 82 u8 FirstChnl; 83 u8 NumChnls; 84 s8 MaxTxPowerInDbm; 85 }; 86 87 88 /* ===== Below this line is sync from SD7 driver COMMON/bt_hci.h ===== */ 89 /* The following is for BT 3.0 + HS HCI COMMAND ERRORS CODES */ 90 91 #define Max80211PALPDUSize 1492 92 #define Max80211AMPASSOCLen 672 93 #define MinGUserPrio 4 94 #define MaxGUserPrio 7 95 #define BEUserPrio0 0 96 #define BEUserPrio1 3 97 #define Max80211BeaconPeriod 2000 98 #define ShortRangeModePowerMax 4 99 100 #define BT_Default_Chnl 10 101 #define ACLDataHeaderLen 4 102 103 #define BTTotalDataBlockNum 0x100 104 #define BTLocalBufNum 0x200 105 #define BTMaxDataBlockLen 0x800 106 #define BTTOTALBANDWIDTH 0x7530 107 #define BTMAXBANDGUBANDWIDTH 0x4e20 108 #define TmpLocalBufSize 0x100 109 #define BTSynDataPacketLength 0xff 110 /* */ 111 112 #define BTMaxAuthCount 5 113 #define BTMaxAsocCount 5 114 115 #define MAX_LOGICAL_LINK_NUM 2 /* temporarily define */ 116 #define MAX_BT_ASOC_ENTRY_NUM 2 /* temporarily define */ 117 118 #define INVALID_PL_HANDLE 0xff 119 #define INVALID_ENTRY_NUM 0xff 120 /* */ 121 122 #define CAM_BT_START_INDEX (HALF_CAM_ENTRY - 4) /* MAX_BT_ASOC_ENTRY_NUM : 4 !!! */ 123 #define BT_HWCAM_STAR CAM_BT_START_INDEX /* We used HALF_CAM_ENTRY ~ HALF_CAM_ENTRY -MAX_BT_ASOC_ENTRY_NUM */ 124 125 enum hci_status { 126 HCI_STATUS_SUCCESS = 0x00, /* Success */ 127 HCI_STATUS_UNKNOW_HCI_CMD = 0x01, /* Unknown HCI Command */ 128 HCI_STATUS_UNKNOW_CONNECT_ID = 0X02, /* Unknown Connection Identifier */ 129 HCI_STATUS_HW_FAIL = 0X03, /* Hardware Failure */ 130 HCI_STATUS_PAGE_TIMEOUT = 0X04, /* Page Timeout */ 131 HCI_STATUS_AUTH_FAIL = 0X05, /* Authentication Failure */ 132 HCI_STATUS_PIN_OR_KEY_MISSING = 0X06, /* PIN or Key Missing */ 133 HCI_STATUS_MEM_CAP_EXCEED = 0X07, /* Memory Capacity Exceeded */ 134 HCI_STATUS_CONNECT_TIMEOUT = 0X08, /* Connection Timeout */ 135 HCI_STATUS_CONNECT_LIMIT = 0X09, /* Connection Limit Exceeded */ 136 HCI_STATUS_SYN_CONNECT_LIMIT = 0X0a, /* Synchronous Connection Limit To A Device Exceeded */ 137 HCI_STATUS_ACL_CONNECT_EXISTS = 0X0b, /* ACL Connection Already Exists */ 138 HCI_STATUS_CMD_DISALLOW = 0X0c, /* Command Disallowed */ 139 HCI_STATUS_CONNECT_RJT_LIMIT_RESOURCE = 0X0d, /* Connection Rejected due to Limited Resources */ 140 HCI_STATUS_CONNECT_RJT_SEC_REASON = 0X0e, /* Connection Rejected Due To Security Reasons */ 141 HCI_STATUS_CONNECT_RJT_UNACCEPT_BD_ADDR = 0X0f, /* Connection Rejected due to Unacceptable BD_ADDR */ 142 HCI_STATUS_CONNECT_ACCEPT_TIMEOUT = 0X10, /* Connection Accept Timeout Exceeded */ 143 HCI_STATUS_UNSUPPORT_FEATURE_PARA_VALUE = 0X11, /* Unsupported Feature or Parameter Value */ 144 HCI_STATUS_INVALID_HCI_CMD_PARA_VALUE = 0X12, /* Invalid HCI Command Parameters */ 145 HCI_STATUS_REMOTE_USER_TERMINATE_CONNECT = 0X13, /* Remote User Terminated Connection */ 146 HCI_STATUS_REMOTE_DEV_TERMINATE_LOW_RESOURCE = 0X14, /* Remote Device Terminated Connection due to Low Resources */ 147 HCI_STATUS_REMOTE_DEV_TERMINATE_CONNECT_POWER_OFF = 0X15, /* Remote Device Terminated Connection due to Power Off */ 148 HCI_STATUS_CONNECT_TERMINATE_LOCAL_HOST = 0X16, /* Connection Terminated By Local Host */ 149 HCI_STATUS_REPEATE_ATTEMPT = 0X17, /* Repeated Attempts */ 150 HCI_STATUS_PAIR_NOT_ALLOW = 0X18, /* Pairing Not Allowed */ 151 HCI_STATUS_UNKNOW_LMP_PDU = 0X19, /* Unknown LMP PDU */ 152 HCI_STATUS_UNSUPPORT_REMOTE_LMP_FEATURE = 0X1a, /* Unsupported Remote Feature / Unsupported LMP Feature */ 153 HCI_STATUS_SOC_OFFSET_REJECT = 0X1b, /* SCO Offset Rejected */ 154 HCI_STATUS_SOC_INTERVAL_REJECT = 0X1c, /* SCO Interval Rejected */ 155 HCI_STATUS_SOC_AIR_MODE_REJECT = 0X1d,/* SCO Air Mode Rejected */ 156 HCI_STATUS_INVALID_LMP_PARA = 0X1e, /* Invalid LMP Parameters */ 157 HCI_STATUS_UNSPECIFIC_ERROR = 0X1f, /* Unspecified Error */ 158 HCI_STATUS_UNSUPPORT_LMP_PARA_VALUE = 0X20, /* Unsupported LMP Parameter Value */ 159 HCI_STATUS_ROLE_CHANGE_NOT_ALLOW = 0X21, /* Role Change Not Allowed */ 160 HCI_STATUS_LMP_RESPONSE_TIMEOUT = 0X22, /* LMP Response Timeout */ 161 HCI_STATUS_LMP_ERROR_TRANSACTION_COLLISION = 0X23, /* LMP Error Transaction Collision */ 162 HCI_STATUS_LMP_PDU_NOT_ALLOW = 0X24, /* LMP PDU Not Allowed */ 163 HCI_STATUS_ENCRYPTION_MODE_NOT_ALLOW = 0X25, /* Encryption Mode Not Acceptable */ 164 HCI_STATUS_LINK_KEY_CAN_NOT_CHANGE = 0X26, /* Link Key Can Not be Changed */ 165 HCI_STATUS_REQUEST_QOS_NOT_SUPPORT = 0X27, /* Requested QoS Not Supported */ 166 HCI_STATUS_INSTANT_PASSED = 0X28, /* Instant Passed */ 167 HCI_STATUS_PAIRING_UNIT_KEY_NOT_SUPPORT = 0X29, /* Pairing With Unit Key Not Supported */ 168 HCI_STATUS_DIFFERENT_TRANSACTION_COLLISION = 0X2a, /* Different Transaction Collision */ 169 HCI_STATUS_RESERVE_1 = 0X2b, /* Reserved */ 170 HCI_STATUS_QOS_UNACCEPT_PARA = 0X2c, /* QoS Unacceptable Parameter */ 171 HCI_STATUS_QOS_REJECT = 0X2d, /* QoS Rejected */ 172 HCI_STATUS_CHNL_CLASSIFICATION_NOT_SUPPORT = 0X2e, /* Channel Classification Not Supported */ 173 HCI_STATUS_INSUFFICIENT_SECURITY = 0X2f, /* Insufficient Security */ 174 HCI_STATUS_PARA_OUT_OF_RANGE = 0x30, /* Parameter Out Of Mandatory Range */ 175 HCI_STATUS_RESERVE_2 = 0X31, /* Reserved */ 176 HCI_STATUS_ROLE_SWITCH_PENDING = 0X32, /* Role Switch Pending */ 177 HCI_STATUS_RESERVE_3 = 0X33, /* Reserved */ 178 HCI_STATUS_RESERVE_SOLT_VIOLATION = 0X34, /* Reserved Slot Violation */ 179 HCI_STATUS_ROLE_SWITCH_FAIL = 0X35, /* Role Switch Failed */ 180 HCI_STATUS_EXTEND_INQUIRY_RSP_TOO_LARGE = 0X36, /* Extended Inquiry Response Too Large */ 181 HCI_STATUS_SEC_SIMPLE_PAIRING_NOT_SUPPORT = 0X37, /* Secure Simple Pairing Not Supported By Host. */ 182 HCI_STATUS_HOST_BUSY_PAIRING = 0X38, /* Host Busy - Pairing */ 183 HCI_STATUS_CONNECT_REJ_NOT_SUIT_CHNL_FOUND = 0X39, /* Connection Rejected due to No Suitable Channel Found */ 184 HCI_STATUS_CONTROLLER_BUSY = 0X3a /* CONTROLLER BUSY */ 185 }; 186 187 /* */ 188 /* The following is for BT 3.0 + HS HCI COMMAND */ 189 /* */ 190 191 /* bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ 192 /* | OCF | OGF | */ 193 /* */ 194 195 /* OGF 0x01 */ 196 #define LINK_CONTROL_COMMANDS 0x01 197 enum link_control_commands { 198 HCI_INQUIRY = 0x0001, 199 HCI_INQUIRY_CANCEL = 0x0002, 200 HCI_PERIODIC_INQUIRY_MODE = 0x0003, 201 HCI_EXIT_PERIODIC_INQUIRY_MODE = 0x0004, 202 HCI_CREATE_CONNECTION = 0x0005, 203 HCI_DISCONNECT = 0x0006, 204 HCI_CREATE_CONNECTION_CANCEL = 0x0008, 205 HCI_ACCEPT_CONNECTIONREQUEST = 0x0009, 206 HCI_REJECT_CONNECTION_REQUEST = 0x000a, 207 HCI_LINK_KEY_REQUEST_REPLY = 0x000b, 208 HCI_LINK_KEY_REQUEST_NEGATIVE_REPLY = 0x000c, 209 HCI_PIN_CODE_REQUEST_REPLY = 0x000d, 210 HCI_PIN_CODE_REQUEST_NEGATIVE_REPLY = 0x000e, 211 HCI_CHANGE_CONNECTION_PACKET_TYPE = 0x000f, 212 HCI_AUTHENTICATION_REQUESTED = 0x0011, 213 HCI_SET_CONNECTION_ENCRYPTION = 0x0013, 214 HCI_CHANGE_CONNECTION_LINK_KEY = 0x0015, 215 HCI_MASTER_LINK_KEY = 0x0017, 216 HCI_REMOTE_NAME_REQUEST = 0x0019, 217 HCI_REMOTE_NAME_REQUEST_CANCEL = 0x001a, 218 HCI_READ_REMOTE_SUPPORTED_FEATURES = 0x001b, 219 HCI_READ_REMOTE_EXTENDED_FEATURES = 0x001c, 220 HCI_READ_REMOTE_VERSION_INFORMATION = 0x001d, 221 HCI_READ_CLOCK_OFFSET = 0x001f, 222 HCI_READ_LMP_HANDLE = 0x0020, 223 HCI_SETUP_SYNCHRONOUS_CONNECTION = 0x0028, 224 HCI_ACCEPT_SYNCHRONOUS_CONNECTION_REQUEST = 0x0029, 225 HCI_REJECT_SYNCHRONOUS_CONNECTION_REQUEST = 0x002a, 226 HCI_IO_CAPABILITY_REQUEST_REPLY = 0x002b, 227 HCI_USER_CONFIRMATION_REQUEST_REPLY = 0x002c, 228 HCI_USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY = 0x002d, 229 HCI_USER_PASSKEY_REQUEST_REPLY = 0x002e, 230 HCI_USER_PASSKEY_REQUESTNEGATIVE_REPLY = 0x002f, 231 HCI_REMOTE_OOB_DATA_REQUEST_REPLY = 0x0030, 232 HCI_REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY = 0x0033, 233 HCI_IO_CAPABILITY_REQUEST_NEGATIVE_REPLY = 0x0034, 234 HCI_CREATE_PHYSICAL_LINK = 0x0035, 235 HCI_ACCEPT_PHYSICAL_LINK = 0x0036, 236 HCI_DISCONNECT_PHYSICAL_LINK = 0x0037, 237 HCI_CREATE_LOGICAL_LINK = 0x0038, 238 HCI_ACCEPT_LOGICAL_LINK = 0x0039, 239 HCI_DISCONNECT_LOGICAL_LINK = 0x003a, 240 HCI_LOGICAL_LINK_CANCEL = 0x003b, 241 HCI_FLOW_SPEC_MODIFY = 0x003c 242 }; 243 244 /* OGF 0x02 */ 245 #define HOLD_MODE_COMMAND 0x02 246 enum hold_mode_command { 247 HCI_HOLD_MODE = 0x0001, 248 HCI_SNIFF_MODE = 0x0002, 249 HCI_EXIT_SNIFF_MODE = 0x0003, 250 HCI_PARK_STATE = 0x0005, 251 HCI_EXIT_PARK_STATE = 0x0006, 252 HCI_QOS_SETUP = 0x0007, 253 HCI_ROLE_DISCOVERY = 0x0009, 254 HCI_SWITCH_ROLE = 0x000b, 255 HCI_READ_LINK_POLICY_SETTINGS = 0x000c, 256 HCI_WRITE_LINK_POLICY_SETTINGS = 0x000d, 257 HCI_READ_DEFAULT_LINK_POLICY_SETTINGS = 0x000e, 258 HCI_WRITE_DEFAULT_LINK_POLICY_SETTINGS = 0x000f, 259 HCI_FLOW_SPECIFICATION = 0x0010, 260 HCI_SNIFF_SUBRATING = 0x0011 261 }; 262 263 /* OGF 0x03 */ 264 #define OGF_SET_EVENT_MASK_COMMAND 0x03 265 enum set_event_mask_command { 266 HCI_SET_EVENT_MASK = 0x0001, 267 HCI_RESET = 0x0003, 268 HCI_SET_EVENT_FILTER = 0x0005, 269 HCI_FLUSH = 0x0008, 270 HCI_READ_PIN_TYPE = 0x0009, 271 HCI_WRITE_PIN_TYPE = 0x000a, 272 HCI_CREATE_NEW_UNIT_KEY = 0x000b, 273 HCI_READ_STORED_LINK_KEY = 0x000d, 274 HCI_WRITE_STORED_LINK_KEY = 0x0011, 275 HCI_DELETE_STORED_LINK_KEY = 0x0012, 276 HCI_WRITE_LOCAL_NAME = 0x0013, 277 HCI_READ_LOCAL_NAME = 0x0014, 278 HCI_READ_CONNECTION_ACCEPT_TIMEOUT = 0x0015, 279 HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT = 0x0016, 280 HCI_READ_PAGE_TIMEOUT = 0x0017, 281 HCI_WRITE_PAGE_TIMEOUT = 0x0018, 282 HCI_READ_SCAN_ENABLE = 0x0019, 283 HCI_WRITE_SCAN_ENABLE = 0x001a, 284 HCI_READ_PAGE_SCAN_ACTIVITY = 0x001b, 285 HCI_WRITE_PAGE_SCAN_ACTIVITY = 0x001c, 286 HCI_READ_INQUIRY_SCAN_ACTIVITY = 0x001d, 287 HCI_WRITE_INQUIRY_SCAN_ACTIVITY = 0x001e, 288 HCI_READ_AUTHENTICATION_ENABLE = 0x001f, 289 HCI_WRITE_AUTHENTICATION_ENABLE = 0x0020, 290 HCI_READ_CLASS_OF_DEVICE = 0x0023, 291 HCI_WRITE_CLASS_OF_DEVICE = 0x0024, 292 HCI_READ_VOICE_SETTING = 0x0025, 293 HCI_WRITE_VOICE_SETTING = 0x0026, 294 HCI_READ_AUTOMATIC_FLUSH_TIMEOUT = 0x0027, 295 HCI_WRITE_AUTOMATIC_FLUSH_TIMEOUT = 0x0028, 296 HCI_READ_NUM_BROADCAST_RETRANSMISSIONS = 0x0029, 297 HCI_WRITE_NUM_BROADCAST_RETRANSMISSIONS = 0x002a, 298 HCI_READ_HOLD_MODE_ACTIVITY = 0x002b, 299 HCI_WRITE_HOLD_MODE_ACTIVITY = 0x002c, 300 HCI_READ_SYNCHRONOUS_FLOW_CONTROL_ENABLE = 0x002e, 301 HCI_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE = 0x002f, 302 HCI_SET_CONTROLLER_TO_HOST_FLOW_CONTROL = 0x0031, 303 HCI_HOST_BUFFER_SIZE = 0x0033, 304 HCI_HOST_NUMBER_OF_COMPLETED_PACKETS = 0x0035, 305 HCI_READ_LINK_SUPERVISION_TIMEOUT = 0x0036, 306 HCI_WRITE_LINK_SUPERVISION_TIMEOUT = 0x0037, 307 HCI_READ_NUMBER_OF_SUPPORTED_IAC = 0x0038, 308 HCI_READ_CURRENT_IAC_LAP = 0x0039, 309 HCI_WRITE_CURRENT_IAC_LAP = 0x003a, 310 HCI_READ_PAGE_SCAN_MODE = 0x003d, 311 HCI_WRITE_PAGE_SCAN_MODE = 0x003e, 312 HCI_SET_AFH_HOST_CHANNEL_CLASSIFICATION = 0x003f, 313 HCI_READ_INQUIRY_SCAN_TYPE = 0x0042, 314 HCI_WRITE_INQUIRY_SCAN_TYPE = 0x0043, 315 HCI_READ_INQUIRY_MODE = 0x0044, 316 HCI_WRITE_INQUIRY_MODE = 0x0045, 317 HCI_READ_PAGE_SCAN_TYPE = 0x0046, 318 HCI_WRITE_PAGE_SCAN_TYPE = 0x0047, 319 HCI_READ_AFH_CHANNEL_ASSESSMENT_MODE = 0x0048, 320 HCI_WRITE_AFH_CHANNEL_ASSESSMENT_MODE = 0x0049, 321 HCI_READ_EXTENDED_INQUIRY_RESPONSE = 0x0051, 322 HCI_WRITE_EXTENDED_INQUIRY_RESPONSE = 0x0052, 323 HCI_REFRESH_ENCRYPTION_KEY = 0x0053, 324 HCI_READ_SIMPLE_PAIRING_MODE = 0x0055, 325 HCI_WRITE_SIMPLE_PAIRING_MODE = 0x0056, 326 HCI_READ_LOCAL_OOB_DATA = 0x0057, 327 HCI_READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL = 0x0058, 328 HCI_WRITE_INQUIRY_TRANSMIT_POWER_LEVEL = 0x0059, 329 HCI_READ_DEFAULT_ERRONEOUS_DATA_REPORTING = 0x005a, 330 HCI_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING = 0x005b, 331 HCI_ENHANCED_FLUSH = 0x005f, 332 HCI_SEND_KEYPRESS_NOTIFICATION = 0x0060, 333 HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT = 0x0061, 334 HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT = 0x0062, 335 HCI_SET_EVENT_MASK_PAGE_2 = 0x0063, 336 HCI_READ_LOCATION_DATA = 0x0064, 337 HCI_WRITE_LOCATION_DATA = 0x0065, 338 HCI_READ_FLOW_CONTROL_MODE = 0x0066, 339 HCI_WRITE_FLOW_CONTROL_MODE = 0x0067, 340 HCI_READ_ENHANCE_TRANSMIT_POWER_LEVEL = 0x0068, 341 HCI_READ_BEST_EFFORT_FLUSH_TIMEOUT = 0x0069, 342 HCI_WRITE_BEST_EFFORT_FLUSH_TIMEOUT = 0x006a, 343 HCI_SHORT_RANGE_MODE = 0x006b 344 }; 345 346 /* OGF 0x04 */ 347 #define OGF_INFORMATIONAL_PARAMETERS 0x04 348 enum informational_params { 349 HCI_READ_LOCAL_VERSION_INFORMATION = 0x0001, 350 HCI_READ_LOCAL_SUPPORTED_COMMANDS = 0x0002, 351 HCI_READ_LOCAL_SUPPORTED_FEATURES = 0x0003, 352 HCI_READ_LOCAL_EXTENDED_FEATURES = 0x0004, 353 HCI_READ_BUFFER_SIZE = 0x0005, 354 HCI_READ_BD_ADDR = 0x0009, 355 HCI_READ_DATA_BLOCK_SIZE = 0x000a 356 }; 357 358 /* OGF 0x05 */ 359 #define OGF_STATUS_PARAMETERS 0x05 360 enum status_params { 361 HCI_READ_FAILED_CONTACT_COUNTER = 0x0001, 362 HCI_RESET_FAILED_CONTACT_COUNTER = 0x0002, 363 HCI_READ_LINK_QUALITY = 0x0003, 364 HCI_READ_RSSI = 0x0005, 365 HCI_READ_AFH_CHANNEL_MAP = 0x0006, 366 HCI_READ_CLOCK = 0x0007, 367 HCI_READ_ENCRYPTION_KEY_SIZE = 0x0008, 368 HCI_READ_LOCAL_AMP_INFO = 0x0009, 369 HCI_READ_LOCAL_AMP_ASSOC = 0x000a, 370 HCI_WRITE_REMOTE_AMP_ASSOC = 0x000b 371 }; 372 373 /* OGF 0x06 */ 374 #define OGF_TESTING_COMMANDS 0x06 375 enum testing_commands { 376 HCI_READ_LOOPBACK_MODE = 0x0001, 377 HCI_WRITE_LOOPBACK_MODE = 0x0002, 378 HCI_ENABLE_DEVICE_UNDER_TEST_MODE = 0x0003, 379 HCI_WRITE_SIMPLE_PAIRING_DEBUG_MODE = 0x0004, 380 HCI_ENABLE_AMP_RECEIVER_REPORTS = 0x0007, 381 HCI_AMP_TEST_END = 0x0008, 382 HCI_AMP_TEST_COMMAND = 0x0009 383 }; 384 385 /* OGF 0x3f */ 386 #define OGF_EXTENSION 0X3f 387 enum hci_extension_commands { 388 HCI_SET_ACL_LINK_DATA_FLOW_MODE = 0x0010, 389 HCI_SET_ACL_LINK_STATUS = 0x0020, 390 HCI_SET_SCO_LINK_STATUS = 0x0030, 391 HCI_SET_RSSI_VALUE = 0x0040, 392 HCI_SET_CURRENT_BLUETOOTH_STATUS = 0x0041, 393 394 /* The following is for RTK8723 */ 395 HCI_EXTENSION_VERSION_NOTIFY = 0x0100, 396 HCI_LINK_STATUS_NOTIFY = 0x0101, 397 HCI_BT_OPERATION_NOTIFY = 0x0102, 398 HCI_ENABLE_WIFI_SCAN_NOTIFY = 0x0103, 399 400 401 /* The following is for IVT */ 402 HCI_WIFI_CURRENT_CHANNEL = 0x0300, 403 HCI_WIFI_CURRENT_BANDWIDTH = 0x0301, 404 HCI_WIFI_CONNECTION_STATUS = 0x0302, 405 }; 406 407 enum bt_spec { 408 BT_SPEC_1_0_b = 0x00, 409 BT_SPEC_1_1 = 0x01, 410 BT_SPEC_1_2 = 0x02, 411 BT_SPEC_2_0_EDR = 0x03, 412 BT_SPEC_2_1_EDR = 0x04, 413 BT_SPEC_3_0_HS = 0x05, 414 BT_SPEC_4_0 = 0x06 415 }; 416 417 /* The following is for BT 3.0 + HS EVENTS */ 418 enum hci_event { 419 HCI_EVENT_INQUIRY_COMPLETE = 0x01, 420 HCI_EVENT_INQUIRY_RESULT = 0x02, 421 HCI_EVENT_CONNECTION_COMPLETE = 0x03, 422 HCI_EVENT_CONNECTION_REQUEST = 0x04, 423 HCI_EVENT_DISCONNECTION_COMPLETE = 0x05, 424 HCI_EVENT_AUTHENTICATION_COMPLETE = 0x06, 425 HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE = 0x07, 426 HCI_EVENT_ENCRYPTION_CHANGE = 0x08, 427 HCI_EVENT_CHANGE_LINK_KEY_COMPLETE = 0x09, 428 HCI_EVENT_MASTER_LINK_KEY_COMPLETE = 0x0a, 429 HCI_EVENT_READ_REMOTE_SUPPORT_FEATURES_COMPLETE = 0x0b, 430 HCI_EVENT_READ_REMOTE_VER_INFO_COMPLETE = 0x0c, 431 HCI_EVENT_QOS_SETUP_COMPLETE = 0x0d, 432 HCI_EVENT_COMMAND_COMPLETE = 0x0e, 433 HCI_EVENT_COMMAND_STATUS = 0x0f, 434 HCI_EVENT_HARDWARE_ERROR = 0x10, 435 HCI_EVENT_FLUSH_OCCRUED = 0x11, 436 HCI_EVENT_ROLE_CHANGE = 0x12, 437 HCI_EVENT_NUMBER_OF_COMPLETE_PACKETS = 0x13, 438 HCI_EVENT_MODE_CHANGE = 0x14, 439 HCI_EVENT_RETURN_LINK_KEYS = 0x15, 440 HCI_EVENT_PIN_CODE_REQUEST = 0x16, 441 HCI_EVENT_LINK_KEY_REQUEST = 0x17, 442 HCI_EVENT_LINK_KEY_NOTIFICATION = 0x18, 443 HCI_EVENT_LOOPBACK_COMMAND = 0x19, 444 HCI_EVENT_DATA_BUFFER_OVERFLOW = 0x1a, 445 HCI_EVENT_MAX_SLOTS_CHANGE = 0x1b, 446 HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE = 0x1c, 447 HCI_EVENT_CONNECT_PACKET_TYPE_CHANGE = 0x1d, 448 HCI_EVENT_QOS_VIOLATION = 0x1e, 449 HCI_EVENT_PAGE_SCAN_REPETITION_MODE_CHANGE = 0x20, 450 HCI_EVENT_FLOW_SEPC_COMPLETE = 0x21, 451 HCI_EVENT_INQUIRY_RESULT_WITH_RSSI = 0x22, 452 HCI_EVENT_READ_REMOTE_EXT_FEATURES_COMPLETE = 0x23, 453 HCI_EVENT_SYNC_CONNECT_COMPLETE = 0x2c, 454 HCI_EVENT_SYNC_CONNECT_CHANGE = 0x2d, 455 HCI_EVENT_SNIFFER_SUBRATING = 0x2e, 456 HCI_EVENT_EXTENTED_INQUIRY_RESULT = 0x2f, 457 HCI_EVENT_ENCRYPTION_KEY_REFLASH_COMPLETE = 0x30, 458 HCI_EVENT_IO_CAPIBILITY_COMPLETE = 0x31, 459 HCI_EVENT_IO_CAPIBILITY_RESPONSE = 0x32, 460 HCI_EVENT_USER_CONFIRMTION_REQUEST = 0x33, 461 HCI_EVENT_USER_PASSKEY_REQUEST = 0x34, 462 HCI_EVENT_REMOTE_OOB_DATA_REQUEST = 0x35, 463 HCI_EVENT_SIMPLE_PAIRING_COMPLETE = 0x36, 464 HCI_EVENT_LINK_SUPERVISION_TIMEOUT_CHANGE = 0x38, 465 HCI_EVENT_ENHANCED_FLUSH_COMPLETE = 0x39, 466 HCI_EVENT_USER_PASSKEY_NOTIFICATION = 0x3b, 467 HCI_EVENT_KEYPRESS_NOTIFICATION = 0x3c, 468 HCI_EVENT_REMOTE_HOST_SUPPORT_FEATURES_NOTIFICATION = 0x3d, 469 HCI_EVENT_PHY_LINK_COMPLETE = 0x40, 470 HCI_EVENT_CHANNEL_SELECT = 0x41, 471 HCI_EVENT_DISCONNECT_PHY_LINK_COMPLETE = 0x42, 472 HCI_EVENT_PHY_LINK_LOSS_EARLY_WARNING = 0x43, 473 HCI_EVENT_PHY_LINK_RECOVER = 0x44, 474 HCI_EVENT_LOGICAL_LINK_COMPLETE = 0x45, 475 HCI_EVENT_DISCONNECT_LOGICAL_LINK_COMPLETE = 0x46, 476 HCI_EVENT_FLOW_SPEC_MODIFY_COMPLETE = 0x47, 477 HCI_EVENT_NUM_OF_COMPLETE_DATA_BLOCKS = 0x48, 478 HCI_EVENT_AMP_START_TEST = 0x49, 479 HCI_EVENT_AMP_TEST_END = 0x4a, 480 HCI_EVENT_AMP_RECEIVER_REPORT = 0x4b, 481 HCI_EVENT_SHORT_RANGE_MODE_CHANGE_COMPLETE = 0x4c, 482 HCI_EVENT_AMP_STATUS_CHANGE = 0x4d, 483 HCI_EVENT_EXTENSION_RTK = 0xfe, 484 HCI_EVENT_EXTENSION_MOTO = 0xff, 485 }; 486 487 enum hci_extension_event_moto { 488 HCI_EVENT_GET_BT_RSSI = 0x01, 489 }; 490 491 enum hci_extension_event { 492 HCI_EVENT_EXT_WIFI_SCAN_NOTIFY = 0x01, 493 }; 494 495 enum hci_event_mask_page_2 { 496 EMP2_HCI_EVENT_PHY_LINK_COMPLETE = 0x0000000000000001, 497 EMP2_HCI_EVENT_CHANNEL_SELECT = 0x0000000000000002, 498 EMP2_HCI_EVENT_DISCONNECT_PHY_LINK_COMPLETE = 0x0000000000000004, 499 EMP2_HCI_EVENT_PHY_LINK_LOSS_EARLY_WARNING = 0x0000000000000008, 500 EMP2_HCI_EVENT_PHY_LINK_RECOVER = 0x0000000000000010, 501 EMP2_HCI_EVENT_LOGICAL_LINK_COMPLETE = 0x0000000000000020, 502 EMP2_HCI_EVENT_DISCONNECT_LOGICAL_LINK_COMPLETE = 0x0000000000000040, 503 EMP2_HCI_EVENT_FLOW_SPEC_MODIFY_COMPLETE = 0x0000000000000080, 504 EMP2_HCI_EVENT_NUM_OF_COMPLETE_DATA_BLOCKS = 0x0000000000000100, 505 EMP2_HCI_EVENT_AMP_START_TEST = 0x0000000000000200, 506 EMP2_HCI_EVENT_AMP_TEST_END = 0x0000000000000400, 507 EMP2_HCI_EVENT_AMP_RECEIVER_REPORT = 0x0000000000000800, 508 EMP2_HCI_EVENT_SHORT_RANGE_MODE_CHANGE_COMPLETE = 0x0000000000001000, 509 EMP2_HCI_EVENT_AMP_STATUS_CHANGE = 0x0000000000002000, 510 }; 511 512 enum hci_state_machine { 513 HCI_STATE_STARTING = 0x01, 514 HCI_STATE_CONNECTING = 0x02, 515 HCI_STATE_AUTHENTICATING = 0x04, 516 HCI_STATE_CONNECTED = 0x08, 517 HCI_STATE_DISCONNECTING = 0x10, 518 HCI_STATE_DISCONNECTED = 0x20 519 }; 520 521 enum amp_assoc_structure_type { 522 AMP_MAC_ADDR = 0x01, 523 AMP_PREFERRED_CHANNEL_LIST = 0x02, 524 AMP_CONNECTED_CHANNEL = 0x03, 525 AMP_80211_PAL_CAP_LIST = 0x04, 526 AMP_80211_PAL_VISION = 0x05, 527 AMP_RESERVED_FOR_TESTING = 0x33 528 }; 529 530 enum amp_btap_type { 531 AMP_BTAP_NONE, 532 AMP_BTAP_CREATOR, 533 AMP_BTAP_JOINER 534 }; 535 536 enum hci_state_with_cmd { 537 STATE_CMD_CREATE_PHY_LINK, 538 STATE_CMD_ACCEPT_PHY_LINK, 539 STATE_CMD_DISCONNECT_PHY_LINK, 540 STATE_CMD_CONNECT_ACCEPT_TIMEOUT, 541 STATE_CMD_MAC_START_COMPLETE, 542 STATE_CMD_MAC_START_FAILED, 543 STATE_CMD_MAC_CONNECT_COMPLETE, 544 STATE_CMD_MAC_CONNECT_FAILED, 545 STATE_CMD_MAC_DISCONNECT_INDICATE, 546 STATE_CMD_MAC_CONNECT_CANCEL_INDICATE, 547 STATE_CMD_4WAY_FAILED, 548 STATE_CMD_4WAY_SUCCESSED, 549 STATE_CMD_ENTER_STATE, 550 STATE_CMD_NO_SUCH_CMD, 551 }; 552 553 enum hci_service_type { 554 SERVICE_NO_TRAFFIC, 555 SERVICE_BEST_EFFORT, 556 SERVICE_GUARANTEE 557 }; 558 559 enum hci_traffic_mode { 560 TRAFFIC_MODE_BEST_EFFORT = 0x00, 561 TRAFFIC_MODE_GUARANTEED_LATENCY = 0x01, 562 TRAFFIC_MODE_GUARANTEED_BANDWIDTH = 0x02, 563 TRAFFIC_MODE_GUARANTEED_LATENCY_AND_BANDWIDTH = 0x03 564 }; 565 566 #define HCIOPCODE(_OCF, _OGF) (_OGF<<10|_OCF) 567 #define HCIOPCODELOW(_OCF, _OGF) (u8)(HCIOPCODE(_OCF, _OGF)&0x00ff) 568 #define HCIOPCODEHIGHT(_OCF, _OGF) (u8)(HCIOPCODE(_OCF, _OGF)>>8) 569 570 #define TWOBYTE_HIGHTBYTE(_DATA) (u8)(_DATA>>8) 571 #define TWOBYTE_LOWBYTE(_DATA) (u8)(_DATA) 572 573 enum amp_status { 574 AMP_STATUS_AVA_PHY_PWR_DWN = 0x0, 575 AMP_STATUS_BT_USE_ONLY = 0x1, 576 AMP_STATUS_NO_CAPACITY_FOR_BT = 0x2, 577 AMP_STATUS_LOW_CAPACITY_FOR_BT = 0x3, 578 AMP_STATUS_MEDIUM_CAPACITY_FOR_BT = 0x4, 579 AMP_STATUS_HIGH_CAPACITY_FOR_BT = 0x5, 580 AMP_STATUS_FULL_CAPACITY_FOR_BT = 0x6 581 }; 582 583 enum bt_wpa_msg_type { 584 Type_BT_4way1st = 0, 585 Type_BT_4way2nd = 1, 586 Type_BT_4way3rd = 2, 587 Type_BT_4way4th = 3, 588 Type_BT_unknow = 4 589 }; 590 591 enum bt_connect_type { 592 BT_CONNECT_AUTH_REQ = 0x00, 593 BT_CONNECT_AUTH_RSP = 0x01, 594 BT_CONNECT_ASOC_REQ = 0x02, 595 BT_CONNECT_ASOC_RSP = 0x03, 596 BT_DISCONNECT = 0x04 597 }; 598 599 enum bt_ll_service_type { 600 BT_LL_BE = 0x01, 601 BT_LL_GU = 0x02 602 }; 603 604 enum bt_ll_flowspec { 605 BT_TX_BE_FS, /* TX best effort flowspec */ 606 BT_RX_BE_FS, /* RX best effort flowspec */ 607 BT_TX_GU_FS, /* TX guaranteed latency flowspec */ 608 BT_RX_GU_FS, /* RX guaranteed latency flowspec */ 609 BT_TX_BE_AGG_FS, /* TX aggregated best effort flowspec */ 610 BT_RX_BE_AGG_FS, /* RX aggregated best effort flowspec */ 611 BT_TX_GU_BW_FS, /* TX guaranteed bandwidth flowspec */ 612 BT_RX_GU_BW_FS, /* RX guaranteed bandwidth flowspec */ 613 BT_TX_GU_LARGE_FS, /* TX guaranteed latency flowspec, for testing only */ 614 BT_RX_GU_LARGE_FS, /* RX guaranteed latency flowspec, for testing only */ 615 }; 616 617 enum bt_traffic_mode { 618 BT_MOTOR_EXT_BE = 0x00, /* Best Effort. Default. for HCRP, PAN, SDP, RFCOMM-based profiles like FTP, OPP, SPP, DUN, etc. */ 619 BT_MOTOR_EXT_GUL = 0x01, /* Guaranteed Latency. This type of traffic is used e.g. for HID and AVRCP. */ 620 BT_MOTOR_EXT_GUB = 0X02, /* Guaranteed Bandwidth. */ 621 BT_MOTOR_EXT_GULB = 0X03 /* Guaranteed Latency and Bandwidth. for A2DP and VDP. */ 622 }; 623 624 enum bt_traffic_mode_profile { 625 BT_PROFILE_NONE, 626 BT_PROFILE_A2DP, 627 BT_PROFILE_PAN, 628 BT_PROFILE_HID, 629 BT_PROFILE_SCO 630 }; 631 632 enum bt_link_role { 633 BT_LINK_MASTER = 0, 634 BT_LINK_SLAVE = 1 635 }; 636 637 enum bt_state_wpa_auth { 638 STATE_WPA_AUTH_UNINITIALIZED, 639 STATE_WPA_AUTH_WAIT_PACKET_1, /* Join */ 640 STATE_WPA_AUTH_WAIT_PACKET_2, /* Creat */ 641 STATE_WPA_AUTH_WAIT_PACKET_3, 642 STATE_WPA_AUTH_WAIT_PACKET_4, 643 STATE_WPA_AUTH_SUCCESSED 644 }; 645 646 #define BT_WPA_AUTH_TIMEOUT_PERIOD 1000 647 #define BTMaxWPAAuthReTransmitCoun 5 648 649 #define MAX_AMP_ASSOC_FRAG_LEN 248 650 #define TOTAL_ALLOCIATE_ASSOC_LEN 1000 651 652 struct hci_flow_spec { 653 u8 Identifier; 654 u8 ServiceType; 655 u16 MaximumSDUSize; 656 u32 SDUInterArrivalTime; 657 u32 AccessLatency; 658 u32 FlushTimeout; 659 }; 660 661 struct hci_log_link_cmd_data { 662 u8 BtPhyLinkhandle; 663 u16 BtLogLinkhandle; 664 u8 BtTxFlowSpecID; 665 struct hci_flow_spec Tx_Flow_Spec; 666 struct hci_flow_spec Rx_Flow_Spec; 667 u32 TxPacketCount; 668 u32 BestEffortFlushTimeout; 669 670 u8 bLLCompleteEventIsSet; 671 672 u8 bLLCancelCMDIsSetandComplete; 673 }; 674 675 struct hci_phy_link_cmd_data { 676 /* Physical_Link_Handle */ 677 u8 BtPhyLinkhandle; 678 679 u16 LinkSuperversionTimeout; 680 681 /* u16 SuperTimeOutCnt; */ 682 683 /* Dedicated_AMP_Key_Length */ 684 u8 BtAMPKeyLen; 685 /* Dedicated_AMP_Key_Type */ 686 u8 BtAMPKeyType; 687 /* Dedicated_AMP_Key */ 688 u8 BtAMPKey[PMK_LEN]; 689 }; 690 691 struct amp_assoc_structure { 692 /* TYPE ID */ 693 u8 TypeID; 694 /* Length */ 695 u16 Length; 696 /* Value */ 697 u8 Data[1]; 698 }; 699 700 struct amp_pref_chnl_regulatory { 701 u8 reXId; 702 u8 regulatoryClass; 703 u8 coverageClass; 704 }; 705 706 struct amp_assoc_cmd_data { 707 /* Physical_Link_Handle */ 708 u8 BtPhyLinkhandle; 709 /* Length_So_Far */ 710 u16 LenSoFar; 711 712 u16 MaxRemoteASSOCLen; 713 /* AMP_ASSOC_Remaining_Length */ 714 u16 AMPAssocRemLen; 715 /* AMP_ASSOC_fragment */ 716 void *AMPAssocfragment; 717 }; 718 719 struct hci_link_info { 720 u16 ConnectHandle; 721 u8 IncomingTrafficMode; 722 u8 OutgoingTrafficMode; 723 u8 BTProfile; 724 u8 BTCoreSpec; 725 s8 BT_RSSI; 726 u8 TrafficProfile; 727 u8 linkRole; 728 }; 729 730 struct hci_ext_config { 731 struct hci_link_info linkInfo[MAX_BT_ASOC_ENTRY_NUM]; 732 u8 btOperationCode; 733 u16 CurrentConnectHandle; 734 u8 CurrentIncomingTrafficMode; 735 u8 CurrentOutgoingTrafficMode; 736 s8 MIN_BT_RSSI; 737 u8 NumberOfHandle; 738 u8 NumberOfSCO; 739 u8 CurrentBTStatus; 740 u16 HCIExtensionVer; 741 742 /* Bt coexist related */ 743 u8 btProfileCase; 744 u8 btProfileAction; 745 u8 bManualControl; 746 u8 bBTBusy; 747 u8 bBTA2DPBusy; 748 u8 bEnableWifiScanNotify; 749 750 u8 bHoldForBtOperation; 751 u32 bHoldPeriodCnt; 752 }; 753 754 struct hci_acl_packet_data { 755 u16 ACLDataPacketLen; 756 u8 SyncDataPacketLen; 757 u16 TotalNumACLDataPackets; 758 u16 TotalSyncNumDataPackets; 759 }; 760 761 struct hci_phy_link_bss_info { 762 u16 bdCap; /* capability information */ 763 }; 764 765 struct packet_irp_hcicmd_data { 766 u16 OCF:10; 767 u16 OGF:6; 768 u8 Length; 769 u8 Data[20]; 770 }; 771 772 struct bt_asoc_entry { 773 u8 bUsed; 774 u8 mAssoc; 775 u8 b4waySuccess; 776 u8 Bssid[6]; 777 struct hci_phy_link_cmd_data PhyLinkCmdData; 778 779 struct hci_log_link_cmd_data LogLinkCmdData[MAX_LOGICAL_LINK_NUM]; 780 781 struct hci_acl_packet_data ACLPacketsData; 782 783 struct amp_assoc_cmd_data AmpAsocCmdData; 784 struct octet_string BTSsid; 785 u8 BTSsidBuf[33]; 786 787 enum hci_status PhyLinkDisconnectReason; 788 789 u8 bSendSupervisionPacket; 790 /* u8 CurrentSuervisionPacketSendNum; */ 791 /* u8 LastSuervisionPacketSendNum; */ 792 u32 NoRxPktCnt; 793 /* Is Creator or Joiner */ 794 enum amp_btap_type AMPRole; 795 796 /* BT current state */ 797 u8 BtCurrentState; 798 /* BT next state */ 799 u8 BtNextState; 800 801 u8 bNeedPhysLinkCompleteEvent; 802 803 enum hci_status PhysLinkCompleteStatus; 804 805 u8 BTRemoteMACAddr[6]; 806 807 u32 BTCapability; 808 809 u8 SyncDataPacketLen; 810 811 u16 TotalSyncNumDataPackets; 812 u16 TotalNumACLDataPackets; 813 814 u8 ShortRangeMode; 815 816 u8 PTK[PTK_LEN_TKIP]; 817 u8 GTK[GTK_LEN]; 818 u8 ANonce[KEY_NONCE_LEN]; 819 u8 SNonce[KEY_NONCE_LEN]; 820 u64 KeyReplayCounter; 821 u8 WPAAuthReplayCount; 822 u8 AESKeyBuf[AESCCMP_BLK_SIZE_TOTAL]; 823 u8 PMK[PMK_LEN]; 824 enum bt_state_wpa_auth BTWPAAuthState; 825 s32 UndecoratedSmoothedPWDB; 826 827 /* Add for HW security !! */ 828 u8 HwCAMIndex; /* Cam index */ 829 u8 bPeerQosSta; 830 831 u32 rxSuvpPktCnt; 832 }; 833 834 struct bt_traffic_statistics { 835 u8 bTxBusyTraffic; 836 u8 bRxBusyTraffic; 837 u8 bIdle; 838 u32 TxPktCntInPeriod; 839 u32 RxPktCntInPeriod; 840 u64 TxPktLenInPeriod; 841 u64 RxPktLenInPeriod; 842 }; 843 844 struct bt_mgnt { 845 u8 bBTConnectInProgress; 846 u8 bLogLinkInProgress; 847 u8 bPhyLinkInProgress; 848 u8 bPhyLinkInProgressStartLL; 849 u8 BtCurrentPhyLinkhandle; 850 u16 BtCurrentLogLinkhandle; 851 u8 CurrentConnectEntryNum; 852 u8 DisconnectEntryNum; 853 u8 CurrentBTConnectionCnt; 854 enum bt_connect_type BTCurrentConnectType; 855 enum bt_connect_type BTReceiveConnectPkt; 856 u8 BTAuthCount; 857 u8 BTAsocCount; 858 u8 bStartSendSupervisionPkt; 859 u8 BtOperationOn; 860 u8 BTNeedAMPStatusChg; 861 u8 JoinerNeedSendAuth; 862 struct hci_phy_link_bss_info bssDesc; 863 struct hci_ext_config ExtConfig; 864 u8 bNeedNotifyAMPNoCap; 865 u8 bCreateSpportQos; 866 u8 bSupportProfile; 867 u8 BTChannel; 868 u8 CheckChnlIsSuit; 869 u8 bBtScan; 870 u8 btLogoTest; 871 }; 872 873 struct bt_hci_dgb_info { 874 u32 hciCmdCnt; 875 u32 hciCmdCntUnknown; 876 u32 hciCmdCntCreatePhyLink; 877 u32 hciCmdCntAcceptPhyLink; 878 u32 hciCmdCntDisconnectPhyLink; 879 u32 hciCmdPhyLinkStatus; 880 u32 hciCmdCntCreateLogLink; 881 u32 hciCmdCntAcceptLogLink; 882 u32 hciCmdCntDisconnectLogLink; 883 u32 hciCmdCntReadLocalAmpAssoc; 884 u32 hciCmdCntWriteRemoteAmpAssoc; 885 u32 hciCmdCntSetAclLinkStatus; 886 u32 hciCmdCntSetScoLinkStatus; 887 u32 hciCmdCntExtensionVersionNotify; 888 u32 hciCmdCntLinkStatusNotify; 889 }; 890 891 struct bt_irp_dgb_info { 892 u32 irpMJCreate; 893 /* Io Control */ 894 u32 irpIoControl; 895 u32 irpIoCtrlHciCmd; 896 u32 irpIoCtrlHciEvent; 897 u32 irpIoCtrlHciTxData; 898 u32 irpIoCtrlHciRxData; 899 u32 irpIoCtrlUnknown; 900 901 u32 irpIoCtrlHciTxData1s; 902 }; 903 904 struct bt_packet_dgb_info { 905 u32 btPktTxProbReq; 906 u32 btPktRxProbReq; 907 u32 btPktRxProbReqFail; 908 u32 btPktTxProbRsp; 909 u32 btPktRxProbRsp; 910 u32 btPktTxAuth; 911 u32 btPktRxAuth; 912 u32 btPktRxAuthButDrop; 913 u32 btPktTxAssocReq; 914 u32 btPktRxAssocReq; 915 u32 btPktRxAssocReqButDrop; 916 u32 btPktTxAssocRsp; 917 u32 btPktRxAssocRsp; 918 u32 btPktTxDisassoc; 919 u32 btPktRxDisassoc; 920 u32 btPktRxDeauth; 921 u32 btPktTx4way1st; 922 u32 btPktRx4way1st; 923 u32 btPktTx4way2nd; 924 u32 btPktRx4way2nd; 925 u32 btPktTx4way3rd; 926 u32 btPktRx4way3rd; 927 u32 btPktTx4way4th; 928 u32 btPktRx4way4th; 929 u32 btPktTxLinkSuperReq; 930 u32 btPktRxLinkSuperReq; 931 u32 btPktTxLinkSuperRsp; 932 u32 btPktRxLinkSuperRsp; 933 u32 btPktTxData; 934 u32 btPktRxData; 935 }; 936 937 struct bt_dgb { 938 u8 dbgCtrl; 939 u32 dbgProfile; 940 struct bt_hci_dgb_info dbgHciInfo; 941 struct bt_irp_dgb_info dbgIrpInfo; 942 struct bt_packet_dgb_info dbgBtPkt; 943 }; 944 945 struct bt_hci_info { 946 /* 802.11 Pal version specifier */ 947 u8 BTPalVersion; 948 u16 BTPalCompanyID; 949 u16 BTPalsubversion; 950 951 /* Connected channel list */ 952 u16 BTConnectChnlListLen; 953 u8 BTConnectChnllist[64]; 954 955 /* Fail contact counter */ 956 u16 FailContactCount; 957 958 /* Event mask */ 959 u64 BTEventMask; 960 u64 BTEventMaskPage2; 961 962 /* timeout var */ 963 u16 ConnAcceptTimeout; 964 u16 LogicalAcceptTimeout; 965 u16 PageTimeout; 966 967 u8 LocationDomainAware; 968 u16 LocationDomain; 969 u8 LocationDomainOptions; 970 u8 LocationOptions; 971 972 u8 FlowControlMode; 973 974 /* Preferred channel list */ 975 u16 BtPreChnlListLen; 976 u8 BTPreChnllist[64]; 977 978 u16 enFlush_LLH; /* enhanced flush handle */ 979 u16 FLTO_LLH; /* enhanced flush handle */ 980 981 /* */ 982 /* Test command only. */ 983 u8 bInTestMode; 984 u8 bTestIsEnd; 985 u8 bTestNeedReport; 986 u8 TestScenario; 987 u8 TestReportInterval; 988 u8 TestCtrType; 989 u32 TestEventType; 990 u16 TestNumOfFrame; 991 u16 TestNumOfErrFrame; 992 u16 TestNumOfBits; 993 u16 TestNumOfErrBits; 994 /* */ 995 }; 996 997 struct bt_traffic { 998 /* Add for check replay data */ 999 u8 LastRxUniFragNum; 1000 u16 LastRxUniSeqNum; 1001 1002 /* s32 EntryMaxUndecoratedSmoothedPWDB; */ 1003 /* s32 EntryMinUndecoratedSmoothedPWDB; */ 1004 1005 struct bt_traffic_statistics Bt30TrafficStatistics; 1006 }; 1007 1008 #define RT_WORK_ITEM struct work_struct 1009 1010 struct bt_security { 1011 /* WPA auth state 1012 * May need to remove to BTSecInfo ... 1013 * enum bt_state_wpa_auth BTWPAAuthState; 1014 */ 1015 struct octet_string RSNIE; 1016 u8 RSNIEBuf[MAXRSNIELEN]; 1017 u8 bRegNoEncrypt; 1018 u8 bUsedHwEncrypt; 1019 }; 1020 1021 struct bt_30info { 1022 struct rtw_adapter *padapter; 1023 struct bt_asoc_entry BtAsocEntry[MAX_BT_ASOC_ENTRY_NUM]; 1024 struct bt_mgnt BtMgnt; 1025 struct bt_dgb BtDbg; 1026 struct bt_hci_info BtHciInfo; 1027 struct bt_traffic BtTraffic; 1028 struct bt_security BtSec; 1029 RT_WORK_ITEM HCICmdWorkItem; 1030 struct timer_list BTHCICmdTimer; 1031 RT_WORK_ITEM BTPsDisableWorkItem; 1032 RT_WORK_ITEM BTConnectWorkItem; 1033 struct timer_list BTHCIDiscardAclDataTimer; 1034 struct timer_list BTHCIJoinTimeoutTimer; 1035 struct timer_list BTTestSendPacketTimer; 1036 struct timer_list BTDisconnectPhyLinkTimer; 1037 struct timer_list BTBeaconTimer; 1038 u8 BTBeaconTmrOn; 1039 1040 struct timer_list BTPsDisableTimer; 1041 1042 void * pBtChnlList; 1043 }; 1044 1045 struct packet_irp_acl_data { 1046 u16 Handle:12; 1047 u16 PB_Flag:2; 1048 u16 BC_Flag:2; 1049 u16 Length; 1050 u8 Data[1]; 1051 }; 1052 1053 struct packet_irp_hcievent_data { 1054 u8 EventCode; 1055 u8 Length; 1056 u8 Data[20]; 1057 }; 1058 1059 struct common_triple { 1060 u8 byte_1st; 1061 u8 byte_2nd; 1062 u8 byte_3rd; 1063 }; 1064 1065 #define COUNTRY_STR_LEN 3 /* country string len = 3 */ 1066 1067 #define LOCAL_PMK 0 1068 1069 enum hci_wifi_connect_status { 1070 HCI_WIFI_NOT_CONNECTED = 0x0, 1071 HCI_WIFI_CONNECTED = 0x1, 1072 HCI_WIFI_CONNECT_IN_PROGRESS = 0x2, 1073 }; 1074 1075 enum hci_ext_bp_operation { 1076 HCI_BT_OP_NONE = 0x0, 1077 HCI_BT_OP_INQUIRY_START = 0x1, 1078 HCI_BT_OP_INQUIRY_FINISH = 0x2, 1079 HCI_BT_OP_PAGING_START = 0x3, 1080 HCI_BT_OP_PAGING_SUCCESS = 0x4, 1081 HCI_BT_OP_PAGING_UNSUCCESS = 0x5, 1082 HCI_BT_OP_PAIRING_START = 0x6, 1083 HCI_BT_OP_PAIRING_FINISH = 0x7, 1084 HCI_BT_OP_BT_DEV_ENABLE = 0x8, 1085 HCI_BT_OP_BT_DEV_DISABLE = 0x9, 1086 HCI_BT_OP_MAX 1087 }; 1088 1089 #define BTHCI_SM_WITH_INFO(_Adapter, _StateToEnter, _StateCmd, _EntryNum) \ 1090 { \ 1091 RTPRINT(FIOCTL, IOCTL_STATE, ("[BT state change] caused by ""%s"", line =%d\n", __func__, __LINE__)); \ 1092 BTHCI_StateMachine(_Adapter, _StateToEnter, _StateCmd, _EntryNum);\ 1093 } 1094 1095 void BTHCI_EventParse(struct rtw_adapter * padapter, void *pEvntData, u32 dataLen); 1096 #define BT_EventParse BTHCI_EventParse 1097 u8 BTHCI_HsConnectionEstablished(struct rtw_adapter * padapter); 1098 void BTHCI_UpdateBTProfileRTKToMoto(struct rtw_adapter * padapter); 1099 void BTHCI_WifiScanNotify(struct rtw_adapter * padapter, u8 scanType); 1100 void BTHCI_StateMachine(struct rtw_adapter * padapter, u8 StateToEnter, enum hci_state_with_cmd StateCmd, u8 EntryNum); 1101 void BTHCI_DisconnectPeer(struct rtw_adapter * padapter, u8 EntryNum); 1102 void BTHCI_EventNumOfCompletedDataBlocks(struct rtw_adapter * padapter); 1103 void BTHCI_EventAMPStatusChange(struct rtw_adapter * padapter, u8 AMP_Status); 1104 void BTHCI_DisconnectAll(struct rtw_adapter * padapter); 1105 enum hci_status BTHCI_HandleHCICMD(struct rtw_adapter * padapter, struct packet_irp_hcicmd_data *pHciCmd); 1106 1107 /* ===== End of sync from SD7 driver COMMON/bt_hci.h ===== */ 1108 1109 /* ===== Below this line is sync from SD7 driver HAL/BTCoexist/HalBtc87231Ant.h ===== */ 1110 #define GET_BT_INFO(padapter) (&GET_HAL_DATA(padapter)->BtInfo) 1111 1112 #define BTC_FOR_SCAN_START 1 1113 #define BTC_FOR_SCAN_FINISH 0 1114 1115 #define BT_TXRX_CNT_THRES_1 1200 1116 #define BT_TXRX_CNT_THRES_2 1400 1117 #define BT_TXRX_CNT_THRES_3 3000 1118 #define BT_TXRX_CNT_LEVEL_0 0 /* < 1200 */ 1119 #define BT_TXRX_CNT_LEVEL_1 1 /* >= 1200 && < 1400 */ 1120 #define BT_TXRX_CNT_LEVEL_2 2 /* >= 1400 */ 1121 #define BT_TXRX_CNT_LEVEL_3 3 /* >= 3000 */ 1122 1123 enum bt_state_1ant { 1124 BT_INFO_STATE_DISABLED = 0, 1125 BT_INFO_STATE_NO_CONNECTION = 1, 1126 BT_INFO_STATE_CONNECT_IDLE = 2, 1127 BT_INFO_STATE_INQ_OR_PAG = 3, 1128 BT_INFO_STATE_ACL_ONLY_BUSY = 4, 1129 BT_INFO_STATE_SCO_ONLY_BUSY = 5, 1130 BT_INFO_STATE_ACL_SCO_BUSY = 6, 1131 BT_INFO_STATE_ACL_INQ_OR_PAG = 7, 1132 BT_INFO_STATE_MAX = 8 1133 }; 1134 1135 struct btdm_8723a_1ant { 1136 u8 prePsTdma; 1137 u8 curPsTdma; 1138 u8 psTdmaDuAdjType; 1139 u8 bPrePsTdmaOn; 1140 u8 bCurPsTdmaOn; 1141 u8 preWifiPara; 1142 u8 curWifiPara; 1143 u8 preCoexWifiCon; 1144 u8 curCoexWifiCon; 1145 u8 wifiRssiThresh; 1146 1147 u32 psTdmaMonitorCnt; 1148 u32 psTdmaGlobalCnt; 1149 1150 /* DurationAdjust For SCO */ 1151 u32 psTdmaMonitorCntForSCO; 1152 u8 psTdmaDuAdjTypeForSCO; 1153 u8 RSSI_WiFi_Last; 1154 u8 RSSI_BT_Last; 1155 1156 u8 bWiFiHalt; 1157 u8 bRAChanged; 1158 }; 1159 1160 void BTDM_1AntSignalCompensation(struct rtw_adapter * padapter, u8 *rssi_wifi, u8 *rssi_bt); 1161 void BTDM_1AntForDhcp(struct rtw_adapter * padapter); 1162 void BTDM_1AntBtCoexist8723A(struct rtw_adapter * padapter); 1163 1164 /* ===== End of sync from SD7 driver HAL/BTCoexist/HalBtc87231Ant.h ===== */ 1165 1166 /* ===== Below this line is sync from SD7 driver HAL/BTCoexist/HalBtc87232Ant.h ===== */ 1167 enum bt_2ant_bt_status { 1168 BT_2ANT_BT_STATUS_IDLE = 0x0, 1169 BT_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1, 1170 BT_2ANT_BT_STATUS_NON_IDLE = 0x2, 1171 BT_2ANT_BT_STATUS_MAX 1172 }; 1173 1174 enum bt_2ant_coex_algo { 1175 BT_2ANT_COEX_ALGO_UNDEFINED = 0x0, 1176 BT_2ANT_COEX_ALGO_SCO = 0x1, 1177 BT_2ANT_COEX_ALGO_HID = 0x2, 1178 BT_2ANT_COEX_ALGO_A2DP = 0x3, 1179 BT_2ANT_COEX_ALGO_PANEDR = 0x4, 1180 BT_2ANT_COEX_ALGO_PANHS = 0x5, 1181 BT_2ANT_COEX_ALGO_PANEDR_A2DP = 0x6, 1182 BT_2ANT_COEX_ALGO_PANEDR_HID = 0x7, 1183 BT_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x8, 1184 BT_2ANT_COEX_ALGO_HID_A2DP = 0x9, 1185 BT_2ANT_COEX_ALGO_HID_A2DP_PANHS = 0xA, 1186 BT_2ANT_COEX_ALGO_MAX = 0xB, 1187 }; 1188 1189 struct btdm_8723a_2ant { 1190 u8 bPreDecBtPwr; 1191 u8 bCurDecBtPwr; 1192 1193 u8 preWlanActHi; 1194 u8 curWlanActHi; 1195 u8 preWlanActLo; 1196 u8 curWlanActLo; 1197 1198 u8 preFwDacSwingLvl; 1199 u8 curFwDacSwingLvl; 1200 1201 u8 bPreRfRxLpfShrink; 1202 u8 bCurRfRxLpfShrink; 1203 1204 u8 bPreLowPenaltyRa; 1205 u8 bCurLowPenaltyRa; 1206 1207 u8 preBtRetryIndex; 1208 u8 curBtRetryIndex; 1209 1210 u8 bPreDacSwingOn; 1211 u32 preDacSwingLvl; 1212 u8 bCurDacSwingOn; 1213 u32 curDacSwingLvl; 1214 1215 u8 bPreAdcBackOff; 1216 u8 bCurAdcBackOff; 1217 1218 u8 bPreAgcTableEn; 1219 u8 bCurAgcTableEn; 1220 1221 u32 preVal0x6c0; 1222 u32 curVal0x6c0; 1223 u32 preVal0x6c8; 1224 u32 curVal0x6c8; 1225 u8 preVal0x6cc; 1226 u8 curVal0x6cc; 1227 1228 u8 bCurIgnoreWlanAct; 1229 u8 bPreIgnoreWlanAct; 1230 1231 u8 prePsTdma; 1232 u8 curPsTdma; 1233 u8 psTdmaDuAdjType; 1234 u8 bPrePsTdmaOn; 1235 u8 bCurPsTdmaOn; 1236 1237 u8 preAlgorithm; 1238 u8 curAlgorithm; 1239 u8 bResetTdmaAdjust; 1240 1241 u8 btStatus; 1242 }; 1243 1244 void BTDM_2AntBtCoexist8723A(struct rtw_adapter * padapter); 1245 /* ===== End of sync from SD7 driver HAL/BTCoexist/HalBtc87232Ant.h ===== */ 1246 1247 /* ===== Below this line is sync from SD7 driver HAL/BTCoexist/HalBtc8723.h ===== */ 1248 1249 #define BT_Q_PKT_OFF 0 1250 #define BT_Q_PKT_ON 1 1251 1252 #define BT_TX_PWR_OFF 0 1253 #define BT_TX_PWR_ON 1 1254 1255 /* TDMA mode definition */ 1256 #define TDMA_2ANT 0 1257 #define TDMA_1ANT 1 1258 #define TDMA_NAV_OFF 0 1259 #define TDMA_NAV_ON 1 1260 #define TDMA_DAC_SWING_OFF 0 1261 #define TDMA_DAC_SWING_ON 1 1262 1263 #define BT_RSSI_LEVEL_H 0 1264 #define BT_RSSI_LEVEL_M 1 1265 #define BT_RSSI_LEVEL_L 2 1266 1267 /* PTA mode related definition */ 1268 #define BT_PTA_MODE_OFF 0 1269 #define BT_PTA_MODE_ON 1 1270 1271 /* Penalty Tx Rate Adaptive */ 1272 #define BT_TX_RATE_ADAPTIVE_NORMAL 0 1273 #define BT_TX_RATE_ADAPTIVE_LOW_PENALTY 1 1274 1275 /* RF Corner */ 1276 #define BT_RF_RX_LPF_CORNER_RESUME 0 1277 #define BT_RF_RX_LPF_CORNER_SHRINK 1 1278 1279 #define BT_INFO_ACL BIT(0) 1280 #define BT_INFO_SCO BIT(1) 1281 #define BT_INFO_INQ_PAG BIT(2) 1282 #define BT_INFO_ACL_BUSY BIT(3) 1283 #define BT_INFO_SCO_BUSY BIT(4) 1284 #define BT_INFO_HID BIT(5) 1285 #define BT_INFO_A2DP BIT(6) 1286 #define BT_INFO_FTP BIT(7) 1287 1288 1289 1290 struct bt_coexist_8723a { 1291 u32 highPriorityTx; 1292 u32 highPriorityRx; 1293 u32 lowPriorityTx; 1294 u32 lowPriorityRx; 1295 u8 btRssi; 1296 u8 TotalAntNum; 1297 u8 bC2hBtInfoSupport; 1298 u8 c2hBtInfo; 1299 u8 c2hBtInfoOriginal; 1300 u8 prec2hBtInfo; /* for 1Ant */ 1301 u8 bC2hBtInquiryPage; 1302 unsigned long btInqPageStartTime; /* for 2Ant */ 1303 u8 c2hBtProfile; /* for 1Ant */ 1304 u8 btRetryCnt; 1305 u8 btInfoExt; 1306 u8 bC2hBtInfoReqSent; 1307 u8 bForceFwBtInfo; 1308 u8 bForceA2dpSink; 1309 struct btdm_8723a_2ant btdm2Ant; 1310 struct btdm_8723a_1ant btdm1Ant; 1311 }; 1312 1313 void BTDM_SetFwChnlInfo(struct rtw_adapter * padapter, enum rt_media_status mstatus); 1314 u8 BTDM_IsWifiConnectionExist(struct rtw_adapter * padapter); 1315 void BTDM_SetFw3a(struct rtw_adapter * padapter, u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5); 1316 void BTDM_QueryBtInformation(struct rtw_adapter * padapter); 1317 void BTDM_SetSwRfRxLpfCorner(struct rtw_adapter * padapter, u8 type); 1318 void BTDM_SetSwPenaltyTxRateAdaptive(struct rtw_adapter * padapter, u8 raType); 1319 void BTDM_SetFwDecBtPwr(struct rtw_adapter * padapter, u8 bDecBtPwr); 1320 u8 BTDM_BtProfileSupport(struct rtw_adapter * padapter); 1321 void BTDM_LpsLeave(struct rtw_adapter * padapter); 1322 1323 /* ===== End of sync from SD7 driver HAL/BTCoexist/HalBtc8723.h ===== */ 1324 1325 /* ===== Below this line is sync from SD7 driver HAL/BTCoexist/HalBtcCsr1Ant.h ===== */ 1326 1327 enum BT_A2DP_INDEX{ 1328 BT_A2DP_INDEX0 = 0, /* 32, 12; the most critical for BT */ 1329 BT_A2DP_INDEX1, /* 12, 24 */ 1330 BT_A2DP_INDEX2, /* 0, 0 */ 1331 BT_A2DP_INDEX_MAX 1332 }; 1333 1334 #define BT_A2DP_STATE_NOT_ENTERED 0 1335 #define BT_A2DP_STATE_DETECTING 1 1336 #define BT_A2DP_STATE_DETECTED 2 1337 1338 #define BTDM_ANT_BT_IDLE 0 1339 #define BTDM_ANT_WIFI 1 1340 #define BTDM_ANT_BT 2 1341 1342 1343 void BTDM_SingleAnt(struct rtw_adapter * padapter, u8 bSingleAntOn, u8 bInterruptOn, u8 bMultiNAVOn); 1344 void BTDM_CheckBTIdleChange1Ant(struct rtw_adapter * padapter); 1345 1346 /* ===== End of sync from SD7 driver HAL/BTCoexist/HalBtcCsr1Ant.h ===== */ 1347 1348 /* ===== Below this line is sync from SD7 driver HAL/BTCoexist/HalBtcCsr2Ant.h ===== */ 1349 1350 /* */ 1351 /* For old core stack before v251 */ 1352 /* */ 1353 #define BT_RSSI_STATE_NORMAL_POWER BIT(0) 1354 #define BT_RSSI_STATE_AMDPU_OFF BIT(1) 1355 #define BT_RSSI_STATE_SPECIAL_LOW BIT(2) 1356 #define BT_RSSI_STATE_BG_EDCA_LOW BIT(3) 1357 #define BT_RSSI_STATE_TXPOWER_LOW BIT(4) 1358 1359 #define BT_DACSWING_OFF 0 1360 #define BT_DACSWING_M4 1 1361 #define BT_DACSWING_M7 2 1362 #define BT_DACSWING_M10 3 1363 1364 void BTDM_DiminishWiFi(struct rtw_adapter * Adapter, u8 bDACOn, u8 bInterruptOn, u8 DACSwingLevel, u8 bNAVOn); 1365 1366 /* ===== End of sync from SD7 driver HAL/BTCoexist/HalBtcCsr2Ant.h ===== */ 1367 1368 /* HEADER/TypeDef.h */ 1369 #define MAX_FW_SUPPORT_MACID_NUM 64 1370 1371 /* ===== Below this line is sync from SD7 driver HAL/BTCoexist/HalBtCoexist.h ===== */ 1372 1373 #define FW_VER_BT_REG 62 1374 #define FW_VER_BT_REG1 74 1375 #define REG_BT_ACTIVE 0x444 1376 #define REG_BT_STATE 0x448 1377 #define REG_BT_POLLING1 0x44c 1378 #define REG_BT_POLLING 0x700 1379 1380 #define REG_BT_ACTIVE_OLD 0x488 1381 #define REG_BT_STATE_OLD 0x48c 1382 #define REG_BT_POLLING_OLD 0x490 1383 1384 /* The reg define is for 8723 */ 1385 #define REG_HIGH_PRIORITY_TXRX 0x770 1386 #define REG_LOW_PRIORITY_TXRX 0x774 1387 1388 #define BT_FW_COEX_THRESH_TOL 6 1389 #define BT_FW_COEX_THRESH_20 20 1390 #define BT_FW_COEX_THRESH_23 23 1391 #define BT_FW_COEX_THRESH_25 25 1392 #define BT_FW_COEX_THRESH_30 30 1393 #define BT_FW_COEX_THRESH_35 35 1394 #define BT_FW_COEX_THRESH_40 40 1395 #define BT_FW_COEX_THRESH_45 45 1396 #define BT_FW_COEX_THRESH_47 47 1397 #define BT_FW_COEX_THRESH_50 50 1398 #define BT_FW_COEX_THRESH_55 55 1399 #define BT_FW_COEX_THRESH_65 65 1400 1401 #define BT_COEX_STATE_BT30 BIT(0) 1402 #define BT_COEX_STATE_WIFI_HT20 BIT(1) 1403 #define BT_COEX_STATE_WIFI_HT40 BIT(2) 1404 #define BT_COEX_STATE_WIFI_LEGACY BIT(3) 1405 1406 #define BT_COEX_STATE_WIFI_RSSI_LOW BIT(4) 1407 #define BT_COEX_STATE_WIFI_RSSI_MEDIUM BIT(5) 1408 #define BT_COEX_STATE_WIFI_RSSI_HIGH BIT(6) 1409 #define BT_COEX_STATE_DEC_BT_POWER BIT(7) 1410 1411 #define BT_COEX_STATE_WIFI_IDLE BIT(8) 1412 #define BT_COEX_STATE_WIFI_UPLINK BIT(9) 1413 #define BT_COEX_STATE_WIFI_DOWNLINK BIT(10) 1414 1415 #define BT_COEX_STATE_BT_INQ_PAGE BIT(11) 1416 #define BT_COEX_STATE_BT_IDLE BIT(12) 1417 #define BT_COEX_STATE_BT_UPLINK BIT(13) 1418 #define BT_COEX_STATE_BT_DOWNLINK BIT(14) 1419 /* */ 1420 /* Todo: Remove these definitions */ 1421 #define BT_COEX_STATE_BT_PAN_IDLE BIT(15) 1422 #define BT_COEX_STATE_BT_PAN_UPLINK BIT(16) 1423 #define BT_COEX_STATE_BT_PAN_DOWNLINK BIT(17) 1424 #define BT_COEX_STATE_BT_A2DP_IDLE BIT(18) 1425 /* */ 1426 #define BT_COEX_STATE_BT_RSSI_LOW BIT(19) 1427 1428 #define BT_COEX_STATE_PROFILE_HID BIT(20) 1429 #define BT_COEX_STATE_PROFILE_A2DP BIT(21) 1430 #define BT_COEX_STATE_PROFILE_PAN BIT(22) 1431 #define BT_COEX_STATE_PROFILE_SCO BIT(23) 1432 1433 #define BT_COEX_STATE_WIFI_RSSI_1_LOW BIT(24) 1434 #define BT_COEX_STATE_WIFI_RSSI_1_MEDIUM BIT(25) 1435 #define BT_COEX_STATE_WIFI_RSSI_1_HIGH BIT(26) 1436 1437 #define BT_COEX_STATE_WIFI_RSSI_BEACON_LOW BIT(27) 1438 #define BT_COEX_STATE_WIFI_RSSI_BEACON_MEDIUM BIT(28) 1439 #define BT_COEX_STATE_WIFI_RSSI_BEACON_HIGH BIT(29) 1440 1441 1442 #define BT_COEX_STATE_BTINFO_COMMON BIT(30) 1443 #define BT_COEX_STATE_BTINFO_B_HID_SCOESCO BIT(31) 1444 #define BT_COEX_STATE_BTINFO_B_FTP_A2DP BIT(32) 1445 1446 #define BT_COEX_STATE_BT_CNT_LEVEL_0 BIT(33) 1447 #define BT_COEX_STATE_BT_CNT_LEVEL_1 BIT(34) 1448 #define BT_COEX_STATE_BT_CNT_LEVEL_2 BIT(35) 1449 #define BT_COEX_STATE_BT_CNT_LEVEL_3 BIT(36) 1450 1451 #define BT_RSSI_STATE_HIGH 0 1452 #define BT_RSSI_STATE_MEDIUM 1 1453 #define BT_RSSI_STATE_LOW 2 1454 #define BT_RSSI_STATE_STAY_HIGH 3 1455 #define BT_RSSI_STATE_STAY_MEDIUM 4 1456 #define BT_RSSI_STATE_STAY_LOW 5 1457 1458 #define BT_AGCTABLE_OFF 0 1459 #define BT_AGCTABLE_ON 1 1460 1461 #define BT_BB_BACKOFF_OFF 0 1462 #define BT_BB_BACKOFF_ON 1 1463 1464 #define BT_FW_NAV_OFF 0 1465 #define BT_FW_NAV_ON 1 1466 1467 #define BT_COEX_MECH_NONE 0 1468 #define BT_COEX_MECH_SCO 1 1469 #define BT_COEX_MECH_HID 2 1470 #define BT_COEX_MECH_A2DP 3 1471 #define BT_COEX_MECH_PAN 4 1472 #define BT_COEX_MECH_HID_A2DP 5 1473 #define BT_COEX_MECH_HID_PAN 6 1474 #define BT_COEX_MECH_PAN_A2DP 7 1475 #define BT_COEX_MECH_HID_SCO_ESCO 8 1476 #define BT_COEX_MECH_FTP_A2DP 9 1477 #define BT_COEX_MECH_COMMON 10 1478 #define BT_COEX_MECH_MAX 11 1479 /* BT Dbg Ctrl */ 1480 #define BT_DBG_PROFILE_NONE 0 1481 #define BT_DBG_PROFILE_SCO 1 1482 #define BT_DBG_PROFILE_HID 2 1483 #define BT_DBG_PROFILE_A2DP 3 1484 #define BT_DBG_PROFILE_PAN 4 1485 #define BT_DBG_PROFILE_HID_A2DP 5 1486 #define BT_DBG_PROFILE_HID_PAN 6 1487 #define BT_DBG_PROFILE_PAN_A2DP 7 1488 #define BT_DBG_PROFILE_MAX 9 1489 1490 struct bt_coexist_str { 1491 u8 BluetoothCoexist; 1492 u8 BT_Ant_Num; 1493 u8 BT_CoexistType; 1494 u8 BT_Ant_isolation; /* 0:good, 1:bad */ 1495 u8 bt_radiosharedtype; 1496 u32 Ratio_Tx; 1497 u32 Ratio_PRI; 1498 u8 bInitlized; 1499 u32 BtRfRegOrigin1E; 1500 u32 BtRfRegOrigin1F; 1501 u8 bBTBusyTraffic; 1502 u8 bBTTrafficModeSet; 1503 u8 bBTNonTrafficModeSet; 1504 struct bt_traffic_statistics BT21TrafficStatistics; 1505 u64 CurrentState; 1506 u64 PreviousState; 1507 u8 preRssiState; 1508 u8 preRssiState1; 1509 u8 preRssiStateBeacon; 1510 u8 bFWCoexistAllOff; 1511 u8 bSWCoexistAllOff; 1512 u8 bHWCoexistAllOff; 1513 u8 bBalanceOn; 1514 u8 bSingleAntOn; 1515 u8 bInterruptOn; 1516 u8 bMultiNAVOn; 1517 u8 PreWLANActH; 1518 u8 PreWLANActL; 1519 u8 WLANActH; 1520 u8 WLANActL; 1521 u8 A2DPState; 1522 u8 AntennaState; 1523 u32 lastBtEdca; 1524 u16 last_aggr_num; 1525 u8 bEDCAInitialized; 1526 u8 exec_cnt; 1527 u8 b8723aAgcTableOn; 1528 u8 b92DAgcTableOn; 1529 struct bt_coexist_8723a halCoex8723; 1530 u8 btActiveZeroCnt; 1531 u8 bCurBtDisabled; 1532 u8 bPreBtDisabled; 1533 u8 bNeedToRoamForBtDisableEnable; 1534 u8 fw3aVal[5]; 1535 }; 1536 1537 void BTDM_CheckAntSelMode(struct rtw_adapter * padapter); 1538 void BTDM_FwC2hBtRssi(struct rtw_adapter * padapter, u8 *tmpBuf); 1539 #define BT_FwC2hBtRssi BTDM_FwC2hBtRssi 1540 void BTDM_DisplayBtCoexInfo(struct rtw_adapter * padapter); 1541 #define BT_DisplayBtCoexInfo BTDM_DisplayBtCoexInfo 1542 void BTDM_RejectAPAggregatedPacket(struct rtw_adapter * padapter, u8 bReject); 1543 u8 BTDM_IsHT40(struct rtw_adapter * padapter); 1544 u8 BTDM_Legacy(struct rtw_adapter * padapter); 1545 void BTDM_CheckWiFiState(struct rtw_adapter * padapter); 1546 s32 BTDM_GetRxSS(struct rtw_adapter * padapter); 1547 u8 BTDM_CheckCoexBcnRssiState(struct rtw_adapter * padapter, u8 levelNum, u8 RssiThresh, u8 RssiThresh1); 1548 u8 BTDM_CheckCoexRSSIState1(struct rtw_adapter * padapter, u8 levelNum, u8 RssiThresh, u8 RssiThresh1); 1549 u8 BTDM_CheckCoexRSSIState(struct rtw_adapter * padapter, u8 levelNum, u8 RssiThresh, u8 RssiThresh1); 1550 void BTDM_Balance(struct rtw_adapter * padapter, u8 bBalanceOn, u8 ms0, u8 ms1); 1551 void BTDM_AGCTable(struct rtw_adapter * padapter, u8 type); 1552 void BTDM_BBBackOffLevel(struct rtw_adapter * padapter, u8 type); 1553 void BTDM_FWCoexAllOff(struct rtw_adapter * padapter); 1554 void BTDM_SWCoexAllOff(struct rtw_adapter * padapter); 1555 void BTDM_HWCoexAllOff(struct rtw_adapter * padapter); 1556 void BTDM_CoexAllOff(struct rtw_adapter * padapter); 1557 void BTDM_TurnOffBtCoexistBeforeEnterIPS(struct rtw_adapter * padapter); 1558 void BTDM_SignalCompensation(struct rtw_adapter * padapter, u8 *rssi_wifi, u8 *rssi_bt); 1559 void BTDM_UpdateCoexState(struct rtw_adapter * padapter); 1560 u8 BTDM_IsSameCoexistState(struct rtw_adapter * padapter); 1561 void BTDM_PWDBMonitor(struct rtw_adapter * padapter); 1562 u8 BTDM_IsBTBusy(struct rtw_adapter * padapter); 1563 #define BT_IsBtBusy BTDM_IsBTBusy 1564 u8 BTDM_IsWifiBusy(struct rtw_adapter * padapter); 1565 u8 BTDM_IsCoexistStateChanged(struct rtw_adapter * padapter); 1566 u8 BTDM_IsWifiUplink(struct rtw_adapter * padapter); 1567 u8 BTDM_IsWifiDownlink(struct rtw_adapter * padapter); 1568 u8 BTDM_IsBTHSMode(struct rtw_adapter * padapter); 1569 u8 BTDM_IsBTUplink(struct rtw_adapter * padapter); 1570 u8 BTDM_IsBTDownlink(struct rtw_adapter * padapter); 1571 void BTDM_AdjustForBtOperation(struct rtw_adapter * padapter); 1572 void BTDM_ForHalt(struct rtw_adapter * padapter); 1573 void BTDM_WifiScanNotify(struct rtw_adapter * padapter, u8 scanType); 1574 void BTDM_WifiAssociateNotify(struct rtw_adapter * padapter, u8 action); 1575 void BTDM_MediaStatusNotify(struct rtw_adapter * padapter, enum rt_media_status mstatus); 1576 void BTDM_ForDhcp(struct rtw_adapter * padapter); 1577 void BTDM_ResetActionProfileState(struct rtw_adapter * padapter); 1578 void BTDM_SetBtCoexCurrAntNum(struct rtw_adapter * padapter, u8 antNum); 1579 #define BT_SetBtCoexCurrAntNum BTDM_SetBtCoexCurrAntNum 1580 u8 BTDM_IsActionSCO(struct rtw_adapter * padapter); 1581 u8 BTDM_IsActionHID(struct rtw_adapter * padapter); 1582 u8 BTDM_IsActionA2DP(struct rtw_adapter * padapter); 1583 u8 BTDM_IsActionPAN(struct rtw_adapter * padapter); 1584 u8 BTDM_IsActionHIDA2DP(struct rtw_adapter * padapter); 1585 u8 BTDM_IsActionHIDPAN(struct rtw_adapter * padapter); 1586 u8 BTDM_IsActionPANA2DP(struct rtw_adapter * padapter); 1587 u32 BTDM_BtTxRxCounterH(struct rtw_adapter * padapter); 1588 u32 BTDM_BtTxRxCounterL(struct rtw_adapter * padapter); 1589 1590 /* ===== End of sync from SD7 driver HAL/BTCoexist/HalBtCoexist.h ===== */ 1591 1592 /* ===== Below this line is sync from SD7 driver HAL/HalBT.h ===== */ 1593 1594 #define RTS_CTS_NO_LEN_LIMIT 0 1595 1596 u8 HALBT_GetPGAntNum(struct rtw_adapter * padapter); 1597 #define BT_GetPGAntNum HALBT_GetPGAntNum 1598 void HALBT_SetKey(struct rtw_adapter * padapter, u8 EntryNum); 1599 void HALBT_RemoveKey(struct rtw_adapter * padapter, u8 EntryNum); 1600 u8 HALBT_IsBTExist(struct rtw_adapter * padapter); 1601 #define BT_IsBtExist HALBT_IsBTExist 1602 u8 HALBT_BTChipType(struct rtw_adapter * padapter); 1603 void HALBT_SetRtsCtsNoLenLimit(struct rtw_adapter * padapter); 1604 1605 /* ===== End of sync from SD7 driver HAL/HalBT.c ===== */ 1606 1607 #define _bt_dbg_off_ 0 1608 #define _bt_dbg_on_ 1 1609 1610 extern u32 BTCoexDbgLevel; 1611 1612 1613 1614 #endif /* __RTL8723A_BT_COEXIST_H__ */ 1615