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 /****************************************************************************** 20 * 21 * This file contains function of the HCIC unit to format and send HCI 22 * commands. 23 * 24 ******************************************************************************/ 25 26 #include "bt_target.h" 27 #include "gki.h" 28 #include "hcidefs.h" 29 #include "hcimsgs.h" 30 #include "hcidefs.h" 31 #include "btu.h" 32 33 #include <stddef.h> 34 #include <string.h> 35 36 #if defined (LMP_TEST) 37 #include <script.h> 38 #define btu_hcif_send_cmd(p1, p2) HCI_CMD_TO_LOWER((p2)) 39 #else 40 #include "btm_int.h" /* Included for UIPC_* macro definitions */ 41 #endif 42 43 BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration, UINT8 response_cnt) 44 { 45 BT_HDR *p; 46 UINT8 *pp; 47 48 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_INQUIRY)) == NULL) 49 return (FALSE); 50 51 pp = (UINT8 *)(p + 1); 52 53 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQUIRY; 54 p->offset = 0; 55 56 UINT16_TO_STREAM (pp, HCI_INQUIRY); 57 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_INQUIRY); 58 59 LAP_TO_STREAM (pp, inq_lap); 60 UINT8_TO_STREAM (pp, duration); 61 UINT8_TO_STREAM (pp, response_cnt); 62 63 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 64 return (TRUE); 65 } 66 67 BOOLEAN btsnd_hcic_inq_cancel(void) 68 { 69 BT_HDR *p; 70 UINT8 *pp; 71 72 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_INQ_CANCEL)) == NULL) 73 return (FALSE); 74 75 pp = (UINT8 *)(p + 1); 76 77 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQ_CANCEL; 78 p->offset = 0; 79 UINT16_TO_STREAM (pp, HCI_INQUIRY_CANCEL); 80 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_INQ_CANCEL); 81 82 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 83 return (TRUE); 84 } 85 86 BOOLEAN btsnd_hcic_per_inq_mode (UINT16 max_period, UINT16 min_period, 87 const LAP inq_lap, UINT8 duration, UINT8 response_cnt) 88 { 89 BT_HDR *p; 90 UINT8 *pp; 91 92 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_PER_INQ_MODE)) == NULL) 93 return (FALSE); 94 95 pp = (UINT8 *)(p + 1); 96 97 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PER_INQ_MODE; 98 p->offset = 0; 99 100 UINT16_TO_STREAM (pp, HCI_PERIODIC_INQUIRY_MODE); 101 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_PER_INQ_MODE); 102 103 UINT16_TO_STREAM (pp, max_period); 104 UINT16_TO_STREAM (pp, min_period); 105 LAP_TO_STREAM (pp, inq_lap); 106 UINT8_TO_STREAM (pp, duration); 107 UINT8_TO_STREAM (pp, response_cnt); 108 109 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 110 return (TRUE); 111 } 112 113 BOOLEAN btsnd_hcic_exit_per_inq (void) 114 { 115 BT_HDR *p; 116 UINT8 *pp; 117 118 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_EXIT_PER_INQ)) == NULL) 119 return (FALSE); 120 121 pp = (UINT8 *)(p + 1); 122 123 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_EXIT_PER_INQ; 124 p->offset = 0; 125 UINT16_TO_STREAM (pp, HCI_EXIT_PERIODIC_INQUIRY_MODE); 126 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_EXIT_PER_INQ); 127 128 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 129 return (TRUE); 130 } 131 132 133 BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types, 134 UINT8 page_scan_rep_mode, UINT8 page_scan_mode, 135 UINT16 clock_offset, UINT8 allow_switch) 136 { 137 BT_HDR *p; 138 UINT8 *pp; 139 140 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CREATE_CONN)) == NULL) 141 return (FALSE); 142 143 pp = (UINT8 *)(p + 1); 144 145 #ifndef BT_10A 146 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN; 147 #else 148 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN - 1; 149 #endif 150 p->offset = 0; 151 152 UINT16_TO_STREAM (pp, HCI_CREATE_CONNECTION); 153 #ifndef BT_10A 154 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CREATE_CONN); 155 #else 156 UINT8_TO_STREAM (pp, (HCIC_PARAM_SIZE_CREATE_CONN - 1)); 157 #endif 158 BDADDR_TO_STREAM (pp, dest); 159 UINT16_TO_STREAM (pp, packet_types); 160 UINT8_TO_STREAM (pp, page_scan_rep_mode); 161 UINT8_TO_STREAM (pp, page_scan_mode); 162 UINT16_TO_STREAM (pp, clock_offset); 163 #if !defined (BT_10A) 164 UINT8_TO_STREAM (pp, allow_switch); 165 #endif 166 /* If calling from LMP_TEST or ScriptEngine, then send HCI command immediately */ 167 #if (!defined (LMP_TEST) && !defined(BTISE)) 168 btm_acl_paging (p, dest); 169 #else 170 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 171 #endif 172 return (TRUE); 173 } 174 175 BOOLEAN btsnd_hcic_disconnect (UINT16 handle, UINT8 reason) 176 { 177 BT_HDR *p; 178 UINT8 *pp; 179 180 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_DISCONNECT)) == NULL) 181 return (FALSE); 182 183 pp = (UINT8 *)(p + 1); 184 185 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_DISCONNECT; 186 p->offset = 0; 187 188 UINT16_TO_STREAM (pp, HCI_DISCONNECT); 189 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_DISCONNECT); 190 UINT16_TO_STREAM (pp, handle); 191 UINT8_TO_STREAM (pp, reason); 192 193 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 194 /* If calling from LMP_TEST or ScriptEngine, then send HCI command immediately */ 195 #if (!defined (LMP_TEST) && !defined(BTISE)) 196 // btla-specific ++ 197 // btm_acl_set_discing(TRUE); 198 // btla-specific -- 199 #endif 200 return (TRUE); 201 } 202 203 #if BTM_SCO_INCLUDED == TRUE 204 BOOLEAN btsnd_hcic_add_SCO_conn (UINT16 handle, UINT16 packet_types) 205 { 206 BT_HDR *p; 207 UINT8 *pp; 208 209 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_ADD_SCO_CONN)) == NULL) 210 return (FALSE); 211 212 pp = (UINT8 *)(p + 1); 213 214 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ADD_SCO_CONN; 215 p->offset = 0; 216 217 UINT16_TO_STREAM (pp, HCI_ADD_SCO_CONNECTION); 218 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_ADD_SCO_CONN); 219 220 UINT16_TO_STREAM (pp, handle); 221 UINT16_TO_STREAM (pp, packet_types); 222 223 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 224 return (TRUE); 225 } 226 #endif /* BTM_SCO_INCLUDED */ 227 228 BOOLEAN btsnd_hcic_create_conn_cancel(BD_ADDR dest) 229 { 230 BT_HDR *p; 231 UINT8 *pp; 232 233 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CREATE_CONN_CANCEL)) == NULL) 234 return (FALSE); 235 236 pp = (UINT8 *)(p + 1); 237 238 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN_CANCEL; 239 p->offset = 0; 240 241 UINT16_TO_STREAM (pp, HCI_CREATE_CONNECTION_CANCEL); 242 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CREATE_CONN_CANCEL); 243 244 BDADDR_TO_STREAM (pp, dest); 245 246 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 247 return (TRUE); 248 } 249 250 BOOLEAN btsnd_hcic_accept_conn (BD_ADDR dest, UINT8 role) 251 { 252 BT_HDR *p; 253 UINT8 *pp; 254 255 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_ACCEPT_CONN)) == NULL) 256 return (FALSE); 257 258 pp = (UINT8 *)(p + 1); 259 260 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ACCEPT_CONN; 261 p->offset = 0; 262 263 UINT16_TO_STREAM (pp, HCI_ACCEPT_CONNECTION_REQUEST); 264 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_ACCEPT_CONN); 265 BDADDR_TO_STREAM (pp, dest); 266 UINT8_TO_STREAM (pp, role); 267 268 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 269 return (TRUE); 270 } 271 272 BOOLEAN btsnd_hcic_reject_conn (BD_ADDR dest, UINT8 reason) 273 { 274 BT_HDR *p; 275 UINT8 *pp; 276 277 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_REJECT_CONN)) == NULL) 278 return (FALSE); 279 280 pp = (UINT8 *)(p + 1); 281 282 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_CONN; 283 p->offset = 0; 284 285 UINT16_TO_STREAM (pp, HCI_REJECT_CONNECTION_REQUEST); 286 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REJECT_CONN); 287 288 BDADDR_TO_STREAM (pp, dest); 289 UINT8_TO_STREAM (pp, reason); 290 291 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 292 return (TRUE); 293 } 294 295 BOOLEAN btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr, LINK_KEY link_key) 296 { 297 BT_HDR *p; 298 UINT8 *pp; 299 300 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY)) == NULL) 301 return (FALSE); 302 303 pp = (UINT8 *)(p + 1); 304 305 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY; 306 p->offset = 0; 307 308 UINT16_TO_STREAM (pp, HCI_LINK_KEY_REQUEST_REPLY); 309 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY); 310 311 BDADDR_TO_STREAM (pp, bd_addr); 312 ARRAY16_TO_STREAM (pp, link_key); 313 314 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 315 return (TRUE); 316 } 317 318 BOOLEAN btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr) 319 { 320 BT_HDR *p; 321 UINT8 *pp; 322 323 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY)) == NULL) 324 return (FALSE); 325 326 pp = (UINT8 *)(p + 1); 327 328 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY; 329 p->offset = 0; 330 331 UINT16_TO_STREAM (pp, HCI_LINK_KEY_REQUEST_NEG_REPLY); 332 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY); 333 334 BDADDR_TO_STREAM (pp, bd_addr); 335 336 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 337 return (TRUE); 338 } 339 340 BOOLEAN btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr, UINT8 pin_code_len, 341 PIN_CODE pin_code) 342 { 343 BT_HDR *p; 344 UINT8 *pp; 345 int i; 346 347 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY)) == NULL) 348 return (FALSE); 349 350 pp = (UINT8 *)(p + 1); 351 352 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY; 353 p->offset = 0; 354 355 UINT16_TO_STREAM (pp, HCI_PIN_CODE_REQUEST_REPLY); 356 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY); 357 358 BDADDR_TO_STREAM (pp, bd_addr); 359 UINT8_TO_STREAM (pp, pin_code_len); 360 361 for (i = 0; i < pin_code_len; i++) 362 *pp++ = *pin_code++; 363 364 for (; i < PIN_CODE_LEN; i++) 365 *pp++ = 0; 366 367 368 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 369 return (TRUE); 370 } 371 372 BOOLEAN btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr) 373 { 374 BT_HDR *p; 375 UINT8 *pp; 376 377 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY)) == NULL) 378 return (FALSE); 379 380 pp = (UINT8 *)(p + 1); 381 382 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY; 383 p->offset = 0; 384 385 UINT16_TO_STREAM (pp, HCI_PIN_CODE_REQUEST_NEG_REPLY); 386 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY); 387 388 BDADDR_TO_STREAM (pp, bd_addr); 389 390 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 391 return (TRUE); 392 } 393 394 BOOLEAN btsnd_hcic_change_conn_type (UINT16 handle, UINT16 packet_types) 395 { 396 BT_HDR *p; 397 UINT8 *pp; 398 399 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CHANGE_CONN_TYPE)) == NULL) 400 return (FALSE); 401 402 pp = (UINT8 *)(p + 1); 403 404 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_CONN_TYPE; 405 p->offset = 0; 406 407 UINT16_TO_STREAM (pp, HCI_CHANGE_CONN_PACKET_TYPE); 408 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CHANGE_CONN_TYPE); 409 410 UINT16_TO_STREAM (pp, handle); 411 UINT16_TO_STREAM (pp, packet_types); 412 413 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 414 return (TRUE); 415 } 416 417 BOOLEAN btsnd_hcic_auth_request (UINT16 handle) 418 { 419 BT_HDR *p; 420 UINT8 *pp; 421 422 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 423 return (FALSE); 424 425 pp = (UINT8 *)(p + 1); 426 427 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 428 p->offset = 0; 429 430 UINT16_TO_STREAM (pp, HCI_AUTHENTICATION_REQUESTED); 431 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 432 433 UINT16_TO_STREAM (pp, handle); 434 435 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 436 return (TRUE); 437 } 438 439 BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable) 440 { 441 BT_HDR *p; 442 UINT8 *pp; 443 444 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SET_CONN_ENCRYPT)) == NULL) 445 return (FALSE); 446 447 pp = (UINT8 *)(p + 1); 448 449 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_CONN_ENCRYPT; 450 p->offset = 0; 451 452 UINT16_TO_STREAM (pp, HCI_SET_CONN_ENCRYPTION); 453 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SET_CONN_ENCRYPT); 454 455 UINT16_TO_STREAM (pp, handle); 456 UINT8_TO_STREAM (pp, enable); 457 458 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 459 return (TRUE); 460 } 461 462 BOOLEAN btsnd_hcic_change_link_key (UINT16 handle) 463 { 464 BT_HDR *p; 465 UINT8 *pp; 466 467 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 468 return (FALSE); 469 470 pp = (UINT8 *)(p + 1); 471 472 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 473 p->offset = 0; 474 475 UINT16_TO_STREAM (pp, HCI_CHANGE_CONN_LINK_KEY); 476 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 477 478 UINT16_TO_STREAM (pp, handle); 479 480 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 481 return (TRUE); 482 } 483 484 BOOLEAN btsnd_hcic_master_link_key (BOOLEAN key_flag) 485 { 486 BT_HDR *p; 487 UINT8 *pp; 488 489 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_MASTER_LINK_KEY)) == NULL) 490 return (FALSE); 491 492 pp = (UINT8 *)(p + 1); 493 494 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_MASTER_LINK_KEY; 495 p->offset = 0; 496 497 UINT16_TO_STREAM (pp, HCI_MASTER_LINK_KEY); 498 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_MASTER_LINK_KEY); 499 500 UINT8_TO_STREAM (pp, key_flag); 501 502 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 503 return (TRUE); 504 } 505 506 BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr, UINT8 page_scan_rep_mode, 507 UINT8 page_scan_mode, UINT16 clock_offset) 508 { 509 BT_HDR *p; 510 UINT8 *pp; 511 512 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_RMT_NAME_REQ)) == NULL) 513 return (FALSE); 514 515 pp = (UINT8 *)(p + 1); 516 517 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_NAME_REQ; 518 p->offset = 0; 519 520 UINT16_TO_STREAM (pp, HCI_RMT_NAME_REQUEST); 521 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RMT_NAME_REQ); 522 523 BDADDR_TO_STREAM (pp, bd_addr); 524 UINT8_TO_STREAM (pp, page_scan_rep_mode); 525 UINT8_TO_STREAM (pp, page_scan_mode); 526 UINT16_TO_STREAM (pp, clock_offset); 527 528 /* If calling from LMP_TEST or ScriptEngine, then send HCI command immediately */ 529 #if (!defined (LMP_TEST) && !defined(BTISE)) 530 btm_acl_paging (p, bd_addr); 531 #else 532 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 533 #endif 534 return (TRUE); 535 } 536 537 BOOLEAN btsnd_hcic_rmt_name_req_cancel (BD_ADDR bd_addr) 538 { 539 BT_HDR *p; 540 UINT8 *pp; 541 542 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL)) == NULL) 543 return (FALSE); 544 545 pp = (UINT8 *)(p + 1); 546 547 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL; 548 p->offset = 0; 549 550 UINT16_TO_STREAM (pp, HCI_RMT_NAME_REQUEST_CANCEL); 551 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL); 552 553 BDADDR_TO_STREAM (pp, bd_addr); 554 555 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 556 return (TRUE); 557 } 558 559 BOOLEAN btsnd_hcic_rmt_features_req (UINT16 handle) 560 { 561 BT_HDR *p; 562 UINT8 *pp; 563 564 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 565 return (FALSE); 566 567 pp = (UINT8 *)(p + 1); 568 569 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 570 p->offset = 0; 571 572 UINT16_TO_STREAM (pp, HCI_READ_RMT_FEATURES); 573 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 574 575 UINT16_TO_STREAM (pp, handle); 576 577 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 578 return (TRUE); 579 } 580 581 BOOLEAN btsnd_hcic_rmt_ext_features (UINT16 handle, UINT8 page_num) 582 { 583 BT_HDR *p; 584 UINT8 *pp; 585 586 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_RMT_EXT_FEATURES)) == NULL) 587 return (FALSE); 588 589 pp = (UINT8 *)(p + 1); 590 591 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_EXT_FEATURES; 592 p->offset = 0; 593 594 UINT16_TO_STREAM (pp, HCI_READ_RMT_EXT_FEATURES); 595 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RMT_EXT_FEATURES); 596 597 UINT16_TO_STREAM (pp, handle); 598 UINT8_TO_STREAM (pp, page_num); 599 600 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 601 return (TRUE); 602 } 603 604 BOOLEAN btsnd_hcic_rmt_ver_req (UINT16 handle) 605 { 606 BT_HDR *p; 607 UINT8 *pp; 608 609 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 610 return (FALSE); 611 612 pp = (UINT8 *)(p + 1); 613 614 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 615 p->offset = 0; 616 617 UINT16_TO_STREAM (pp, HCI_READ_RMT_VERSION_INFO); 618 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 619 620 UINT16_TO_STREAM (pp, handle); 621 622 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 623 return (TRUE); 624 } 625 626 BOOLEAN btsnd_hcic_read_rmt_clk_offset (UINT16 handle) 627 { 628 BT_HDR *p; 629 UINT8 *pp; 630 631 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 632 return (FALSE); 633 634 pp = (UINT8 *)(p + 1); 635 636 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 637 p->offset = 0; 638 639 UINT16_TO_STREAM (pp, HCI_READ_RMT_CLOCK_OFFSET); 640 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 641 642 UINT16_TO_STREAM (pp, handle); 643 644 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 645 return (TRUE); 646 } 647 648 BOOLEAN btsnd_hcic_read_lmp_handle (UINT16 handle) 649 { 650 BT_HDR *p; 651 UINT8 *pp; 652 653 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 654 return (FALSE); 655 656 pp = (UINT8 *)(p + 1); 657 658 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 659 p->offset = 0; 660 661 UINT16_TO_STREAM (pp, HCI_READ_LMP_HANDLE); 662 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 663 664 UINT16_TO_STREAM (pp, handle); 665 666 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 667 return (TRUE); 668 } 669 670 BOOLEAN btsnd_hcic_setup_esco_conn (UINT16 handle, UINT32 tx_bw, 671 UINT32 rx_bw, UINT16 max_latency, UINT16 voice, 672 UINT8 retrans_effort, UINT16 packet_types) 673 { 674 BT_HDR *p; 675 UINT8 *pp; 676 677 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SETUP_ESCO)) == NULL) 678 return (FALSE); 679 680 pp = (UINT8 *)(p + 1); 681 682 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SETUP_ESCO; 683 p->offset = 0; 684 685 UINT16_TO_STREAM (pp, HCI_SETUP_ESCO_CONNECTION); 686 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SETUP_ESCO); 687 688 UINT16_TO_STREAM (pp, handle); 689 UINT32_TO_STREAM (pp, tx_bw); 690 UINT32_TO_STREAM (pp, rx_bw); 691 UINT16_TO_STREAM (pp, max_latency); 692 UINT16_TO_STREAM (pp, voice); 693 UINT8_TO_STREAM (pp, retrans_effort); 694 UINT16_TO_STREAM (pp, packet_types); 695 696 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 697 return (TRUE); 698 } 699 700 BOOLEAN btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr, UINT32 tx_bw, 701 UINT32 rx_bw, UINT16 max_latency, 702 UINT16 content_fmt, UINT8 retrans_effort, 703 UINT16 packet_types) 704 { 705 BT_HDR *p; 706 UINT8 *pp; 707 708 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_ACCEPT_ESCO)) == NULL) 709 return (FALSE); 710 711 pp = (UINT8 *)(p + 1); 712 713 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ACCEPT_ESCO; 714 p->offset = 0; 715 716 UINT16_TO_STREAM (pp, HCI_ACCEPT_ESCO_CONNECTION); 717 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_ACCEPT_ESCO); 718 719 BDADDR_TO_STREAM (pp, bd_addr); 720 UINT32_TO_STREAM (pp, tx_bw); 721 UINT32_TO_STREAM (pp, rx_bw); 722 UINT16_TO_STREAM (pp, max_latency); 723 UINT16_TO_STREAM (pp, content_fmt); 724 UINT8_TO_STREAM (pp, retrans_effort); 725 UINT16_TO_STREAM (pp, packet_types); 726 727 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 728 return (TRUE); 729 } 730 731 BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason) 732 { 733 BT_HDR *p; 734 UINT8 *pp; 735 736 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_REJECT_ESCO)) == NULL) 737 return (FALSE); 738 739 pp = (UINT8 *)(p + 1); 740 741 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_ESCO; 742 p->offset = 0; 743 744 UINT16_TO_STREAM (pp, HCI_REJECT_ESCO_CONNECTION); 745 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REJECT_ESCO); 746 747 BDADDR_TO_STREAM (pp, bd_addr); 748 UINT8_TO_STREAM (pp, reason); 749 750 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 751 return (TRUE); 752 } 753 754 BOOLEAN btsnd_hcic_hold_mode (UINT16 handle, UINT16 max_hold_period, 755 UINT16 min_hold_period) 756 { 757 BT_HDR *p; 758 UINT8 *pp; 759 760 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_HOLD_MODE)) == NULL) 761 return (FALSE); 762 763 pp = (UINT8 *)(p + 1); 764 765 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_HOLD_MODE; 766 p->offset = 0; 767 768 UINT16_TO_STREAM (pp, HCI_HOLD_MODE); 769 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_HOLD_MODE); 770 771 UINT16_TO_STREAM (pp, handle); 772 UINT16_TO_STREAM (pp, max_hold_period); 773 UINT16_TO_STREAM (pp, min_hold_period); 774 775 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 776 return (TRUE); 777 } 778 779 BOOLEAN btsnd_hcic_sniff_mode (UINT16 handle, UINT16 max_sniff_period, 780 UINT16 min_sniff_period, UINT16 sniff_attempt, 781 UINT16 sniff_timeout) 782 { 783 BT_HDR *p; 784 UINT8 *pp; 785 786 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SNIFF_MODE)) == NULL) 787 return (FALSE); 788 789 pp = (UINT8 *)(p + 1); 790 791 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SNIFF_MODE; 792 p->offset = 0; 793 794 UINT16_TO_STREAM (pp, HCI_SNIFF_MODE); 795 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SNIFF_MODE); 796 797 UINT16_TO_STREAM (pp, handle); 798 UINT16_TO_STREAM (pp, max_sniff_period); 799 UINT16_TO_STREAM (pp, min_sniff_period); 800 UINT16_TO_STREAM (pp, sniff_attempt); 801 UINT16_TO_STREAM (pp, sniff_timeout); 802 803 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 804 return (TRUE); 805 } 806 807 BOOLEAN btsnd_hcic_exit_sniff_mode (UINT16 handle) 808 { 809 BT_HDR *p; 810 UINT8 *pp; 811 812 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 813 return (FALSE); 814 815 pp = (UINT8 *)(p + 1); 816 817 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 818 p->offset = 0; 819 820 UINT16_TO_STREAM (pp, HCI_EXIT_SNIFF_MODE); 821 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 822 823 UINT16_TO_STREAM (pp, handle); 824 825 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 826 return TRUE; 827 } 828 829 BOOLEAN btsnd_hcic_park_mode (UINT16 handle, UINT16 beacon_max_interval, 830 UINT16 beacon_min_interval) 831 { 832 BT_HDR *p; 833 UINT8 *pp; 834 835 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_PARK_MODE)) == NULL) 836 return (FALSE); 837 838 pp = (UINT8 *)(p + 1); 839 840 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PARK_MODE; 841 p->offset = 0; 842 843 UINT16_TO_STREAM (pp, HCI_PARK_MODE); 844 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_PARK_MODE); 845 846 UINT16_TO_STREAM (pp, handle); 847 UINT16_TO_STREAM (pp, beacon_max_interval); 848 UINT16_TO_STREAM (pp, beacon_min_interval); 849 850 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 851 return (TRUE); 852 } 853 854 BOOLEAN btsnd_hcic_exit_park_mode (UINT16 handle) 855 { 856 BT_HDR *p; 857 UINT8 *pp; 858 859 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 860 return (FALSE); 861 862 pp = (UINT8 *)(p + 1); 863 864 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 865 p->offset = 0; 866 867 UINT16_TO_STREAM (pp, HCI_EXIT_PARK_MODE); 868 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 869 870 UINT16_TO_STREAM (pp, handle); 871 872 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 873 return TRUE; 874 } 875 876 BOOLEAN btsnd_hcic_qos_setup (UINT16 handle, UINT8 flags, UINT8 service_type, 877 UINT32 token_rate, UINT32 peak, UINT32 latency, 878 UINT32 delay_var) 879 { 880 BT_HDR *p; 881 UINT8 *pp; 882 883 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_QOS_SETUP)) == NULL) 884 return (FALSE); 885 886 pp = (UINT8 *)(p + 1); 887 888 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_QOS_SETUP; 889 p->offset = 0; 890 891 UINT16_TO_STREAM (pp, HCI_QOS_SETUP); 892 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_QOS_SETUP); 893 894 UINT16_TO_STREAM (pp, handle); 895 UINT8_TO_STREAM (pp, flags); 896 UINT8_TO_STREAM (pp, service_type); 897 UINT32_TO_STREAM (pp, token_rate); 898 UINT32_TO_STREAM (pp, peak); 899 UINT32_TO_STREAM (pp, latency); 900 UINT32_TO_STREAM (pp, delay_var); 901 902 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 903 return (TRUE); 904 } 905 906 BOOLEAN btsnd_hcic_role_discovery (UINT16 handle) 907 { 908 BT_HDR *p; 909 UINT8 *pp; 910 911 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 912 return (FALSE); 913 914 pp = (UINT8 *)(p + 1); 915 916 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 917 p->offset = 0; 918 919 UINT16_TO_STREAM (pp, HCI_ROLE_DISCOVERY); 920 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 921 922 UINT16_TO_STREAM (pp, handle); 923 924 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 925 return (TRUE); 926 } 927 928 BOOLEAN btsnd_hcic_switch_role (BD_ADDR bd_addr, UINT8 role) 929 { 930 BT_HDR *p; 931 UINT8 *pp; 932 933 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SWITCH_ROLE)) == NULL) 934 return (FALSE); 935 936 pp = (UINT8 *)(p + 1); 937 938 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SWITCH_ROLE; 939 p->offset = 0; 940 941 UINT16_TO_STREAM (pp, HCI_SWITCH_ROLE); 942 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SWITCH_ROLE); 943 944 BDADDR_TO_STREAM (pp, bd_addr); 945 UINT8_TO_STREAM (pp, role); 946 947 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 948 return (TRUE); 949 } 950 951 BOOLEAN btsnd_hcic_read_policy_set (UINT16 handle) 952 { 953 BT_HDR *p; 954 UINT8 *pp; 955 956 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 957 return (FALSE); 958 959 pp = (UINT8 *)(p + 1); 960 961 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 962 p->offset = 0; 963 964 UINT16_TO_STREAM (pp, HCI_READ_POLICY_SETTINGS); 965 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 966 967 UINT16_TO_STREAM (pp, handle); 968 969 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 970 return (TRUE); 971 } 972 973 BOOLEAN btsnd_hcic_write_policy_set (UINT16 handle, UINT16 settings) 974 { 975 BT_HDR *p; 976 UINT8 *pp; 977 978 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_POLICY_SET)) == NULL) 979 return (FALSE); 980 981 pp = (UINT8 *)(p + 1); 982 983 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_POLICY_SET; 984 p->offset = 0; 985 UINT16_TO_STREAM (pp, HCI_WRITE_POLICY_SETTINGS); 986 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_POLICY_SET); 987 988 UINT16_TO_STREAM (pp, handle); 989 UINT16_TO_STREAM (pp, settings); 990 991 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 992 return (TRUE); 993 } 994 995 BOOLEAN btsnd_hcic_read_def_policy_set (void) 996 { 997 BT_HDR *p; 998 UINT8 *pp; 999 1000 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_DEF_POLICY_SET)) == NULL) 1001 return (FALSE); 1002 1003 pp = (UINT8 *)(p + 1); 1004 1005 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_DEF_POLICY_SET; 1006 p->offset = 0; 1007 1008 UINT16_TO_STREAM (pp, HCI_READ_DEF_POLICY_SETTINGS); 1009 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_DEF_POLICY_SET); 1010 1011 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1012 return (TRUE); 1013 } 1014 1015 BOOLEAN btsnd_hcic_write_def_policy_set (UINT16 settings) 1016 { 1017 BT_HDR *p; 1018 UINT8 *pp; 1019 1020 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET)) == NULL) 1021 return (FALSE); 1022 1023 pp = (UINT8 *)(p + 1); 1024 1025 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET; 1026 p->offset = 0; 1027 UINT16_TO_STREAM (pp, HCI_WRITE_DEF_POLICY_SETTINGS); 1028 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET); 1029 1030 UINT16_TO_STREAM (pp, settings); 1031 1032 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1033 return (TRUE); 1034 } 1035 1036 BOOLEAN btsnd_hcic_flow_specification(UINT16 handle, UINT8 flags, UINT8 flow_direct, 1037 UINT8 service_type, UINT32 token_rate, 1038 UINT32 token_bucket_size, UINT32 peak, 1039 UINT32 latency) 1040 { 1041 BT_HDR *p; 1042 UINT8 *pp; 1043 1044 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_FLOW_SPEC)) == NULL) 1045 return (FALSE); 1046 1047 pp = (UINT8 *)(p + 1); 1048 1049 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_FLOW_SPEC; 1050 p->offset = 0; 1051 1052 UINT16_TO_STREAM (pp, HCI_FLOW_SPECIFICATION); 1053 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_FLOW_SPEC); 1054 1055 UINT16_TO_STREAM (pp, handle); 1056 UINT8_TO_STREAM (pp, flags); 1057 UINT8_TO_STREAM (pp, flow_direct); 1058 UINT8_TO_STREAM (pp, service_type); 1059 UINT32_TO_STREAM (pp, token_rate); 1060 UINT32_TO_STREAM (pp, token_bucket_size); 1061 UINT32_TO_STREAM (pp, peak); 1062 UINT32_TO_STREAM (pp, latency); 1063 1064 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1065 return (TRUE); 1066 } 1067 1068 BOOLEAN btsnd_hcic_set_event_mask(UINT8 local_controller_id, BT_EVENT_MASK event_mask) 1069 { 1070 BT_HDR *p; 1071 UINT8 *pp; 1072 1073 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SET_EVENT_MASK)) == NULL) 1074 return (FALSE); 1075 1076 pp = (UINT8 *)(p + 1); 1077 1078 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_EVENT_MASK; 1079 p->offset = 0; 1080 1081 UINT16_TO_STREAM (pp, HCI_SET_EVENT_MASK); 1082 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SET_EVENT_MASK); 1083 ARRAY8_TO_STREAM (pp, event_mask); 1084 1085 btu_hcif_send_cmd (local_controller_id, p); 1086 return (TRUE); 1087 } 1088 1089 BOOLEAN btsnd_hcic_set_event_mask_page_2 (UINT8 local_controller_id, BT_EVENT_MASK event_mask) 1090 { 1091 BT_HDR *p; 1092 UINT8 *pp; 1093 1094 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SET_EVENT_MASK_PAGE_2)) == NULL) 1095 return (FALSE); 1096 1097 pp = (UINT8 *)(p + 1); 1098 1099 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_EVENT_MASK_PAGE_2; 1100 p->offset = 0; 1101 1102 UINT16_TO_STREAM (pp, HCI_SET_EVENT_MASK_PAGE_2); 1103 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SET_EVENT_MASK_PAGE_2); 1104 ARRAY8_TO_STREAM (pp, event_mask); 1105 1106 btu_hcif_send_cmd (local_controller_id, p); 1107 return (TRUE); 1108 } 1109 1110 BOOLEAN btsnd_hcic_reset (UINT8 local_controller_id) 1111 { 1112 BT_HDR *p; 1113 UINT8 *pp; 1114 1115 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_RESET)) == NULL) 1116 return (FALSE); 1117 1118 pp = (UINT8 *)(p + 1); 1119 1120 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RESET; 1121 p->offset = 0; 1122 1123 UINT16_TO_STREAM (pp, HCI_RESET); 1124 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RESET); 1125 1126 btu_hcif_send_cmd (local_controller_id, p); 1127 /* If calling from LMP_TEST or ScriptEngine, then send HCI command immediately */ 1128 #if (!defined (LMP_TEST) && !defined(BTISE)) 1129 if (local_controller_id == LOCAL_BR_EDR_CONTROLLER_ID) 1130 { 1131 btm_acl_reset_paging (); 1132 btm_acl_set_discing (FALSE); 1133 } 1134 #endif 1135 return (TRUE); 1136 } 1137 1138 BOOLEAN btsnd_hcic_set_event_filter (UINT8 filt_type, UINT8 filt_cond_type, 1139 UINT8 *filt_cond, UINT8 filt_cond_len) 1140 { 1141 BT_HDR *p; 1142 UINT8 *pp; 1143 1144 /* Use buffer large enough to hold all sizes in this command */ 1145 if ((p = HCI_GET_CMD_BUF(2 + filt_cond_len)) == NULL) 1146 return (FALSE); 1147 1148 pp = (UINT8 *)(p + 1); 1149 1150 p->offset = 0; 1151 1152 UINT16_TO_STREAM (pp, HCI_SET_EVENT_FILTER); 1153 1154 if (filt_type) 1155 { 1156 p->len = (UINT16)(HCIC_PREAMBLE_SIZE + 2 + filt_cond_len); 1157 UINT8_TO_STREAM (pp, (UINT8)(2 + filt_cond_len)); 1158 1159 UINT8_TO_STREAM (pp, filt_type); 1160 UINT8_TO_STREAM (pp, filt_cond_type); 1161 1162 if (filt_cond_type == HCI_FILTER_COND_DEVICE_CLASS) 1163 { 1164 DEVCLASS_TO_STREAM (pp, filt_cond); 1165 filt_cond += DEV_CLASS_LEN; 1166 DEVCLASS_TO_STREAM (pp, filt_cond); 1167 filt_cond += DEV_CLASS_LEN; 1168 1169 filt_cond_len -= (2 * DEV_CLASS_LEN); 1170 } 1171 else if (filt_cond_type == HCI_FILTER_COND_BD_ADDR) 1172 { 1173 BDADDR_TO_STREAM (pp, filt_cond); 1174 filt_cond += BD_ADDR_LEN; 1175 1176 filt_cond_len -= BD_ADDR_LEN; 1177 } 1178 1179 if (filt_cond_len) 1180 ARRAY_TO_STREAM (pp, filt_cond, filt_cond_len); 1181 } 1182 else 1183 { 1184 p->len = (UINT16)(HCIC_PREAMBLE_SIZE + 1); 1185 UINT8_TO_STREAM (pp, 1); 1186 1187 UINT8_TO_STREAM (pp, filt_type); 1188 } 1189 1190 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1191 return (TRUE); 1192 } 1193 1194 BOOLEAN btsnd_hcic_flush (UINT8 local_controller_id, UINT16 handle) 1195 { 1196 BT_HDR *p; 1197 UINT8 *pp; 1198 1199 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 1200 return (FALSE); 1201 1202 pp = (UINT8 *)(p + 1); 1203 1204 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 1205 p->offset = 0; 1206 UINT16_TO_STREAM (pp, HCI_FLUSH); 1207 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 1208 1209 UINT16_TO_STREAM (pp, handle); 1210 1211 btu_hcif_send_cmd (local_controller_id, p); 1212 return (TRUE); 1213 } 1214 1215 BOOLEAN btsnd_hcic_read_pin_type (void) 1216 { 1217 BT_HDR *p; 1218 UINT8 *pp; 1219 1220 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1221 return (FALSE); 1222 1223 pp = (UINT8 *)(p + 1); 1224 1225 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1226 p->offset = 0; 1227 1228 UINT16_TO_STREAM (pp, HCI_READ_PIN_TYPE); 1229 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1230 1231 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1232 return (TRUE); 1233 } 1234 1235 BOOLEAN btsnd_hcic_write_pin_type (UINT8 type) 1236 { 1237 BT_HDR *p; 1238 UINT8 *pp; 1239 1240 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 1241 return (FALSE); 1242 1243 pp = (UINT8 *)(p + 1); 1244 1245 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 1246 p->offset = 0; 1247 1248 UINT16_TO_STREAM (pp, HCI_WRITE_PIN_TYPE); 1249 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 1250 1251 UINT8_TO_STREAM (pp, type); 1252 1253 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1254 return (TRUE); 1255 } 1256 1257 BOOLEAN btsnd_hcic_new_unit_key (void) 1258 { 1259 BT_HDR *p; 1260 UINT8 *pp; 1261 1262 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_NEW_UNIT_KEY)) == NULL) 1263 return (FALSE); 1264 1265 pp = (UINT8 *)(p + 1); 1266 1267 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_NEW_UNIT_KEY; 1268 p->offset = 0; 1269 1270 UINT16_TO_STREAM (pp, HCI_CREATE_NEW_UNIT_KEY); 1271 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_NEW_UNIT_KEY); 1272 1273 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1274 return (TRUE); 1275 } 1276 1277 BOOLEAN btsnd_hcic_read_stored_key (BD_ADDR bd_addr, BOOLEAN read_all_flag) 1278 { 1279 BT_HDR *p; 1280 UINT8 *pp; 1281 1282 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_STORED_KEY)) == NULL) 1283 return (FALSE); 1284 1285 pp = (UINT8 *)(p + 1); 1286 1287 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_STORED_KEY; 1288 p->offset = 0; 1289 1290 UINT16_TO_STREAM (pp, HCI_READ_STORED_LINK_KEY); 1291 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_STORED_KEY); 1292 1293 BDADDR_TO_STREAM (pp, bd_addr); 1294 UINT8_TO_STREAM (pp, read_all_flag); 1295 1296 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1297 return (TRUE); 1298 } 1299 1300 BOOLEAN btsnd_hcic_write_stored_key (UINT8 num_keys, BD_ADDR *bd_addr, 1301 LINK_KEY *link_key) 1302 { 1303 BT_HDR *p; 1304 UINT8 *pp; 1305 int j; 1306 1307 if ((p = HCI_GET_CMD_BUF(1 + (num_keys * (BD_ADDR_LEN + LINK_KEY_LEN)))) == NULL) 1308 return (FALSE); 1309 1310 pp = (UINT8 *)(p + 1); 1311 1312 1313 p->len = HCIC_PREAMBLE_SIZE + 1 + (num_keys * (BD_ADDR_LEN + LINK_KEY_LEN)); 1314 p->offset = 0; 1315 1316 UINT16_TO_STREAM (pp, HCI_WRITE_STORED_LINK_KEY); 1317 UINT8_TO_STREAM (pp, p->len - HCIC_PREAMBLE_SIZE); 1318 1319 if(num_keys > HCI_MAX_NUM_OF_LINK_KEYS_PER_CMMD) 1320 num_keys = HCI_MAX_NUM_OF_LINK_KEYS_PER_CMMD; 1321 1322 UINT8_TO_STREAM (pp, num_keys); 1323 1324 for (j = 0; j < num_keys; j++) 1325 { 1326 BDADDR_TO_STREAM (pp, bd_addr[j]); 1327 ARRAY16_TO_STREAM (pp, link_key[j]); 1328 } 1329 1330 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1331 return (TRUE); 1332 } 1333 1334 BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag) 1335 { 1336 BT_HDR *p; 1337 UINT8 *pp; 1338 1339 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_DELETE_STORED_KEY)) == NULL) 1340 return (FALSE); 1341 1342 pp = (UINT8 *)(p + 1); 1343 1344 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_DELETE_STORED_KEY; 1345 p->offset = 0; 1346 1347 UINT16_TO_STREAM (pp, HCI_DELETE_STORED_LINK_KEY); 1348 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_DELETE_STORED_KEY); 1349 1350 BDADDR_TO_STREAM (pp, bd_addr); 1351 UINT8_TO_STREAM (pp, delete_all_flag); 1352 1353 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1354 return (TRUE); 1355 } 1356 1357 BOOLEAN btsnd_hcic_change_name (BD_NAME name) 1358 { 1359 BT_HDR *p; 1360 UINT8 *pp; 1361 UINT16 len = strlen ((char *)name) + 1; 1362 1363 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CHANGE_NAME)) == NULL) 1364 return (FALSE); 1365 1366 pp = (UINT8 *)(p + 1); 1367 memset(pp, 0, HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_NAME); 1368 1369 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_NAME; 1370 p->offset = 0; 1371 1372 UINT16_TO_STREAM (pp, HCI_CHANGE_LOCAL_NAME); 1373 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CHANGE_NAME); 1374 1375 if (len > HCIC_PARAM_SIZE_CHANGE_NAME) 1376 len = HCIC_PARAM_SIZE_CHANGE_NAME; 1377 1378 ARRAY_TO_STREAM (pp, name, len); 1379 1380 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1381 return (TRUE); 1382 } 1383 1384 BOOLEAN btsnd_hcic_read_name (void) 1385 { 1386 BT_HDR *p; 1387 UINT8 *pp; 1388 1389 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1390 return (FALSE); 1391 1392 pp = (UINT8 *)(p + 1); 1393 1394 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1395 p->offset = 0; 1396 1397 UINT16_TO_STREAM (pp, HCI_READ_LOCAL_NAME); 1398 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1399 1400 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1401 return (TRUE); 1402 } 1403 1404 BOOLEAN btsnd_hcic_read_conn_acc_tout (UINT8 local_controller_id) 1405 { 1406 BT_HDR *p; 1407 UINT8 *pp; 1408 1409 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1410 return (FALSE); 1411 1412 pp = (UINT8 *)(p + 1); 1413 1414 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1415 p->offset = 0; 1416 1417 UINT16_TO_STREAM (pp, HCI_READ_CONN_ACCEPT_TOUT); 1418 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1419 1420 btu_hcif_send_cmd (local_controller_id, p); 1421 return (TRUE); 1422 } 1423 1424 BOOLEAN btsnd_hcic_write_conn_acc_tout (UINT8 local_controller_id, UINT16 timeout) 1425 { 1426 BT_HDR *p; 1427 UINT8 *pp; 1428 1429 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM2)) == NULL) 1430 return (FALSE); 1431 1432 pp = (UINT8 *)(p + 1); 1433 1434 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM2; 1435 p->offset = 0; 1436 1437 UINT16_TO_STREAM (pp, HCI_WRITE_CONN_ACCEPT_TOUT); 1438 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM2); 1439 1440 UINT16_TO_STREAM (pp, timeout); 1441 1442 btu_hcif_send_cmd (local_controller_id, p); 1443 return (TRUE); 1444 } 1445 1446 BOOLEAN btsnd_hcic_read_page_tout (void) 1447 { 1448 BT_HDR *p; 1449 UINT8 *pp; 1450 1451 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1452 return (FALSE); 1453 1454 pp = (UINT8 *)(p + 1); 1455 1456 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1457 p->offset = 0; 1458 1459 UINT16_TO_STREAM (pp, HCI_READ_PAGE_TOUT); 1460 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1461 1462 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1463 return (TRUE); 1464 } 1465 1466 BOOLEAN btsnd_hcic_write_page_tout (UINT16 timeout) 1467 { 1468 BT_HDR *p; 1469 UINT8 *pp; 1470 1471 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM2)) == NULL) 1472 return (FALSE); 1473 1474 pp = (UINT8 *)(p + 1); 1475 1476 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM2; 1477 p->offset = 0; 1478 1479 UINT16_TO_STREAM (pp, HCI_WRITE_PAGE_TOUT); 1480 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM2); 1481 1482 UINT16_TO_STREAM (pp, timeout); 1483 1484 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1485 return (TRUE); 1486 } 1487 1488 BOOLEAN btsnd_hcic_read_scan_enable (void) 1489 { 1490 BT_HDR *p; 1491 UINT8 *pp; 1492 1493 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1494 return (FALSE); 1495 1496 pp = (UINT8 *)(p + 1); 1497 1498 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1499 p->offset = 0; 1500 1501 UINT16_TO_STREAM (pp, HCI_READ_SCAN_ENABLE); 1502 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1503 1504 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1505 return (TRUE); 1506 } 1507 1508 BOOLEAN btsnd_hcic_write_scan_enable (UINT8 flag) 1509 { 1510 BT_HDR *p; 1511 UINT8 *pp; 1512 1513 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 1514 return (FALSE); 1515 1516 pp = (UINT8 *)(p + 1); 1517 1518 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 1519 p->offset = 0; 1520 1521 UINT16_TO_STREAM (pp, HCI_WRITE_SCAN_ENABLE); 1522 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 1523 1524 UINT8_TO_STREAM (pp, flag); 1525 1526 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1527 return (TRUE); 1528 } 1529 1530 BOOLEAN btsnd_hcic_read_pagescan_cfg(void) 1531 { 1532 BT_HDR *p; 1533 UINT8 *pp; 1534 1535 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1536 return (FALSE); 1537 1538 pp = (UINT8 *)(p + 1); 1539 1540 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1541 p->offset = 0; 1542 1543 UINT16_TO_STREAM (pp, HCI_READ_PAGESCAN_CFG); 1544 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1545 1546 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1547 return (TRUE); 1548 } 1549 1550 BOOLEAN btsnd_hcic_write_pagescan_cfg(UINT16 interval, UINT16 window) 1551 { 1552 BT_HDR *p; 1553 UINT8 *pp; 1554 1555 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG)) == NULL) 1556 return (FALSE); 1557 1558 pp = (UINT8 *)(p + 1); 1559 1560 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG; 1561 p->offset = 0; 1562 1563 UINT16_TO_STREAM (pp, HCI_WRITE_PAGESCAN_CFG); 1564 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG); 1565 1566 UINT16_TO_STREAM (pp, interval); 1567 UINT16_TO_STREAM (pp, window); 1568 1569 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1570 return (TRUE); 1571 } 1572 1573 BOOLEAN btsnd_hcic_read_inqscan_cfg(void) 1574 { 1575 BT_HDR *p; 1576 UINT8 *pp; 1577 1578 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1579 return (FALSE); 1580 1581 pp = (UINT8 *)(p + 1); 1582 1583 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1584 p->offset = 0; 1585 1586 UINT16_TO_STREAM (pp, HCI_READ_INQUIRYSCAN_CFG); 1587 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1588 1589 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1590 return (TRUE); 1591 } 1592 1593 BOOLEAN btsnd_hcic_write_inqscan_cfg(UINT16 interval, UINT16 window) 1594 { 1595 BT_HDR *p; 1596 UINT8 *pp; 1597 1598 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG)) == NULL) 1599 return (FALSE); 1600 1601 pp = (UINT8 *)(p + 1); 1602 1603 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG; 1604 p->offset = 0; 1605 1606 UINT16_TO_STREAM (pp, HCI_WRITE_INQUIRYSCAN_CFG); 1607 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG); 1608 1609 UINT16_TO_STREAM (pp, interval); 1610 UINT16_TO_STREAM (pp, window); 1611 1612 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1613 return (TRUE); 1614 } 1615 1616 BOOLEAN btsnd_hcic_read_auth_enable (void) 1617 { 1618 BT_HDR *p; 1619 UINT8 *pp; 1620 1621 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1622 return (FALSE); 1623 1624 pp = (UINT8 *)(p + 1); 1625 1626 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1627 p->offset = 0; 1628 1629 UINT16_TO_STREAM (pp, HCI_READ_AUTHENTICATION_ENABLE); 1630 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1631 1632 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1633 return (TRUE); 1634 } 1635 1636 BOOLEAN btsnd_hcic_write_auth_enable (UINT8 flag) 1637 { 1638 BT_HDR *p; 1639 UINT8 *pp; 1640 1641 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 1642 return (FALSE); 1643 1644 pp = (UINT8 *)(p + 1); 1645 1646 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 1647 p->offset = 0; 1648 1649 UINT16_TO_STREAM (pp, HCI_WRITE_AUTHENTICATION_ENABLE); 1650 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 1651 1652 UINT8_TO_STREAM (pp, flag); 1653 1654 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1655 return (TRUE); 1656 } 1657 1658 BOOLEAN btsnd_hcic_read_encr_mode (void) 1659 { 1660 BT_HDR *p; 1661 UINT8 *pp; 1662 1663 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1664 return (FALSE); 1665 1666 pp = (UINT8 *)(p + 1); 1667 1668 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1669 p->offset = 0; 1670 1671 UINT16_TO_STREAM (pp, HCI_READ_ENCRYPTION_MODE); 1672 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1673 1674 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1675 return (TRUE); 1676 } 1677 1678 BOOLEAN btsnd_hcic_write_encr_mode (UINT8 mode) 1679 { 1680 BT_HDR *p; 1681 UINT8 *pp; 1682 1683 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 1684 return (FALSE); 1685 1686 pp = (UINT8 *)(p + 1); 1687 1688 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 1689 p->offset = 0; 1690 1691 UINT16_TO_STREAM (pp, HCI_WRITE_ENCRYPTION_MODE); 1692 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 1693 1694 UINT8_TO_STREAM (pp, mode); 1695 1696 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1697 return (TRUE); 1698 } 1699 1700 BOOLEAN btsnd_hcic_read_dev_class(void) 1701 { 1702 BT_HDR *p; 1703 UINT8 *pp; 1704 1705 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1706 return (FALSE); 1707 1708 pp = (UINT8 *)(p + 1); 1709 1710 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1711 p->offset = 0; 1712 1713 UINT16_TO_STREAM (pp, HCI_READ_CLASS_OF_DEVICE); 1714 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1715 1716 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1717 return (TRUE); 1718 } 1719 1720 BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev_class) 1721 { 1722 BT_HDR *p; 1723 UINT8 *pp; 1724 1725 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM3)) == NULL) 1726 return (FALSE); 1727 1728 pp = (UINT8 *)(p + 1); 1729 1730 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM3; 1731 p->offset = 0; 1732 1733 UINT16_TO_STREAM (pp, HCI_WRITE_CLASS_OF_DEVICE); 1734 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM3); 1735 1736 DEVCLASS_TO_STREAM (pp, dev_class); 1737 1738 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1739 return (TRUE); 1740 } 1741 1742 BOOLEAN btsnd_hcic_read_voice_settings(void) 1743 { 1744 BT_HDR *p; 1745 UINT8 *pp; 1746 1747 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1748 return (FALSE); 1749 1750 pp = (UINT8 *)(p + 1); 1751 1752 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1753 p->offset = 0; 1754 1755 UINT16_TO_STREAM (pp, HCI_READ_VOICE_SETTINGS); 1756 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1757 1758 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1759 return (TRUE); 1760 } 1761 1762 BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags) 1763 { 1764 BT_HDR *p; 1765 UINT8 *pp; 1766 1767 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM2)) == NULL) 1768 return (FALSE); 1769 1770 pp = (UINT8 *)(p + 1); 1771 1772 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM2; 1773 p->offset = 0; 1774 1775 UINT16_TO_STREAM (pp, HCI_WRITE_VOICE_SETTINGS); 1776 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM2); 1777 1778 UINT16_TO_STREAM (pp, flags); 1779 1780 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1781 return (TRUE); 1782 } 1783 1784 BOOLEAN btsnd_hcic_read_auto_flush_tout (UINT16 handle) 1785 { 1786 BT_HDR *p; 1787 UINT8 *pp; 1788 1789 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 1790 return (FALSE); 1791 1792 pp = (UINT8 *)(p + 1); 1793 1794 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 1795 p->offset = 0; 1796 1797 UINT16_TO_STREAM (pp, HCI_READ_AUTO_FLUSH_TOUT); 1798 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 1799 1800 UINT16_TO_STREAM (pp, handle); 1801 1802 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1803 return (TRUE); 1804 } 1805 1806 BOOLEAN btsnd_hcic_write_auto_flush_tout (UINT16 handle, UINT16 tout) 1807 { 1808 BT_HDR *p; 1809 UINT8 *pp; 1810 1811 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT)) == NULL) 1812 return (FALSE); 1813 1814 pp = (UINT8 *)(p + 1); 1815 1816 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT; 1817 p->offset = 0; 1818 1819 UINT16_TO_STREAM (pp, HCI_WRITE_AUTO_FLUSH_TOUT); 1820 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT); 1821 1822 UINT16_TO_STREAM (pp, handle); 1823 UINT16_TO_STREAM (pp, tout); 1824 1825 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1826 return (TRUE); 1827 } 1828 1829 BOOLEAN btsnd_hcic_read_num_bcast_xmit (void) 1830 { 1831 BT_HDR *p; 1832 UINT8 *pp; 1833 1834 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1835 return (FALSE); 1836 1837 pp = (UINT8 *)(p + 1); 1838 1839 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1840 p->offset = 0; 1841 1842 UINT16_TO_STREAM (pp, HCI_READ_NUM_BCAST_REXMITS); 1843 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1844 1845 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1846 return (TRUE); 1847 } 1848 1849 BOOLEAN btsnd_hcic_write_num_bcast_xmit (UINT8 num) 1850 { 1851 BT_HDR *p; 1852 UINT8 *pp; 1853 1854 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 1855 return (FALSE); 1856 1857 pp = (UINT8 *)(p + 1); 1858 1859 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 1860 p->offset = 0; 1861 1862 UINT16_TO_STREAM (pp, HCI_WRITE_NUM_BCAST_REXMITS); 1863 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 1864 1865 UINT8_TO_STREAM (pp, num); 1866 1867 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1868 return (TRUE); 1869 } 1870 1871 BOOLEAN btsnd_hcic_read_hold_mode_act (void) 1872 { 1873 BT_HDR *p; 1874 UINT8 *pp; 1875 1876 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1877 return (FALSE); 1878 1879 pp = (UINT8 *)(p + 1); 1880 1881 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1882 p->offset = 0; 1883 1884 UINT16_TO_STREAM (pp, HCI_READ_HOLD_MODE_ACTIVITY); 1885 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1886 1887 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1888 return (TRUE); 1889 } 1890 1891 BOOLEAN btsnd_hcic_write_hold_mode_act (UINT8 flags) 1892 { 1893 BT_HDR *p; 1894 UINT8 *pp; 1895 1896 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 1897 return (FALSE); 1898 1899 pp = (UINT8 *)(p + 1); 1900 1901 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 1902 p->offset = 0; 1903 1904 UINT16_TO_STREAM (pp, HCI_WRITE_HOLD_MODE_ACTIVITY); 1905 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 1906 1907 UINT8_TO_STREAM (pp, flags); 1908 1909 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1910 return (TRUE); 1911 } 1912 1913 BOOLEAN btsnd_hcic_read_tx_power (UINT16 handle, UINT8 type) 1914 { 1915 BT_HDR *p; 1916 UINT8 *pp; 1917 1918 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_TX_POWER)) == NULL) 1919 return (FALSE); 1920 1921 pp = (UINT8 *)(p + 1); 1922 1923 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_TX_POWER; 1924 p->offset = 0; 1925 1926 UINT16_TO_STREAM (pp, HCI_READ_TRANSMIT_POWER_LEVEL); 1927 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_TX_POWER); 1928 1929 UINT16_TO_STREAM (pp, handle); 1930 UINT8_TO_STREAM (pp, type); 1931 1932 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1933 return (TRUE); 1934 } 1935 1936 BOOLEAN btsnd_hcic_read_sco_flow_enable (void) 1937 { 1938 BT_HDR *p; 1939 UINT8 *pp; 1940 1941 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 1942 return (FALSE); 1943 1944 pp = (UINT8 *)(p + 1); 1945 1946 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 1947 p->offset = 0; 1948 1949 UINT16_TO_STREAM (pp, HCI_READ_SCO_FLOW_CTRL_ENABLE); 1950 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 1951 1952 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1953 return (TRUE); 1954 } 1955 1956 BOOLEAN btsnd_hcic_write_sco_flow_enable (UINT8 flag) 1957 { 1958 BT_HDR *p; 1959 UINT8 *pp; 1960 1961 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 1962 return (FALSE); 1963 1964 pp = (UINT8 *)(p + 1); 1965 1966 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 1967 p->offset = 0; 1968 1969 UINT16_TO_STREAM (pp, HCI_WRITE_SCO_FLOW_CTRL_ENABLE); 1970 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 1971 1972 UINT8_TO_STREAM (pp, flag); 1973 1974 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1975 return (TRUE); 1976 } 1977 1978 BOOLEAN btsnd_hcic_set_host_flow_ctrl (UINT8 value) 1979 { 1980 BT_HDR *p; 1981 UINT8 *pp; 1982 1983 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 1984 return (FALSE); 1985 1986 pp = (UINT8 *)(p + 1); 1987 1988 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 1989 p->offset = 0; 1990 1991 UINT16_TO_STREAM (pp, HCI_SET_HC_TO_HOST_FLOW_CTRL); 1992 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 1993 1994 UINT8_TO_STREAM (pp, value); 1995 1996 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 1997 return (TRUE); 1998 } 1999 2000 BOOLEAN btsnd_hcic_set_host_buf_size (UINT16 acl_len, UINT8 sco_len, 2001 UINT16 acl_num, UINT16 sco_num) 2002 { 2003 BT_HDR *p; 2004 UINT8 *pp; 2005 2006 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SET_HOST_BUF_SIZE)) == NULL) 2007 return (FALSE); 2008 2009 pp = (UINT8 *)(p + 1); 2010 2011 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_HOST_BUF_SIZE; 2012 p->offset = 0; 2013 2014 UINT16_TO_STREAM (pp, HCI_HOST_BUFFER_SIZE); 2015 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SET_HOST_BUF_SIZE); 2016 2017 UINT16_TO_STREAM (pp, acl_len); 2018 UINT8_TO_STREAM (pp, sco_len); 2019 UINT16_TO_STREAM (pp, acl_num); 2020 UINT16_TO_STREAM (pp, sco_num); 2021 2022 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2023 return (TRUE); 2024 } 2025 2026 BOOLEAN btsnd_hcic_host_num_xmitted_pkts (UINT8 num_handles, UINT16 *handle, 2027 UINT16 *num_pkts) 2028 { 2029 BT_HDR *p; 2030 UINT8 *pp; 2031 int j; 2032 2033 if ((p = HCI_GET_CMD_BUF(1 + (num_handles * 4))) == NULL) 2034 return (FALSE); 2035 2036 pp = (UINT8 *)(p + 1); 2037 2038 p->len = HCIC_PREAMBLE_SIZE + 1 + (num_handles * 4); 2039 p->offset = 0; 2040 2041 UINT16_TO_STREAM (pp, HCI_HOST_NUM_PACKETS_DONE); 2042 UINT8_TO_STREAM (pp, p->len - HCIC_PREAMBLE_SIZE); 2043 2044 UINT8_TO_STREAM (pp, num_handles); 2045 2046 for (j = 0; j < num_handles; j++) 2047 { 2048 UINT16_TO_STREAM (pp, handle[j]); 2049 UINT16_TO_STREAM (pp, num_pkts[j]); 2050 } 2051 2052 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2053 return (TRUE); 2054 } 2055 2056 BOOLEAN btsnd_hcic_read_link_super_tout (UINT8 local_controller_id, UINT16 handle) 2057 { 2058 BT_HDR *p; 2059 UINT8 *pp; 2060 2061 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 2062 return (FALSE); 2063 2064 pp = (UINT8 *)(p + 1); 2065 2066 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 2067 p->offset = 0; 2068 2069 UINT16_TO_STREAM (pp, HCI_READ_LINK_SUPER_TOUT); 2070 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 2071 2072 UINT16_TO_STREAM (pp, handle); 2073 2074 btu_hcif_send_cmd (local_controller_id, p); 2075 return (TRUE); 2076 } 2077 2078 BOOLEAN btsnd_hcic_write_link_super_tout (UINT8 local_controller_id, UINT16 handle, UINT16 timeout) 2079 { 2080 BT_HDR *p; 2081 UINT8 *pp; 2082 2083 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT)) == NULL) 2084 return (FALSE); 2085 2086 pp = (UINT8 *)(p + 1); 2087 2088 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT; 2089 p->offset = 0; 2090 2091 UINT16_TO_STREAM (pp, HCI_WRITE_LINK_SUPER_TOUT); 2092 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT); 2093 2094 UINT16_TO_STREAM (pp, handle); 2095 UINT16_TO_STREAM (pp, timeout); 2096 2097 btu_hcif_send_cmd (local_controller_id, p); 2098 return (TRUE); 2099 } 2100 2101 BOOLEAN btsnd_hcic_read_max_iac (void) 2102 { 2103 BT_HDR *p; 2104 UINT8 *pp; 2105 2106 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2107 return (FALSE); 2108 2109 pp = (UINT8 *)(p + 1); 2110 2111 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2112 p->offset = 0; 2113 2114 UINT16_TO_STREAM (pp, HCI_READ_NUM_SUPPORTED_IAC); 2115 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2116 2117 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2118 return (TRUE); 2119 } 2120 2121 BOOLEAN btsnd_hcic_read_cur_iac_lap (void) 2122 { 2123 BT_HDR *p; 2124 UINT8 *pp; 2125 2126 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2127 return (FALSE); 2128 2129 pp = (UINT8 *)(p + 1); 2130 2131 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2132 p->offset = 0; 2133 2134 UINT16_TO_STREAM (pp, HCI_READ_CURRENT_IAC_LAP); 2135 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2136 2137 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2138 return (TRUE); 2139 } 2140 2141 BOOLEAN btsnd_hcic_write_cur_iac_lap (UINT8 num_cur_iac, LAP * const iac_lap) 2142 { 2143 BT_HDR *p; 2144 UINT8 *pp; 2145 int i; 2146 2147 if ((p = HCI_GET_CMD_BUF(1 + (LAP_LEN * num_cur_iac))) == NULL) 2148 return (FALSE); 2149 2150 pp = (UINT8 *)(p + 1); 2151 2152 p->len = HCIC_PREAMBLE_SIZE + 1 + (LAP_LEN * num_cur_iac); 2153 p->offset = 0; 2154 2155 UINT16_TO_STREAM (pp, HCI_WRITE_CURRENT_IAC_LAP); 2156 UINT8_TO_STREAM (pp, p->len - HCIC_PREAMBLE_SIZE); 2157 2158 UINT8_TO_STREAM (pp, num_cur_iac); 2159 2160 for (i = 0; i < num_cur_iac; i++) 2161 LAP_TO_STREAM (pp, iac_lap[i]); 2162 2163 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2164 return (TRUE); 2165 } 2166 2167 BOOLEAN btsnd_hcic_read_page_scan_per (void) 2168 { 2169 BT_HDR *p; 2170 UINT8 *pp; 2171 2172 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2173 return (FALSE); 2174 2175 pp = (UINT8 *)(p + 1); 2176 2177 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2178 p->offset = 0; 2179 2180 UINT16_TO_STREAM (pp, HCI_READ_PAGESCAN_PERIOD_MODE); 2181 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2182 2183 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2184 return (TRUE); 2185 } 2186 2187 BOOLEAN btsnd_hcic_write_page_scan_per (UINT8 mode) 2188 { 2189 BT_HDR *p; 2190 UINT8 *pp; 2191 2192 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 2193 return (FALSE); 2194 2195 pp = (UINT8 *)(p + 1); 2196 2197 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 2198 p->offset = 0; 2199 2200 UINT16_TO_STREAM (pp, HCI_WRITE_PAGESCAN_PERIOD_MODE); 2201 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 2202 2203 UINT8_TO_STREAM (pp, mode); 2204 2205 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2206 return (TRUE); 2207 } 2208 2209 BOOLEAN btsnd_hcic_read_page_scan_mode (void) 2210 { 2211 BT_HDR *p; 2212 UINT8 *pp; 2213 2214 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2215 return (FALSE); 2216 2217 pp = (UINT8 *)(p + 1); 2218 2219 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2220 p->offset = 0; 2221 2222 UINT16_TO_STREAM (pp, HCI_READ_PAGESCAN_MODE); 2223 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2224 2225 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2226 return (TRUE); 2227 } 2228 2229 BOOLEAN btsnd_hcic_write_page_scan_mode (UINT8 mode) 2230 { 2231 BT_HDR *p; 2232 UINT8 *pp; 2233 2234 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 2235 return (FALSE); 2236 2237 pp = (UINT8 *)(p + 1); 2238 2239 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 2240 p->offset = 0; 2241 2242 UINT16_TO_STREAM (pp, HCI_WRITE_PAGESCAN_MODE); 2243 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 2244 2245 UINT8_TO_STREAM (pp, mode); 2246 2247 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2248 return (TRUE); 2249 } 2250 2251 /****************************************** 2252 ** Lisbon Features 2253 *******************************************/ 2254 #if BTM_SSR_INCLUDED == TRUE 2255 2256 BOOLEAN btsnd_hcic_sniff_sub_rate(UINT16 handle, UINT16 max_lat, 2257 UINT16 min_remote_lat, UINT16 min_local_lat) 2258 { 2259 BT_HDR *p; 2260 UINT8 *pp; 2261 2262 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SNIFF_SUB_RATE)) == NULL) 2263 return (FALSE); 2264 2265 pp = (UINT8 *)(p + 1); 2266 2267 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SNIFF_SUB_RATE; 2268 p->offset = 0; 2269 2270 UINT16_TO_STREAM (pp, HCI_SNIFF_SUB_RATE); 2271 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SNIFF_SUB_RATE); 2272 2273 UINT16_TO_STREAM (pp, handle); 2274 UINT16_TO_STREAM (pp, max_lat); 2275 UINT16_TO_STREAM (pp, min_remote_lat); 2276 UINT16_TO_STREAM (pp, min_local_lat); 2277 2278 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2279 return (TRUE); 2280 } 2281 #endif /* BTM_SSR_INCLUDED */ 2282 2283 #if (BTM_EIR_SERVER_INCLUDED == TRUE) 2284 /**** Extended Inquiry Response Commands ****/ 2285 BOOLEAN btsnd_hcic_read_ext_inquiry_response (void) 2286 { 2287 BT_HDR *p; 2288 UINT8 *pp; 2289 2290 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2291 return (FALSE); 2292 2293 pp = (UINT8 *)(p + 1); 2294 2295 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2296 p->offset = 0; 2297 2298 UINT16_TO_STREAM (pp, HCI_READ_EXT_INQ_RESPONSE); 2299 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2300 2301 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2302 return (TRUE); 2303 } 2304 2305 void btsnd_hcic_write_ext_inquiry_response (void *buffer, UINT8 fec_req) 2306 { 2307 BT_HDR *p = (BT_HDR *)buffer; 2308 UINT8 *pp = (UINT8 *)(p + 1); 2309 2310 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_EXT_INQ_RESP; 2311 p->offset = 0; 2312 2313 UINT16_TO_STREAM (pp, HCI_WRITE_EXT_INQ_RESPONSE); 2314 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_EXT_INQ_RESP); 2315 2316 UINT8_TO_STREAM (pp, fec_req); 2317 2318 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2319 } 2320 #endif /* BTM_EIR_SERVER_INCLUDED == TRUE */ 2321 2322 /**** Simple Pairing Commands ****/ 2323 BOOLEAN btsnd_hcic_write_simple_pairing_mode (UINT8 mode) 2324 { 2325 BT_HDR *p; 2326 UINT8 *pp; 2327 2328 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_W_SIMP_PAIR)) == NULL) 2329 return (FALSE); 2330 2331 pp = (UINT8 *)(p + 1); 2332 2333 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_W_SIMP_PAIR; 2334 p->offset = 0; 2335 2336 UINT16_TO_STREAM (pp, HCI_WRITE_SIMPLE_PAIRING_MODE); 2337 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_W_SIMP_PAIR); 2338 2339 UINT8_TO_STREAM (pp, mode); 2340 2341 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2342 return (TRUE); 2343 } 2344 2345 BOOLEAN btsnd_hcic_read_simple_pairing_mode (void) 2346 { 2347 BT_HDR *p; 2348 UINT8 *pp; 2349 2350 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_R_SIMP_PAIR)) == NULL) 2351 return (FALSE); 2352 2353 pp = (UINT8 *)(p + 1); 2354 2355 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_SIMP_PAIR; 2356 p->offset = 0; 2357 2358 UINT16_TO_STREAM (pp, HCI_READ_SIMPLE_PAIRING_MODE); 2359 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_R_SIMP_PAIR); 2360 2361 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2362 return (TRUE); 2363 } 2364 2365 BOOLEAN btsnd_hcic_write_simp_pair_debug_mode(UINT8 debug_mode) 2366 { 2367 BT_HDR *p; 2368 UINT8 *pp; 2369 2370 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SIMP_PAIR_DBUG)) == NULL) 2371 return (FALSE); 2372 2373 pp = (UINT8 *)(p + 1); 2374 2375 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SIMP_PAIR_DBUG; 2376 p->offset = 0; 2377 2378 UINT16_TO_STREAM (pp, HCI_WRITE_SIMP_PAIR_DEBUG_MODE); 2379 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SIMP_PAIR_DBUG); 2380 2381 UINT8_TO_STREAM (pp, debug_mode); 2382 2383 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2384 return (TRUE); 2385 } 2386 2387 BOOLEAN btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, UINT8 capability, 2388 UINT8 oob_present, UINT8 auth_req) 2389 { 2390 BT_HDR *p; 2391 UINT8 *pp; 2392 2393 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_IO_CAP_RESP)) == NULL) 2394 return (FALSE); 2395 2396 pp = (UINT8 *)(p + 1); 2397 2398 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_IO_CAP_RESP; 2399 p->offset = 0; 2400 2401 UINT16_TO_STREAM (pp, HCI_IO_CAPABILITY_RESPONSE); 2402 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_IO_CAP_RESP); 2403 2404 BDADDR_TO_STREAM (pp, bd_addr); 2405 UINT8_TO_STREAM (pp, capability); 2406 UINT8_TO_STREAM (pp, oob_present); 2407 UINT8_TO_STREAM (pp, auth_req); 2408 2409 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2410 return (TRUE); 2411 } 2412 2413 BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code) 2414 { 2415 BT_HDR *p; 2416 UINT8 *pp; 2417 2418 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY)) == NULL) 2419 return (FALSE); 2420 2421 pp = (UINT8 *)(p + 1); 2422 2423 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY; 2424 p->offset = 0; 2425 2426 UINT16_TO_STREAM (pp, HCI_IO_CAP_REQ_NEG_REPLY); 2427 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY); 2428 2429 BDADDR_TO_STREAM (pp, bd_addr); 2430 UINT8_TO_STREAM (pp, err_code); 2431 2432 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2433 return (TRUE); 2434 } 2435 2436 BOOLEAN btsnd_hcic_read_local_oob_data (void) 2437 { 2438 BT_HDR *p; 2439 UINT8 *pp; 2440 2441 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_R_LOCAL_OOB)) == NULL) 2442 return (FALSE); 2443 2444 pp = (UINT8 *)(p + 1); 2445 2446 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_LOCAL_OOB; 2447 p->offset = 0; 2448 2449 UINT16_TO_STREAM (pp, HCI_READ_LOCAL_OOB_DATA); 2450 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_R_LOCAL_OOB); 2451 2452 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2453 return (TRUE); 2454 } 2455 2456 BOOLEAN btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, BOOLEAN is_yes) 2457 { 2458 BT_HDR *p; 2459 UINT8 *pp; 2460 2461 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_UCONF_REPLY)) == NULL) 2462 return (FALSE); 2463 2464 pp = (UINT8 *)(p + 1); 2465 2466 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_UCONF_REPLY; 2467 p->offset = 0; 2468 2469 if (!is_yes) 2470 { 2471 /* Negative reply */ 2472 UINT16_TO_STREAM (pp, HCI_USER_CONF_VALUE_NEG_REPLY); 2473 } 2474 else 2475 { 2476 /* Confirmation */ 2477 UINT16_TO_STREAM (pp, HCI_USER_CONF_REQUEST_REPLY); 2478 } 2479 2480 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_UCONF_REPLY); 2481 2482 BDADDR_TO_STREAM (pp, bd_addr); 2483 2484 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2485 return (TRUE); 2486 } 2487 2488 BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value) 2489 { 2490 BT_HDR *p; 2491 UINT8 *pp; 2492 2493 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_U_PKEY_REPLY)) == NULL) 2494 return (FALSE); 2495 2496 pp = (UINT8 *)(p + 1); 2497 2498 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_U_PKEY_REPLY; 2499 p->offset = 0; 2500 2501 UINT16_TO_STREAM (pp, HCI_USER_PASSKEY_REQ_REPLY); 2502 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_U_PKEY_REPLY); 2503 2504 BDADDR_TO_STREAM (pp, bd_addr); 2505 UINT32_TO_STREAM (pp, value); 2506 2507 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2508 return (TRUE); 2509 } 2510 2511 BOOLEAN btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr) 2512 { 2513 BT_HDR *p; 2514 UINT8 *pp; 2515 2516 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY)) == NULL) 2517 return (FALSE); 2518 2519 pp = (UINT8 *)(p + 1); 2520 2521 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY; 2522 p->offset = 0; 2523 2524 UINT16_TO_STREAM (pp, HCI_USER_PASSKEY_REQ_NEG_REPLY); 2525 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY); 2526 2527 BDADDR_TO_STREAM (pp, bd_addr); 2528 2529 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2530 return (TRUE); 2531 } 2532 2533 BOOLEAN btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, UINT8 *p_c, UINT8 *p_r) 2534 { 2535 BT_HDR *p; 2536 UINT8 *pp; 2537 2538 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_REM_OOB_REPLY)) == NULL) 2539 return (FALSE); 2540 2541 pp = (UINT8 *)(p + 1); 2542 2543 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REM_OOB_REPLY; 2544 p->offset = 0; 2545 2546 UINT16_TO_STREAM (pp, HCI_REM_OOB_DATA_REQ_REPLY); 2547 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REM_OOB_REPLY); 2548 2549 BDADDR_TO_STREAM (pp, bd_addr); 2550 ARRAY16_TO_STREAM (pp, p_c); 2551 ARRAY16_TO_STREAM (pp, p_r); 2552 2553 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2554 return (TRUE); 2555 } 2556 2557 BOOLEAN btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr) 2558 { 2559 BT_HDR *p; 2560 UINT8 *pp; 2561 2562 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY)) == NULL) 2563 return (FALSE); 2564 2565 pp = (UINT8 *)(p + 1); 2566 2567 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY; 2568 p->offset = 0; 2569 2570 UINT16_TO_STREAM (pp, HCI_REM_OOB_DATA_REQ_NEG_REPLY); 2571 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY); 2572 2573 BDADDR_TO_STREAM (pp, bd_addr); 2574 2575 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2576 return (TRUE); 2577 } 2578 2579 2580 BOOLEAN btsnd_hcic_read_inq_tx_power (void) 2581 { 2582 BT_HDR *p; 2583 UINT8 *pp; 2584 2585 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_R_TX_POWER)) == NULL) 2586 return (FALSE); 2587 2588 pp = (UINT8 *)(p + 1); 2589 2590 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_TX_POWER; 2591 p->offset = 0; 2592 2593 UINT16_TO_STREAM (pp, HCI_READ_INQ_TX_POWER_LEVEL); 2594 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_R_TX_POWER); 2595 2596 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2597 return (TRUE); 2598 } 2599 2600 BOOLEAN btsnd_hcic_write_inq_tx_power (INT8 level) 2601 { 2602 BT_HDR *p; 2603 UINT8 *pp; 2604 2605 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_W_TX_POWER)) == NULL) 2606 return (FALSE); 2607 2608 pp = (UINT8 *)(p + 1); 2609 2610 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_W_TX_POWER; 2611 p->offset = 0; 2612 2613 UINT16_TO_STREAM (pp, HCI_WRITE_INQ_TX_POWER_LEVEL); 2614 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_W_TX_POWER); 2615 2616 INT8_TO_STREAM (pp, level); 2617 2618 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2619 return (TRUE); 2620 } 2621 2622 #if 0 /* currently not been used */ 2623 BOOLEAN btsnd_hcic_read_default_erroneous_data_rpt (void) 2624 { 2625 BT_HDR *p; 2626 UINT8 *pp; 2627 2628 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_R_ERR_DATA_RPT)) == NULL) 2629 return (FALSE); 2630 2631 pp = (UINT8 *)(p + 1); 2632 2633 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_ERR_DATA_RPT; 2634 p->offset = 0; 2635 2636 UINT16_TO_STREAM (pp, HCI_READ_ERRONEOUS_DATA_RPT); 2637 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_R_ERR_DATA_RPT); 2638 2639 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2640 return (TRUE); 2641 } 2642 #endif 2643 2644 BOOLEAN btsnd_hcic_write_default_erroneous_data_rpt (UINT8 flag) 2645 { 2646 BT_HDR *p; 2647 UINT8 *pp; 2648 2649 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_W_ERR_DATA_RPT)) == NULL) 2650 return (FALSE); 2651 2652 pp = (UINT8 *)(p + 1); 2653 2654 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_W_ERR_DATA_RPT; 2655 p->offset = 0; 2656 2657 UINT16_TO_STREAM (pp, HCI_WRITE_ERRONEOUS_DATA_RPT); 2658 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_W_ERR_DATA_RPT); 2659 2660 UINT8_TO_STREAM (pp, flag); 2661 2662 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2663 return (TRUE); 2664 } 2665 2666 BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif) 2667 { 2668 BT_HDR *p; 2669 UINT8 *pp; 2670 2671 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF)) == NULL) 2672 return (FALSE); 2673 2674 pp = (UINT8 *)(p + 1); 2675 2676 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF; 2677 p->offset = 0; 2678 2679 UINT16_TO_STREAM (pp, HCI_SEND_KEYPRESS_NOTIF); 2680 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF); 2681 2682 BDADDR_TO_STREAM (pp, bd_addr); 2683 UINT8_TO_STREAM (pp, notif); 2684 2685 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2686 return (TRUE); 2687 } 2688 2689 /**** end of Simple Pairing Commands ****/ 2690 2691 #if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE 2692 BOOLEAN btsnd_hcic_enhanced_flush (UINT16 handle, UINT8 packet_type) 2693 { 2694 BT_HDR *p; 2695 UINT8 *pp; 2696 2697 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_ENHANCED_FLUSH)) == NULL) 2698 return (FALSE); 2699 2700 pp = (UINT8 *)(p + 1); 2701 2702 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ENHANCED_FLUSH; 2703 p->offset = 0; 2704 UINT16_TO_STREAM (pp, HCI_ENHANCED_FLUSH); 2705 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_ENHANCED_FLUSH); 2706 2707 UINT16_TO_STREAM (pp, handle); 2708 UINT8_TO_STREAM (pp, packet_type); 2709 2710 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2711 return (TRUE); 2712 } 2713 #endif 2714 2715 2716 BOOLEAN btsnd_hcic_refresh_encryption_key (UINT16 handle) 2717 { 2718 BT_HDR *p; 2719 UINT8 *pp; 2720 2721 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 2722 return (FALSE); 2723 2724 pp = (UINT8 *)(p + 1); 2725 2726 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 2727 p->offset = 0; 2728 UINT16_TO_STREAM (pp, HCI_REFRESH_ENCRYPTION_KEY); 2729 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 2730 2731 UINT16_TO_STREAM (pp, handle); 2732 2733 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2734 return (TRUE); 2735 } 2736 /************************* 2737 ** End of Lisbon Commands 2738 **************************/ 2739 2740 BOOLEAN btsnd_hcic_read_local_ver (UINT8 local_controller_id) 2741 { 2742 BT_HDR *p; 2743 UINT8 *pp; 2744 2745 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2746 return (FALSE); 2747 2748 pp = (UINT8 *)(p + 1); 2749 2750 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2751 p->offset = 0; 2752 2753 UINT16_TO_STREAM (pp, HCI_READ_LOCAL_VERSION_INFO); 2754 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2755 2756 btu_hcif_send_cmd (local_controller_id, p); 2757 return (TRUE); 2758 } 2759 2760 BOOLEAN btsnd_hcic_read_local_supported_cmds (UINT8 local_controller_id) 2761 { 2762 BT_HDR *p; 2763 UINT8 *pp; 2764 2765 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2766 return (FALSE); 2767 2768 pp = (UINT8 *)(p + 1); 2769 2770 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2771 p->offset = 0; 2772 2773 UINT16_TO_STREAM (pp, HCI_READ_LOCAL_SUPPORTED_CMDS); 2774 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2775 2776 btu_hcif_send_cmd (local_controller_id, p); 2777 return (TRUE); 2778 } 2779 2780 BOOLEAN btsnd_hcic_read_local_features (void) 2781 { 2782 BT_HDR *p; 2783 UINT8 *pp; 2784 2785 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2786 return (FALSE); 2787 2788 pp = (UINT8 *)(p + 1); 2789 2790 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2791 p->offset = 0; 2792 2793 UINT16_TO_STREAM (pp, HCI_READ_LOCAL_FEATURES); 2794 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2795 2796 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2797 return (TRUE); 2798 } 2799 2800 BOOLEAN btsnd_hcic_read_local_ext_features (UINT8 page_num) 2801 { 2802 BT_HDR *p; 2803 UINT8 *pp; 2804 2805 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_LOCAL_EXT_FEATURES)) == NULL) 2806 return (FALSE); 2807 2808 pp = (UINT8 *)(p + 1); 2809 2810 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LOCAL_EXT_FEATURES; 2811 p->offset = 0; 2812 2813 UINT16_TO_STREAM (pp, HCI_READ_LOCAL_EXT_FEATURES); 2814 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_LOCAL_EXT_FEATURES); 2815 2816 UINT8_TO_STREAM (pp, page_num); 2817 2818 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2819 return (TRUE); 2820 } 2821 2822 BOOLEAN btsnd_hcic_read_buffer_size (void) 2823 { 2824 BT_HDR *p; 2825 UINT8 *pp; 2826 2827 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2828 return (FALSE); 2829 2830 pp = (UINT8 *)(p + 1); 2831 2832 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2833 p->offset = 0; 2834 2835 UINT16_TO_STREAM (pp, HCI_READ_BUFFER_SIZE); 2836 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2837 2838 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2839 return (TRUE); 2840 } 2841 2842 BOOLEAN btsnd_hcic_read_country_code (void) 2843 { 2844 BT_HDR *p; 2845 UINT8 *pp; 2846 2847 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2848 return (FALSE); 2849 2850 pp = (UINT8 *)(p + 1); 2851 2852 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2853 p->offset = 0; 2854 2855 UINT16_TO_STREAM (pp, HCI_READ_COUNTRY_CODE); 2856 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2857 2858 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2859 return (TRUE); 2860 } 2861 2862 BOOLEAN btsnd_hcic_read_bd_addr (void) 2863 { 2864 BT_HDR *p; 2865 UINT8 *pp; 2866 2867 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2868 return (FALSE); 2869 2870 pp = (UINT8 *)(p + 1); 2871 2872 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2873 p->offset = 0; 2874 2875 UINT16_TO_STREAM (pp, HCI_READ_BD_ADDR); 2876 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2877 2878 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2879 return (TRUE); 2880 } 2881 2882 BOOLEAN btsnd_hcic_read_fail_contact_count (UINT8 local_controller_id, UINT16 handle) 2883 { 2884 BT_HDR *p; 2885 UINT8 *pp; 2886 2887 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 2888 return (FALSE); 2889 2890 pp = (UINT8 *)(p + 1); 2891 2892 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 2893 p->offset = 0; 2894 2895 UINT16_TO_STREAM (pp, HCI_READ_FAILED_CONTACT_COUNT); 2896 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 2897 2898 UINT16_TO_STREAM (pp, handle); 2899 2900 btu_hcif_send_cmd (local_controller_id, p); 2901 return (TRUE); 2902 } 2903 2904 BOOLEAN btsnd_hcic_reset_fail_contact_count (UINT8 local_controller_id, UINT16 handle) 2905 { 2906 BT_HDR *p; 2907 UINT8 *pp; 2908 2909 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 2910 return (FALSE); 2911 2912 pp = (UINT8 *)(p + 1); 2913 2914 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 2915 p->offset = 0; 2916 2917 UINT16_TO_STREAM (pp, HCI_RESET_FAILED_CONTACT_COUNT); 2918 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 2919 2920 UINT16_TO_STREAM (pp, handle); 2921 2922 btu_hcif_send_cmd (local_controller_id, p); 2923 return (TRUE); 2924 } 2925 2926 BOOLEAN btsnd_hcic_get_link_quality (UINT16 handle) 2927 { 2928 BT_HDR *p; 2929 UINT8 *pp; 2930 2931 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 2932 return (FALSE); 2933 2934 pp = (UINT8 *)(p + 1); 2935 2936 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 2937 p->offset = 0; 2938 2939 UINT16_TO_STREAM (pp, HCI_GET_LINK_QUALITY); 2940 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 2941 2942 UINT16_TO_STREAM (pp, handle); 2943 2944 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2945 return (TRUE); 2946 } 2947 2948 BOOLEAN btsnd_hcic_read_rssi (UINT16 handle) 2949 { 2950 BT_HDR *p; 2951 UINT8 *pp; 2952 2953 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 2954 return (FALSE); 2955 2956 pp = (UINT8 *)(p + 1); 2957 2958 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 2959 p->offset = 0; 2960 2961 UINT16_TO_STREAM (pp, HCI_READ_RSSI); 2962 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 2963 2964 UINT16_TO_STREAM (pp, handle); 2965 2966 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2967 return (TRUE); 2968 } 2969 2970 BOOLEAN btsnd_hcic_read_loopback_mode (void) 2971 { 2972 BT_HDR *p; 2973 UINT8 *pp; 2974 2975 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 2976 return (FALSE); 2977 2978 pp = (UINT8 *)(p + 1); 2979 2980 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 2981 p->offset = 0; 2982 2983 UINT16_TO_STREAM (pp, HCI_READ_LOOPBACK_MODE); 2984 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 2985 2986 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 2987 return (TRUE); 2988 } 2989 2990 BOOLEAN btsnd_hcic_write_loopback_mode (UINT8 mode) 2991 { 2992 BT_HDR *p; 2993 UINT8 *pp; 2994 2995 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 2996 return (FALSE); 2997 2998 pp = (UINT8 *)(p + 1); 2999 3000 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 3001 p->offset = 0; 3002 3003 UINT16_TO_STREAM (pp, HCI_WRITE_LOOPBACK_MODE); 3004 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 3005 3006 UINT8_TO_STREAM (pp, mode); 3007 3008 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3009 return (TRUE); 3010 } 3011 3012 BOOLEAN btsnd_hcic_enable_test_mode (void) 3013 { 3014 BT_HDR *p; 3015 UINT8 *pp; 3016 3017 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 3018 return (FALSE); 3019 3020 pp = (UINT8 *)(p + 1); 3021 3022 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 3023 p->offset = 0; 3024 3025 UINT16_TO_STREAM (pp, HCI_ENABLE_DEV_UNDER_TEST_MODE); 3026 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 3027 3028 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3029 return (TRUE); 3030 } 3031 3032 BOOLEAN btsnd_hcic_write_afh_channel_assessment_mode (UINT8 mode) 3033 { 3034 BT_HDR *p; 3035 UINT8 *pp; 3036 3037 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 3038 return (FALSE); 3039 3040 pp = (UINT8 *)(p + 1); 3041 3042 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 3043 p->offset = 0; 3044 3045 UINT16_TO_STREAM (pp, HCI_WRITE_AFH_ASSESSMENT_MODE); 3046 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 3047 3048 UINT8_TO_STREAM (pp, mode); 3049 3050 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3051 return (TRUE); 3052 } 3053 3054 BOOLEAN btsnd_hcic_read_afh_channel_assessment_mode(void) 3055 { 3056 BT_HDR *p; 3057 UINT8 *pp; 3058 3059 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 3060 return (FALSE); 3061 3062 pp = (UINT8 *)(p + 1); 3063 3064 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 3065 p->offset = 0; 3066 3067 UINT16_TO_STREAM (pp, HCI_READ_AFH_ASSESSMENT_MODE); 3068 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 3069 3070 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3071 return (TRUE); 3072 } 3073 3074 BOOLEAN btsnd_hcic_set_afh_channels (UINT8 first, UINT8 last) 3075 { 3076 BT_HDR *p; 3077 UINT8 *pp; 3078 UINT8 channels[10] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F}; 3079 int i; 3080 3081 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SET_AFH_CHANNELS)) == NULL) 3082 return (FALSE); 3083 3084 pp = (UINT8 *)(p + 1); 3085 3086 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_AFH_CHANNELS; 3087 p->offset = 0; 3088 3089 UINT16_TO_STREAM (pp, HCI_SET_AFH_CHANNELS); 3090 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SET_AFH_CHANNELS); 3091 3092 /* Just make sure that caller did not exceed 79 Bluetooth channels */ 3093 if ((first <= last) && (last <= 78)) 3094 { 3095 for (i = first; i <= last; i++) 3096 { 3097 int byte_offset = i / 8; 3098 int bit_offset = i % 8; 3099 channels[byte_offset] &= ~(1 << bit_offset); 3100 } 3101 } 3102 for (i = 0; i < 10; i++) 3103 *pp++ = channels[i]; 3104 3105 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3106 return (TRUE); 3107 } 3108 3109 BOOLEAN btsnd_hcic_set_afh_host_channel_class (UINT8 *p_afhchannelmap) 3110 { 3111 BT_HDR *p; 3112 UINT8 *pp; 3113 int i; 3114 3115 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SET_AFH_CHANNELS)) == NULL) 3116 return (FALSE); 3117 3118 pp = (UINT8 *)(p + 1); 3119 3120 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_AFH_CHANNELS; 3121 p->offset = 0; 3122 3123 UINT16_TO_STREAM (pp, HCI_SET_AFH_CHANNELS); 3124 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SET_AFH_CHANNELS); 3125 3126 /* Copy and convert */ 3127 for (i = 0; i < 10; i++) 3128 *pp++ = p_afhchannelmap[9-i]; 3129 3130 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3131 return (TRUE); 3132 } 3133 3134 BOOLEAN btsnd_hcic_read_afh_channel_map (UINT16 handle) 3135 { 3136 BT_HDR *p; 3137 UINT8 *pp; 3138 3139 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CMD_HANDLE)) == NULL) 3140 return (FALSE); 3141 3142 pp = (UINT8 *)(p + 1); 3143 3144 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; 3145 p->offset = 0; 3146 3147 UINT16_TO_STREAM (pp, HCI_READ_AFH_CH_MAP); 3148 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); 3149 3150 UINT16_TO_STREAM (pp, handle); 3151 3152 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3153 return (TRUE); 3154 } 3155 3156 BOOLEAN btsnd_hcic_read_clock (UINT16 handle, UINT8 which_clock) 3157 { 3158 BT_HDR *p; 3159 UINT8 *pp; 3160 3161 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CLOCK)) == NULL) 3162 return (FALSE); 3163 3164 pp = (UINT8 *)(p + 1); 3165 3166 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CLOCK; 3167 p->offset = 0; 3168 3169 UINT16_TO_STREAM (pp, HCI_READ_CLOCK); 3170 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CLOCK); 3171 3172 UINT16_TO_STREAM (pp, handle); 3173 UINT8_TO_STREAM (pp, which_clock); 3174 3175 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3176 return (TRUE); 3177 } 3178 3179 BOOLEAN btsnd_hcic_read_inqscan_type(void) 3180 { 3181 BT_HDR *p; 3182 UINT8 *pp; 3183 3184 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 3185 return (FALSE); 3186 3187 pp = (UINT8 *)(p + 1); 3188 3189 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 3190 p->offset = 0; 3191 3192 UINT16_TO_STREAM (pp, HCI_READ_INQSCAN_TYPE); 3193 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 3194 3195 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3196 return (TRUE); 3197 } 3198 3199 BOOLEAN btsnd_hcic_write_inqscan_type (UINT8 type) 3200 { 3201 BT_HDR *p; 3202 UINT8 *pp; 3203 3204 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 3205 return (FALSE); 3206 3207 pp = (UINT8 *)(p + 1); 3208 3209 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 3210 p->offset = 0; 3211 3212 UINT16_TO_STREAM (pp, HCI_WRITE_INQSCAN_TYPE); 3213 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 3214 3215 UINT8_TO_STREAM (pp, type); 3216 3217 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3218 return (TRUE); 3219 } 3220 3221 BOOLEAN btsnd_hcic_read_inquiry_mode (void) 3222 { 3223 BT_HDR *p; 3224 UINT8 *pp; 3225 3226 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 3227 return (FALSE); 3228 3229 pp = (UINT8 *)(p + 1); 3230 3231 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 3232 p->offset = 0; 3233 3234 UINT16_TO_STREAM (pp, HCI_READ_INQUIRY_MODE); 3235 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 3236 3237 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3238 return (TRUE); 3239 } 3240 3241 BOOLEAN btsnd_hcic_write_inquiry_mode (UINT8 mode) 3242 { 3243 BT_HDR *p; 3244 UINT8 *pp; 3245 3246 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 3247 return (FALSE); 3248 3249 pp = (UINT8 *)(p + 1); 3250 3251 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 3252 p->offset = 0; 3253 3254 UINT16_TO_STREAM (pp, HCI_WRITE_INQUIRY_MODE); 3255 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 3256 3257 UINT8_TO_STREAM (pp, mode); 3258 3259 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3260 return (TRUE); 3261 } 3262 3263 BOOLEAN btsnd_hcic_read_pagescan_type (void) 3264 { 3265 BT_HDR *p; 3266 UINT8 *pp; 3267 3268 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 3269 return (FALSE); 3270 3271 pp = (UINT8 *)(p + 1); 3272 3273 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 3274 p->offset = 0; 3275 3276 UINT16_TO_STREAM (pp, HCI_READ_PAGESCAN_TYPE); 3277 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 3278 3279 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3280 return (TRUE); 3281 } 3282 3283 BOOLEAN btsnd_hcic_write_pagescan_type (UINT8 type) 3284 { 3285 BT_HDR *p; 3286 UINT8 *pp; 3287 3288 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM1)) == NULL) 3289 return (FALSE); 3290 3291 pp = (UINT8 *)(p + 1); 3292 3293 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; 3294 p->offset = 0; 3295 3296 UINT16_TO_STREAM (pp, HCI_WRITE_PAGESCAN_TYPE); 3297 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); 3298 3299 UINT8_TO_STREAM (pp, type); 3300 3301 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3302 return (TRUE); 3303 } 3304 3305 /* Must have room to store BT_HDR + max VSC length + callback pointer */ 3306 #if !defined (LMP_TEST) && (HCI_CMD_POOL_BUF_SIZE < 268) 3307 #error "HCI_CMD_POOL_BUF_SIZE must be larger than 268" 3308 #endif 3309 3310 void btsnd_hcic_vendor_spec_cmd (void *buffer, UINT16 opcode, UINT8 len, 3311 UINT8 *p_data, void *p_cmd_cplt_cback) 3312 { 3313 BT_HDR *p = (BT_HDR *)buffer; 3314 UINT8 *pp = (UINT8 *)(p + 1); 3315 3316 p->len = HCIC_PREAMBLE_SIZE + len; 3317 p->offset = sizeof(void *); 3318 3319 *((void **)pp) = p_cmd_cplt_cback; /* Store command complete callback in buffer */ 3320 pp += sizeof(void *); /* Skip over callback pointer */ 3321 3322 UINT16_TO_STREAM (pp, HCI_GRP_VENDOR_SPECIFIC | opcode); 3323 UINT8_TO_STREAM (pp, len); 3324 ARRAY_TO_STREAM (pp, p_data, len); 3325 3326 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3327 } 3328 3329 void btsnd_hcic_data (BT_HDR *p_buf, UINT16 len, UINT16 handle, UINT8 boundary, UINT8 broadcast) 3330 { 3331 UINT8 *p; 3332 3333 /* Higher layer should have left 4 bytes for us to fill the header */ 3334 p_buf->offset -= 4; 3335 p_buf->len += 4; 3336 3337 /* Find the pointer to the beginning of the data */ 3338 p = (UINT8 *)(p_buf + 1) + p_buf->offset; 3339 3340 UINT16_TO_STREAM (p, handle | ((boundary & 3) << 12) | ((broadcast & 3) << 14)); 3341 UINT16_TO_STREAM (p, len); 3342 3343 HCI_ACL_DATA_TO_LOWER (p_buf); 3344 } 3345 3346 BOOLEAN btsnd_hcic_nop (void) 3347 { 3348 BT_HDR *p; 3349 UINT8 *pp; 3350 3351 if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_CMD)) == NULL) 3352 return (FALSE); 3353 3354 pp = (UINT8 *)(p + 1); 3355 3356 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; 3357 p->offset = 0; 3358 3359 UINT16_TO_STREAM (pp, HCI_COMMAND_NONE); 3360 UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); 3361 3362 btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); 3363 return (TRUE); 3364 } 3365 3366