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 * 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_PIPE_CB]; /* 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 the gate if any specified or an 345 ** available generic gate for the app to provide an entry point 346 ** for a particular service to other host or to establish 347 ** communication with other host. When the gate is 348 ** allocated (or if an error occurs), the app will be notified 349 ** with NFA_HCI_ALLOCATE_GATE_EVT with the gate id. The allocated 350 ** Gate information will be stored in non volatile memory. 351 ** 352 ** Returns NFA_STATUS_OK if this API started 353 ** NFA_STATUS_FAILED if no generic gate is available 354 ** 355 *******************************************************************************/ 356 NFC_API extern tNFA_STATUS NFA_HciAllocGate (tNFA_HANDLE hci_handle, UINT8 gate); 357 358 /******************************************************************************* 359 ** 360 ** Function NFA_HciDeallocGate 361 ** 362 ** Description This function will release the specified gate that was 363 ** previously allocated to the application. When the generic 364 ** gate is released (or if an error occurs), the app will be 365 ** notified with NFA_HCI_DEALLOCATE_GATE_EVT with the gate id. 366 ** The allocated Gate information will be deleted from non 367 ** volatile memory and all the associated pipes are deleted 368 ** by informing host controller. 369 ** 370 ** Returns NFA_STATUS_OK if successfully initiated 371 ** NFA_STATUS_BAD_HANDLE if handle is not valid 372 ** NFA_STATUS_FAILED otherwise 373 ** 374 *******************************************************************************/ 375 NFC_API extern tNFA_STATUS NFA_HciDeallocGate (tNFA_HANDLE conn_handle, UINT8 gate); 376 377 /******************************************************************************* 378 ** 379 ** Function NFA_HciGetHostList 380 ** 381 ** Description This function will request the host controller to return the 382 ** list of hosts that are present in the host network. When 383 ** host controller responds with the host list (or if an error 384 ** occurs), the app will be notified with NFA_HCI_HOST_LIST_EVT 385 ** 386 ** Returns NFA_STATUS_OK if successfully initiated 387 ** NFA_STATUS_BAD_HANDLE if handle is not valid 388 ** NFA_STATUS_FAILED otherwise 389 ** 390 *******************************************************************************/ 391 NFC_API extern tNFA_STATUS NFA_HciGetHostList (tNFA_HANDLE hci_handle); 392 393 /******************************************************************************* 394 ** 395 ** Function NFA_HciCreatePipe 396 ** 397 ** Description This function is called to create a dynamic pipe with the 398 ** specified host. When the dynamic pipe is created (or 399 ** if an error occurs), the app will be notified with 400 ** NFA_HCI_CREATE_PIPE_EVT with the pipe id. If a pipe exists 401 ** between the two gates passed as argument and if it was 402 ** created earlier by the calling application then the pipe 403 ** id of the existing pipe will be returned and a new pipe 404 ** will not be created. After successful creation of pipe, 405 ** registry entry will be created for the dynamic pipe and 406 ** all information related to the pipe will be stored in non 407 ** volatile memory. 408 ** 409 ** Returns NFA_STATUS_OK if successfully initiated 410 ** NFA_STATUS_FAILED otherwise 411 ** 412 *******************************************************************************/ 413 NFC_API extern tNFA_STATUS NFA_HciCreatePipe (tNFA_HANDLE hci_handle, 414 UINT8 source_gate_id, 415 UINT8 dest_host, 416 UINT8 dest_gate); 417 418 /******************************************************************************* 419 ** 420 ** Function NFA_HciOpenPipe 421 ** 422 ** Description This function is called to open a dynamic pipe. 423 ** When the dynamic pipe is opened (or 424 ** if an error occurs), the app will be notified with 425 ** NFA_HCI_OPEN_PIPE_EVT with the pipe id. 426 ** 427 ** Returns NFA_STATUS_OK if successfully initiated 428 ** NFA_STATUS_FAILED otherwise 429 ** 430 *******************************************************************************/ 431 NFC_API extern tNFA_STATUS NFA_HciOpenPipe (tNFA_HANDLE hci_handle, UINT8 pipe); 432 433 /******************************************************************************* 434 ** 435 ** Function NFA_HciGetRegistry 436 ** 437 ** Description This function requests a peer host to return the desired 438 ** registry field value for the gate that the pipe is on. 439 ** 440 ** When the peer host responds,the app is notified with 441 ** NFA_HCI_GET_REG_RSP_EVT or 442 ** if an error occurs in sending the command the app will be 443 ** notified by NFA_HCI_CMD_SENT_EVT 444 ** 445 ** Returns NFA_STATUS_OK if successfully initiated 446 ** NFA_STATUS_FAILED otherwise 447 ** 448 *******************************************************************************/ 449 NFC_API extern tNFA_STATUS NFA_HciGetRegistry (tNFA_HANDLE hci_handle, UINT8 pipe, UINT8 reg_inx); 450 451 /******************************************************************************* 452 ** 453 ** Function NFA_HciSetRegistry 454 ** 455 ** Description This function requests a peer host to set the desired 456 ** registry field value for the gate that the pipe is on. 457 ** 458 ** When the peer host responds,the app is notified with 459 ** NFA_HCI_SET_REG_RSP_EVT or 460 ** if an error occurs in sending the command the app will be 461 ** notified by NFA_HCI_CMD_SENT_EVT 462 ** 463 ** Returns NFA_STATUS_OK if successfully initiated 464 ** NFA_STATUS_FAILED otherwise 465 ** 466 *******************************************************************************/ 467 NFC_API extern tNFA_STATUS NFA_HciSetRegistry (tNFA_HANDLE hci_handle, 468 UINT8 pipe, 469 UINT8 reg_inx, 470 UINT8 data_size, 471 UINT8 *p_data); 472 473 /******************************************************************************* 474 ** 475 ** Function NFA_HciSendCommand 476 ** 477 ** Description This function is called to send a command on a pipe created 478 ** by the application. 479 ** The app will be notified by NFA_HCI_CMD_SENT_EVT if an error 480 ** occurs. 481 ** When the peer host responds,the app is notified with 482 ** NFA_HCI_RSP_RCVD_EVT 483 ** 484 ** Returns NFA_STATUS_OK if successfully initiated 485 ** NFA_STATUS_FAILED otherwise 486 ** 487 *******************************************************************************/ 488 NFC_API extern tNFA_STATUS NFA_HciSendCommand (tNFA_HANDLE hci_handle, 489 UINT8 pipe, 490 UINT8 cmd_code, 491 UINT16 cmd_size, 492 UINT8 *p_data); 493 494 /******************************************************************************* 495 ** 496 ** Function NFA_HciSendResponse 497 ** 498 ** Description This function is called to send a response on a pipe created 499 ** by the application. 500 ** The app will be notified by NFA_HCI_RSP_SENT_EVT if an error 501 ** occurs. 502 ** 503 ** Returns NFA_STATUS_OK if successfully initiated 504 ** NFA_STATUS_FAILED otherwise 505 ** 506 *******************************************************************************/ 507 NFC_API extern tNFA_STATUS NFA_HciSendResponse (tNFA_HANDLE hci_handle, 508 UINT8 pipe, 509 UINT8 response, 510 UINT8 data_size, 511 UINT8 *p_data); 512 513 /******************************************************************************* 514 ** 515 ** Function NFA_HciSendEvent 516 ** 517 ** Description This function is called to send any event on a pipe created 518 ** by the application. 519 ** The app will be notified by NFA_HCI_EVENT_SENT_EVT 520 ** after successfully sending the event on the specified pipe 521 ** or if an error occurs. The application should wait for this 522 ** event before releasing event buffer passed as argument. 523 ** If the app is expecting a response to the event then it can 524 ** provide response buffer for collecting the response. If it 525 ** provides a response buffer it should also provide response 526 ** timeout indicating duration validity of the response buffer. 527 ** Maximum of NFA_MAX_HCI_EVENT_LEN bytes APDU can be received 528 ** using internal buffer if no response buffer is provided by 529 ** the application. The app will be notified by 530 ** NFA_HCI_EVENT_RCVD_EVT after receiving the response event 531 ** or on timeout if app provided response buffer. 532 ** If response buffer is provided by the application, it should 533 ** wait for this event before releasing the response buffer. 534 ** 535 ** Returns NFA_STATUS_OK if successfully initiated 536 ** NFA_STATUS_FAILED otherwise 537 ** 538 *******************************************************************************/ 539 NFC_API extern tNFA_STATUS NFA_HciSendEvent (tNFA_HANDLE hci_handle, 540 UINT8 pipe, 541 UINT8 evt_code, 542 UINT16 evt_size, 543 UINT8 *p_data, 544 UINT16 rsp_size, 545 UINT8 *p_rsp_buf, 546 UINT16 rsp_timeout); 547 548 /******************************************************************************* 549 ** 550 ** Function NFA_HciClosePipe 551 ** 552 ** Description This function is called to close a dynamic pipe. 553 ** When the dynamic pipe is closed (or 554 ** if an error occurs), the app will be notified with 555 ** NFA_HCI_CLOSE_PIPE_EVT with the pipe id. 556 ** 557 ** Returns NFA_STATUS_OK if successfully initiated 558 ** NFA_STATUS_FAILED otherwise 559 ** 560 *******************************************************************************/ 561 NFC_API extern tNFA_STATUS NFA_HciClosePipe (tNFA_HANDLE hci_handle, UINT8 pipe); 562 563 /******************************************************************************* 564 ** 565 ** Function NFA_HciDeletePipe 566 ** 567 ** Description This function is called to delete a particular dynamic pipe. 568 ** When the dynamic pipe is deleted (or if an error occurs), 569 ** the app will be notified with NFA_HCI_DELETE_PIPE_EVT with 570 ** the pipe id. After successful deletion of pipe, registry 571 ** entry will be deleted for the dynamic pipe and all 572 ** information related to the pipe will be deleted from non 573 ** volatile memory. 574 ** 575 ** Returns NFA_STATUS_OK if successfully initiated 576 ** NFA_STATUS_BAD_HANDLE if handle is not valid 577 ** NFA_STATUS_FAILED otherwise 578 ** 579 *******************************************************************************/ 580 NFC_API extern tNFA_STATUS NFA_HciDeletePipe (tNFA_HANDLE hci_handle, UINT8 pipe); 581 582 /******************************************************************************* 583 ** 584 ** Function NFA_HciAddStaticPipe 585 ** 586 ** Description This function is called to add a static pipe for sending 587 ** 7816 APDUs. When the static pipe is added (or if an error occurs), 588 ** the app will be notified with NFA_HCI_ADD_STATIC_PIPE_EVT with 589 ** status. 590 ** 591 ** Returns NFA_STATUS_OK if successfully initiated 592 ** NFA_STATUS_FAILED otherwise 593 ** 594 *******************************************************************************/ 595 NFC_API extern tNFA_STATUS NFA_HciAddStaticPipe (tNFA_HANDLE hci_handle, UINT8 host, UINT8 gate, UINT8 pipe); 596 597 /******************************************************************************* 598 ** 599 ** Function NFA_HciDebug 600 ** 601 ** Description Debug function. 602 ** 603 *******************************************************************************/ 604 NFC_API extern void NFA_HciDebug (UINT8 action, UINT8 size, UINT8 *p_data); 605 606 #ifdef __cplusplus 607 } 608 #endif 609 610 #endif /* NFA_P2P_API_H */ 611 612