1 /****************************************************************************** 2 * 3 * Copyright (C) 2010-2014 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 NCI unit to format and send NCI 22 * commands (for DH). 23 * 24 ******************************************************************************/ 25 #include <string.h> 26 #include "nfc_target.h" 27 28 #include "nci_defs.h" 29 #include "nci_hmsgs.h" 30 #include "nfc_api.h" 31 #include "nfc_int.h" 32 33 /******************************************************************************* 34 ** 35 ** Function nci_snd_core_reset 36 ** 37 ** Description compose and send CORE RESET command to command queue 38 ** 39 ** Returns status 40 ** 41 *******************************************************************************/ 42 uint8_t nci_snd_core_reset(uint8_t reset_type) { 43 NFC_HDR* p; 44 uint8_t* pp; 45 46 p = NCI_GET_CMD_BUF(NCI_CORE_PARAM_SIZE_RESET); 47 if (p == NULL) return (NCI_STATUS_FAILED); 48 49 p->event = BT_EVT_TO_NFC_NCI; 50 p->len = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_RESET; 51 p->offset = NCI_MSG_OFFSET_SIZE; 52 p->layer_specific = 0; 53 pp = (uint8_t*)(p + 1) + p->offset; 54 55 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_CORE); 56 NCI_MSG_BLD_HDR1(pp, NCI_MSG_CORE_RESET); 57 UINT8_TO_STREAM(pp, NCI_CORE_PARAM_SIZE_RESET); 58 UINT8_TO_STREAM(pp, reset_type); 59 60 nfc_ncif_send_cmd(p); 61 return (NCI_STATUS_OK); 62 } 63 64 /******************************************************************************* 65 ** 66 ** Function nci_snd_core_init 67 ** 68 ** Description compose and send CORE INIT command to command queue 69 ** 70 ** Returns status 71 ** 72 *******************************************************************************/ 73 uint8_t nci_snd_core_init(void) { 74 NFC_HDR* p; 75 uint8_t* pp; 76 77 p = NCI_GET_CMD_BUF(NCI_CORE_PARAM_SIZE_INIT); 78 if (p == NULL) return (NCI_STATUS_FAILED); 79 80 p->event = BT_EVT_TO_NFC_NCI; 81 p->len = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_INIT; 82 p->offset = NCI_MSG_OFFSET_SIZE; 83 p->layer_specific = 0; 84 pp = (uint8_t*)(p + 1) + p->offset; 85 86 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_CORE); 87 NCI_MSG_BLD_HDR1(pp, NCI_MSG_CORE_INIT); 88 UINT8_TO_STREAM(pp, NCI_CORE_PARAM_SIZE_INIT); 89 90 nfc_ncif_send_cmd(p); 91 return (NCI_STATUS_OK); 92 } 93 94 /******************************************************************************* 95 ** 96 ** Function nci_snd_core_get_config 97 ** 98 ** Description compose and send CORE GET_CONFIG command to command queue 99 ** 100 ** Returns status 101 ** 102 *******************************************************************************/ 103 uint8_t nci_snd_core_get_config(uint8_t* param_ids, uint8_t num_ids) { 104 NFC_HDR* p; 105 uint8_t* pp; 106 107 p = NCI_GET_CMD_BUF(num_ids); 108 if (p == NULL) return (NCI_STATUS_FAILED); 109 110 p->event = BT_EVT_TO_NFC_NCI; 111 p->len = NCI_MSG_HDR_SIZE + num_ids + 1; 112 p->offset = NCI_MSG_OFFSET_SIZE; 113 p->layer_specific = 0; 114 pp = (uint8_t*)(p + 1) + p->offset; 115 116 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_CORE); 117 NCI_MSG_BLD_HDR1(pp, NCI_MSG_CORE_GET_CONFIG); 118 UINT8_TO_STREAM(pp, (uint8_t)(num_ids + 1)); 119 UINT8_TO_STREAM(pp, num_ids); 120 ARRAY_TO_STREAM(pp, param_ids, num_ids); 121 122 nfc_ncif_send_cmd(p); 123 return (NCI_STATUS_OK); 124 } 125 126 /******************************************************************************* 127 ** 128 ** Function nci_snd_core_set_config 129 ** 130 ** Description compose and send CORE SET_CONFIG command to command queue 131 ** 132 ** Returns status 133 ** 134 *******************************************************************************/ 135 uint8_t nci_snd_core_set_config(uint8_t* p_param_tlvs, uint8_t tlv_size) { 136 NFC_HDR* p; 137 uint8_t* pp; 138 uint8_t num = 0, ulen, len, *pt; 139 140 p = NCI_GET_CMD_BUF(tlv_size + 1); 141 if (p == NULL) return (NCI_STATUS_FAILED); 142 143 p->event = BT_EVT_TO_NFC_NCI; 144 p->len = NCI_MSG_HDR_SIZE + tlv_size + 1; 145 p->offset = NCI_MSG_OFFSET_SIZE; 146 pp = (uint8_t*)(p + 1) + p->offset; 147 148 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_CORE); 149 NCI_MSG_BLD_HDR1(pp, NCI_MSG_CORE_SET_CONFIG); 150 UINT8_TO_STREAM(pp, (uint8_t)(tlv_size + 1)); 151 len = tlv_size; 152 pt = p_param_tlvs; 153 while (len > 1) { 154 len -= 2; 155 pt++; 156 num++; 157 ulen = *pt++; 158 pt += ulen; 159 if (len >= ulen) { 160 len -= ulen; 161 } else { 162 GKI_freebuf(p); 163 return NCI_STATUS_FAILED; 164 } 165 } 166 167 UINT8_TO_STREAM(pp, num); 168 ARRAY_TO_STREAM(pp, p_param_tlvs, tlv_size); 169 nfc_ncif_send_cmd(p); 170 171 return (NCI_STATUS_OK); 172 } 173 174 /******************************************************************************* 175 ** 176 ** Function nci_snd_core_conn_create 177 ** 178 ** Description compose and send CORE CONN_CREATE command to command queue 179 ** 180 ** Returns status 181 ** 182 *******************************************************************************/ 183 uint8_t nci_snd_core_conn_create(uint8_t dest_type, uint8_t num_tlv, 184 uint8_t tlv_size, uint8_t* p_param_tlvs) { 185 NFC_HDR* p; 186 uint8_t* pp; 187 uint8_t size = NCI_CORE_PARAM_SIZE_CON_CREATE + tlv_size; 188 189 p = NCI_GET_CMD_BUF(size); 190 if (p == NULL) return (NCI_STATUS_FAILED); 191 192 p->event = BT_EVT_TO_NFC_NCI; 193 p->len = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_CON_CREATE; 194 p->offset = NCI_MSG_OFFSET_SIZE; 195 p->layer_specific = 0; 196 pp = (uint8_t*)(p + 1) + p->offset; 197 198 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_CORE); 199 NCI_MSG_BLD_HDR1(pp, NCI_MSG_CORE_CONN_CREATE); 200 UINT8_TO_STREAM(pp, size); 201 UINT8_TO_STREAM(pp, dest_type); 202 UINT8_TO_STREAM(pp, num_tlv); 203 if (tlv_size) { 204 ARRAY_TO_STREAM(pp, p_param_tlvs, tlv_size); 205 p->len += tlv_size; 206 } 207 208 nfc_ncif_send_cmd(p); 209 return (NCI_STATUS_OK); 210 } 211 212 /******************************************************************************* 213 ** 214 ** Function nci_snd_core_conn_close 215 ** 216 ** Description compose and send CORE CONN_CLOSE command to command queue 217 ** 218 ** Returns status 219 ** 220 *******************************************************************************/ 221 uint8_t nci_snd_core_conn_close(uint8_t conn_id) { 222 NFC_HDR* p; 223 uint8_t* pp; 224 225 p = NCI_GET_CMD_BUF(NCI_CORE_PARAM_SIZE_CON_CLOSE); 226 if (p == NULL) return (NCI_STATUS_FAILED); 227 228 p->event = BT_EVT_TO_NFC_NCI; 229 p->len = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_CON_CLOSE; 230 p->offset = NCI_MSG_OFFSET_SIZE; 231 p->layer_specific = 0; 232 pp = (uint8_t*)(p + 1) + p->offset; 233 234 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_CORE); 235 NCI_MSG_BLD_HDR1(pp, NCI_MSG_CORE_CONN_CLOSE); 236 UINT8_TO_STREAM(pp, NCI_CORE_PARAM_SIZE_CON_CLOSE); 237 UINT8_TO_STREAM(pp, conn_id); 238 239 nfc_ncif_send_cmd(p); 240 return (NCI_STATUS_OK); 241 } 242 243 #if (NFC_NFCEE_INCLUDED == TRUE) 244 #if (NFC_RW_ONLY == FALSE) 245 /******************************************************************************* 246 ** 247 ** Function nci_snd_nfcee_discover 248 ** 249 ** Description compose and send NFCEE Management NFCEE_DISCOVER command 250 ** to command queue 251 ** 252 ** Returns status 253 ** 254 *******************************************************************************/ 255 uint8_t nci_snd_nfcee_discover(uint8_t discover_action) { 256 NFC_HDR* p; 257 uint8_t* pp; 258 259 p = NCI_GET_CMD_BUF(NCI_PARAM_SIZE_DISCOVER_NFCEE); 260 if (p == NULL) return (NCI_STATUS_FAILED); 261 262 p->event = BT_EVT_TO_NFC_NCI; 263 p->len = NCI_MSG_HDR_SIZE + NCI_PARAM_SIZE_DISCOVER_NFCEE; 264 p->offset = NCI_MSG_OFFSET_SIZE; 265 p->layer_specific = 0; 266 pp = (uint8_t*)(p + 1) + p->offset; 267 268 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_EE_MANAGE); 269 NCI_MSG_BLD_HDR1(pp, NCI_MSG_NFCEE_DISCOVER); 270 UINT8_TO_STREAM(pp, NCI_PARAM_SIZE_DISCOVER_NFCEE); 271 UINT8_TO_STREAM(pp, discover_action); 272 273 nfc_ncif_send_cmd(p); 274 return (NCI_STATUS_OK); 275 } 276 277 /******************************************************************************* 278 ** 279 ** Function nci_snd_nfcee_mode_set 280 ** 281 ** Description compose and send NFCEE Management NFCEE MODE SET command 282 ** to command queue 283 ** 284 ** Returns status 285 ** 286 *******************************************************************************/ 287 uint8_t nci_snd_nfcee_mode_set(uint8_t nfcee_id, uint8_t nfcee_mode) { 288 NFC_HDR* p; 289 uint8_t* pp; 290 291 p = NCI_GET_CMD_BUF(NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET); 292 if (p == NULL) return (NCI_STATUS_FAILED); 293 294 p->event = BT_EVT_TO_NFC_NCI; 295 p->len = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET; 296 p->offset = NCI_MSG_OFFSET_SIZE; 297 p->layer_specific = 0; 298 pp = (uint8_t*)(p + 1) + p->offset; 299 300 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_EE_MANAGE); 301 NCI_MSG_BLD_HDR1(pp, NCI_MSG_NFCEE_MODE_SET); 302 UINT8_TO_STREAM(pp, NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET); 303 UINT8_TO_STREAM(pp, nfcee_id); 304 UINT8_TO_STREAM(pp, nfcee_mode); 305 306 nfc_ncif_send_cmd(p); 307 return (NCI_STATUS_OK); 308 } 309 #endif 310 #endif 311 312 /******************************************************************************* 313 ** 314 ** Function nci_snd_discover_cmd 315 ** 316 ** Description compose and send RF Management DISCOVER command to command 317 ** queue 318 ** 319 ** Returns status 320 ** 321 *******************************************************************************/ 322 uint8_t nci_snd_discover_cmd(uint8_t num, tNCI_DISCOVER_PARAMS* p_param) { 323 NFC_HDR* p; 324 uint8_t *pp, *p_size, *p_start; 325 int xx; 326 int size; 327 328 size = num * sizeof(tNCI_DISCOVER_PARAMS) + 1; 329 p = NCI_GET_CMD_BUF(size); 330 if (p == NULL) return (NCI_STATUS_FAILED); 331 332 p->event = BT_EVT_TO_NFC_NCI; 333 p->offset = NCI_MSG_OFFSET_SIZE; 334 p->layer_specific = 0; 335 pp = (uint8_t*)(p + 1) + p->offset; 336 337 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); 338 NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_DISCOVER); 339 p_size = pp; 340 pp++; 341 p_start = pp; 342 UINT8_TO_STREAM(pp, num); 343 for (xx = 0; xx < num; xx++) { 344 UINT8_TO_STREAM(pp, p_param[xx].type); 345 UINT8_TO_STREAM(pp, p_param[xx].frequency); 346 } 347 *p_size = (uint8_t)(pp - p_start); 348 p->len = NCI_MSG_HDR_SIZE + *p_size; 349 350 nfc_ncif_send_cmd(p); 351 return (NCI_STATUS_OK); 352 } 353 354 /******************************************************************************* 355 ** 356 ** Function nci_snd_discover_select_cmd 357 ** 358 ** Description compose and send RF Management DISCOVER SELECT command 359 ** to command queue 360 ** 361 ** Returns status 362 ** 363 *******************************************************************************/ 364 uint8_t nci_snd_discover_select_cmd(uint8_t rf_disc_id, uint8_t protocol, 365 uint8_t rf_interface) { 366 NFC_HDR* p; 367 uint8_t* pp; 368 369 p = NCI_GET_CMD_BUF(NCI_DISCOVER_PARAM_SIZE_SELECT); 370 if (p == NULL) return (NCI_STATUS_FAILED); 371 372 p->event = BT_EVT_TO_NFC_NCI; 373 p->len = NCI_MSG_HDR_SIZE + NCI_DISCOVER_PARAM_SIZE_SELECT; 374 p->offset = NCI_MSG_OFFSET_SIZE; 375 p->layer_specific = 0; 376 pp = (uint8_t*)(p + 1) + p->offset; 377 378 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); 379 NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_DISCOVER_SELECT); 380 UINT8_TO_STREAM(pp, NCI_DISCOVER_PARAM_SIZE_SELECT); 381 UINT8_TO_STREAM(pp, rf_disc_id); 382 UINT8_TO_STREAM(pp, protocol); 383 UINT8_TO_STREAM(pp, rf_interface); 384 385 nfc_ncif_send_cmd(p); 386 return (NCI_STATUS_OK); 387 } 388 389 /******************************************************************************* 390 ** 391 ** Function nci_snd_deactivate_cmd 392 ** 393 ** Description compose and send RF Management DEACTIVATE command 394 ** to command queue 395 ** 396 ** Returns status 397 ** 398 *******************************************************************************/ 399 uint8_t nci_snd_deactivate_cmd(uint8_t de_act_type) { 400 NFC_HDR* p; 401 uint8_t* pp; 402 403 nfc_cb.reassembly = true; 404 405 p = NCI_GET_CMD_BUF(NCI_DISCOVER_PARAM_SIZE_DEACT); 406 if (p == NULL) return (NCI_STATUS_FAILED); 407 408 p->event = BT_EVT_TO_NFC_NCI; 409 p->len = NCI_MSG_HDR_SIZE + NCI_DISCOVER_PARAM_SIZE_DEACT; 410 p->offset = NCI_MSG_OFFSET_SIZE; 411 p->layer_specific = 0; 412 pp = (uint8_t*)(p + 1) + p->offset; 413 414 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); 415 NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_DEACTIVATE); 416 UINT8_TO_STREAM(pp, NCI_DISCOVER_PARAM_SIZE_DEACT); 417 UINT8_TO_STREAM(pp, de_act_type); 418 419 nfc_ncif_send_cmd(p); 420 return (NCI_STATUS_OK); 421 } 422 423 /******************************************************************************* 424 ** 425 ** Function nci_snd_discover_map_cmd 426 ** 427 ** Description compose and send RF Management DISCOVER MAP command 428 ** to command queue 429 ** 430 ** Returns status 431 ** 432 *******************************************************************************/ 433 uint8_t nci_snd_discover_map_cmd(uint8_t num, tNCI_DISCOVER_MAPS* p_maps) { 434 NFC_HDR* p; 435 uint8_t *pp, *p_size, *p_start; 436 int xx; 437 int size; 438 439 size = num * sizeof(tNCI_DISCOVER_MAPS) + 1; 440 441 p = NCI_GET_CMD_BUF(size); 442 if (p == NULL) return (NCI_STATUS_FAILED); 443 444 p->event = BT_EVT_TO_NFC_NCI; 445 p->offset = NCI_MSG_OFFSET_SIZE; 446 p->layer_specific = 0; 447 pp = (uint8_t*)(p + 1) + p->offset; 448 449 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); 450 NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_DISCOVER_MAP); 451 p_size = pp; 452 pp++; 453 p_start = pp; 454 UINT8_TO_STREAM(pp, num); 455 for (xx = 0; xx < num; xx++) { 456 UINT8_TO_STREAM(pp, p_maps[xx].protocol); 457 UINT8_TO_STREAM(pp, p_maps[xx].mode); 458 UINT8_TO_STREAM(pp, p_maps[xx].intf_type); 459 } 460 *p_size = (uint8_t)(pp - p_start); 461 p->len = NCI_MSG_HDR_SIZE + *p_size; 462 nfc_ncif_send_cmd(p); 463 return (NCI_STATUS_OK); 464 } 465 /******************************************************************************* 466 ** 467 ** Function nci_snd_t3t_polling 468 ** 469 ** Description compose and send RF Management T3T POLLING command 470 ** to command queue 471 ** 472 ** Returns status 473 ** 474 *******************************************************************************/ 475 uint8_t nci_snd_t3t_polling(uint16_t system_code, uint8_t rc, uint8_t tsn) { 476 NFC_HDR* p; 477 uint8_t* pp; 478 479 p = NCI_GET_CMD_BUF(NCI_RF_PARAM_SIZE_T3T_POLLING); 480 if (p == NULL) return (NCI_STATUS_FAILED); 481 482 p->event = BT_EVT_TO_NFC_NCI; 483 p->len = NCI_MSG_HDR_SIZE + NCI_RF_PARAM_SIZE_T3T_POLLING; 484 p->offset = NCI_MSG_OFFSET_SIZE; 485 p->layer_specific = 0; 486 pp = (uint8_t*)(p + 1) + p->offset; 487 488 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); 489 NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_T3T_POLLING); 490 UINT8_TO_STREAM(pp, NCI_RF_PARAM_SIZE_T3T_POLLING); 491 UINT16_TO_BE_STREAM(pp, system_code); 492 UINT8_TO_STREAM(pp, rc); 493 UINT8_TO_STREAM(pp, tsn); 494 495 nfc_ncif_send_cmd(p); 496 return (NCI_STATUS_OK); 497 } 498 499 /******************************************************************************* 500 ** 501 ** Function nci_snd_parameter_update_cmd 502 ** 503 ** Description compose and send RF Management RF Communication Parameter 504 ** Update commandto command queue 505 ** 506 ** Returns status 507 ** 508 *******************************************************************************/ 509 uint8_t nci_snd_parameter_update_cmd(uint8_t* p_param_tlvs, uint8_t tlv_size) { 510 NFC_HDR* p; 511 uint8_t* pp; 512 uint8_t num = 0, ulen, len, *pt; 513 514 p = NCI_GET_CMD_BUF(tlv_size + 1); 515 if (p == NULL) return (NCI_STATUS_FAILED); 516 517 p->event = BT_EVT_TO_NFC_NCI; 518 p->len = NCI_MSG_HDR_SIZE + tlv_size + 1; 519 p->offset = NCI_MSG_OFFSET_SIZE; 520 pp = (uint8_t*)(p + 1) + p->offset; 521 522 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); 523 NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_PARAMETER_UPDATE); 524 UINT8_TO_STREAM(pp, (uint8_t)(tlv_size + 1)); 525 len = tlv_size; 526 pt = p_param_tlvs; 527 while (len > 1) { 528 len -= 2; 529 pt++; 530 num++; 531 ulen = *pt++; 532 pt += ulen; 533 if (len >= ulen) { 534 len -= ulen; 535 } else { 536 GKI_freebuf(p); 537 return NCI_STATUS_FAILED; 538 } 539 } 540 541 UINT8_TO_STREAM(pp, num); 542 ARRAY_TO_STREAM(pp, p_param_tlvs, tlv_size); 543 nfc_ncif_send_cmd(p); 544 545 return (NCI_STATUS_OK); 546 } 547 548 #if (NFC_NFCEE_INCLUDED == TRUE) 549 #if (NFC_RW_ONLY == FALSE) 550 /******************************************************************************* 551 ** 552 ** Function nci_snd_set_routing_cmd 553 ** 554 ** Description compose and send RF Management SET_LISTEN_MODE_ROUTING 555 ** command to command queue 556 ** 557 ** Returns status 558 ** 559 *******************************************************************************/ 560 uint8_t nci_snd_set_routing_cmd(bool more, uint8_t num_tlv, uint8_t tlv_size, 561 uint8_t* p_param_tlvs) { 562 NFC_HDR* p; 563 uint8_t* pp; 564 uint8_t size = tlv_size + 2; 565 566 if (tlv_size == 0) { 567 /* just to terminate routing table 568 * 2 bytes (more=FALSE and num routing entries=0) */ 569 size = 2; 570 } 571 572 p = NCI_GET_CMD_BUF(size); 573 if (p == NULL) return (NCI_STATUS_FAILED); 574 575 p->event = BT_EVT_TO_NFC_NCI; 576 p->offset = NCI_MSG_OFFSET_SIZE; 577 p->len = NCI_MSG_HDR_SIZE + size; 578 p->layer_specific = 0; 579 pp = (uint8_t*)(p + 1) + p->offset; 580 581 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); 582 NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_SET_ROUTING); 583 UINT8_TO_STREAM(pp, size); 584 UINT8_TO_STREAM(pp, more); 585 if (size == 2) { 586 UINT8_TO_STREAM(pp, 0); 587 } else { 588 UINT8_TO_STREAM(pp, num_tlv); 589 ARRAY_TO_STREAM(pp, p_param_tlvs, tlv_size); 590 } 591 nfc_ncif_send_cmd(p); 592 593 return (NCI_STATUS_OK); 594 } 595 596 /******************************************************************************* 597 ** 598 ** Function nci_snd_get_routing_cmd 599 ** 600 ** Description compose and send RF Management GET_LISTEN_MODE_ROUTING 601 ** command to command queue 602 ** 603 ** Returns status 604 ** 605 *******************************************************************************/ 606 uint8_t nci_snd_get_routing_cmd(void) { 607 NFC_HDR* p; 608 uint8_t* pp; 609 uint8_t param_size = 0; 610 611 p = NCI_GET_CMD_BUF(param_size); 612 if (p == NULL) return (NCI_STATUS_FAILED); 613 614 p->event = BT_EVT_TO_NFC_NCI; 615 p->len = NCI_MSG_HDR_SIZE + param_size; 616 p->offset = NCI_MSG_OFFSET_SIZE; 617 p->layer_specific = 0; 618 pp = (uint8_t*)(p + 1) + p->offset; 619 620 NCI_MSG_BLD_HDR0(pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); 621 NCI_MSG_BLD_HDR1(pp, NCI_MSG_RF_GET_ROUTING); 622 UINT8_TO_STREAM(pp, param_size); 623 624 nfc_ncif_send_cmd(p); 625 return (NCI_STATUS_OK); 626 } 627 #endif 628 #endif 629