nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 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 | * |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 20 | * The original Work has been changed by NXP. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 21 | * |
| 22 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 23 | * you may not use this file except in compliance with the License. |
| 24 | * You may obtain a copy of the License at |
| 25 | * |
| 26 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 27 | * |
| 28 | * Unless required by applicable law or agreed to in writing, software |
| 29 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 30 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 31 | * See the License for the specific language governing permissions and |
| 32 | * limitations under the License. |
| 33 | * |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 34 | * Copyright 2018 NXP |
| 35 | * |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 36 | ******************************************************************************/ |
| 37 | |
| 38 | /****************************************************************************** |
| 39 | * |
| 40 | * This is the public interface file for NFA HCI, Broadcom's NFC |
| 41 | * application layer for mobile phones. |
| 42 | * |
| 43 | ******************************************************************************/ |
| 44 | #ifndef NFA_HCI_API_H |
| 45 | #define NFA_HCI_API_H |
| 46 | |
| 47 | #include "nfa_api.h" |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 48 | |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 49 | /***************************************************************************** |
| 50 | ** Constants and data types |
| 51 | *****************************************************************************/ |
| 52 | |
| 53 | /* NFA HCI Debug constants */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 54 | #define NFA_HCI_DEBUG_DISPLAY_CB 0 |
| 55 | #define NFA_HCI_DEBUG_SIM_HCI_EVENT 1 |
| 56 | #define NFA_HCI_DEBUG_ENABLE_LOOPBACK 101 |
| 57 | #define NFA_HCI_DEBUG_DISABLE_LOOPBACK 102 |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 58 | |
| 59 | /* NFA HCI callback events */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 60 | #define NFA_HCI_REGISTER_EVT \ |
| 61 | 0x00 /* Application registered */ |
| 62 | /* Application deregistered */ |
| 63 | #define NFA_HCI_DEREGISTER_EVT 0x01 |
| 64 | /* Retrieved gates,pipes assoc. to application */ |
| 65 | #define NFA_HCI_GET_GATE_PIPE_LIST_EVT 0x02 |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 66 | #define NFA_HCI_ALLOCATE_GATE_EVT \ |
| 67 | 0x03 /* A generic gate allocated to the application */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 68 | #define NFA_HCI_DEALLOCATE_GATE_EVT \ |
| 69 | 0x04 /* A generic gate is released */ |
| 70 | #define NFA_HCI_CREATE_PIPE_EVT \ |
| 71 | 0x05 /* Pipe is created */ |
| 72 | #define NFA_HCI_OPEN_PIPE_EVT \ |
| 73 | 0x06 /* Pipe is opened / could not open */ |
| 74 | #define NFA_HCI_CLOSE_PIPE_EVT \ |
| 75 | 0x07 /* Pipe is closed / could not close */ |
| 76 | #define NFA_HCI_DELETE_PIPE_EVT \ |
| 77 | 0x08 /* Pipe is deleted */ |
| 78 | #define NFA_HCI_HOST_LIST_EVT \ |
| 79 | 0x09 /* Received list of Host from Host controller */ |
| 80 | /* HCI subsytem initialized */ |
| 81 | #define NFA_HCI_INIT_EVT 0x0A |
| 82 | /* HCI subsytem exited */ |
| 83 | #define NFA_HCI_EXIT_EVT 0x0B |
| 84 | /* Response recvd to cmd sent on app owned pipe */ |
| 85 | #define NFA_HCI_RSP_RCVD_EVT 0x0C |
| 86 | /* Response sent on app owned pipe */ |
| 87 | #define NFA_HCI_RSP_SENT_EVT 0x0D |
| 88 | /* Command sent on app owned pipe */ |
| 89 | #define NFA_HCI_CMD_SENT_EVT 0x0E |
| 90 | /* Event sent on app owned pipe */ |
| 91 | #define NFA_HCI_EVENT_SENT_EVT 0x0F |
| 92 | /* Command received on app owned pipe */ |
| 93 | #define NFA_HCI_CMD_RCVD_EVT 0x10 |
| 94 | /* Event received on app owned pipe */ |
| 95 | #define NFA_HCI_EVENT_RCVD_EVT 0x11 |
| 96 | /* Registry read command sent */ |
| 97 | #define NFA_HCI_GET_REG_CMD_EVT 0x12 |
| 98 | /* Registry write command sent */ |
| 99 | #define NFA_HCI_SET_REG_CMD_EVT 0x13 |
| 100 | /* Received response to read registry command */ |
| 101 | #define NFA_HCI_GET_REG_RSP_EVT 0x14 |
| 102 | /* Received response to write registry command */ |
| 103 | #define NFA_HCI_SET_REG_RSP_EVT 0x15 |
| 104 | /* A static pipe is added */ |
| 105 | #define NFA_HCI_ADD_STATIC_PIPE_EVT 0x16 |
nxpandroid | 3e4012e | 2016-08-01 19:09:55 +0530 | [diff] [blame] | 106 | #if (NXP_EXTNS == TRUE) |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 107 | #define NFA_HCI_CMD_APDU_SENT_EVT 0x17 /* Command APDU sent to server APDU Host */ |
| 108 | #define NFA_HCI_APDU_ABORTED_EVT 0x18 /* Stopped waiting for Response APDU */ |
| 109 | #define NFA_HCI_RSP_APDU_RCVD_EVT 0x19 /* Response APDU received from server APDU Host */ |
nxpandroid | 3e4012e | 2016-08-01 19:09:55 +0530 | [diff] [blame] | 110 | #endif |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 111 | typedef uint8_t tNFA_HCI_EVT; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 112 | |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 113 | /* Max application name length */ |
| 114 | #define NFA_MAX_HCI_APP_NAME_LEN 0x10 |
| 115 | /* Max HCI command length */ |
| 116 | #define NFA_MAX_HCI_CMD_LEN 255 |
| 117 | /* Max HCI event length */ |
| 118 | #define NFA_MAX_HCI_RSP_LEN 255 |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 119 | /* Max HCI event length */ |
| 120 | #define NFA_MAX_HCI_EVENT_LEN 260 |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 121 | /* Max HCI data length */ |
| 122 | #define NFA_MAX_HCI_DATA_LEN 260 |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 123 | |
| 124 | /* NFA HCI PIPE states */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 125 | #define NFA_HCI_PIPE_CLOSED 0x00 /* Pipe is closed */ |
| 126 | #define NFA_HCI_PIPE_OPENED 0x01 /* Pipe is opened */ |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 127 | #if (NXP_EXTNS == TRUE) |
suraj | 4cef764 | 2017-09-15 16:33:37 +0530 | [diff] [blame] | 128 | /* HCI Recovery status*/ |
| 129 | #define NFA_HCI_EE_RECOVERY_STARTED 0x01 |
| 130 | #define NFA_HCI_EE_RECOVERY_COMPLETED 0x02 |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 131 | #define NFA_HCI_SESSION_ID_LEN 8 /* HCI Session ID length */ |
suraj | 4cef764 | 2017-09-15 16:33:37 +0530 | [diff] [blame] | 132 | |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 133 | /* APDU Pipe information */ |
| 134 | typedef struct |
| 135 | { |
| 136 | bool reg_info_valid; /* Indicates max_cmd_apdu_size, max_wait_time are valid */ |
| 137 | uint16_t max_cmd_apdu_size; /* Maximum length of msg that can be sent on the APDU pipe */ |
| 138 | uint16_t max_wait_time; /* Maximum waiting time for the response on the APDU pipe */ |
| 139 | } tNFA_HCI_APDU_PIPE_REG_INFO; |
| 140 | #endif |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 141 | typedef uint8_t tNFA_HCI_PIPE_STATE; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 142 | /* Dynamic pipe control block */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 143 | typedef struct { |
| 144 | uint8_t pipe_id; /* Pipe ID */ |
| 145 | tNFA_HCI_PIPE_STATE pipe_state; /* State of the Pipe */ |
| 146 | uint8_t local_gate; /* local gate id */ |
| 147 | uint8_t dest_host; /* Peer host to which this pipe is connected */ |
| 148 | uint8_t dest_gate; /* Peer gate to which this pipe is connected */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 149 | } tNFA_HCI_PIPE_INFO; |
Suraj Uday Kotharkar | 71fc580 | 2018-06-01 16:57:34 +0530 | [diff] [blame] | 150 | |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 151 | /* Data for NFA_HCI_REGISTER_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 152 | typedef struct { |
| 153 | tNFA_STATUS status; /* Status of registration */ |
| 154 | tNFA_HANDLE hci_handle; /* Handle assigned to the application */ |
| 155 | uint8_t num_pipes; /* Number of dynamic pipes exist for the application */ |
| 156 | uint8_t num_gates; /* Number of generic gates exist for the application */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 157 | } tNFA_HCI_REGISTER; |
| 158 | |
| 159 | /* Data for NFA_HCI_DEREGISTER_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 160 | typedef struct { |
| 161 | tNFA_STATUS status; /* Status of deregistration */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 162 | } tNFA_HCI_DEREGISTER; |
| 163 | |
| 164 | /* Data for NFA_HCI_GET_GATE_PIPE_LIST_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 165 | typedef struct { |
| 166 | tNFA_STATUS status; |
| 167 | uint8_t num_pipes; /* Number of dynamic pipes exist for the application */ |
| 168 | tNFA_HCI_PIPE_INFO |
| 169 | pipe[NFA_HCI_MAX_PIPE_CB]; /* List of pipe created for the application */ |
| 170 | uint8_t num_gates; /* Number of generic gates exist for the application */ |
| 171 | uint8_t gate[NFA_HCI_MAX_GATE_CB]; /* List of generic gates allocated to the |
| 172 | application */ |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 173 | #if (NXP_EXTNS == TRUE) |
| 174 | uint8_t num_host_created_pipes; /* Number of pipes created by host */ |
| 175 | tNFA_HCI_PIPE_INFO host_created_pipe |
| 176 | [NFA_HCI_MAX_PIPE_CB]; /* Pipe information of the pipe created */ |
| 177 | #else |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 178 | uint8_t num_uicc_created_pipes; /* Number of pipes created by UICC host */ |
| 179 | tNFA_HCI_PIPE_INFO uicc_created_pipe |
| 180 | [NFA_HCI_MAX_PIPE_CB]; /* Pipe information of the UICC created pipe */ |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 181 | #endif |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 182 | } tNFA_HCI_GET_GATE_PIPE_LIST; |
| 183 | |
| 184 | /* Data for NFA_HCI_ALLOCATE_GATE_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 185 | typedef struct { |
| 186 | tNFA_STATUS status; /* Status of response to allocate gate request */ |
| 187 | uint8_t gate; /* The gate allocated to the application */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 188 | } tNFA_HCI_ALLOCATE_GATE; |
| 189 | |
| 190 | /* Data for NFA_HCI_DEALLOCATE_GATE_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 191 | typedef struct { |
| 192 | tNFA_STATUS status; /* Status of response to deallocate gate request */ |
| 193 | uint8_t gate; /* The gate deallocated from the application */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 194 | } tNFA_HCI_DEALLOCATE_GATE; |
| 195 | |
| 196 | /* Data for NFA_HCI_CREATE_PIPE_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 197 | typedef struct { |
| 198 | tNFA_STATUS status; /* Status of creating dynamic pipe for the application */ |
| 199 | uint8_t pipe; /* The pipe created for the application */ |
| 200 | uint8_t |
| 201 | source_gate; /* DH host gate to which the one end of pipe is attached */ |
| 202 | uint8_t |
| 203 | dest_host; /* Destination host whose gate is the other end of the pipe is |
| 204 | attached to */ |
| 205 | uint8_t dest_gate; /* Destination host gate to which the other end of pipe is |
| 206 | attached */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 207 | } tNFA_HCI_CREATE_PIPE; |
| 208 | |
| 209 | /* Data for NFA_HCI_OPEN_PIPE_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 210 | typedef struct { |
| 211 | tNFA_STATUS status; /* Status of open pipe operation */ |
| 212 | uint8_t pipe; /* The dynamic pipe for open operation */ |
| 213 | } tNFA_HCI_OPEN_PIPE; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 214 | |
| 215 | /* Data for NFA_HCI_CLOSE_PIPE_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 216 | typedef struct { |
| 217 | tNFA_STATUS status; /* Status of close pipe operation */ |
| 218 | uint8_t pipe; /* The dynamic pipe for close operation */ |
| 219 | } tNFA_HCI_CLOSE_PIPE; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 220 | |
| 221 | /* Data for NFA_HCI_DELETE_PIPE_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 222 | typedef struct { |
| 223 | tNFA_STATUS status; /* Status of delete pipe operation */ |
| 224 | uint8_t pipe; /* The dynamic pipe for delete operation */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 225 | } tNFA_HCI_DELETE_PIPE; |
| 226 | |
| 227 | /* Data for NFA_HCI_HOST_LIST_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 228 | typedef struct { |
| 229 | tNFA_STATUS status; /* Status og get host list operation */ |
| 230 | uint8_t num_hosts; /* Number of hosts in the host network */ |
| 231 | uint8_t |
| 232 | host[NFA_HCI_MAX_HOST_IN_NETWORK]; /* List of host in the host network */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 233 | } tNFA_HCI_HOST_LIST; |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 234 | #if (NXP_EXTNS == TRUE) |
| 235 | /* Data for NFA_HCI_CMD_APDU_SENT_EVT */ |
| 236 | typedef struct |
| 237 | { |
| 238 | tNFC_STATUS status; /* Status of APDU send operation */ |
| 239 | uint8_t host_id; /* The APDU Server host to which command APDU is sent */ |
| 240 | } tNFA_HCI_CMD_APDU_SENT; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 241 | |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 242 | /* Data for NFA_HCI_RSP_APDU_RCVD_EVT */ |
| 243 | typedef struct |
| 244 | { |
| 245 | tNFC_STATUS status; /* Status of APDU received */ |
| 246 | uint8_t host_id; /* The APDU Server host from which response APDU is received */ |
| 247 | uint16_t apdu_len; /* Length of Response APDU received */ |
| 248 | uint8_t *p_apdu; /* Response APDU */ |
| 249 | } tNFA_HCI_RSP_APDU_RCVD; |
| 250 | |
| 251 | /* Data for NFA_HCI_APDU_ABORTED_EVT */ |
| 252 | typedef struct |
| 253 | { |
| 254 | tNFC_STATUS status; /* Status of aborting APDU command */ |
| 255 | uint8_t host_id; /* The APDU Server host to which command APDU was addressed is aborted */ |
| 256 | uint16_t atr_len; /* Length of Response ATR received */ |
| 257 | uint8_t *p_atr; /* Response ATR */ |
| 258 | } tNFA_HCI_APDU_ABORTED; |
| 259 | #endif |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 260 | /* Data for NFA_HCI_RSP_RCVD_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 261 | typedef struct { |
| 262 | tNFA_STATUS status; /* Status of RSP to HCP CMD sent */ |
| 263 | uint8_t pipe; /* The pipe on which HCP packet is exchanged */ |
| 264 | uint8_t rsp_code; /* Response id */ |
| 265 | uint16_t rsp_len; /* Response parameter length */ |
| 266 | uint8_t rsp_data[NFA_MAX_HCI_RSP_LEN]; /* Response received */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 267 | } tNFA_HCI_RSP_RCVD; |
| 268 | |
| 269 | /* Data for NFA_HCI_EVENT_RCVD_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 270 | typedef struct { |
| 271 | tNFA_STATUS status; /* Status of Event received */ |
| 272 | uint8_t pipe; /* The pipe on which HCP EVT packet is received */ |
| 273 | uint8_t evt_code; /* HCP EVT id */ |
| 274 | uint16_t evt_len; /* HCP EVT parameter length */ |
| 275 | uint8_t* p_evt_buf; /* HCP EVT Parameter */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 276 | } tNFA_HCI_EVENT_RCVD; |
| 277 | |
| 278 | /* Data for NFA_HCI_CMD_RCVD_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 279 | typedef struct { |
| 280 | tNFA_STATUS status; /* Status of Command received */ |
| 281 | uint8_t pipe; /* The pipe on which HCP CMD packet is received */ |
| 282 | uint8_t cmd_code; /* HCP CMD id */ |
| 283 | uint16_t cmd_len; /* HCP CMD parameter length */ |
| 284 | uint8_t cmd_data[NFA_MAX_HCI_CMD_LEN]; /* HCP CMD Parameter */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 285 | } tNFA_HCI_CMD_RCVD; |
| 286 | |
| 287 | /* Data for NFA_HCI_INIT_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 288 | typedef struct { |
| 289 | tNFA_STATUS status; /* Status of Enabling HCI Network */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 290 | } tNFA_HCI_INIT; |
| 291 | |
| 292 | /* Data for NFA_HCI_EXIT_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 293 | typedef struct { |
| 294 | tNFA_STATUS status; /* Status of Disabling HCI Network */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 295 | } tNFA_HCI_EXIT; |
| 296 | |
| 297 | /* Data for NFA_HCI_RSP_SENT_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 298 | typedef struct { |
| 299 | tNFA_STATUS status; /* Status of HCP response send operation */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 300 | } tNFA_HCI_RSP_SENT; |
| 301 | |
| 302 | /* Data for NFA_HCI_CMD_SENT_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 303 | typedef struct { |
| 304 | tNFA_STATUS status; /* Status of Command send operation */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 305 | } tNFA_HCI_CMD_SENT; |
| 306 | |
| 307 | /* Data for NFA_HCI_EVENT_SENT_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 308 | typedef struct { |
| 309 | tNFA_STATUS status; /* Status of Event send operation */ |
nxpandroid | 70cccc7 | 2016-11-18 19:58:22 +0530 | [diff] [blame] | 310 | #if (NXP_EXTNS == TRUE) |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 311 | uint8_t evt_type; |
nxpandroid | 70cccc7 | 2016-11-18 19:58:22 +0530 | [diff] [blame] | 312 | #endif |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 313 | } tNFA_HCI_EVENT_SENT; |
| 314 | |
| 315 | /* Data for NFA_HCI_ADD_STATIC_PIPE_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 316 | typedef struct { |
| 317 | tNFA_STATUS status; /* Status of adding proprietary pipe */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 318 | } tNFA_HCI_ADD_STATIC_PIPE_EVT; |
| 319 | |
| 320 | /* data type for all registry-related events */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 321 | typedef struct { |
| 322 | tNFA_STATUS status; /* Status of Registry operation */ |
| 323 | uint8_t pipe; /* Pipe on whose registry is of interest */ |
| 324 | uint8_t index; /* Index of the registry operated */ |
| 325 | uint8_t data_len; /* length of the registry parameter */ |
| 326 | uint8_t reg_data[NFA_MAX_HCI_DATA_LEN]; /* Registry parameter */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 327 | } tNFA_HCI_REGISTRY; |
nxpandroid | 3e4012e | 2016-08-01 19:09:55 +0530 | [diff] [blame] | 328 | #if (NXP_EXTNS == TRUE) |
suraj | 4cef764 | 2017-09-15 16:33:37 +0530 | [diff] [blame] | 329 | typedef struct { |
| 330 | tNFA_STATUS status; /* Status of command on Admin pipe */ |
| 331 | uint8_t host; |
| 332 | } tNFA_HCI_EE_RECOVERY_EVT; |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 333 | #endif |
suraj | 4cef764 | 2017-09-15 16:33:37 +0530 | [diff] [blame] | 334 | /* Data for tNFA_HCI_CONFIG_RSP_RCVD */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 335 | /* Union of all hci callback structures */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 336 | typedef union { |
| 337 | tNFA_HCI_REGISTER hci_register; /* NFA_HCI_REGISTER_EVT */ |
| 338 | tNFA_HCI_DEREGISTER hci_deregister; /* NFA_HCI_DEREGISTER_EVT */ |
| 339 | tNFA_HCI_GET_GATE_PIPE_LIST gates_pipes; /* NFA_HCI_GET_GATE_PIPE_LIST_EVT */ |
| 340 | tNFA_HCI_ALLOCATE_GATE allocated; /* NFA_HCI_ALLOCATE_GATE_EVT */ |
| 341 | tNFA_HCI_DEALLOCATE_GATE deallocated; /* NFA_HCI_DEALLOCATE_GATE_EVT */ |
| 342 | tNFA_HCI_CREATE_PIPE created; /* NFA_HCI_CREATE_PIPE_EVT */ |
| 343 | tNFA_HCI_OPEN_PIPE opened; /* NFA_HCI_OPEN_PIPE_EVT */ |
| 344 | tNFA_HCI_CLOSE_PIPE closed; /* NFA_HCI_CLOSE_PIPE_EVT */ |
| 345 | tNFA_HCI_DELETE_PIPE deleted; /* NFA_HCI_DELETE_PIPE_EVT */ |
| 346 | tNFA_HCI_HOST_LIST hosts; /* NFA_HCI_HOST_LIST_EVT */ |
| 347 | tNFA_HCI_RSP_RCVD rsp_rcvd; /* NFA_HCI_RSP_RCVD_EVT */ |
| 348 | tNFA_HCI_RSP_SENT rsp_sent; /* NFA_HCI_RSP_SENT_EVT */ |
| 349 | tNFA_HCI_CMD_SENT cmd_sent; /* NFA_HCI_CMD_SENT_EVT */ |
| 350 | tNFA_HCI_EVENT_SENT evt_sent; /* NFA_HCI_EVENT_SENT_EVT */ |
| 351 | tNFA_HCI_CMD_RCVD cmd_rcvd; /* NFA_HCI_CMD_RCVD_EVT */ |
| 352 | tNFA_HCI_EVENT_RCVD rcvd_evt; /* NFA_HCI_EVENT_RCVD_EVT */ |
| 353 | tNFA_STATUS status; /* status of api command request */ |
| 354 | tNFA_HCI_REGISTRY registry; /* all registry-related events - |
| 355 | NFA_HCI_GET_REG_CMD_EVT, |
| 356 | NFA_HCI_SET_REG_CMD_EVT, |
| 357 | NFA_HCI_GET_REG_RSP_EVT, |
| 358 | NFA_HCI_SET_REG_RSP_EVT */ |
| 359 | tNFA_HCI_INIT hci_init; /* NFA_HCI_INIT_EVT */ |
| 360 | tNFA_HCI_EXIT hci_exit; /* NFA_HCI_EXIT_EVT */ |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 361 | #if (NXP_EXTNS == TRUE) |
| 362 | tNFA_HCI_CMD_APDU_SENT apdu_sent; /* NFA_HCI_CMD_APDU_SENT_EVT */ |
| 363 | tNFA_HCI_APDU_ABORTED apdu_aborted; /* NFA_HCI_APDU_ABORTED_EVT */ |
| 364 | tNFA_HCI_RSP_APDU_RCVD apdu_rcvd; /* NFA_HCI_RSP_APDU_RCVD_EVT */ |
| 365 | #endif |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 366 | tNFA_HCI_ADD_STATIC_PIPE_EVT pipe_added; /* NFA_HCI_ADD_STATIC_PIPE_EVT */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 367 | } tNFA_HCI_EVT_DATA; |
| 368 | |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 369 | /* NFA HCI callback */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 370 | typedef void(tNFA_HCI_CBACK)(tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* p_data); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 371 | |
| 372 | /***************************************************************************** |
| 373 | ** External Function Declarations |
| 374 | *****************************************************************************/ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 375 | |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 376 | /******************************************************************************* |
| 377 | ** |
| 378 | ** Function NFA_HciRegister |
| 379 | ** |
| 380 | ** Description This function will register an application with hci and |
| 381 | ** returns an application handle and provides a mechanism to |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 382 | ** register a callback with HCI to receive NFA HCI event |
| 383 | ** notification. When the application is registered (or if an |
| 384 | ** error occurs), the app will be notified with |
| 385 | ** NFA_HCI_REGISTER_EVT. Previous session information |
| 386 | ** including allocated gates, created pipes and pipes states |
| 387 | ** will be returned as part of tNFA_HCI_REGISTER data. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 388 | ** |
| 389 | ** Returns NFA_STATUS_OK if successfully initiated |
| 390 | ** NFA_STATUS_FAILED otherwise |
| 391 | ** |
| 392 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 393 | extern tNFA_STATUS NFA_HciRegister(char* p_app_name, tNFA_HCI_CBACK* p_cback, |
| 394 | bool b_send_conn_evts); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 395 | |
| 396 | /******************************************************************************* |
| 397 | ** |
| 398 | ** Function NFA_HciGetGateAndPipeList |
| 399 | ** |
| 400 | ** Description This function will retrieve the list of gates allocated to |
| 401 | ** the application and list of dynamic pipes created for the |
| 402 | ** application. The app will be notified with |
| 403 | ** NFA_HCI_GET_GATE_PIPE_LIST_EVT. List of allocated dynamic |
| 404 | ** gates to the application and list of pipes created by the |
| 405 | ** application will be returned as part of |
| 406 | ** tNFA_HCI_GET_GATE_PIPE_LIST data. |
| 407 | ** |
| 408 | ** Returns NFA_STATUS_OK if successfully initiated |
| 409 | ** NFA_STATUS_FAILED otherwise |
| 410 | ** |
| 411 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 412 | extern tNFA_STATUS NFA_HciGetGateAndPipeList(tNFA_HANDLE hci_handle); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 413 | |
| 414 | /******************************************************************************* |
| 415 | ** |
| 416 | ** Function NFA_HciDeregister |
| 417 | ** |
| 418 | ** Description This function is called to deregister an application |
| 419 | ** from HCI. The app will be notified by NFA_HCI_DEREGISTER_EVT |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 420 | ** after deleting all the pipes owned by the app and |
| 421 | ** deallocating all the gates allocated to the app or if an |
| 422 | ** error occurs. The app can release the buffer provided for |
| 423 | ** collecting long APDUs after receiving |
| 424 | ** NFA_HCI_DEREGISTER_EVT. Even if deregistration fails, the |
| 425 | ** app has to register again to provide a new cback function |
| 426 | ** and event buffer for receiving long APDUs. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 427 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 428 | ** Returns NFA_STATUS_OK if the application is deregistered |
| 429 | ** successfully |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 430 | ** NFA_STATUS_FAILED otherwise |
| 431 | ** |
| 432 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 433 | extern tNFA_STATUS NFA_HciDeregister(char* p_app_name); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 434 | |
| 435 | /******************************************************************************* |
| 436 | ** |
| 437 | ** Function NFA_HciAllocGate |
| 438 | ** |
| 439 | ** Description This function will allocate the gate if any specified or an |
| 440 | ** available generic gate for the app to provide an entry point |
| 441 | ** for a particular service to other host or to establish |
| 442 | ** communication with other host. When the gate is |
| 443 | ** allocated (or if an error occurs), the app will be notified |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 444 | ** with NFA_HCI_ALLOCATE_GATE_EVT with the gate id. The |
| 445 | ** allocated Gate information will be stored in non volatile |
| 446 | ** memory. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 447 | ** |
| 448 | ** Returns NFA_STATUS_OK if this API started |
| 449 | ** NFA_STATUS_FAILED if no generic gate is available |
| 450 | ** |
| 451 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 452 | extern tNFA_STATUS NFA_HciAllocGate(tNFA_HANDLE hci_handle, uint8_t gate); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 453 | |
| 454 | /******************************************************************************* |
| 455 | ** |
| 456 | ** Function NFA_HciDeallocGate |
| 457 | ** |
| 458 | ** Description This function will release the specified gate that was |
| 459 | ** previously allocated to the application. When the generic |
| 460 | ** gate is released (or if an error occurs), the app will be |
| 461 | ** notified with NFA_HCI_DEALLOCATE_GATE_EVT with the gate id. |
| 462 | ** The allocated Gate information will be deleted from non |
| 463 | ** volatile memory and all the associated pipes are deleted |
| 464 | ** by informing host controller. |
| 465 | ** |
| 466 | ** Returns NFA_STATUS_OK if successfully initiated |
| 467 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 468 | ** NFA_STATUS_FAILED otherwise |
| 469 | ** |
| 470 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 471 | extern tNFA_STATUS NFA_HciDeallocGate(tNFA_HANDLE conn_handle, uint8_t gate); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 472 | |
| 473 | /******************************************************************************* |
| 474 | ** |
| 475 | ** Function NFA_HciGetHostList |
| 476 | ** |
| 477 | ** Description This function will request the host controller to return the |
| 478 | ** list of hosts that are present in the host network. When |
| 479 | ** host controller responds with the host list (or if an error |
| 480 | ** occurs), the app will be notified with NFA_HCI_HOST_LIST_EVT |
| 481 | ** |
| 482 | ** Returns NFA_STATUS_OK if successfully initiated |
| 483 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 484 | ** NFA_STATUS_FAILED otherwise |
| 485 | ** |
| 486 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 487 | extern tNFA_STATUS NFA_HciGetHostList(tNFA_HANDLE hci_handle); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 488 | |
| 489 | /******************************************************************************* |
| 490 | ** |
| 491 | ** Function NFA_HciCreatePipe |
| 492 | ** |
| 493 | ** Description This function is called to create a dynamic pipe with the |
| 494 | ** specified host. When the dynamic pipe is created (or |
| 495 | ** if an error occurs), the app will be notified with |
| 496 | ** NFA_HCI_CREATE_PIPE_EVT with the pipe id. If a pipe exists |
| 497 | ** between the two gates passed as argument and if it was |
| 498 | ** created earlier by the calling application then the pipe |
| 499 | ** id of the existing pipe will be returned and a new pipe |
| 500 | ** will not be created. After successful creation of pipe, |
| 501 | ** registry entry will be created for the dynamic pipe and |
| 502 | ** all information related to the pipe will be stored in non |
| 503 | ** volatile memory. |
| 504 | ** |
| 505 | ** Returns NFA_STATUS_OK if successfully initiated |
| 506 | ** NFA_STATUS_FAILED otherwise |
| 507 | ** |
| 508 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 509 | extern tNFA_STATUS NFA_HciCreatePipe(tNFA_HANDLE hci_handle, |
| 510 | uint8_t source_gate_id, uint8_t dest_host, |
| 511 | uint8_t dest_gate); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 512 | |
| 513 | /******************************************************************************* |
| 514 | ** |
| 515 | ** Function NFA_HciOpenPipe |
| 516 | ** |
| 517 | ** Description This function is called to open a dynamic pipe. |
| 518 | ** When the dynamic pipe is opened (or |
| 519 | ** if an error occurs), the app will be notified with |
| 520 | ** NFA_HCI_OPEN_PIPE_EVT with the pipe id. |
| 521 | ** |
| 522 | ** Returns NFA_STATUS_OK if successfully initiated |
| 523 | ** NFA_STATUS_FAILED otherwise |
| 524 | ** |
| 525 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 526 | extern tNFA_STATUS NFA_HciOpenPipe(tNFA_HANDLE hci_handle, uint8_t pipe); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 527 | |
| 528 | /******************************************************************************* |
| 529 | ** |
| 530 | ** Function NFA_HciGetRegistry |
| 531 | ** |
| 532 | ** Description This function requests a peer host to return the desired |
| 533 | ** registry field value for the gate that the pipe is on. |
| 534 | ** |
| 535 | ** When the peer host responds,the app is notified with |
| 536 | ** NFA_HCI_GET_REG_RSP_EVT or |
| 537 | ** if an error occurs in sending the command the app will be |
| 538 | ** notified by NFA_HCI_CMD_SENT_EVT |
| 539 | ** |
| 540 | ** Returns NFA_STATUS_OK if successfully initiated |
| 541 | ** NFA_STATUS_FAILED otherwise |
| 542 | ** |
| 543 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 544 | extern tNFA_STATUS NFA_HciGetRegistry(tNFA_HANDLE hci_handle, uint8_t pipe, |
| 545 | uint8_t reg_inx); |
nxf24591 | e1fb2f9 | 2018-06-06 14:41:56 +0530 | [diff] [blame] | 546 | #if (NXP_EXTNS == TRUE) |
| 547 | /******************************************************************************* |
| 548 | ** |
| 549 | ** Function NFA_HciSetRegistry |
| 550 | ** |
| 551 | ** Description This function requests a peer host to set the desired |
| 552 | ** registry field value for the gate that the pipe is on. |
| 553 | ** |
| 554 | ** When the peer host responds,the app is notified with |
| 555 | ** NFA_HCI_SET_REG_RSP_EVT or |
| 556 | ** if an error occurs in sending the command the app will be |
| 557 | ** notified by NFA_HCI_CMD_SENT_EVT |
| 558 | ** |
| 559 | ** Returns NFA_STATUS_OK if successfully initiated |
| 560 | ** NFA_STATUS_FAILED otherwise |
| 561 | ** |
| 562 | *******************************************************************************/ |
| 563 | extern tNFA_STATUS NFA_HciSetRegistry(tNFA_HANDLE hci_handle, uint8_t pipe, |
| 564 | uint8_t reg_inx, uint8_t data_size, |
| 565 | uint8_t* p_data); |
| 566 | #endif |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 567 | /******************************************************************************* |
| 568 | ** |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 569 | ** Function NFA_HciSendCommand |
| 570 | ** |
| 571 | ** Description This function is called to send a command on a pipe created |
| 572 | ** by the application. |
| 573 | ** The app will be notified by NFA_HCI_CMD_SENT_EVT if an error |
| 574 | ** occurs. |
| 575 | ** When the peer host responds,the app is notified with |
| 576 | ** NFA_HCI_RSP_RCVD_EVT |
| 577 | ** |
| 578 | ** Returns NFA_STATUS_OK if successfully initiated |
| 579 | ** NFA_STATUS_FAILED otherwise |
| 580 | ** |
| 581 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 582 | extern tNFA_STATUS NFA_HciSendCommand(tNFA_HANDLE hci_handle, uint8_t pipe, |
| 583 | uint8_t cmd_code, uint16_t cmd_size, |
| 584 | uint8_t* p_data); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 585 | |
| 586 | /******************************************************************************* |
| 587 | ** |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 588 | ** Function NFA_HciSendEvent |
| 589 | ** |
| 590 | ** Description This function is called to send any event on a pipe created |
| 591 | ** by the application. |
| 592 | ** The app will be notified by NFA_HCI_EVENT_SENT_EVT |
| 593 | ** after successfully sending the event on the specified pipe |
| 594 | ** or if an error occurs. The application should wait for this |
| 595 | ** event before releasing event buffer passed as argument. |
| 596 | ** If the app is expecting a response to the event then it can |
| 597 | ** provide response buffer for collecting the response. If it |
| 598 | ** provides a response buffer it should also provide response |
| 599 | ** timeout indicating duration validity of the response buffer. |
| 600 | ** Maximum of NFA_MAX_HCI_EVENT_LEN bytes APDU can be received |
| 601 | ** using internal buffer if no response buffer is provided by |
| 602 | ** the application. The app will be notified by |
| 603 | ** NFA_HCI_EVENT_RCVD_EVT after receiving the response event |
| 604 | ** or on timeout if app provided response buffer. |
| 605 | ** If response buffer is provided by the application, it should |
| 606 | ** wait for this event before releasing the response buffer. |
| 607 | ** |
| 608 | ** Returns NFA_STATUS_OK if successfully initiated |
| 609 | ** NFA_STATUS_FAILED otherwise |
| 610 | ** |
| 611 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 612 | tNFA_STATUS NFA_HciSendEvent(tNFA_HANDLE hci_handle, uint8_t pipe, |
| 613 | uint8_t evt_code, uint16_t evt_size, |
| 614 | uint8_t* p_data, uint16_t rsp_size, |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 615 | uint8_t* p_rsp_buf, uint16_t rsp_timeout); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 616 | |
| 617 | /******************************************************************************* |
| 618 | ** |
| 619 | ** Function NFA_HciClosePipe |
| 620 | ** |
| 621 | ** Description This function is called to close a dynamic pipe. |
| 622 | ** When the dynamic pipe is closed (or |
| 623 | ** if an error occurs), the app will be notified with |
| 624 | ** NFA_HCI_CLOSE_PIPE_EVT with the pipe id. |
| 625 | ** |
| 626 | ** Returns NFA_STATUS_OK if successfully initiated |
| 627 | ** NFA_STATUS_FAILED otherwise |
| 628 | ** |
| 629 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 630 | extern tNFA_STATUS NFA_HciClosePipe(tNFA_HANDLE hci_handle, uint8_t pipe); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 631 | |
| 632 | /******************************************************************************* |
| 633 | ** |
| 634 | ** Function NFA_HciDeletePipe |
| 635 | ** |
| 636 | ** Description This function is called to delete a particular dynamic pipe. |
| 637 | ** When the dynamic pipe is deleted (or if an error occurs), |
| 638 | ** the app will be notified with NFA_HCI_DELETE_PIPE_EVT with |
| 639 | ** the pipe id. After successful deletion of pipe, registry |
| 640 | ** entry will be deleted for the dynamic pipe and all |
| 641 | ** information related to the pipe will be deleted from non |
| 642 | ** volatile memory. |
| 643 | ** |
| 644 | ** Returns NFA_STATUS_OK if successfully initiated |
| 645 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 646 | ** NFA_STATUS_FAILED otherwise |
| 647 | ** |
| 648 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 649 | extern tNFA_STATUS NFA_HciDeletePipe(tNFA_HANDLE hci_handle, uint8_t pipe); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 650 | |
| 651 | /******************************************************************************* |
| 652 | ** |
| 653 | ** Function NFA_HciAddStaticPipe |
| 654 | ** |
| 655 | ** Description This function is called to add a static pipe for sending |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 656 | ** 7816 APDUs. When the static pipe is added (or if an error |
| 657 | ** occurs), the app will be notified with |
| 658 | ** NFA_HCI_ADD_STATIC_PIPE_EVT with status. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 659 | ** |
| 660 | ** Returns NFA_STATUS_OK if successfully initiated |
| 661 | ** NFA_STATUS_FAILED otherwise |
| 662 | ** |
| 663 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 664 | extern tNFA_STATUS NFA_HciAddStaticPipe(tNFA_HANDLE hci_handle, uint8_t host, |
| 665 | uint8_t gate, uint8_t pipe); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 666 | |
nxpandroid | 5e58978 | 2017-08-14 11:54:50 +0530 | [diff] [blame] | 667 | #if (NXP_EXTNS == TRUE) |
nxpandroid | 3e4012e | 2016-08-01 19:09:55 +0530 | [diff] [blame] | 668 | /******************************************************************************* |
| 669 | ** |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 670 | ** Function NFA_HciSendResponse |
nxpandroid | 3e4012e | 2016-08-01 19:09:55 +0530 | [diff] [blame] | 671 | ** |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 672 | ** Description This function is called to send a response on a pipe created |
| 673 | ** by the application. |
| 674 | ** The app will be notified by NFA_HCI_RSP_SENT_EVT if an error |
| 675 | ** occurs. |
| 676 | ** |
| 677 | ** Returns NFA_STATUS_OK if successfully initiated |
| 678 | ** NFA_STATUS_FAILED otherwise |
nxpandroid | 3e4012e | 2016-08-01 19:09:55 +0530 | [diff] [blame] | 679 | ** |
| 680 | *******************************************************************************/ |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 681 | extern tNFA_STATUS NFA_HciSendResponse(tNFA_HANDLE hci_handle, uint8_t pipe, |
| 682 | uint8_t response, uint8_t data_size, |
| 683 | uint8_t* p_data); |
| 684 | /******************************************************************************* |
| 685 | ** |
| 686 | ** Function NFA_HciSendApdu |
| 687 | ** |
| 688 | ** Description This function is called to send APDU commands to one of |
| 689 | ** the host that acts as a server APDU host and to receive |
| 690 | ** response from that host on APDU pipe. |
| 691 | ** |
| 692 | ** The application will be notified by NFA_HCI_CMD_APDU_SENT_EVT |
| 693 | ** after successfully sending the APDU command on APDU pipe of |
| 694 | ** the specified host or if an error occurs. The application |
| 695 | ** should wait for this event before releasing APDU command |
| 696 | ** buffer passed as an argument. The application should provide |
| 697 | ** response APDU buffer for collecting the response APDU. |
| 698 | ** The application will be notified by NFA_HCI_RSP_APDU_RCVD_EVT |
| 699 | ** after receiving the response APDU or on timeout if timeout |
| 700 | ** can be automatically detected on the pipe (If APDU Pipe is |
| 701 | ** connected to APDU Gate implemented as per spec ETSI TS 102 |
| 702 | ** 622 V12.1.0) on destination host. |
| 703 | ** If a response buffer is provided by the application, it |
| 704 | ** should wait for NFA_HCI_RSP_APDU_RCVD_EVT event or call |
| 705 | ** NFA_HciAbortApdu and wait for NFA_HCI_APDU_ABORTED_EVT |
| 706 | ** before releasing the response APDU buffer. |
| 707 | ** |
| 708 | ** Returns NFA_STATUS_OK if successfully initiated |
| 709 | ** NFA_STATUS_FAILED otherwise |
| 710 | ** |
| 711 | *******************************************************************************/ |
| 712 | tNFC_STATUS NFA_HciSendApdu (tNFA_HANDLE hci_handle, |
| 713 | uint8_t host_id, |
| 714 | uint16_t cmd_apdu_len, |
| 715 | uint8_t *p_cmd_apdu, |
| 716 | uint16_t rsp_apdu_buf_size, |
| 717 | uint8_t *p_rsp_apdu_buf, |
| 718 | uint32_t rsp_timeout); |
| 719 | |
| 720 | /******************************************************************************* |
| 721 | ** |
| 722 | ** Function NFA_HciAbortApdu |
| 723 | ** |
| 724 | ** Description This function is called to stop waiting for response APDU |
| 725 | ** for the command APDU sent by the application on the APDU pipe |
| 726 | ** of the specified host. The application will be notified by |
| 727 | ** NFA_HCI_APDU_ABORTED_EVT after releasing response buffer |
| 728 | ** provided with NFA_HciSendApdu for collecting the response |
| 729 | ** APDU and releasing the APDU pipe for sending next command |
| 730 | ** APDU on the pipe. |
| 731 | ** If APDU server host supports EVT_ABORT then the server host |
| 732 | ** is also notified to Abort the APDU command and wait for |
| 733 | ** it to confirm with EVT_ATR that it stopped processing the |
| 734 | ** command APDU before releasing the response buffer and |
| 735 | ** reporting NFA_HCI_APDU_ABORTED_EVT to the application |
| 736 | ** |
| 737 | ** Returns NFA_STATUS_OK if successfully initiated |
| 738 | ** NFA_STATUS_FAILED otherwise |
| 739 | ** |
| 740 | *******************************************************************************/ |
| 741 | tNFC_STATUS NFA_HciAbortApdu (tNFA_HANDLE hci_handle, uint8_t host_id, uint32_t rsp_timeout); |
| 742 | |
nxpandroid | 3e4012e | 2016-08-01 19:09:55 +0530 | [diff] [blame] | 743 | #endif |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 744 | /******************************************************************************* |
| 745 | ** |
| 746 | ** Function NFA_HciDebug |
| 747 | ** |
| 748 | ** Description Debug function. |
| 749 | ** |
| 750 | *******************************************************************************/ |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 751 | extern void NFA_HciDebug(uint8_t action, uint8_t size, uint8_t* p_data); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 752 | |
| 753 | #endif /* NFA_P2P_API_H */ |