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