hcimsgs.h revision 2a1f4e2121f7ffd9bbbd868c4bd5307356adb054
1/****************************************************************************** 2 * 3 * Copyright (C) 1999-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19#ifndef HCIMSGS_H 20#define HCIMSGS_H 21 22#include "bt_target.h" 23#include "hcidefs.h" 24#include "bt_types.h" 25 26void bte_main_hci_send(BT_HDR *p_msg, UINT16 event); 27void bte_main_lpm_allow_bt_device_sleep(void); 28 29/* Message by message.... */ 30 31extern BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration, 32 UINT8 response_cnt); 33 34#define HCIC_PARAM_SIZE_INQUIRY 5 35 36 37#define HCIC_INQ_INQ_LAP_OFF 0 38#define HCIC_INQ_DUR_OFF 3 39#define HCIC_INQ_RSP_CNT_OFF 4 40 /* Inquiry */ 41 42 /* Inquiry Cancel */ 43extern BOOLEAN btsnd_hcic_inq_cancel(void); 44 45#define HCIC_PARAM_SIZE_INQ_CANCEL 0 46 47 /* Periodic Inquiry Mode */ 48extern BOOLEAN btsnd_hcic_per_inq_mode(UINT16 max_period, UINT16 min_period, 49 const LAP inq_lap, UINT8 duration, 50 UINT8 response_cnt); 51 52#define HCIC_PARAM_SIZE_PER_INQ_MODE 9 53 54#define HCI_PER_INQ_MAX_INTRVL_OFF 0 55#define HCI_PER_INQ_MIN_INTRVL_OFF 2 56#define HCI_PER_INQ_INQ_LAP_OFF 4 57#define HCI_PER_INQ_DURATION_OFF 7 58#define HCI_PER_INQ_RSP_CNT_OFF 8 59 /* Periodic Inquiry Mode */ 60 61 /* Exit Periodic Inquiry Mode */ 62extern BOOLEAN btsnd_hcic_exit_per_inq(void); 63 64#define HCIC_PARAM_SIZE_EXIT_PER_INQ 0 65 /* Create Connection */ 66extern BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types, 67 UINT8 page_scan_rep_mode, 68 UINT8 page_scan_mode, 69 UINT16 clock_offset, 70 UINT8 allow_switch); 71 72#define HCIC_PARAM_SIZE_CREATE_CONN 13 73 74#define HCIC_CR_CONN_BD_ADDR_OFF 0 75#define HCIC_CR_CONN_PKT_TYPES_OFF 6 76#define HCIC_CR_CONN_REP_MODE_OFF 8 77#define HCIC_CR_CONN_PAGE_SCAN_MODE_OFF 9 78#define HCIC_CR_CONN_CLK_OFF_OFF 10 79#define HCIC_CR_CONN_ALLOW_SWITCH_OFF 12 80 /* Create Connection */ 81 82 /* Disconnect */ 83extern BOOLEAN btsnd_hcic_disconnect(UINT16 handle, UINT8 reason); 84 85#define HCIC_PARAM_SIZE_DISCONNECT 3 86 87#define HCI_DISC_HANDLE_OFF 0 88#define HCI_DISC_REASON_OFF 2 89 /* Disconnect */ 90 91#if BTM_SCO_INCLUDED == TRUE 92 /* Add SCO Connection */ 93extern BOOLEAN btsnd_hcic_add_SCO_conn (UINT16 handle, UINT16 packet_types); 94#endif /* BTM_SCO_INCLUDED */ 95 96#define HCIC_PARAM_SIZE_ADD_SCO_CONN 4 97 98#define HCI_ADD_SCO_HANDLE_OFF 0 99#define HCI_ADD_SCO_PACKET_TYPES_OFF 2 100 /* Add SCO Connection */ 101 102 /* Create Connection Cancel */ 103extern BOOLEAN btsnd_hcic_create_conn_cancel(BD_ADDR dest); 104 105#define HCIC_PARAM_SIZE_CREATE_CONN_CANCEL 6 106 107#define HCIC_CR_CONN_CANCEL_BD_ADDR_OFF 0 108 /* Create Connection Cancel */ 109 110 /* Accept Connection Request */ 111extern BOOLEAN btsnd_hcic_accept_conn (BD_ADDR bd_addr, UINT8 role); 112 113#define HCIC_PARAM_SIZE_ACCEPT_CONN 7 114 115#define HCI_ACC_CONN_BD_ADDR_OFF 0 116#define HCI_ACC_CONN_ROLE_OFF 6 117 /* Accept Connection Request */ 118 119 /* Reject Connection Request */ 120extern BOOLEAN btsnd_hcic_reject_conn (BD_ADDR bd_addr, UINT8 reason); 121 122#define HCIC_PARAM_SIZE_REJECT_CONN 7 123 124#define HCI_REJ_CONN_BD_ADDR_OFF 0 125#define HCI_REJ_CONN_REASON_OFF 6 126 /* Reject Connection Request */ 127 128 /* Link Key Request Reply */ 129extern BOOLEAN btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr, 130 LINK_KEY link_key); 131 132#define HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY 22 133 134#define HCI_LINK_KEY_REPLY_BD_ADDR_OFF 0 135#define HCI_LINK_KEY_REPLY_LINK_KEY_OFF 6 136 /* Link Key Request Reply */ 137 138 /* Link Key Request Neg Reply */ 139extern BOOLEAN btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr); 140 141#define HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY 6 142 143#define HCI_LINK_KEY_NEG_REP_BD_ADR_OFF 0 144 /* Link Key Request Neg Reply */ 145 146 /* PIN Code Request Reply */ 147extern BOOLEAN btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr, 148 UINT8 pin_code_len, 149 PIN_CODE pin_code); 150 151#define HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY 23 152 153#define HCI_PIN_CODE_REPLY_BD_ADDR_OFF 0 154#define HCI_PIN_CODE_REPLY_PIN_LEN_OFF 6 155#define HCI_PIN_CODE_REPLY_PIN_CODE_OFF 7 156 /* PIN Code Request Reply */ 157 158 /* Link Key Request Neg Reply */ 159extern BOOLEAN btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr); 160 161#define HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY 6 162 163#define HCI_PIN_CODE_NEG_REP_BD_ADR_OFF 0 164 /* Link Key Request Neg Reply */ 165 166 /* Change Connection Type */ 167extern BOOLEAN btsnd_hcic_change_conn_type (UINT16 handle, UINT16 packet_types); 168 169#define HCIC_PARAM_SIZE_CHANGE_CONN_TYPE 4 170 171#define HCI_CHNG_PKT_TYPE_HANDLE_OFF 0 172#define HCI_CHNG_PKT_TYPE_PKT_TYPE_OFF 2 173 /* Change Connection Type */ 174 175#define HCIC_PARAM_SIZE_CMD_HANDLE 2 176 177#define HCI_CMD_HANDLE_HANDLE_OFF 0 178 179extern BOOLEAN btsnd_hcic_auth_request (UINT16 handle); /* Authentication Request */ 180 181 /* Set Connection Encryption */ 182extern BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable); 183#define HCIC_PARAM_SIZE_SET_CONN_ENCRYPT 3 184 185 186#define HCI_SET_ENCRYPT_HANDLE_OFF 0 187#define HCI_SET_ENCRYPT_ENABLE_OFF 2 188 /* Set Connection Encryption */ 189 190 /* Master Link Key */ 191extern BOOLEAN btsnd_hcic_master_link_key (BOOLEAN key_flag); 192 193#define HCIC_PARAM_SIZE_MASTER_LINK_KEY 1 194 195#define HCI_MASTER_KEY_FLAG_OFF 0 196 /* Master Link Key */ 197 198 /* Remote Name Request */ 199extern BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr, 200 UINT8 page_scan_rep_mode, 201 UINT8 page_scan_mode, 202 UINT16 clock_offset); 203 204#define HCIC_PARAM_SIZE_RMT_NAME_REQ 10 205 206#define HCI_RMT_NAME_BD_ADDR_OFF 0 207#define HCI_RMT_NAME_REP_MODE_OFF 6 208#define HCI_RMT_NAME_PAGE_SCAN_MODE_OFF 7 209#define HCI_RMT_NAME_CLK_OFF_OFF 8 210 /* Remote Name Request */ 211 212 /* Remote Name Request Cancel */ 213extern BOOLEAN btsnd_hcic_rmt_name_req_cancel(BD_ADDR bd_addr); 214 215#define HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL 6 216 217#define HCI_RMT_NAME_CANCEL_BD_ADDR_OFF 0 218 /* Remote Name Request Cancel */ 219 220extern BOOLEAN btsnd_hcic_rmt_features_req(UINT16 handle); /* Remote Features Request */ 221 222 /* Remote Extended Features */ 223extern BOOLEAN btsnd_hcic_rmt_ext_features(UINT16 handle, UINT8 page_num); 224 225#define HCIC_PARAM_SIZE_RMT_EXT_FEATURES 3 226 227#define HCI_RMT_EXT_FEATURES_HANDLE_OFF 0 228#define HCI_RMT_EXT_FEATURES_PAGE_NUM_OFF 2 229 /* Remote Extended Features */ 230 231 232extern BOOLEAN btsnd_hcic_rmt_ver_req(UINT16 handle); /* Remote Version Info Request */ 233extern BOOLEAN btsnd_hcic_read_rmt_clk_offset(UINT16 handle); /* Remote Clock Offset */ 234extern BOOLEAN btsnd_hcic_read_lmp_handle(UINT16 handle); /* Remote LMP Handle */ 235 236extern BOOLEAN btsnd_hcic_setup_esco_conn (UINT16 handle, 237 UINT32 tx_bw, UINT32 rx_bw, 238 UINT16 max_latency, UINT16 voice, 239 UINT8 retrans_effort, 240 UINT16 packet_types); 241#define HCIC_PARAM_SIZE_SETUP_ESCO 17 242 243#define HCI_SETUP_ESCO_HANDLE_OFF 0 244#define HCI_SETUP_ESCO_TX_BW_OFF 2 245#define HCI_SETUP_ESCO_RX_BW_OFF 6 246#define HCI_SETUP_ESCO_MAX_LAT_OFF 10 247#define HCI_SETUP_ESCO_VOICE_OFF 12 248#define HCI_SETUP_ESCO_RETRAN_EFF_OFF 14 249#define HCI_SETUP_ESCO_PKT_TYPES_OFF 15 250 251 252extern BOOLEAN btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr, 253 UINT32 tx_bw, UINT32 rx_bw, 254 UINT16 max_latency, 255 UINT16 content_fmt, 256 UINT8 retrans_effort, 257 UINT16 packet_types); 258#define HCIC_PARAM_SIZE_ACCEPT_ESCO 21 259 260#define HCI_ACCEPT_ESCO_BDADDR_OFF 0 261#define HCI_ACCEPT_ESCO_TX_BW_OFF 6 262#define HCI_ACCEPT_ESCO_RX_BW_OFF 10 263#define HCI_ACCEPT_ESCO_MAX_LAT_OFF 14 264#define HCI_ACCEPT_ESCO_VOICE_OFF 16 265#define HCI_ACCEPT_ESCO_RETRAN_EFF_OFF 18 266#define HCI_ACCEPT_ESCO_PKT_TYPES_OFF 19 267 268 269extern BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason); 270#define HCIC_PARAM_SIZE_REJECT_ESCO 7 271 272#define HCI_REJECT_ESCO_BDADDR_OFF 0 273#define HCI_REJECT_ESCO_REASON_OFF 6 274 275/* Hold Mode */ 276extern BOOLEAN btsnd_hcic_hold_mode(UINT16 handle, UINT16 max_hold_period, 277 UINT16 min_hold_period); 278 279#define HCIC_PARAM_SIZE_HOLD_MODE 6 280 281#define HCI_HOLD_MODE_HANDLE_OFF 0 282#define HCI_HOLD_MODE_MAX_PER_OFF 2 283#define HCI_HOLD_MODE_MIN_PER_OFF 4 284 /* Hold Mode */ 285 286 /* Sniff Mode */ 287extern BOOLEAN btsnd_hcic_sniff_mode(UINT16 handle, 288 UINT16 max_sniff_period, 289 UINT16 min_sniff_period, 290 UINT16 sniff_attempt, 291 UINT16 sniff_timeout); 292 293#define HCIC_PARAM_SIZE_SNIFF_MODE 10 294 295 296#define HCI_SNIFF_MODE_HANDLE_OFF 0 297#define HCI_SNIFF_MODE_MAX_PER_OFF 2 298#define HCI_SNIFF_MODE_MIN_PER_OFF 4 299#define HCI_SNIFF_MODE_ATTEMPT_OFF 6 300#define HCI_SNIFF_MODE_TIMEOUT_OFF 8 301 /* Sniff Mode */ 302 303extern BOOLEAN btsnd_hcic_exit_sniff_mode(UINT16 handle); /* Exit Sniff Mode */ 304 305 /* Park Mode */ 306extern BOOLEAN btsnd_hcic_park_mode (UINT16 handle, 307 UINT16 beacon_max_interval, 308 UINT16 beacon_min_interval); 309 310#define HCIC_PARAM_SIZE_PARK_MODE 6 311 312#define HCI_PARK_MODE_HANDLE_OFF 0 313#define HCI_PARK_MODE_MAX_PER_OFF 2 314#define HCI_PARK_MODE_MIN_PER_OFF 4 315 /* Park Mode */ 316 317extern BOOLEAN btsnd_hcic_exit_park_mode(UINT16 handle); /* Exit Park Mode */ 318 319 /* QoS Setup */ 320extern BOOLEAN btsnd_hcic_qos_setup (UINT16 handle, UINT8 flags, 321 UINT8 service_type, 322 UINT32 token_rate, UINT32 peak, 323 UINT32 latency, UINT32 delay_var); 324 325#define HCIC_PARAM_SIZE_QOS_SETUP 20 326 327#define HCI_QOS_HANDLE_OFF 0 328#define HCI_QOS_FLAGS_OFF 2 329#define HCI_QOS_SERVICE_TYPE_OFF 3 330#define HCI_QOS_TOKEN_RATE_OFF 4 331#define HCI_QOS_PEAK_BANDWIDTH_OFF 8 332#define HCI_QOS_LATENCY_OFF 12 333#define HCI_QOS_DELAY_VAR_OFF 16 334 /* QoS Setup */ 335 336 /* Switch Role Request */ 337extern BOOLEAN btsnd_hcic_switch_role (BD_ADDR bd_addr, UINT8 role); 338 339#define HCIC_PARAM_SIZE_SWITCH_ROLE 7 340 341#define HCI_SWITCH_BD_ADDR_OFF 0 342#define HCI_SWITCH_ROLE_OFF 6 343 /* Switch Role Request */ 344 345extern BOOLEAN btsnd_hcic_read_policy_set(UINT16 handle); /* Read Policy Settings */ 346 347 /* Write Policy Settings */ 348extern BOOLEAN btsnd_hcic_write_policy_set(UINT16 handle, UINT16 settings); 349 350#define HCIC_PARAM_SIZE_WRITE_POLICY_SET 4 351 352#define HCI_WRITE_POLICY_HANDLE_OFF 0 353#define HCI_WRITE_POLICY_SETTINGS_OFF 2 354 /* Write Policy Settings */ 355 356 /* Write Default Policy Settings */ 357extern BOOLEAN btsnd_hcic_write_def_policy_set(UINT16 settings); 358 359#define HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET 2 360 361#define HCI_WRITE_DEF_POLICY_SETTINGS_OFF 0 362 /* Write Default Policy Settings */ 363 364/****************************************** 365** Lisbon Features 366*******************************************/ 367#if BTM_SSR_INCLUDED == TRUE 368 /* Sniff Subrating */ 369extern BOOLEAN btsnd_hcic_sniff_sub_rate(UINT16 handle, UINT16 max_lat, 370 UINT16 min_remote_lat, 371 UINT16 min_local_lat); 372 373#define HCIC_PARAM_SIZE_SNIFF_SUB_RATE 8 374 375#define HCI_SNIFF_SUB_RATE_HANDLE_OFF 0 376#define HCI_SNIFF_SUB_RATE_MAX_LAT_OFF 2 377#define HCI_SNIFF_SUB_RATE_MIN_REM_LAT_OFF 4 378#define HCI_SNIFF_SUB_RATE_MIN_LOC_LAT_OFF 6 379 /* Sniff Subrating */ 380 381#else /* BTM_SSR_INCLUDED == FALSE */ 382 383#define btsnd_hcic_sniff_sub_rate(handle, max_lat, min_remote_lat, min_local_lat) FALSE 384 385#endif /* BTM_SSR_INCLUDED */ 386 387 /* Extended Inquiry Response */ 388extern void btsnd_hcic_write_ext_inquiry_response(void *buffer, UINT8 fec_req); 389 390#define HCIC_PARAM_SIZE_EXT_INQ_RESP 241 391 392#define HCIC_EXT_INQ_RESP_FEC_OFF 0 393#define HCIC_EXT_INQ_RESP_RESPONSE 1 394 /* IO Capabilities Response */ 395extern BOOLEAN btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, UINT8 capability, 396 UINT8 oob_present, UINT8 auth_req); 397 398#define HCIC_PARAM_SIZE_IO_CAP_RESP 9 399 400#define HCI_IO_CAP_BD_ADDR_OFF 0 401#define HCI_IO_CAPABILITY_OFF 6 402#define HCI_IO_CAP_OOB_DATA_OFF 7 403#define HCI_IO_CAP_AUTH_REQ_OFF 8 404 405 /* IO Capabilities Req Neg Reply */ 406extern BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code); 407 408#define HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY 7 409 410#define HCI_IO_CAP_NR_BD_ADDR_OFF 0 411#define HCI_IO_CAP_NR_ERR_CODE 6 412 413 /* Read Local OOB Data */ 414extern BOOLEAN btsnd_hcic_read_local_oob_data (void); 415 416#define HCIC_PARAM_SIZE_R_LOCAL_OOB 0 417 418 419extern BOOLEAN btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, BOOLEAN is_yes); 420 421#define HCIC_PARAM_SIZE_UCONF_REPLY 6 422 423#define HCI_USER_CONF_BD_ADDR_OFF 0 424 425 426extern BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value); 427 428#define HCIC_PARAM_SIZE_U_PKEY_REPLY 10 429 430#define HCI_USER_PASSKEY_BD_ADDR_OFF 0 431#define HCI_USER_PASSKEY_VALUE_OFF 6 432 433 434extern BOOLEAN btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr); 435 436#define HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY 6 437 438#define HCI_USER_PASSKEY_NEG_BD_ADDR_OFF 0 439 440 /* Remote OOB Data Request Reply */ 441extern BOOLEAN btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, UINT8 *p_c, 442 UINT8 *p_r); 443 444#define HCIC_PARAM_SIZE_REM_OOB_REPLY 38 445 446#define HCI_REM_OOB_DATA_BD_ADDR_OFF 0 447#define HCI_REM_OOB_DATA_C_OFF 6 448#define HCI_REM_OOB_DATA_R_OFF 22 449 450 /* Remote OOB Data Request Negative Reply */ 451extern BOOLEAN btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr); 452 453#define HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY 6 454 455#define HCI_REM_OOB_DATA_NEG_BD_ADDR_OFF 0 456 457 /* Read Tx Power Level */ 458extern BOOLEAN btsnd_hcic_read_inq_tx_power (void); 459 460#define HCIC_PARAM_SIZE_R_TX_POWER 0 461 462 /* Read Default Erroneous Data Reporting */ 463extern BOOLEAN btsnd_hcic_read_default_erroneous_data_rpt (void); 464 465#define HCIC_PARAM_SIZE_R_ERR_DATA_RPT 0 466 467#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE 468extern BOOLEAN btsnd_hcic_enhanced_flush (UINT16 handle, UINT8 packet_type); 469 470#define HCIC_PARAM_SIZE_ENHANCED_FLUSH 3 471#endif 472 473 474extern BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif); 475 476#define HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF 7 477 478#define HCI_SEND_KEYPRESS_NOTIF_BD_ADDR_OFF 0 479#define HCI_SEND_KEYPRESS_NOTIF_NOTIF_OFF 6 480 481/**** end of Simple Pairing Commands ****/ 482 483 /* Store Current Settings */ 484#define MAX_FILT_COND (sizeof (BD_ADDR) + 1) 485 486extern BOOLEAN btsnd_hcic_set_event_filter(UINT8 filt_type, 487 UINT8 filt_cond_type, 488 UINT8 *filt_cond, 489 UINT8 filt_cond_len); 490 491#define HCIC_PARAM_SIZE_SET_EVT_FILTER 9 492 493#define HCI_FILT_COND_FILT_TYPE_OFF 0 494#define HCI_FILT_COND_COND_TYPE_OFF 1 495#define HCI_FILT_COND_FILT_OFF 2 496 /* Set Event Filter */ 497 498 /* Read Stored Key */ 499extern BOOLEAN btsnd_hcic_read_stored_key (BD_ADDR bd_addr, 500 BOOLEAN read_all_flag); 501 502#define HCIC_PARAM_SIZE_READ_STORED_KEY 7 503 504#define HCI_READ_KEY_BD_ADDR_OFF 0 505#define HCI_READ_KEY_ALL_FLAG_OFF 6 506 /* Read Stored Key */ 507 508#define MAX_WRITE_KEYS 10 509 /* Write Stored Key */ 510extern BOOLEAN btsnd_hcic_write_stored_key (UINT8 num_keys, BD_ADDR *bd_addr, 511 LINK_KEY *link_key); 512 513#define HCIC_PARAM_SIZE_WRITE_STORED_KEY sizeof(btmsg_hcic_write_stored_key_t) 514 515#define HCI_WRITE_KEY_NUM_KEYS_OFF 0 516#define HCI_WRITE_KEY_BD_ADDR_OFF 1 517#define HCI_WRITE_KEY_KEY_OFF 7 518/* only 0x0b keys cab be sent in one HCI command */ 519#define HCI_MAX_NUM_OF_LINK_KEYS_PER_CMMD 0x0b 520 /* Write Stored Key */ 521 522 /* Delete Stored Key */ 523extern BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag); 524 525#define HCIC_PARAM_SIZE_DELETE_STORED_KEY 7 526 527#define HCI_DELETE_KEY_BD_ADDR_OFF 0 528#define HCI_DELETE_KEY_ALL_FLAG_OFF 6 529 /* Delete Stored Key */ 530 531 /* Change Local Name */ 532extern BOOLEAN btsnd_hcic_change_name(BD_NAME name); 533 534#define HCIC_PARAM_SIZE_CHANGE_NAME BD_NAME_LEN 535 536#define HCI_CHANGE_NAME_NAME_OFF 0 537 /* Change Local Name */ 538 539 540#define HCIC_PARAM_SIZE_READ_CMD 0 541 542#define HCIC_PARAM_SIZE_WRITE_PARAM1 1 543 544#define HCIC_WRITE_PARAM1_PARAM_OFF 0 545 546#define HCIC_PARAM_SIZE_WRITE_PARAM2 2 547 548#define HCIC_WRITE_PARAM2_PARAM_OFF 0 549 550#define HCIC_PARAM_SIZE_WRITE_PARAM3 3 551 552#define HCIC_WRITE_PARAM3_PARAM_OFF 0 553 554#define HCIC_PARAM_SIZE_SET_AFH_CHANNELS 10 555 556extern BOOLEAN btsnd_hcic_write_pin_type(UINT8 type); /* Write PIN Type */ 557extern BOOLEAN btsnd_hcic_write_auto_accept(UINT8 flag); /* Write Auto Accept */ 558extern BOOLEAN btsnd_hcic_read_name (void); /* Read Local Name */ 559extern BOOLEAN btsnd_hcic_write_page_tout(UINT16 timeout); /* Write Page Timout */ 560extern BOOLEAN btsnd_hcic_write_scan_enable(UINT8 flag); /* Write Scan Enable */ 561extern BOOLEAN btsnd_hcic_write_pagescan_cfg(UINT16 interval, 562 UINT16 window); /* Write Page Scan Activity */ 563 564#define HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG 4 565 566#define HCI_SCAN_CFG_INTERVAL_OFF 0 567#define HCI_SCAN_CFG_WINDOW_OFF 2 568 /* Write Page Scan Activity */ 569 570 /* Write Inquiry Scan Activity */ 571extern BOOLEAN btsnd_hcic_write_inqscan_cfg(UINT16 interval, UINT16 window); 572 573#define HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG 4 574 575#define HCI_SCAN_CFG_INTERVAL_OFF 0 576#define HCI_SCAN_CFG_WINDOW_OFF 2 577 /* Write Inquiry Scan Activity */ 578 579extern BOOLEAN btsnd_hcic_write_auth_enable(UINT8 flag); /* Write Authentication Enable */ 580extern BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev); /* Write Class of Device */ 581extern BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags); /* Write Voice Settings */ 582 583/* Host Controller to Host flow control */ 584#define HCI_HOST_FLOW_CTRL_OFF 0 585#define HCI_HOST_FLOW_CTRL_ACL_ON 1 586#define HCI_HOST_FLOW_CTRL_SCO_ON 2 587#define HCI_HOST_FLOW_CTRL_BOTH_ON 3 588 589extern BOOLEAN btsnd_hcic_write_auto_flush_tout(UINT16 handle, 590 UINT16 timeout); /* Write Retransmit Timout */ 591 592#define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT 4 593 594#define HCI_FLUSH_TOUT_HANDLE_OFF 0 595#define HCI_FLUSH_TOUT_TOUT_OFF 2 596 597extern BOOLEAN btsnd_hcic_read_tx_power(UINT16 handle, UINT8 type); /* Read Tx Power */ 598 599#define HCIC_PARAM_SIZE_READ_TX_POWER 3 600 601#define HCI_READ_TX_POWER_HANDLE_OFF 0 602#define HCI_READ_TX_POWER_TYPE_OFF 2 603 604/* Read transmit power level parameter */ 605#define HCI_READ_CURRENT 0x00 606#define HCI_READ_MAXIMUM 0x01 607 608extern BOOLEAN btsnd_hcic_host_num_xmitted_pkts (UINT8 num_handles, 609 UINT16 *handle, 610 UINT16 *num_pkts); /* Set Host Buffer Size */ 611 612#define HCIC_PARAM_SIZE_NUM_PKTS_DONE_SIZE sizeof(btmsg_hcic_num_pkts_done_t) 613 614#define MAX_DATA_HANDLES 10 615 616#define HCI_PKTS_DONE_NUM_HANDLES_OFF 0 617#define HCI_PKTS_DONE_HANDLE_OFF 1 618#define HCI_PKTS_DONE_NUM_PKTS_OFF 3 619 620 /* Write Link Supervision Timeout */ 621extern BOOLEAN btsnd_hcic_write_link_super_tout(UINT8 local_controller_id, UINT16 handle, UINT16 timeout); 622 623#define HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT 4 624 625#define HCI_LINK_SUPER_TOUT_HANDLE_OFF 0 626#define HCI_LINK_SUPER_TOUT_TOUT_OFF 2 627 /* Write Link Supervision Timeout */ 628 629extern BOOLEAN btsnd_hcic_write_cur_iac_lap (UINT8 num_cur_iac, 630 LAP * const iac_lap); /* Write Current IAC LAP */ 631 632#define MAX_IAC_LAPS 0x40 633 634#define HCI_WRITE_IAC_LAP_NUM_OFF 0 635#define HCI_WRITE_IAC_LAP_LAP_OFF 1 636 /* Write Current IAC LAP */ 637 638extern BOOLEAN btsnd_hcic_get_link_quality (UINT16 handle); /* Get Link Quality */ 639extern BOOLEAN btsnd_hcic_read_rssi (UINT16 handle); /* Read RSSI */ 640extern BOOLEAN btsnd_hcic_enable_test_mode (void); /* Enable Device Under Test Mode */ 641extern BOOLEAN btsnd_hcic_write_pagescan_type(UINT8 type); /* Write Page Scan Type */ 642extern BOOLEAN btsnd_hcic_write_inqscan_type(UINT8 type); /* Write Inquiry Scan Type */ 643extern BOOLEAN btsnd_hcic_write_inquiry_mode(UINT8 type); /* Write Inquiry Mode */ 644 645#define HCI_DATA_HANDLE_MASK 0x0FFF 646 647#define HCID_GET_HANDLE_EVENT(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset) + \ 648 (*((UINT8 *)((p) + 1) + p->offset + 1) << 8))) 649 650#define HCID_GET_HANDLE(u16) (UINT16)((u16) & HCI_DATA_HANDLE_MASK) 651 652#define HCI_DATA_EVENT_MASK 3 653#define HCI_DATA_EVENT_OFFSET 12 654#define HCID_GET_EVENT(u16) (UINT8)(((u16) >> HCI_DATA_EVENT_OFFSET) & HCI_DATA_EVENT_MASK) 655 656#define HCI_DATA_BCAST_MASK 3 657#define HCI_DATA_BCAST_OFFSET 10 658#define HCID_GET_BCAST(u16) (UINT8)(((u16) >> HCI_DATA_BCAST_OFFSET) & HCI_DATA_BCAST_MASK) 659 660#define HCID_GET_ACL_LEN(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset + 2) + \ 661 (*((UINT8 *)((p) + 1) + p->offset + 3) << 8))) 662 663#define HCID_HEADER_SIZE 4 664 665#define HCID_GET_SCO_LEN(p) (*((UINT8 *)((p) + 1) + p->offset + 2)) 666 667extern void btsnd_hcic_vendor_spec_cmd (void *buffer, UINT16 opcode, 668 UINT8 len, UINT8 *p_data, 669 void *p_cmd_cplt_cback); 670 671#if (BLE_INCLUDED == TRUE) 672/******************************************************************************** 673** BLE Commands 674** Note: "local_controller_id" is for transport, not counted in HCI message size 675*********************************************************************************/ 676#define HCIC_PARAM_SIZE_SET_USED_FEAT_CMD 8 677#define HCIC_PARAM_SIZE_WRITE_RANDOM_ADDR_CMD 6 678#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS 15 679#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_RSP 31 680#define HCIC_PARAM_SIZE_WRITE_ADV_ENABLE 1 681#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_PARAM 7 682#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_ENABLE 2 683#define HCIC_PARAM_SIZE_BLE_CREATE_LL_CONN 25 684#define HCIC_PARAM_SIZE_BLE_CREATE_CONN_CANCEL 0 685#define HCIC_PARAM_SIZE_CLEAR_WHITE_LIST 0 686#define HCIC_PARAM_SIZE_ADD_WHITE_LIST 7 687#define HCIC_PARAM_SIZE_REMOVE_WHITE_LIST 7 688#define HCIC_PARAM_SIZE_BLE_UPD_LL_CONN_PARAMS 14 689#define HCIC_PARAM_SIZE_SET_HOST_CHNL_CLASS 5 690#define HCIC_PARAM_SIZE_READ_CHNL_MAP 2 691#define HCIC_PARAM_SIZE_BLE_READ_REMOTE_FEAT 2 692#define HCIC_PARAM_SIZE_BLE_ENCRYPT 32 693#define HCIC_PARAM_SIZE_BLE_RAND 0 694#define HCIC_PARAM_SIZE_WRITE_LE_HOST_SUPPORTED 2 695 696#define HCIC_BLE_RAND_DI_SIZE 8 697#define HCIC_BLE_ENCRYT_KEY_SIZE 16 698#define HCIC_PARAM_SIZE_BLE_START_ENC (4 + HCIC_BLE_RAND_DI_SIZE + HCIC_BLE_ENCRYT_KEY_SIZE) 699#define HCIC_PARAM_SIZE_LTK_REQ_REPLY (2 + HCIC_BLE_ENCRYT_KEY_SIZE) 700#define HCIC_PARAM_SIZE_LTK_REQ_NEG_REPLY 2 701#define HCIC_BLE_CHNL_MAP_SIZE 5 702#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA 31 703 704/* ULP HCI command */ 705extern BOOLEAN btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask); 706 707extern BOOLEAN btsnd_hcic_ble_read_buffer_size (void); 708 709extern BOOLEAN btsnd_hcic_ble_read_local_spt_feat (void); 710 711extern BOOLEAN btsnd_hcic_ble_set_local_used_feat (UINT8 feat_set[8]); 712 713extern BOOLEAN btsnd_hcic_ble_set_random_addr (BD_ADDR random_addr); 714 715extern BOOLEAN btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max, 716 UINT8 adv_type, UINT8 addr_type_own, 717 UINT8 addr_type_dir, BD_ADDR direct_bda, 718 UINT8 channel_map, UINT8 scan_filter_policy); 719 720extern BOOLEAN btsnd_hcic_ble_read_adv_chnl_tx_power (void); 721 722extern BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data); 723 724extern BOOLEAN btsnd_hcic_ble_set_scan_rsp_data (UINT8 data_len, UINT8 *p_scan_rsp); 725 726extern BOOLEAN btsnd_hcic_ble_set_adv_enable (UINT8 adv_enable); 727 728extern BOOLEAN btsnd_hcic_ble_set_scan_params (UINT8 scan_type, 729 UINT16 scan_int, UINT16 scan_win, 730 UINT8 addr_type, UINT8 scan_filter_policy); 731 732extern BOOLEAN btsnd_hcic_ble_set_scan_enable (UINT8 scan_enable, UINT8 duplicate); 733 734extern BOOLEAN btsnd_hcic_ble_create_ll_conn (UINT16 scan_int, UINT16 scan_win, 735 UINT8 init_filter_policy, UINT8 addr_type_peer, BD_ADDR bda_peer, UINT8 addr_type_own, 736 UINT16 conn_int_min, UINT16 conn_int_max, UINT16 conn_latency, UINT16 conn_timeout, 737 UINT16 min_ce_len, UINT16 max_ce_len); 738 739extern BOOLEAN btsnd_hcic_ble_create_conn_cancel (void); 740 741extern BOOLEAN btsnd_hcic_ble_read_white_list_size (void); 742 743extern BOOLEAN btsnd_hcic_ble_clear_white_list (void); 744 745extern BOOLEAN btsnd_hcic_ble_add_white_list (UINT8 addr_type, BD_ADDR bda); 746 747extern BOOLEAN btsnd_hcic_ble_remove_from_white_list (UINT8 addr_type, BD_ADDR bda); 748 749extern BOOLEAN btsnd_hcic_ble_upd_ll_conn_params (UINT16 handle, UINT16 conn_int_min, UINT16 conn_int_max, 750 UINT16 conn_latency, UINT16 conn_timeout, UINT16 min_len, UINT16 max_len); 751 752extern BOOLEAN btsnd_hcic_ble_set_host_chnl_class (UINT8 chnl_map[HCIC_BLE_CHNL_MAP_SIZE]); 753 754extern BOOLEAN btsnd_hcic_ble_read_chnl_map (UINT16 handle); 755 756extern BOOLEAN btsnd_hcic_ble_read_remote_feat ( UINT16 handle); 757 758extern BOOLEAN btsnd_hcic_ble_encrypt (UINT8* key, UINT8 key_len, UINT8* plain_text, UINT8 pt_len, void *p_cmd_cplt_cback); 759 760extern BOOLEAN btsnd_hcic_ble_rand (void *p_cmd_cplt_cback); 761 762extern BOOLEAN btsnd_hcic_ble_start_enc ( UINT16 handle, 763 UINT8 rand[HCIC_BLE_RAND_DI_SIZE], 764 UINT16 ediv, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]); 765 766extern BOOLEAN btsnd_hcic_ble_ltk_req_reply (UINT16 handle, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]); 767 768extern BOOLEAN btsnd_hcic_ble_ltk_req_neg_reply (UINT16 handle); 769 770extern BOOLEAN btsnd_hcic_ble_read_supported_states (void); 771 772extern BOOLEAN btsnd_hcic_ble_write_host_supported (UINT8 le_host_spt, UINT8 simul_le_host_spt); 773 774extern BOOLEAN btsnd_hcic_ble_read_host_supported (void); 775 776extern BOOLEAN btsnd_hcic_ble_receiver_test(UINT8 rx_freq); 777 778extern BOOLEAN btsnd_hcic_ble_transmitter_test(UINT8 tx_freq, UINT8 test_data_len, 779 UINT8 payload); 780extern BOOLEAN btsnd_hcic_ble_test_end(void); 781 782#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE) 783 784#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_REPLY 14 785extern BOOLEAN btsnd_hcic_ble_rc_param_req_reply(UINT16 handle, 786 UINT16 conn_int_min, UINT16 conn_int_max, 787 UINT16 conn_latency, UINT16 conn_timeout, 788 UINT16 min_ce_len, UINT16 max_ce_len); 789 790#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_NEG_REPLY 3 791extern BOOLEAN btsnd_hcic_ble_rc_param_req_neg_reply(UINT16 handle, UINT8 reason); 792 793#endif /* BLE_LLT_INCLUDED */ 794 795 796#endif /* BLE_INCLUDED */ 797 798#endif 799