1 /****************************************************************************** 2 * 3 * Copyright (C) 2010-2013 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 * 22 * This is the public interface file for NFA HCI, Broadcom's NFC 23 * application layer for mobile phones. 24 * 25 ******************************************************************************/ 26 #ifndef NFA_HCI_API_H 27 #define NFA_HCI_API_H 28 29 #include "nfa_api.h" 30 31 /***************************************************************************** 32 ** Constants and data types 33 *****************************************************************************/ 34 35 /* NFA HCI Debug constants */ 36 #define NFA_HCI_DEBUG_DISPLAY_CB 0 37 #define NFA_HCI_DEBUG_SIM_HCI_EVENT 1 38 #define NFA_HCI_DEBUG_ENABLE_LOOPBACK 101 39 #define NFA_HCI_DEBUG_DISABLE_LOOPBACK 102 40 41 /* NFA HCI callback events */ 42 #define NFA_HCI_REGISTER_EVT 0x00 /* Application registered */ 43 #define NFA_HCI_DEREGISTER_EVT 0x01 /* Application deregistered */ 44 #define NFA_HCI_GET_GATE_PIPE_LIST_EVT 0x02 /* Retrieved gates,pipes assoc. to application */ 45 #define NFA_HCI_ALLOCATE_GATE_EVT 0x03 /* A generic gate allocated to the application */ 46 #define NFA_HCI_DEALLOCATE_GATE_EVT 0x04 /* A generic gate is released */ 47 #define NFA_HCI_CREATE_PIPE_EVT 0x05 /* Pipe is created */ 48 #define NFA_HCI_OPEN_PIPE_EVT 0x06 /* Pipe is opened / could not open */ 49 #define NFA_HCI_CLOSE_PIPE_EVT 0x07 /* Pipe is closed / could not close */ 50 #define NFA_HCI_DELETE_PIPE_EVT 0x08 /* Pipe is deleted */ 51 #define NFA_HCI_HOST_LIST_EVT 0x09 /* Received list of Host from Host controller */ 52 #define NFA_HCI_INIT_EVT 0x0A /* HCI subsytem initialized */ 53 #define NFA_HCI_EXIT_EVT 0x0B /* HCI subsytem exited */ 54 #define NFA_HCI_RSP_RCVD_EVT 0x0C /* Response recvd to cmd sent on app owned pipe */ 55 #define NFA_HCI_RSP_SENT_EVT 0x0D /* Response sent on app owned pipe */ 56 #define NFA_HCI_CMD_SENT_EVT 0x0E /* Command sent on app owned pipe */ 57 #define NFA_HCI_EVENT_SENT_EVT 0x0F /* Event sent on app owned pipe */ 58 #define NFA_HCI_CMD_RCVD_EVT 0x10 /* Command received on app owned pipe */ 59 #define NFA_HCI_EVENT_RCVD_EVT 0x11 /* Event received on app owned pipe */ 60 #define NFA_HCI_GET_REG_CMD_EVT 0x12 /* Registry read command sent */ 61 #define NFA_HCI_SET_REG_CMD_EVT 0x13 /* Registry write command sent */ 62 #define NFA_HCI_GET_REG_RSP_EVT 0x14 /* Received response to read registry command */ 63 #define NFA_HCI_SET_REG_RSP_EVT 0x15 /* Received response to write registry command */ 64 #define NFA_HCI_ADD_STATIC_PIPE_EVT 0x16 /* A static pipe is added */ 65 66 typedef UINT8 tNFA_HCI_EVT; 67 68 #define NFA_MAX_HCI_APP_NAME_LEN 0x10 /* Max application name length */ 69 #define NFA_MAX_HCI_CMD_LEN 255 /* Max HCI command length */ 70 #define NFA_MAX_HCI_RSP_LEN 255 /* Max HCI event length */ 71 #define NFA_MAX_HCI_EVENT_LEN 260 /* Max HCI event length */ 72 #define NFA_MAX_HCI_DATA_LEN 260 /* Max HCI data length */ 73 74 /* NFA HCI PIPE states */ 75 #define NFA_HCI_PIPE_CLOSED 0x00 /* Pipe is closed */ 76 #define NFA_HCI_PIPE_OPENED 0x01 /* Pipe is opened */ 77 78 typedef UINT8 tNFA_HCI_PIPE_STATE; 79 /* Dynamic pipe control block */ 80 typedef struct 81 { 82 UINT8 pipe_id; /* Pipe ID */ 83 tNFA_HCI_PIPE_STATE pipe_state; /* State of the Pipe */ 84 UINT8 local_gate; /* local gate id */ 85 UINT8 dest_host; /* Peer host to which this pipe is connected */ 86 UINT8 dest_gate; /* Peer gate to which this pipe is connected */ 87 } tNFA_HCI_PIPE_INFO; 88 89 /* Data for NFA_HCI_REGISTER_EVT */ 90 typedef struct 91 { 92 tNFA_STATUS status; /* Status of registration */ 93 tNFA_HANDLE hci_handle; /* Handle assigned to the application */ 94 UINT8 num_pipes; /* Number of dynamic pipes exist for the application */ 95 UINT8 num_gates; /* Number of generic gates exist for the application */ 96 } tNFA_HCI_REGISTER; 97 98 /* Data for NFA_HCI_DEREGISTER_EVT */ 99 typedef struct 100 { 101 tNFA_STATUS status; /* Status of deregistration */ 102 } tNFA_HCI_DEREGISTER; 103 104 /* Data for NFA_HCI_GET_GATE_PIPE_LIST_EVT */ 105 typedef struct 106 { 107 tNFA_STATUS status; 108 UINT8 num_pipes; /* Number of dynamic pipes exist for the application */ 109 tNFA_HCI_PIPE_INFO pipe[NFA_HCI_MAX_PIPE_CB]; /* List of pipe created for the application */ 110 UINT8 num_gates; /* Number of generic gates exist for the application */ 111 UINT8 gate[NFA_HCI_MAX_GATE_CB]; /* List of generic gates allocated to the application */ 112 UINT8 num_uicc_created_pipes; /* Number of pipes created by UICC host */ 113 tNFA_HCI_PIPE_INFO uicc_created_pipe[NFA_HCI_MAX_HOST_IN_NETWORK]; /* Pipe information of the UICC created pipe */ 114 } tNFA_HCI_GET_GATE_PIPE_LIST; 115 116 /* Data for NFA_HCI_ALLOCATE_GATE_EVT */ 117 typedef struct 118 { 119 tNFA_STATUS status; /* Status of response to allocate gate request */ 120 UINT8 gate; /* The gate allocated to the application */ 121 } tNFA_HCI_ALLOCATE_GATE; 122 123 /* Data for NFA_HCI_DEALLOCATE_GATE_EVT */ 124 typedef struct 125 { 126 tNFA_STATUS status; /* Status of response to deallocate gate request */ 127 UINT8 gate; /* The gate deallocated from the application */ 128 } tNFA_HCI_DEALLOCATE_GATE; 129 130 /* Data for NFA_HCI_CREATE_PIPE_EVT */ 131 typedef struct 132 { 133 tNFA_STATUS status; /* Status of creating dynamic pipe for the application */ 134 UINT8 pipe; /* The pipe created for the application */ 135 UINT8 source_gate; /* DH host gate to which the one end of pipe is attached */ 136 UINT8 dest_host; /* Destination host whose gate is the other end of the pipe is attached to */ 137 UINT8 dest_gate; /* Destination host gate to which the other end of pipe is attached */ 138 } tNFA_HCI_CREATE_PIPE; 139 140 /* Data for NFA_HCI_OPEN_PIPE_EVT */ 141 typedef struct 142 { 143 tNFA_STATUS status; /* Status of open pipe operation */ 144 UINT8 pipe; /* The dynamic pipe for open operation */ 145 }tNFA_HCI_OPEN_PIPE; 146 147 /* Data for NFA_HCI_CLOSE_PIPE_EVT */ 148 typedef struct 149 { 150 tNFA_STATUS status; /* Status of close pipe operation */ 151 UINT8 pipe; /* The dynamic pipe for close operation */ 152 }tNFA_HCI_CLOSE_PIPE; 153 154 /* Data for NFA_HCI_DELETE_PIPE_EVT */ 155 typedef struct 156 { 157 tNFA_STATUS status; /* Status of delete pipe operation */ 158 UINT8 pipe; /* The dynamic pipe for delete operation */ 159 } tNFA_HCI_DELETE_PIPE; 160 161 /* Data for NFA_HCI_HOST_LIST_EVT */ 162 typedef struct 163 { 164 tNFA_STATUS status; /* Status og get host list operation */ 165 UINT8 num_hosts; /* Number of hosts in the host network */ 166 UINT8 host[NFA_HCI_MAX_HOST_IN_NETWORK]; /* List of host in the host network */ 167 } tNFA_HCI_HOST_LIST; 168 169 /* Data for NFA_HCI_RSP_RCVD_EVT */ 170 typedef struct 171 { 172 tNFA_STATUS status; /* Status of RSP to HCP CMD sent */ 173 UINT8 pipe; /* The pipe on which HCP packet is exchanged */ 174 UINT8 rsp_code; /* Response id */ 175 UINT16 rsp_len; /* Response parameter length */ 176 UINT8 rsp_data[NFA_MAX_HCI_RSP_LEN]; /* Response received */ 177 } tNFA_HCI_RSP_RCVD; 178 179 /* Data for NFA_HCI_EVENT_RCVD_EVT */ 180 typedef struct 181 { 182 tNFA_STATUS status; /* Status of Event received */ 183 UINT8 pipe; /* The pipe on which HCP EVT packet is received */ 184 UINT8 evt_code; /* HCP EVT id */ 185 UINT16 evt_len; /* HCP EVT parameter length */ 186 UINT8 *p_evt_buf; /* HCP EVT Parameter */ 187 } tNFA_HCI_EVENT_RCVD; 188 189 /* Data for NFA_HCI_CMD_RCVD_EVT */ 190 typedef struct 191 { 192 tNFA_STATUS status; /* Status of Command received */ 193 UINT8 pipe; /* The pipe on which HCP CMD packet is received */ 194 UINT8 cmd_code; /* HCP CMD id */ 195 UINT16 cmd_len; /* HCP CMD parameter length */ 196 UINT8 cmd_data[NFA_MAX_HCI_CMD_LEN]; /* HCP CMD Parameter */ 197 } tNFA_HCI_CMD_RCVD; 198 199 /* Data for NFA_HCI_INIT_EVT */ 200 typedef struct 201 { 202 tNFA_STATUS status; /* Status of Enabling HCI Network */ 203 } tNFA_HCI_INIT; 204 205 /* Data for NFA_HCI_EXIT_EVT */ 206 typedef struct 207 { 208 tNFA_STATUS status; /* Status of Disabling HCI Network */ 209 } tNFA_HCI_EXIT; 210 211 /* Data for NFA_HCI_RSP_SENT_EVT */ 212 typedef struct 213 { 214 tNFA_STATUS status; /* Status of HCP response send operation */ 215 } tNFA_HCI_RSP_SENT; 216 217 /* Data for NFA_HCI_CMD_SENT_EVT */ 218 typedef struct 219 { 220 tNFA_STATUS status; /* Status of Command send operation */ 221 } tNFA_HCI_CMD_SENT; 222 223 /* Data for NFA_HCI_EVENT_SENT_EVT */ 224 typedef struct 225 { 226 tNFA_STATUS status; /* Status of Event send operation */ 227 } tNFA_HCI_EVENT_SENT; 228 229 /* Data for NFA_HCI_ADD_STATIC_PIPE_EVT */ 230 typedef struct 231 { 232 tNFA_STATUS status; /* Status of adding proprietary pipe */ 233 } tNFA_HCI_ADD_STATIC_PIPE_EVT; 234 235 /* data type for all registry-related events */ 236 typedef struct 237 { 238 tNFA_STATUS status; /* Status of Registry operation */ 239 UINT8 pipe; /* Pipe on whose registry is of interest */ 240 UINT8 index; /* Index of the registry operated */ 241 UINT8 data_len; /* length of the registry parameter */ 242 UINT8 reg_data[NFA_MAX_HCI_DATA_LEN]; /* Registry parameter */ 243 } tNFA_HCI_REGISTRY; 244 245 246 /* Union of all hci callback structures */ 247 typedef union 248 { 249 tNFA_HCI_REGISTER hci_register; /* NFA_HCI_REGISTER_EVT */ 250 tNFA_HCI_DEREGISTER hci_deregister; /* NFA_HCI_DEREGISTER_EVT */ 251 tNFA_HCI_GET_GATE_PIPE_LIST gates_pipes; /* NFA_HCI_GET_GATE_PIPE_LIST_EVT */ 252 tNFA_HCI_ALLOCATE_GATE allocated; /* NFA_HCI_ALLOCATE_GATE_EVT */ 253 tNFA_HCI_DEALLOCATE_GATE deallocated; /* NFA_HCI_DEALLOCATE_GATE_EVT */ 254 tNFA_HCI_CREATE_PIPE created; /* NFA_HCI_CREATE_PIPE_EVT */ 255 tNFA_HCI_OPEN_PIPE opened; /* NFA_HCI_OPEN_PIPE_EVT */ 256 tNFA_HCI_CLOSE_PIPE closed; /* NFA_HCI_CLOSE_PIPE_EVT */ 257 tNFA_HCI_DELETE_PIPE deleted; /* NFA_HCI_DELETE_PIPE_EVT */ 258 tNFA_HCI_HOST_LIST hosts; /* NFA_HCI_HOST_LIST_EVT */ 259 tNFA_HCI_RSP_RCVD rsp_rcvd; /* NFA_HCI_RSP_RCVD_EVT */ 260 tNFA_HCI_RSP_SENT rsp_sent; /* NFA_HCI_RSP_SENT_EVT */ 261 tNFA_HCI_CMD_SENT cmd_sent; /* NFA_HCI_CMD_SENT_EVT */ 262 tNFA_HCI_EVENT_SENT evt_sent; /* NFA_HCI_EVENT_SENT_EVT */ 263 tNFA_HCI_CMD_RCVD cmd_rcvd; /* NFA_HCI_CMD_RCVD_EVT */ 264 tNFA_HCI_EVENT_RCVD rcvd_evt; /* NFA_HCI_EVENT_RCVD_EVT */ 265 tNFA_STATUS status; /* status of api command request */ 266 tNFA_HCI_REGISTRY registry; /* all registry-related events - NFA_HCI_GET_REG_CMD_EVT, NFA_HCI_SET_REG_CMD_EVT, NFA_HCI_GET_REG_RSP_EVT, NFA_HCI_SET_REG_RSP_EVT */ 267 tNFA_HCI_INIT hci_init; /* NFA_HCI_INIT_EVT */ 268 tNFA_HCI_EXIT hci_exit; /* NFA_HCI_EXIT_EVT */ 269 tNFA_HCI_ADD_STATIC_PIPE_EVT pipe_added; /* NFA_HCI_ADD_STATIC_PIPE_EVT */ 270 } tNFA_HCI_EVT_DATA; 271 272 /* NFA HCI callback */ 273 typedef void (tNFA_HCI_CBACK) (tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA *p_data); 274 275 /***************************************************************************** 276 ** External Function Declarations 277 *****************************************************************************/ 278 #ifdef __cplusplus 279 extern "C" 280 { 281 #endif 282 283 284 /******************************************************************************* 285 ** 286 ** Function NFA_HciRegister 287 ** 288 ** Description This function will register an application with hci and 289 ** returns an application handle and provides a mechanism to 290 ** register a callback with HCI to receive NFA HCI event notification. 291 ** When the application is registered (or if an error occurs), 292 ** the app will be notified with NFA_HCI_REGISTER_EVT. Previous 293 ** session information including allocated gates, created pipes 294 ** and pipes states will be returned as part of tNFA_HCI_REGISTER data. 295 ** 296 ** Returns NFA_STATUS_OK if successfully initiated 297 ** NFA_STATUS_FAILED otherwise 298 ** 299 *******************************************************************************/ 300 NFC_API extern tNFA_STATUS NFA_HciRegister (char *p_app_name, tNFA_HCI_CBACK *p_cback, BOOLEAN b_send_conn_evts); 301 302 /******************************************************************************* 303 ** 304 ** Function NFA_HciGetGateAndPipeList 305 ** 306 ** Description This function will retrieve the list of gates allocated to 307 ** the application and list of dynamic pipes created for the 308 ** application. The app will be notified with 309 ** NFA_HCI_GET_GATE_PIPE_LIST_EVT. List of allocated dynamic 310 ** gates to the application and list of pipes created by the 311 ** application will be returned as part of 312 ** tNFA_HCI_GET_GATE_PIPE_LIST data. 313 ** 314 ** Returns NFA_STATUS_OK if successfully initiated 315 ** NFA_STATUS_FAILED otherwise 316 ** 317 *******************************************************************************/ 318 NFC_API extern tNFA_STATUS NFA_HciGetGateAndPipeList (tNFA_HANDLE hci_handle); 319 320 /******************************************************************************* 321 ** 322 ** Function NFA_HciDeregister 323 ** 324 ** Description This function is called to deregister an application 325 ** from HCI. The app will be notified by NFA_HCI_DEREGISTER_EVT 326 ** after deleting all the pipes owned by the app and deallocating 327 ** all the gates allocated to the app or if an error occurs. 328 ** The app can release the buffer provided for collecting long 329 ** APDUs after receiving NFA_HCI_DEREGISTER_EVT. 330 ** Even if deregistration fails, the app has to register again 331 ** to provide a new cback function and event buffer for receiving 332 ** long APDUs. 333 ** 334 ** Returns NFA_STATUS_OK if the application is deregistered successfully 335 ** NFA_STATUS_FAILED otherwise 336 ** 337 *******************************************************************************/ 338 NFC_API extern tNFA_STATUS NFA_HciDeregister (char *p_app_name); 339 340 /******************************************************************************* 341 ** 342 ** Function NFA_HciAllocGate 343 ** 344 ** Description This function will allocate an available generic gate for 345 ** the app to provide an entry point for a particular service 346 ** to other host or to establish communication with other host. 347 ** When the generic gate is allocated (or if an error occurs), 348 ** the app will be notified with NFA_HCI_ALLOCATE_GATE_EVT with 349 ** the gate id. The allocated Gate information will be stored in 350 ** non volatile memory. 351 ** 352 ** Returns NFA_STATUS_OK if this API started 353 ** NFA_STATUS_BAD_HANDLE if handle is not valid 354 ** NFA_STATUS_FAILED if no generic gate is available 355 ** 356 *******************************************************************************/ 357 NFC_API extern tNFA_STATUS NFA_HciAllocGate (tNFA_HANDLE hci_handle); 358 359 /******************************************************************************* 360 ** 361 ** Function NFA_HciDeallocGate 362 ** 363 ** Description This function will release the specified gate that was 364 ** previously allocated to the application. When the generic 365 ** gate is released (or if an error occurs), the app will be 366 ** notified with NFA_HCI_DEALLOCATE_GATE_EVT with the gate id. 367 ** The allocated Gate information will be deleted from non 368 ** volatile memory and all the associated pipes are deleted 369 ** by informing host controller. 370 ** 371 ** Returns NFA_STATUS_OK if successfully initiated 372 ** NFA_STATUS_BAD_HANDLE if handle is not valid 373 ** NFA_STATUS_FAILED otherwise 374 ** 375 *******************************************************************************/ 376 NFC_API extern tNFA_STATUS NFA_HciDeallocGate (tNFA_HANDLE conn_handle, UINT8 gate); 377 378 /******************************************************************************* 379 ** 380 ** Function NFA_HciGetHostList 381 ** 382 ** Description This function will request the host controller to return the 383 ** list of hosts that are present in the host network. When 384 ** host controller responds with the host list (or if an error 385 ** occurs), the app will be notified with NFA_HCI_HOST_LIST_EVT 386 ** 387 ** Returns NFA_STATUS_OK if successfully initiated 388 ** NFA_STATUS_BAD_HANDLE if handle is not valid 389 ** NFA_STATUS_FAILED otherwise 390 ** 391 *******************************************************************************/ 392 NFC_API extern tNFA_STATUS NFA_HciGetHostList (tNFA_HANDLE hci_handle); 393 394 /******************************************************************************* 395 ** 396 ** Function NFA_HciCreatePipe 397 ** 398 ** Description This function is called to create a dynamic pipe with the 399 ** specified host. When the dynamic pipe is created (or 400 ** if an error occurs), the app will be notified with 401 ** NFA_HCI_CREATE_PIPE_EVT with the pipe id. If a pipe exists 402 ** between the two gates passed as argument and if it was 403 ** created earlier by the calling application then the pipe 404 ** id of the existing pipe will be returned and a new pipe 405 ** will not be created. After successful creation of pipe, 406 ** registry entry will be created for the dynamic pipe and 407 ** all information related to the pipe will be stored in non 408 ** volatile memory. 409 ** 410 ** Returns NFA_STATUS_OK if successfully initiated 411 ** NFA_STATUS_FAILED otherwise 412 ** 413 *******************************************************************************/ 414 NFC_API extern tNFA_STATUS NFA_HciCreatePipe (tNFA_HANDLE hci_handle, 415 UINT8 source_gate_id, 416 UINT8 dest_host, 417 UINT8 dest_gate); 418 419 /******************************************************************************* 420 ** 421 ** Function NFA_HciOpenPipe 422 ** 423 ** Description This function is called to open a dynamic pipe. 424 ** When the dynamic pipe is opened (or 425 ** if an error occurs), the app will be notified with 426 ** NFA_HCI_OPEN_PIPE_EVT with the pipe id. 427 ** 428 ** Returns NFA_STATUS_OK if successfully initiated 429 ** NFA_STATUS_FAILED otherwise 430 ** 431 *******************************************************************************/ 432 NFC_API extern tNFA_STATUS NFA_HciOpenPipe (tNFA_HANDLE hci_handle, UINT8 pipe); 433 434 /******************************************************************************* 435 ** 436 ** Function NFA_HciGetRegistry 437 ** 438 ** Description This function requests a peer host to return the desired 439 ** registry field value for the gate that the pipe is on. 440 ** 441 ** When the peer host responds,the app is notified with 442 ** NFA_HCI_GET_REG_RSP_EVT or 443 ** if an error occurs in sending the command the app will be 444 ** notified by NFA_HCI_CMD_SENT_EVT 445 ** 446 ** Returns NFA_STATUS_OK if successfully initiated 447 ** NFA_STATUS_FAILED otherwise 448 ** 449 *******************************************************************************/ 450 NFC_API extern tNFA_STATUS NFA_HciGetRegistry (tNFA_HANDLE hci_handle, UINT8 pipe, UINT8 reg_inx); 451 452 /******************************************************************************* 453 ** 454 ** Function NFA_HciSetRegistry 455 ** 456 ** Description This function requests a peer host to set the desired 457 ** registry field value for the gate that the pipe is on. 458 ** 459 ** When the peer host responds,the app is notified with 460 ** NFA_HCI_SET_REG_RSP_EVT or 461 ** if an error occurs in sending the command the app will be 462 ** notified by NFA_HCI_CMD_SENT_EVT 463 ** 464 ** Returns NFA_STATUS_OK if successfully initiated 465 ** NFA_STATUS_FAILED otherwise 466 ** 467 *******************************************************************************/ 468 NFC_API extern tNFA_STATUS NFA_HciSetRegistry (tNFA_HANDLE hci_handle, 469 UINT8 pipe, 470 UINT8 reg_inx, 471 UINT8 data_size, 472 UINT8 *p_data); 473 474 /******************************************************************************* 475 ** 476 ** Function NFA_HciSendCommand 477 ** 478 ** Description This function is called to send a command on a pipe created 479 ** by the application. 480 ** The app will be notified by NFA_HCI_CMD_SENT_EVT if an error 481 ** occurs. 482 ** When the peer host responds,the app is notified with 483 ** NFA_HCI_RSP_RCVD_EVT 484 ** 485 ** Returns NFA_STATUS_OK if successfully initiated 486 ** NFA_STATUS_FAILED otherwise 487 ** 488 *******************************************************************************/ 489 NFC_API extern tNFA_STATUS NFA_HciSendCommand (tNFA_HANDLE hci_handle, 490 UINT8 pipe, 491 UINT8 cmd_code, 492 UINT16 cmd_size, 493 UINT8 *p_data); 494 495 /******************************************************************************* 496 ** 497 ** Function NFA_HciSendResponse 498 ** 499 ** Description This function is called to send a response on a pipe created 500 ** by the application. 501 ** The app will be notified by NFA_HCI_RSP_SENT_EVT if an error 502 ** occurs. 503 ** 504 ** Returns NFA_STATUS_OK if successfully initiated 505 ** NFA_STATUS_FAILED otherwise 506 ** 507 *******************************************************************************/ 508 NFC_API extern tNFA_STATUS NFA_HciSendResponse (tNFA_HANDLE hci_handle, 509 UINT8 pipe, 510 UINT8 response, 511 UINT8 data_size, 512 UINT8 *p_data); 513 514 /******************************************************************************* 515 ** 516 ** Function NFA_HciSendEvent 517 ** 518 ** Description This function is called to send any event on a pipe created 519 ** by the application. 520 ** The app will be notified by NFA_HCI_EVENT_SENT_EVT 521 ** after successfully sending the event on the specified pipe 522 ** or if an error occurs. The application should wait for this 523 ** event before releasing event buffer passed as argument. 524 ** If the app is expecting a response to the event then it can 525 ** provide response buffer for collecting the response. If it 526 ** provides a response buffer it should also provide response 527 ** timeout indicating duration validity of the response buffer. 528 ** Maximum of NFA_MAX_HCI_EVENT_LEN bytes APDU can be received 529 ** using internal buffer if no response buffer is provided by 530 ** the application. The app will be notified by 531 ** NFA_HCI_EVENT_RCVD_EVT after receiving the response event 532 ** or on timeout if app provided response buffer. 533 ** If response buffer is provided by the application, it should 534 ** wait for this event before releasing the response buffer. 535 ** 536 ** Returns NFA_STATUS_OK if successfully initiated 537 ** NFA_STATUS_FAILED otherwise 538 ** 539 *******************************************************************************/ 540 NFC_API extern tNFA_STATUS NFA_HciSendEvent (tNFA_HANDLE hci_handle, 541 UINT8 pipe, 542 UINT8 evt_code, 543 UINT16 evt_size, 544 UINT8 *p_data, 545 UINT16 rsp_size, 546 UINT8 *p_rsp_buf, 547 UINT16 rsp_timeout); 548 549 /******************************************************************************* 550 ** 551 ** Function NFA_HciClosePipe 552 ** 553 ** Description This function is called to close a dynamic pipe. 554 ** When the dynamic pipe is closed (or 555 ** if an error occurs), the app will be notified with 556 ** NFA_HCI_CLOSE_PIPE_EVT with the pipe id. 557 ** 558 ** Returns NFA_STATUS_OK if successfully initiated 559 ** NFA_STATUS_FAILED otherwise 560 ** 561 *******************************************************************************/ 562 NFC_API extern tNFA_STATUS NFA_HciClosePipe (tNFA_HANDLE hci_handle, UINT8 pipe); 563 564 /******************************************************************************* 565 ** 566 ** Function NFA_HciDeletePipe 567 ** 568 ** Description This function is called to delete a particular dynamic pipe. 569 ** When the dynamic pipe is deleted (or if an error occurs), 570 ** the app will be notified with NFA_HCI_DELETE_PIPE_EVT with 571 ** the pipe id. After successful deletion of pipe, registry 572 ** entry will be deleted for the dynamic pipe and all 573 ** information related to the pipe will be deleted from non 574 ** volatile memory. 575 ** 576 ** Returns NFA_STATUS_OK if successfully initiated 577 ** NFA_STATUS_BAD_HANDLE if handle is not valid 578 ** NFA_STATUS_FAILED otherwise 579 ** 580 *******************************************************************************/ 581 NFC_API extern tNFA_STATUS NFA_HciDeletePipe (tNFA_HANDLE hci_handle, UINT8 pipe); 582 583 /******************************************************************************* 584 ** 585 ** Function NFA_HciAddStaticPipe 586 ** 587 ** Description This function is called to add a static pipe for sending 588 ** 7816 APDUs. When the static pipe is added (or if an error occurs), 589 ** the app will be notified with NFA_HCI_ADD_STATIC_PIPE_EVT with 590 ** status. 591 ** 592 ** Returns NFA_STATUS_OK if successfully initiated 593 ** NFA_STATUS_FAILED otherwise 594 ** 595 *******************************************************************************/ 596 NFC_API extern tNFA_STATUS NFA_HciAddStaticPipe (tNFA_HANDLE hci_handle, UINT8 host, UINT8 gate, UINT8 pipe); 597 598 /******************************************************************************* 599 ** 600 ** Function NFA_HciDebug 601 ** 602 ** Description Debug function. 603 ** 604 *******************************************************************************/ 605 NFC_API extern void NFA_HciDebug (UINT8 action, UINT8 size, UINT8 *p_data); 606 607 #ifdef __cplusplus 608 } 609 #endif 610 611 #endif /* NFA_P2P_API_H */ 612 613