The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 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" |
Pavlin Radoslavov | a11035b | 2015-09-27 20:59:05 -0700 | [diff] [blame] | 27 | #include "bt_common.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 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 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 36 | #include "btm_int.h" /* Included for UIPC_* macro definitions */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 37 | |
| 38 | BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration, UINT8 response_cnt) |
| 39 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 40 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 41 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 42 | |
| 43 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQUIRY; |
| 44 | p->offset = 0; |
| 45 | |
| 46 | UINT16_TO_STREAM (pp, HCI_INQUIRY); |
| 47 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_INQUIRY); |
| 48 | |
| 49 | LAP_TO_STREAM (pp, inq_lap); |
| 50 | UINT8_TO_STREAM (pp, duration); |
| 51 | UINT8_TO_STREAM (pp, response_cnt); |
| 52 | |
| 53 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 54 | return (TRUE); |
| 55 | } |
| 56 | |
| 57 | BOOLEAN btsnd_hcic_inq_cancel(void) |
| 58 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 59 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 60 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 61 | |
| 62 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQ_CANCEL; |
| 63 | p->offset = 0; |
| 64 | UINT16_TO_STREAM (pp, HCI_INQUIRY_CANCEL); |
| 65 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_INQ_CANCEL); |
| 66 | |
| 67 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 68 | return (TRUE); |
| 69 | } |
| 70 | |
| 71 | BOOLEAN btsnd_hcic_per_inq_mode (UINT16 max_period, UINT16 min_period, |
| 72 | const LAP inq_lap, UINT8 duration, UINT8 response_cnt) |
| 73 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 74 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 75 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 76 | |
| 77 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PER_INQ_MODE; |
| 78 | p->offset = 0; |
| 79 | |
| 80 | UINT16_TO_STREAM (pp, HCI_PERIODIC_INQUIRY_MODE); |
| 81 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_PER_INQ_MODE); |
| 82 | |
| 83 | UINT16_TO_STREAM (pp, max_period); |
| 84 | UINT16_TO_STREAM (pp, min_period); |
| 85 | LAP_TO_STREAM (pp, inq_lap); |
| 86 | UINT8_TO_STREAM (pp, duration); |
| 87 | UINT8_TO_STREAM (pp, response_cnt); |
| 88 | |
| 89 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 90 | return (TRUE); |
| 91 | } |
| 92 | |
| 93 | BOOLEAN btsnd_hcic_exit_per_inq (void) |
| 94 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 95 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 96 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 97 | |
| 98 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_EXIT_PER_INQ; |
| 99 | p->offset = 0; |
| 100 | UINT16_TO_STREAM (pp, HCI_EXIT_PERIODIC_INQUIRY_MODE); |
| 101 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_EXIT_PER_INQ); |
| 102 | |
| 103 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 104 | return (TRUE); |
| 105 | } |
| 106 | |
| 107 | |
| 108 | BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types, |
| 109 | UINT8 page_scan_rep_mode, UINT8 page_scan_mode, |
| 110 | UINT16 clock_offset, UINT8 allow_switch) |
| 111 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 112 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 113 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 114 | |
| 115 | #ifndef BT_10A |
| 116 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN; |
| 117 | #else |
| 118 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN - 1; |
| 119 | #endif |
| 120 | p->offset = 0; |
| 121 | |
| 122 | UINT16_TO_STREAM (pp, HCI_CREATE_CONNECTION); |
| 123 | #ifndef BT_10A |
| 124 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CREATE_CONN); |
| 125 | #else |
| 126 | UINT8_TO_STREAM (pp, (HCIC_PARAM_SIZE_CREATE_CONN - 1)); |
| 127 | #endif |
| 128 | BDADDR_TO_STREAM (pp, dest); |
| 129 | UINT16_TO_STREAM (pp, packet_types); |
| 130 | UINT8_TO_STREAM (pp, page_scan_rep_mode); |
| 131 | UINT8_TO_STREAM (pp, page_scan_mode); |
| 132 | UINT16_TO_STREAM (pp, clock_offset); |
| 133 | #if !defined (BT_10A) |
| 134 | UINT8_TO_STREAM (pp, allow_switch); |
| 135 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 136 | btm_acl_paging (p, dest); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 137 | return (TRUE); |
| 138 | } |
| 139 | |
| 140 | BOOLEAN btsnd_hcic_disconnect (UINT16 handle, UINT8 reason) |
| 141 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 142 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 143 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 144 | |
| 145 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_DISCONNECT; |
| 146 | p->offset = 0; |
| 147 | |
| 148 | UINT16_TO_STREAM (pp, HCI_DISCONNECT); |
| 149 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_DISCONNECT); |
| 150 | UINT16_TO_STREAM (pp, handle); |
| 151 | UINT8_TO_STREAM (pp, reason); |
| 152 | |
| 153 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 154 | return (TRUE); |
| 155 | } |
| 156 | |
| 157 | #if BTM_SCO_INCLUDED == TRUE |
| 158 | BOOLEAN btsnd_hcic_add_SCO_conn (UINT16 handle, UINT16 packet_types) |
| 159 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 160 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 161 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 162 | |
| 163 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ADD_SCO_CONN; |
| 164 | p->offset = 0; |
| 165 | |
| 166 | UINT16_TO_STREAM (pp, HCI_ADD_SCO_CONNECTION); |
| 167 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_ADD_SCO_CONN); |
| 168 | |
| 169 | UINT16_TO_STREAM (pp, handle); |
| 170 | UINT16_TO_STREAM (pp, packet_types); |
| 171 | |
| 172 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 173 | return (TRUE); |
| 174 | } |
| 175 | #endif /* BTM_SCO_INCLUDED */ |
| 176 | |
| 177 | BOOLEAN btsnd_hcic_create_conn_cancel(BD_ADDR dest) |
| 178 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 179 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 180 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 181 | |
| 182 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN_CANCEL; |
| 183 | p->offset = 0; |
| 184 | |
| 185 | UINT16_TO_STREAM (pp, HCI_CREATE_CONNECTION_CANCEL); |
| 186 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CREATE_CONN_CANCEL); |
| 187 | |
| 188 | BDADDR_TO_STREAM (pp, dest); |
| 189 | |
| 190 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 191 | return (TRUE); |
| 192 | } |
| 193 | |
| 194 | BOOLEAN btsnd_hcic_accept_conn (BD_ADDR dest, UINT8 role) |
| 195 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 196 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 197 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 198 | |
| 199 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ACCEPT_CONN; |
| 200 | p->offset = 0; |
| 201 | |
| 202 | UINT16_TO_STREAM (pp, HCI_ACCEPT_CONNECTION_REQUEST); |
| 203 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_ACCEPT_CONN); |
| 204 | BDADDR_TO_STREAM (pp, dest); |
| 205 | UINT8_TO_STREAM (pp, role); |
| 206 | |
Chris Manton | cccf02f | 2014-10-21 13:55:24 -0700 | [diff] [blame] | 207 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 208 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 209 | return (TRUE); |
| 210 | } |
| 211 | |
| 212 | BOOLEAN btsnd_hcic_reject_conn (BD_ADDR dest, UINT8 reason) |
| 213 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 214 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 215 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 216 | |
| 217 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_CONN; |
| 218 | p->offset = 0; |
| 219 | |
| 220 | UINT16_TO_STREAM (pp, HCI_REJECT_CONNECTION_REQUEST); |
| 221 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REJECT_CONN); |
| 222 | |
| 223 | BDADDR_TO_STREAM (pp, dest); |
| 224 | UINT8_TO_STREAM (pp, reason); |
| 225 | |
Chris Manton | cccf02f | 2014-10-21 13:55:24 -0700 | [diff] [blame] | 226 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 227 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 228 | return (TRUE); |
| 229 | } |
| 230 | |
| 231 | BOOLEAN btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr, LINK_KEY link_key) |
| 232 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 233 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 234 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 235 | |
| 236 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY; |
| 237 | p->offset = 0; |
| 238 | |
| 239 | UINT16_TO_STREAM (pp, HCI_LINK_KEY_REQUEST_REPLY); |
| 240 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY); |
| 241 | |
| 242 | BDADDR_TO_STREAM (pp, bd_addr); |
| 243 | ARRAY16_TO_STREAM (pp, link_key); |
| 244 | |
| 245 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 246 | return (TRUE); |
| 247 | } |
| 248 | |
| 249 | BOOLEAN btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr) |
| 250 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 251 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 252 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 253 | |
| 254 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY; |
| 255 | p->offset = 0; |
| 256 | |
| 257 | UINT16_TO_STREAM (pp, HCI_LINK_KEY_REQUEST_NEG_REPLY); |
| 258 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY); |
| 259 | |
| 260 | BDADDR_TO_STREAM (pp, bd_addr); |
| 261 | |
| 262 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 263 | return (TRUE); |
| 264 | } |
| 265 | |
| 266 | BOOLEAN btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr, UINT8 pin_code_len, |
| 267 | PIN_CODE pin_code) |
| 268 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 269 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 270 | UINT8 *pp = (UINT8 *)(p + 1); |
| 271 | int i; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 272 | |
| 273 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY; |
| 274 | p->offset = 0; |
| 275 | |
| 276 | UINT16_TO_STREAM (pp, HCI_PIN_CODE_REQUEST_REPLY); |
| 277 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY); |
| 278 | |
| 279 | BDADDR_TO_STREAM (pp, bd_addr); |
| 280 | UINT8_TO_STREAM (pp, pin_code_len); |
| 281 | |
| 282 | for (i = 0; i < pin_code_len; i++) |
| 283 | *pp++ = *pin_code++; |
| 284 | |
| 285 | for (; i < PIN_CODE_LEN; i++) |
| 286 | *pp++ = 0; |
| 287 | |
| 288 | |
| 289 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 290 | return (TRUE); |
| 291 | } |
| 292 | |
| 293 | BOOLEAN btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr) |
| 294 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 295 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 296 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 297 | |
| 298 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY; |
| 299 | p->offset = 0; |
| 300 | |
| 301 | UINT16_TO_STREAM (pp, HCI_PIN_CODE_REQUEST_NEG_REPLY); |
| 302 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY); |
| 303 | |
| 304 | BDADDR_TO_STREAM (pp, bd_addr); |
| 305 | |
| 306 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 307 | return (TRUE); |
| 308 | } |
| 309 | |
| 310 | BOOLEAN btsnd_hcic_change_conn_type (UINT16 handle, UINT16 packet_types) |
| 311 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 312 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 313 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 314 | |
| 315 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_CONN_TYPE; |
| 316 | p->offset = 0; |
| 317 | |
| 318 | UINT16_TO_STREAM (pp, HCI_CHANGE_CONN_PACKET_TYPE); |
| 319 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CHANGE_CONN_TYPE); |
| 320 | |
| 321 | UINT16_TO_STREAM (pp, handle); |
| 322 | UINT16_TO_STREAM (pp, packet_types); |
| 323 | |
| 324 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 325 | return (TRUE); |
| 326 | } |
| 327 | |
| 328 | BOOLEAN btsnd_hcic_auth_request (UINT16 handle) |
| 329 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 330 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 331 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 332 | |
| 333 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 334 | p->offset = 0; |
| 335 | |
| 336 | UINT16_TO_STREAM (pp, HCI_AUTHENTICATION_REQUESTED); |
| 337 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 338 | |
| 339 | UINT16_TO_STREAM (pp, handle); |
| 340 | |
| 341 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 342 | return (TRUE); |
| 343 | } |
| 344 | |
| 345 | BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable) |
| 346 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 347 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 348 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 349 | |
| 350 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_CONN_ENCRYPT; |
| 351 | p->offset = 0; |
| 352 | |
| 353 | UINT16_TO_STREAM (pp, HCI_SET_CONN_ENCRYPTION); |
| 354 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SET_CONN_ENCRYPT); |
| 355 | |
| 356 | UINT16_TO_STREAM (pp, handle); |
| 357 | UINT8_TO_STREAM (pp, enable); |
| 358 | |
| 359 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 360 | return (TRUE); |
| 361 | } |
| 362 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 363 | BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr, UINT8 page_scan_rep_mode, |
| 364 | UINT8 page_scan_mode, UINT16 clock_offset) |
| 365 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 366 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 367 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 368 | |
| 369 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_NAME_REQ; |
| 370 | p->offset = 0; |
| 371 | |
| 372 | UINT16_TO_STREAM (pp, HCI_RMT_NAME_REQUEST); |
| 373 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RMT_NAME_REQ); |
| 374 | |
| 375 | BDADDR_TO_STREAM (pp, bd_addr); |
| 376 | UINT8_TO_STREAM (pp, page_scan_rep_mode); |
| 377 | UINT8_TO_STREAM (pp, page_scan_mode); |
| 378 | UINT16_TO_STREAM (pp, clock_offset); |
| 379 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 380 | btm_acl_paging (p, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 381 | return (TRUE); |
| 382 | } |
| 383 | |
| 384 | BOOLEAN btsnd_hcic_rmt_name_req_cancel (BD_ADDR bd_addr) |
| 385 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 386 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 387 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 388 | |
| 389 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL; |
| 390 | p->offset = 0; |
| 391 | |
| 392 | UINT16_TO_STREAM (pp, HCI_RMT_NAME_REQUEST_CANCEL); |
| 393 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL); |
| 394 | |
| 395 | BDADDR_TO_STREAM (pp, bd_addr); |
| 396 | |
| 397 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 398 | return (TRUE); |
| 399 | } |
| 400 | |
| 401 | BOOLEAN btsnd_hcic_rmt_features_req (UINT16 handle) |
| 402 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 403 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 404 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 405 | |
| 406 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 407 | p->offset = 0; |
| 408 | |
| 409 | UINT16_TO_STREAM (pp, HCI_READ_RMT_FEATURES); |
| 410 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 411 | |
| 412 | UINT16_TO_STREAM (pp, handle); |
| 413 | |
| 414 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 415 | return (TRUE); |
| 416 | } |
| 417 | |
| 418 | BOOLEAN btsnd_hcic_rmt_ext_features (UINT16 handle, UINT8 page_num) |
| 419 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 420 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 421 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 422 | |
| 423 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_EXT_FEATURES; |
| 424 | p->offset = 0; |
| 425 | |
| 426 | UINT16_TO_STREAM (pp, HCI_READ_RMT_EXT_FEATURES); |
| 427 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RMT_EXT_FEATURES); |
| 428 | |
| 429 | UINT16_TO_STREAM (pp, handle); |
| 430 | UINT8_TO_STREAM (pp, page_num); |
| 431 | |
| 432 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 433 | return (TRUE); |
| 434 | } |
| 435 | |
| 436 | BOOLEAN btsnd_hcic_rmt_ver_req (UINT16 handle) |
| 437 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 438 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 439 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 440 | |
| 441 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 442 | p->offset = 0; |
| 443 | |
| 444 | UINT16_TO_STREAM (pp, HCI_READ_RMT_VERSION_INFO); |
| 445 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 446 | |
| 447 | UINT16_TO_STREAM (pp, handle); |
| 448 | |
| 449 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 450 | return (TRUE); |
| 451 | } |
| 452 | |
| 453 | BOOLEAN btsnd_hcic_read_rmt_clk_offset (UINT16 handle) |
| 454 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 455 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 456 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 457 | |
| 458 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 459 | p->offset = 0; |
| 460 | |
| 461 | UINT16_TO_STREAM (pp, HCI_READ_RMT_CLOCK_OFFSET); |
| 462 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 463 | |
| 464 | UINT16_TO_STREAM (pp, handle); |
| 465 | |
| 466 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 467 | return (TRUE); |
| 468 | } |
| 469 | |
| 470 | BOOLEAN btsnd_hcic_read_lmp_handle (UINT16 handle) |
| 471 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 472 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 473 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 474 | |
| 475 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 476 | p->offset = 0; |
| 477 | |
| 478 | UINT16_TO_STREAM (pp, HCI_READ_LMP_HANDLE); |
| 479 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 480 | |
| 481 | UINT16_TO_STREAM (pp, handle); |
| 482 | |
| 483 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 484 | return (TRUE); |
| 485 | } |
| 486 | |
| 487 | BOOLEAN btsnd_hcic_setup_esco_conn (UINT16 handle, UINT32 tx_bw, |
| 488 | UINT32 rx_bw, UINT16 max_latency, UINT16 voice, |
| 489 | UINT8 retrans_effort, UINT16 packet_types) |
| 490 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 491 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 492 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 493 | |
| 494 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SETUP_ESCO; |
| 495 | p->offset = 0; |
| 496 | |
| 497 | UINT16_TO_STREAM (pp, HCI_SETUP_ESCO_CONNECTION); |
| 498 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SETUP_ESCO); |
| 499 | |
| 500 | UINT16_TO_STREAM (pp, handle); |
| 501 | UINT32_TO_STREAM (pp, tx_bw); |
| 502 | UINT32_TO_STREAM (pp, rx_bw); |
| 503 | UINT16_TO_STREAM (pp, max_latency); |
| 504 | UINT16_TO_STREAM (pp, voice); |
| 505 | UINT8_TO_STREAM (pp, retrans_effort); |
| 506 | UINT16_TO_STREAM (pp, packet_types); |
| 507 | |
| 508 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 509 | return (TRUE); |
| 510 | } |
| 511 | |
| 512 | BOOLEAN btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr, UINT32 tx_bw, |
| 513 | UINT32 rx_bw, UINT16 max_latency, |
| 514 | UINT16 content_fmt, UINT8 retrans_effort, |
| 515 | UINT16 packet_types) |
| 516 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 517 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 518 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 519 | |
| 520 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ACCEPT_ESCO; |
| 521 | p->offset = 0; |
| 522 | |
| 523 | UINT16_TO_STREAM (pp, HCI_ACCEPT_ESCO_CONNECTION); |
| 524 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_ACCEPT_ESCO); |
| 525 | |
| 526 | BDADDR_TO_STREAM (pp, bd_addr); |
| 527 | UINT32_TO_STREAM (pp, tx_bw); |
| 528 | UINT32_TO_STREAM (pp, rx_bw); |
| 529 | UINT16_TO_STREAM (pp, max_latency); |
| 530 | UINT16_TO_STREAM (pp, content_fmt); |
| 531 | UINT8_TO_STREAM (pp, retrans_effort); |
| 532 | UINT16_TO_STREAM (pp, packet_types); |
| 533 | |
| 534 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 535 | return (TRUE); |
| 536 | } |
| 537 | |
| 538 | BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason) |
| 539 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 540 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 541 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 542 | |
| 543 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_ESCO; |
| 544 | p->offset = 0; |
| 545 | |
| 546 | UINT16_TO_STREAM (pp, HCI_REJECT_ESCO_CONNECTION); |
| 547 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REJECT_ESCO); |
| 548 | |
| 549 | BDADDR_TO_STREAM (pp, bd_addr); |
| 550 | UINT8_TO_STREAM (pp, reason); |
| 551 | |
| 552 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 553 | return (TRUE); |
| 554 | } |
| 555 | |
| 556 | BOOLEAN btsnd_hcic_hold_mode (UINT16 handle, UINT16 max_hold_period, |
| 557 | UINT16 min_hold_period) |
| 558 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 559 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 560 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 561 | |
| 562 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_HOLD_MODE; |
| 563 | p->offset = 0; |
| 564 | |
| 565 | UINT16_TO_STREAM (pp, HCI_HOLD_MODE); |
| 566 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_HOLD_MODE); |
| 567 | |
| 568 | UINT16_TO_STREAM (pp, handle); |
| 569 | UINT16_TO_STREAM (pp, max_hold_period); |
| 570 | UINT16_TO_STREAM (pp, min_hold_period); |
| 571 | |
| 572 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 573 | return (TRUE); |
| 574 | } |
| 575 | |
| 576 | BOOLEAN btsnd_hcic_sniff_mode (UINT16 handle, UINT16 max_sniff_period, |
| 577 | UINT16 min_sniff_period, UINT16 sniff_attempt, |
| 578 | UINT16 sniff_timeout) |
| 579 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 580 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 581 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 582 | |
| 583 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SNIFF_MODE; |
| 584 | p->offset = 0; |
| 585 | |
| 586 | UINT16_TO_STREAM (pp, HCI_SNIFF_MODE); |
| 587 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SNIFF_MODE); |
| 588 | |
| 589 | UINT16_TO_STREAM (pp, handle); |
| 590 | UINT16_TO_STREAM (pp, max_sniff_period); |
| 591 | UINT16_TO_STREAM (pp, min_sniff_period); |
| 592 | UINT16_TO_STREAM (pp, sniff_attempt); |
| 593 | UINT16_TO_STREAM (pp, sniff_timeout); |
| 594 | |
| 595 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 596 | return (TRUE); |
| 597 | } |
| 598 | |
| 599 | BOOLEAN btsnd_hcic_exit_sniff_mode (UINT16 handle) |
| 600 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 601 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 602 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 603 | |
| 604 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 605 | p->offset = 0; |
| 606 | |
| 607 | UINT16_TO_STREAM (pp, HCI_EXIT_SNIFF_MODE); |
| 608 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 609 | |
| 610 | UINT16_TO_STREAM (pp, handle); |
| 611 | |
| 612 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 613 | return TRUE; |
| 614 | } |
| 615 | |
| 616 | BOOLEAN btsnd_hcic_park_mode (UINT16 handle, UINT16 beacon_max_interval, |
| 617 | UINT16 beacon_min_interval) |
| 618 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 619 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 620 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 621 | |
| 622 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PARK_MODE; |
| 623 | p->offset = 0; |
| 624 | |
| 625 | UINT16_TO_STREAM (pp, HCI_PARK_MODE); |
| 626 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_PARK_MODE); |
| 627 | |
| 628 | UINT16_TO_STREAM (pp, handle); |
| 629 | UINT16_TO_STREAM (pp, beacon_max_interval); |
| 630 | UINT16_TO_STREAM (pp, beacon_min_interval); |
| 631 | |
| 632 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 633 | return (TRUE); |
| 634 | } |
| 635 | |
| 636 | BOOLEAN btsnd_hcic_exit_park_mode (UINT16 handle) |
| 637 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 638 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 639 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 640 | |
| 641 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 642 | p->offset = 0; |
| 643 | |
| 644 | UINT16_TO_STREAM (pp, HCI_EXIT_PARK_MODE); |
| 645 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 646 | |
| 647 | UINT16_TO_STREAM (pp, handle); |
| 648 | |
| 649 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 650 | return TRUE; |
| 651 | } |
| 652 | |
| 653 | BOOLEAN btsnd_hcic_qos_setup (UINT16 handle, UINT8 flags, UINT8 service_type, |
| 654 | UINT32 token_rate, UINT32 peak, UINT32 latency, |
| 655 | UINT32 delay_var) |
| 656 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 657 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 658 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 659 | |
| 660 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_QOS_SETUP; |
| 661 | p->offset = 0; |
| 662 | |
| 663 | UINT16_TO_STREAM (pp, HCI_QOS_SETUP); |
| 664 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_QOS_SETUP); |
| 665 | |
| 666 | UINT16_TO_STREAM (pp, handle); |
| 667 | UINT8_TO_STREAM (pp, flags); |
| 668 | UINT8_TO_STREAM (pp, service_type); |
| 669 | UINT32_TO_STREAM (pp, token_rate); |
| 670 | UINT32_TO_STREAM (pp, peak); |
| 671 | UINT32_TO_STREAM (pp, latency); |
| 672 | UINT32_TO_STREAM (pp, delay_var); |
| 673 | |
| 674 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 675 | return (TRUE); |
| 676 | } |
| 677 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 678 | BOOLEAN btsnd_hcic_switch_role (BD_ADDR bd_addr, UINT8 role) |
| 679 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 680 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 681 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 682 | |
| 683 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SWITCH_ROLE; |
| 684 | p->offset = 0; |
| 685 | |
| 686 | UINT16_TO_STREAM (pp, HCI_SWITCH_ROLE); |
| 687 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SWITCH_ROLE); |
| 688 | |
| 689 | BDADDR_TO_STREAM (pp, bd_addr); |
| 690 | UINT8_TO_STREAM (pp, role); |
| 691 | |
| 692 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 693 | return (TRUE); |
| 694 | } |
| 695 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 696 | BOOLEAN btsnd_hcic_write_policy_set (UINT16 handle, UINT16 settings) |
| 697 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 698 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 699 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 700 | |
| 701 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_POLICY_SET; |
| 702 | p->offset = 0; |
| 703 | UINT16_TO_STREAM (pp, HCI_WRITE_POLICY_SETTINGS); |
| 704 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_POLICY_SET); |
| 705 | |
| 706 | UINT16_TO_STREAM (pp, handle); |
| 707 | UINT16_TO_STREAM (pp, settings); |
| 708 | |
| 709 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 710 | return (TRUE); |
| 711 | } |
| 712 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 713 | BOOLEAN btsnd_hcic_write_def_policy_set (UINT16 settings) |
| 714 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 715 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 716 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 717 | |
| 718 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET; |
| 719 | p->offset = 0; |
| 720 | UINT16_TO_STREAM (pp, HCI_WRITE_DEF_POLICY_SETTINGS); |
| 721 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET); |
| 722 | |
| 723 | UINT16_TO_STREAM (pp, settings); |
| 724 | |
| 725 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 726 | return (TRUE); |
| 727 | } |
| 728 | |
Bandari Ramesh | 6b77cf6 | 2016-09-26 19:43:24 +0530 | [diff] [blame] | 729 | BOOLEAN btsnd_hcic_reset (UINT8 local_controller_id) |
| 730 | { |
| 731 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 732 | UINT8 *pp = (UINT8 *)(p + 1); |
| 733 | |
| 734 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RESET; |
| 735 | p->offset = 0; |
| 736 | |
| 737 | UINT16_TO_STREAM (pp, HCI_RESET); |
| 738 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RESET); |
| 739 | |
| 740 | btu_hcif_send_cmd (local_controller_id, p); |
| 741 | return (TRUE); |
| 742 | } |
| 743 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 744 | BOOLEAN btsnd_hcic_set_event_filter (UINT8 filt_type, UINT8 filt_cond_type, |
| 745 | UINT8 *filt_cond, UINT8 filt_cond_len) |
| 746 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 747 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 748 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 749 | |
| 750 | p->offset = 0; |
| 751 | |
| 752 | UINT16_TO_STREAM (pp, HCI_SET_EVENT_FILTER); |
| 753 | |
| 754 | if (filt_type) |
| 755 | { |
| 756 | p->len = (UINT16)(HCIC_PREAMBLE_SIZE + 2 + filt_cond_len); |
| 757 | UINT8_TO_STREAM (pp, (UINT8)(2 + filt_cond_len)); |
| 758 | |
| 759 | UINT8_TO_STREAM (pp, filt_type); |
| 760 | UINT8_TO_STREAM (pp, filt_cond_type); |
| 761 | |
| 762 | if (filt_cond_type == HCI_FILTER_COND_DEVICE_CLASS) |
| 763 | { |
| 764 | DEVCLASS_TO_STREAM (pp, filt_cond); |
| 765 | filt_cond += DEV_CLASS_LEN; |
| 766 | DEVCLASS_TO_STREAM (pp, filt_cond); |
| 767 | filt_cond += DEV_CLASS_LEN; |
| 768 | |
| 769 | filt_cond_len -= (2 * DEV_CLASS_LEN); |
| 770 | } |
| 771 | else if (filt_cond_type == HCI_FILTER_COND_BD_ADDR) |
| 772 | { |
| 773 | BDADDR_TO_STREAM (pp, filt_cond); |
| 774 | filt_cond += BD_ADDR_LEN; |
| 775 | |
| 776 | filt_cond_len -= BD_ADDR_LEN; |
| 777 | } |
| 778 | |
| 779 | if (filt_cond_len) |
| 780 | ARRAY_TO_STREAM (pp, filt_cond, filt_cond_len); |
| 781 | } |
| 782 | else |
| 783 | { |
| 784 | p->len = (UINT16)(HCIC_PREAMBLE_SIZE + 1); |
| 785 | UINT8_TO_STREAM (pp, 1); |
| 786 | |
| 787 | UINT8_TO_STREAM (pp, filt_type); |
| 788 | } |
| 789 | |
| 790 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 791 | return (TRUE); |
| 792 | } |
| 793 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 794 | BOOLEAN btsnd_hcic_write_pin_type (UINT8 type) |
| 795 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 796 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 797 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 798 | |
| 799 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 800 | p->offset = 0; |
| 801 | |
| 802 | UINT16_TO_STREAM (pp, HCI_WRITE_PIN_TYPE); |
| 803 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
| 804 | |
| 805 | UINT8_TO_STREAM (pp, type); |
| 806 | |
| 807 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 808 | return (TRUE); |
| 809 | } |
| 810 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 811 | BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag) |
| 812 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 813 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 814 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 815 | |
| 816 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_DELETE_STORED_KEY; |
| 817 | p->offset = 0; |
| 818 | |
| 819 | UINT16_TO_STREAM (pp, HCI_DELETE_STORED_LINK_KEY); |
| 820 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_DELETE_STORED_KEY); |
| 821 | |
| 822 | BDADDR_TO_STREAM (pp, bd_addr); |
| 823 | UINT8_TO_STREAM (pp, delete_all_flag); |
| 824 | |
| 825 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 826 | return (TRUE); |
| 827 | } |
| 828 | |
| 829 | BOOLEAN btsnd_hcic_change_name (BD_NAME name) |
| 830 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 831 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 832 | UINT8 *pp = (UINT8 *)(p + 1); |
| 833 | UINT16 len = strlen((char *)name) + 1; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 834 | |
Sharvil Nanavati | e14a66a | 2014-02-09 22:21:48 -0800 | [diff] [blame] | 835 | memset(pp, 0, HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_NAME); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 836 | |
| 837 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_NAME; |
| 838 | p->offset = 0; |
| 839 | |
| 840 | UINT16_TO_STREAM (pp, HCI_CHANGE_LOCAL_NAME); |
| 841 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CHANGE_NAME); |
| 842 | |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 843 | if (len > HCIC_PARAM_SIZE_CHANGE_NAME) |
| 844 | len = HCIC_PARAM_SIZE_CHANGE_NAME; |
| 845 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 846 | ARRAY_TO_STREAM (pp, name, len); |
| 847 | |
| 848 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 849 | return (TRUE); |
| 850 | } |
| 851 | |
| 852 | BOOLEAN btsnd_hcic_read_name (void) |
| 853 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 854 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 855 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 856 | |
| 857 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; |
| 858 | p->offset = 0; |
| 859 | |
| 860 | UINT16_TO_STREAM (pp, HCI_READ_LOCAL_NAME); |
| 861 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); |
| 862 | |
| 863 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 864 | return (TRUE); |
| 865 | } |
| 866 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 867 | BOOLEAN btsnd_hcic_write_page_tout (UINT16 timeout) |
| 868 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 869 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 870 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 871 | |
| 872 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM2; |
| 873 | p->offset = 0; |
| 874 | |
| 875 | UINT16_TO_STREAM (pp, HCI_WRITE_PAGE_TOUT); |
| 876 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM2); |
| 877 | |
| 878 | UINT16_TO_STREAM (pp, timeout); |
| 879 | |
| 880 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 881 | return (TRUE); |
| 882 | } |
| 883 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 884 | BOOLEAN btsnd_hcic_write_scan_enable (UINT8 flag) |
| 885 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 886 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 887 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 888 | |
| 889 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 890 | p->offset = 0; |
| 891 | |
| 892 | UINT16_TO_STREAM (pp, HCI_WRITE_SCAN_ENABLE); |
| 893 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
| 894 | |
| 895 | UINT8_TO_STREAM (pp, flag); |
| 896 | |
| 897 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 898 | return (TRUE); |
| 899 | } |
| 900 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 901 | BOOLEAN btsnd_hcic_write_pagescan_cfg(UINT16 interval, UINT16 window) |
| 902 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 903 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 904 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 905 | |
| 906 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG; |
| 907 | p->offset = 0; |
| 908 | |
| 909 | UINT16_TO_STREAM (pp, HCI_WRITE_PAGESCAN_CFG); |
| 910 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG); |
| 911 | |
| 912 | UINT16_TO_STREAM (pp, interval); |
| 913 | UINT16_TO_STREAM (pp, window); |
| 914 | |
| 915 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 916 | return (TRUE); |
| 917 | } |
| 918 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 919 | BOOLEAN btsnd_hcic_write_inqscan_cfg(UINT16 interval, UINT16 window) |
| 920 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 921 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 922 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 923 | |
| 924 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG; |
| 925 | p->offset = 0; |
| 926 | |
| 927 | UINT16_TO_STREAM (pp, HCI_WRITE_INQUIRYSCAN_CFG); |
| 928 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG); |
| 929 | |
| 930 | UINT16_TO_STREAM (pp, interval); |
| 931 | UINT16_TO_STREAM (pp, window); |
| 932 | |
| 933 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 934 | return (TRUE); |
| 935 | } |
| 936 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 937 | BOOLEAN btsnd_hcic_write_auth_enable (UINT8 flag) |
| 938 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 939 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 940 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 941 | |
| 942 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 943 | p->offset = 0; |
| 944 | |
| 945 | UINT16_TO_STREAM (pp, HCI_WRITE_AUTHENTICATION_ENABLE); |
| 946 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
| 947 | |
| 948 | UINT8_TO_STREAM (pp, flag); |
| 949 | |
| 950 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 951 | return (TRUE); |
| 952 | } |
| 953 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 954 | BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev_class) |
| 955 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 956 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 957 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 958 | |
| 959 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM3; |
| 960 | p->offset = 0; |
| 961 | |
| 962 | UINT16_TO_STREAM (pp, HCI_WRITE_CLASS_OF_DEVICE); |
| 963 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM3); |
| 964 | |
| 965 | DEVCLASS_TO_STREAM (pp, dev_class); |
| 966 | |
| 967 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 968 | return (TRUE); |
| 969 | } |
| 970 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 971 | BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags) |
| 972 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 973 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 974 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 975 | |
| 976 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM2; |
| 977 | p->offset = 0; |
| 978 | |
| 979 | UINT16_TO_STREAM (pp, HCI_WRITE_VOICE_SETTINGS); |
| 980 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM2); |
| 981 | |
| 982 | UINT16_TO_STREAM (pp, flags); |
| 983 | |
| 984 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 985 | return (TRUE); |
| 986 | } |
| 987 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 988 | BOOLEAN btsnd_hcic_write_auto_flush_tout (UINT16 handle, UINT16 tout) |
| 989 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 990 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 991 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 992 | |
| 993 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT; |
| 994 | p->offset = 0; |
| 995 | |
| 996 | UINT16_TO_STREAM (pp, HCI_WRITE_AUTO_FLUSH_TOUT); |
| 997 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT); |
| 998 | |
| 999 | UINT16_TO_STREAM (pp, handle); |
| 1000 | UINT16_TO_STREAM (pp, tout); |
| 1001 | |
| 1002 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1003 | return (TRUE); |
| 1004 | } |
| 1005 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1006 | BOOLEAN btsnd_hcic_read_tx_power (UINT16 handle, UINT8 type) |
| 1007 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1008 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1009 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1010 | |
| 1011 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_TX_POWER; |
| 1012 | p->offset = 0; |
| 1013 | |
| 1014 | UINT16_TO_STREAM (pp, HCI_READ_TRANSMIT_POWER_LEVEL); |
| 1015 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_TX_POWER); |
| 1016 | |
| 1017 | UINT16_TO_STREAM (pp, handle); |
| 1018 | UINT8_TO_STREAM (pp, type); |
| 1019 | |
| 1020 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1021 | return (TRUE); |
| 1022 | } |
| 1023 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1024 | BOOLEAN btsnd_hcic_host_num_xmitted_pkts (UINT8 num_handles, UINT16 *handle, |
| 1025 | UINT16 *num_pkts) |
| 1026 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1027 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1028 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1029 | |
| 1030 | p->len = HCIC_PREAMBLE_SIZE + 1 + (num_handles * 4); |
| 1031 | p->offset = 0; |
| 1032 | |
| 1033 | UINT16_TO_STREAM (pp, HCI_HOST_NUM_PACKETS_DONE); |
| 1034 | UINT8_TO_STREAM (pp, p->len - HCIC_PREAMBLE_SIZE); |
| 1035 | |
| 1036 | UINT8_TO_STREAM (pp, num_handles); |
| 1037 | |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1038 | for (int i = 0; i < num_handles; i++) { |
| 1039 | UINT16_TO_STREAM(pp, handle[i]); |
| 1040 | UINT16_TO_STREAM(pp, num_pkts[i]); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1041 | } |
| 1042 | |
| 1043 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1044 | return (TRUE); |
| 1045 | } |
| 1046 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1047 | BOOLEAN btsnd_hcic_write_link_super_tout (UINT8 local_controller_id, UINT16 handle, UINT16 timeout) |
| 1048 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1049 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1050 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1051 | |
| 1052 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT; |
| 1053 | p->offset = 0; |
| 1054 | |
| 1055 | UINT16_TO_STREAM (pp, HCI_WRITE_LINK_SUPER_TOUT); |
| 1056 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT); |
| 1057 | |
| 1058 | UINT16_TO_STREAM (pp, handle); |
| 1059 | UINT16_TO_STREAM (pp, timeout); |
| 1060 | |
| 1061 | btu_hcif_send_cmd (local_controller_id, p); |
| 1062 | return (TRUE); |
| 1063 | } |
| 1064 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1065 | BOOLEAN btsnd_hcic_write_cur_iac_lap (UINT8 num_cur_iac, LAP * const iac_lap) |
| 1066 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1067 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1068 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1069 | |
| 1070 | p->len = HCIC_PREAMBLE_SIZE + 1 + (LAP_LEN * num_cur_iac); |
| 1071 | p->offset = 0; |
| 1072 | |
| 1073 | UINT16_TO_STREAM (pp, HCI_WRITE_CURRENT_IAC_LAP); |
| 1074 | UINT8_TO_STREAM (pp, p->len - HCIC_PREAMBLE_SIZE); |
| 1075 | |
| 1076 | UINT8_TO_STREAM (pp, num_cur_iac); |
| 1077 | |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1078 | for (int i = 0; i < num_cur_iac; i++) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1079 | LAP_TO_STREAM (pp, iac_lap[i]); |
| 1080 | |
| 1081 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1082 | return (TRUE); |
| 1083 | } |
| 1084 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1085 | /****************************************** |
| 1086 | ** Lisbon Features |
| 1087 | *******************************************/ |
| 1088 | #if BTM_SSR_INCLUDED == TRUE |
| 1089 | |
| 1090 | BOOLEAN btsnd_hcic_sniff_sub_rate(UINT16 handle, UINT16 max_lat, |
| 1091 | UINT16 min_remote_lat, UINT16 min_local_lat) |
| 1092 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1093 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1094 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1095 | |
| 1096 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SNIFF_SUB_RATE; |
| 1097 | p->offset = 0; |
| 1098 | |
| 1099 | UINT16_TO_STREAM (pp, HCI_SNIFF_SUB_RATE); |
| 1100 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SNIFF_SUB_RATE); |
| 1101 | |
| 1102 | UINT16_TO_STREAM (pp, handle); |
| 1103 | UINT16_TO_STREAM (pp, max_lat); |
| 1104 | UINT16_TO_STREAM (pp, min_remote_lat); |
| 1105 | UINT16_TO_STREAM (pp, min_local_lat); |
| 1106 | |
| 1107 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1108 | return (TRUE); |
| 1109 | } |
| 1110 | #endif /* BTM_SSR_INCLUDED */ |
| 1111 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1112 | /**** Extended Inquiry Response Commands ****/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1113 | void btsnd_hcic_write_ext_inquiry_response (void *buffer, UINT8 fec_req) |
| 1114 | { |
| 1115 | BT_HDR *p = (BT_HDR *)buffer; |
| 1116 | UINT8 *pp = (UINT8 *)(p + 1); |
| 1117 | |
| 1118 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_EXT_INQ_RESP; |
| 1119 | p->offset = 0; |
| 1120 | |
| 1121 | UINT16_TO_STREAM (pp, HCI_WRITE_EXT_INQ_RESPONSE); |
| 1122 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_EXT_INQ_RESP); |
| 1123 | |
| 1124 | UINT8_TO_STREAM (pp, fec_req); |
| 1125 | |
| 1126 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1127 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1128 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1129 | BOOLEAN btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, UINT8 capability, |
| 1130 | UINT8 oob_present, UINT8 auth_req) |
| 1131 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1132 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1133 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1134 | |
| 1135 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_IO_CAP_RESP; |
| 1136 | p->offset = 0; |
| 1137 | |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 1138 | UINT16_TO_STREAM (pp, HCI_IO_CAPABILITY_REQUEST_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1139 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_IO_CAP_RESP); |
| 1140 | |
| 1141 | BDADDR_TO_STREAM (pp, bd_addr); |
| 1142 | UINT8_TO_STREAM (pp, capability); |
| 1143 | UINT8_TO_STREAM (pp, oob_present); |
| 1144 | UINT8_TO_STREAM (pp, auth_req); |
| 1145 | |
| 1146 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1147 | return (TRUE); |
| 1148 | } |
| 1149 | |
| 1150 | BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code) |
| 1151 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1152 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1153 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1154 | |
| 1155 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY; |
| 1156 | p->offset = 0; |
| 1157 | |
| 1158 | UINT16_TO_STREAM (pp, HCI_IO_CAP_REQ_NEG_REPLY); |
| 1159 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY); |
| 1160 | |
| 1161 | BDADDR_TO_STREAM (pp, bd_addr); |
| 1162 | UINT8_TO_STREAM (pp, err_code); |
| 1163 | |
| 1164 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1165 | return (TRUE); |
| 1166 | } |
| 1167 | |
| 1168 | BOOLEAN btsnd_hcic_read_local_oob_data (void) |
| 1169 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1170 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1171 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1172 | |
| 1173 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_LOCAL_OOB; |
| 1174 | p->offset = 0; |
| 1175 | |
| 1176 | UINT16_TO_STREAM (pp, HCI_READ_LOCAL_OOB_DATA); |
| 1177 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_R_LOCAL_OOB); |
| 1178 | |
| 1179 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1180 | return (TRUE); |
| 1181 | } |
| 1182 | |
| 1183 | BOOLEAN btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, BOOLEAN is_yes) |
| 1184 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1185 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1186 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1187 | |
| 1188 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_UCONF_REPLY; |
| 1189 | p->offset = 0; |
| 1190 | |
| 1191 | if (!is_yes) |
| 1192 | { |
| 1193 | /* Negative reply */ |
| 1194 | UINT16_TO_STREAM (pp, HCI_USER_CONF_VALUE_NEG_REPLY); |
| 1195 | } |
| 1196 | else |
| 1197 | { |
| 1198 | /* Confirmation */ |
| 1199 | UINT16_TO_STREAM (pp, HCI_USER_CONF_REQUEST_REPLY); |
| 1200 | } |
| 1201 | |
| 1202 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_UCONF_REPLY); |
| 1203 | |
| 1204 | BDADDR_TO_STREAM (pp, bd_addr); |
| 1205 | |
| 1206 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1207 | return (TRUE); |
| 1208 | } |
| 1209 | |
| 1210 | BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value) |
| 1211 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1212 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1213 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1214 | |
| 1215 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_U_PKEY_REPLY; |
| 1216 | p->offset = 0; |
| 1217 | |
| 1218 | UINT16_TO_STREAM (pp, HCI_USER_PASSKEY_REQ_REPLY); |
| 1219 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_U_PKEY_REPLY); |
| 1220 | |
| 1221 | BDADDR_TO_STREAM (pp, bd_addr); |
| 1222 | UINT32_TO_STREAM (pp, value); |
| 1223 | |
| 1224 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1225 | return (TRUE); |
| 1226 | } |
| 1227 | |
| 1228 | BOOLEAN btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr) |
| 1229 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1230 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1231 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1232 | |
| 1233 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY; |
| 1234 | p->offset = 0; |
| 1235 | |
| 1236 | UINT16_TO_STREAM (pp, HCI_USER_PASSKEY_REQ_NEG_REPLY); |
| 1237 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY); |
| 1238 | |
| 1239 | BDADDR_TO_STREAM (pp, bd_addr); |
| 1240 | |
| 1241 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1242 | return (TRUE); |
| 1243 | } |
| 1244 | |
| 1245 | BOOLEAN btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, UINT8 *p_c, UINT8 *p_r) |
| 1246 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1247 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1248 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1249 | |
| 1250 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REM_OOB_REPLY; |
| 1251 | p->offset = 0; |
| 1252 | |
| 1253 | UINT16_TO_STREAM (pp, HCI_REM_OOB_DATA_REQ_REPLY); |
| 1254 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REM_OOB_REPLY); |
| 1255 | |
| 1256 | BDADDR_TO_STREAM (pp, bd_addr); |
| 1257 | ARRAY16_TO_STREAM (pp, p_c); |
| 1258 | ARRAY16_TO_STREAM (pp, p_r); |
| 1259 | |
| 1260 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1261 | return (TRUE); |
| 1262 | } |
| 1263 | |
| 1264 | BOOLEAN btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr) |
| 1265 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1266 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1267 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1268 | |
| 1269 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY; |
| 1270 | p->offset = 0; |
| 1271 | |
| 1272 | UINT16_TO_STREAM (pp, HCI_REM_OOB_DATA_REQ_NEG_REPLY); |
| 1273 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY); |
| 1274 | |
| 1275 | BDADDR_TO_STREAM (pp, bd_addr); |
| 1276 | |
| 1277 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1278 | return (TRUE); |
| 1279 | } |
| 1280 | |
| 1281 | |
| 1282 | BOOLEAN btsnd_hcic_read_inq_tx_power (void) |
| 1283 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1284 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1285 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1286 | |
| 1287 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_TX_POWER; |
| 1288 | p->offset = 0; |
| 1289 | |
| 1290 | UINT16_TO_STREAM (pp, HCI_READ_INQ_TX_POWER_LEVEL); |
| 1291 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_R_TX_POWER); |
| 1292 | |
| 1293 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1294 | return (TRUE); |
| 1295 | } |
| 1296 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1297 | BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif) |
| 1298 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1299 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1300 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1301 | |
| 1302 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF; |
| 1303 | p->offset = 0; |
| 1304 | |
| 1305 | UINT16_TO_STREAM (pp, HCI_SEND_KEYPRESS_NOTIF); |
| 1306 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF); |
| 1307 | |
| 1308 | BDADDR_TO_STREAM (pp, bd_addr); |
| 1309 | UINT8_TO_STREAM (pp, notif); |
| 1310 | |
| 1311 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1312 | return (TRUE); |
| 1313 | } |
| 1314 | |
| 1315 | /**** end of Simple Pairing Commands ****/ |
| 1316 | |
| 1317 | #if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE |
| 1318 | BOOLEAN btsnd_hcic_enhanced_flush (UINT16 handle, UINT8 packet_type) |
| 1319 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1320 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1321 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1322 | |
| 1323 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ENHANCED_FLUSH; |
| 1324 | p->offset = 0; |
| 1325 | UINT16_TO_STREAM (pp, HCI_ENHANCED_FLUSH); |
| 1326 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_ENHANCED_FLUSH); |
| 1327 | |
| 1328 | UINT16_TO_STREAM (pp, handle); |
| 1329 | UINT8_TO_STREAM (pp, packet_type); |
| 1330 | |
| 1331 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1332 | return (TRUE); |
| 1333 | } |
| 1334 | #endif |
| 1335 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1336 | /************************* |
| 1337 | ** End of Lisbon Commands |
| 1338 | **************************/ |
| 1339 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1340 | BOOLEAN btsnd_hcic_get_link_quality (UINT16 handle) |
| 1341 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1342 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1343 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1344 | |
| 1345 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 1346 | p->offset = 0; |
| 1347 | |
| 1348 | UINT16_TO_STREAM (pp, HCI_GET_LINK_QUALITY); |
| 1349 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 1350 | |
| 1351 | UINT16_TO_STREAM (pp, handle); |
| 1352 | |
| 1353 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1354 | return (TRUE); |
| 1355 | } |
| 1356 | |
| 1357 | BOOLEAN btsnd_hcic_read_rssi (UINT16 handle) |
| 1358 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1359 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1360 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1361 | |
| 1362 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 1363 | p->offset = 0; |
| 1364 | |
| 1365 | UINT16_TO_STREAM (pp, HCI_READ_RSSI); |
| 1366 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 1367 | |
| 1368 | UINT16_TO_STREAM (pp, handle); |
| 1369 | |
| 1370 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1371 | return (TRUE); |
| 1372 | } |
| 1373 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1374 | BOOLEAN btsnd_hcic_enable_test_mode (void) |
| 1375 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1376 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1377 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1378 | |
| 1379 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; |
| 1380 | p->offset = 0; |
| 1381 | |
| 1382 | UINT16_TO_STREAM (pp, HCI_ENABLE_DEV_UNDER_TEST_MODE); |
| 1383 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_CMD); |
| 1384 | |
| 1385 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1386 | return (TRUE); |
| 1387 | } |
| 1388 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1389 | BOOLEAN btsnd_hcic_write_inqscan_type (UINT8 type) |
| 1390 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1391 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1392 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1393 | |
| 1394 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 1395 | p->offset = 0; |
| 1396 | |
| 1397 | UINT16_TO_STREAM (pp, HCI_WRITE_INQSCAN_TYPE); |
| 1398 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
| 1399 | |
| 1400 | UINT8_TO_STREAM (pp, type); |
| 1401 | |
| 1402 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1403 | return (TRUE); |
| 1404 | } |
| 1405 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1406 | BOOLEAN btsnd_hcic_write_inquiry_mode (UINT8 mode) |
| 1407 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1408 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1409 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1410 | |
| 1411 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 1412 | p->offset = 0; |
| 1413 | |
| 1414 | UINT16_TO_STREAM (pp, HCI_WRITE_INQUIRY_MODE); |
| 1415 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
| 1416 | |
| 1417 | UINT8_TO_STREAM (pp, mode); |
| 1418 | |
| 1419 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1420 | return (TRUE); |
| 1421 | } |
| 1422 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1423 | BOOLEAN btsnd_hcic_write_pagescan_type (UINT8 type) |
| 1424 | { |
Pavlin Radoslavov | c980130 | 2016-02-16 18:16:59 -0800 | [diff] [blame] | 1425 | BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1426 | UINT8 *pp = (UINT8 *)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1427 | |
| 1428 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 1429 | p->offset = 0; |
| 1430 | |
| 1431 | UINT16_TO_STREAM (pp, HCI_WRITE_PAGESCAN_TYPE); |
| 1432 | UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
| 1433 | |
| 1434 | UINT8_TO_STREAM (pp, type); |
| 1435 | |
| 1436 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1437 | return (TRUE); |
| 1438 | } |
| 1439 | |
| 1440 | /* Must have room to store BT_HDR + max VSC length + callback pointer */ |
Pavlin Radoslavov | 03566c2 | 2015-09-23 14:49:24 -0700 | [diff] [blame] | 1441 | #if (HCI_CMD_BUF_SIZE < 268) |
| 1442 | #error "HCI_CMD_BUF_SIZE must be larger than 268" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1443 | #endif |
| 1444 | |
Srinu Jella | 895e852 | 2013-12-06 15:25:26 +0530 | [diff] [blame] | 1445 | |
| 1446 | void btsnd_hcic_raw_cmd (void *buffer, UINT16 opcode, UINT8 len, |
| 1447 | UINT8 *p_data, void *p_cmd_cplt_cback) |
| 1448 | { |
| 1449 | BT_HDR *p = (BT_HDR *)buffer; |
| 1450 | UINT8 *pp = (UINT8 *)(p + 1); |
| 1451 | |
| 1452 | p->len = HCIC_PREAMBLE_SIZE + len; |
| 1453 | p->offset = sizeof(void *); |
| 1454 | |
| 1455 | *((void **)pp) = p_cmd_cplt_cback; /* Store command complete callback in buffer */ |
| 1456 | pp += sizeof(void *); /* Skip over callback pointer */ |
| 1457 | |
| 1458 | UINT16_TO_STREAM (pp, opcode); |
| 1459 | UINT8_TO_STREAM (pp, len); |
| 1460 | ARRAY_TO_STREAM (pp, p_data, len); |
| 1461 | |
| 1462 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1463 | } |
| 1464 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1465 | void btsnd_hcic_vendor_spec_cmd (void *buffer, UINT16 opcode, UINT8 len, |
| 1466 | UINT8 *p_data, void *p_cmd_cplt_cback) |
| 1467 | { |
| 1468 | BT_HDR *p = (BT_HDR *)buffer; |
| 1469 | UINT8 *pp = (UINT8 *)(p + 1); |
| 1470 | |
| 1471 | p->len = HCIC_PREAMBLE_SIZE + len; |
| 1472 | p->offset = sizeof(void *); |
| 1473 | |
| 1474 | *((void **)pp) = p_cmd_cplt_cback; /* Store command complete callback in buffer */ |
| 1475 | pp += sizeof(void *); /* Skip over callback pointer */ |
| 1476 | |
| 1477 | UINT16_TO_STREAM (pp, HCI_GRP_VENDOR_SPECIFIC | opcode); |
| 1478 | UINT8_TO_STREAM (pp, len); |
| 1479 | ARRAY_TO_STREAM (pp, p_data, len); |
| 1480 | |
| 1481 | btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1482 | } |