blob: 13a213a88010ae5fa2c0c8449b6184f7e72a026b [file] [log] [blame]
nxpandroidc7611652015-09-23 16:42:05 +05301/******************************************************************************
2 *
3 * Copyright (C) 2009-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 *
nxf24591c1cbeab2018-02-21 17:32:26 +053020 * The original Work has been changed by NXP.
nxpandroidc7611652015-09-23 16:42:05 +053021 *
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 *
nxf24591c1cbeab2018-02-21 17:32:26 +053034 * Copyright 2018 NXP
35 *
nxpandroidc7611652015-09-23 16:42:05 +053036 ******************************************************************************/
nxpandroidc7611652015-09-23 16:42:05 +053037/******************************************************************************
38 *
39 * This file contains the Near Field Communication (NFC) API function
40 * external definitions.
41 *
42 ******************************************************************************/
43
44#ifndef NFC_API_H
45#define NFC_API_H
46
nxf24591c1cbeab2018-02-21 17:32:26 +053047#include "gki.h"
nxpandroidc7611652015-09-23 16:42:05 +053048#include "nci_defs.h"
49#include "nfc_hal_api.h"
nxf24591c1cbeab2018-02-21 17:32:26 +053050#include "nfc_target.h"
51
nxpandroidcdd30442016-05-27 17:26:18 +053052#include "vendor_cfg.h"
nxpandroid84a71e02017-08-14 11:58:25 +053053
nxf24591c1cbeab2018-02-21 17:32:26 +053054
55#if (NXP_EXTNS == TRUE)
56#define NXP_EN_SN100U 1
57#define NXP_ANDROID_VER (9U) /* NXP android version */
58#define NFC_NXP_MW_VERSION_MAJ (0x00) /* MW Major Version */
nxf2459137d4e162018-08-07 10:24:20 +053059#define NFC_NXP_MW_VERSION_MIN (0x0B) /* MW Minor Version */
nxf24591674f2722018-08-08 00:56:16 +053060#define NFC_NXP_MW_RC_VERSION (0x00) /* MW Minor Version */
nxf2459148793b62018-06-06 14:40:49 +053061#define NFC_EE_DISC_OP_REMOVE 1
nxf24591c1cbeab2018-02-21 17:32:26 +053062#endif
nxpandroidc7611652015-09-23 16:42:05 +053063/* NFC application return status codes */
nxpandroid8f6d0532017-07-12 18:25:30 +053064/* Command succeeded */
65#define NFC_STATUS_OK NCI_STATUS_OK
66/* Command is rejected. */
67#define NFC_STATUS_REJECTED NCI_STATUS_REJECTED
68/* Message is corrupted */
69#define NFC_STATUS_MSG_CORRUPTED NCI_STATUS_MESSAGE_CORRUPTED
70/* buffer full */
71#define NFC_STATUS_BUFFER_FULL NCI_STATUS_BUFFER_FULL
72/* failed */
73#define NFC_STATUS_FAILED NCI_STATUS_FAILED
74/* not initialized */
75#define NFC_STATUS_NOT_INITIALIZED NCI_STATUS_NOT_INITIALIZED
76/* Syntax error */
77#define NFC_STATUS_SYNTAX_ERROR NCI_STATUS_SYNTAX_ERROR
78/* Semantic error */
79#define NFC_STATUS_SEMANTIC_ERROR NCI_STATUS_SEMANTIC_ERROR
80/* Unknown NCI Group ID */
81#define NFC_STATUS_UNKNOWN_GID NCI_STATUS_UNKNOWN_GID
82/* Unknown NCI Opcode */
83#define NFC_STATUS_UNKNOWN_OID NCI_STATUS_UNKNOWN_OID
84/* Invalid Parameter */
85#define NFC_STATUS_INVALID_PARAM NCI_STATUS_INVALID_PARAM
86/* Message size too big */
87#define NFC_STATUS_MSG_SIZE_TOO_BIG NCI_STATUS_MSG_SIZE_TOO_BIG
88/* Already started */
89#define NFC_STATUS_ALREADY_STARTED NCI_STATUS_ALREADY_STARTED
90/* Activation Failed */
91#define NFC_STATUS_ACTIVATION_FAILED NCI_STATUS_ACTIVATION_FAILED
92/* Tear Down Error */
93#define NFC_STATUS_TEAR_DOWN NCI_STATUS_TEAR_DOWN
94/* RF transmission error*/
95#define NFC_STATUS_RF_TRANSMISSION_ERR NCI_STATUS_RF_TRANSMISSION_ERR
96/* RF protocol error */
97#define NFC_STATUS_RF_PROTOCOL_ERR NCI_STATUS_RF_PROTOCOL_ERR
98/* RF Timeout */
99#define NFC_STATUS_TIMEOUT NCI_STATUS_TIMEOUT
100/* EE Intf activate err */
101#define NFC_STATUS_EE_INTF_ACTIVE_FAIL NCI_STATUS_EE_INTF_ACTIVE_FAIL
102/* EE transmission error*/
103#define NFC_STATUS_EE_TRANSMISSION_ERR NCI_STATUS_EE_TRANSMISSION_ERR
104/* EE protocol error */
105#define NFC_STATUS_EE_PROTOCOL_ERR NCI_STATUS_EE_PROTOCOL_ERR
106/* EE Timeout */
107#define NFC_STATUS_EE_TIMEOUT NCI_STATUS_EE_TIMEOUT
nxpandroidc7611652015-09-23 16:42:05 +0530108
nxpandroidc7611652015-09-23 16:42:05 +0530109/* 0xE0 ~0xFF are proprietary status codes */
nxpandroid8f6d0532017-07-12 18:25:30 +0530110/* Command started successfully */
111#define NFC_STATUS_CMD_STARTED 0xE3
nxpandroid8f6d0532017-07-12 18:25:30 +0530112/* NFCC Timeout in responding to an NCI command */
113#define NFC_STATUS_HW_TIMEOUT 0xE4
nxpandroid8f6d0532017-07-12 18:25:30 +0530114/* More (same) event to follow */
115#define NFC_STATUS_CONTINUE 0xE5
116/* API is called to perform illegal function */
117#define NFC_STATUS_REFUSED 0xE6
118/* Wrong format of R-APDU, CC file or NDEF file */
119#define NFC_STATUS_BAD_RESP 0xE7
120/* 7816 Status Word is not command complete(0x9000) */
121#define NFC_STATUS_CMD_NOT_CMPLTD 0xE8
122/* Out of GKI buffers */
123#define NFC_STATUS_NO_BUFFERS 0xE9
124/* Protocol mismatch between API and activated one */
125#define NFC_STATUS_WRONG_PROTOCOL 0xEA
126/* Another Tag command is already in progress */
127#define NFC_STATUS_BUSY 0xEB
nxpandroidc7611652015-09-23 16:42:05 +0530128
nxpandroid8f6d0532017-07-12 18:25:30 +0530129/* Link Loss */
130#define NFC_STATUS_LINK_LOSS 0xFC
131/* data len exceeds MIU */
132#define NFC_STATUS_BAD_LENGTH 0xFD
133/* invalid handle */
134#define NFC_STATUS_BAD_HANDLE 0xFE
135/* congested */
136#define NFC_STATUS_CONGESTED 0xFF
137typedef uint8_t tNFC_STATUS;
nxf24591c1cbeab2018-02-21 17:32:26 +0530138
nxpandroid25862ca2015-11-06 18:43:02 +0530139#if (NXP_EXTNS == TRUE)
nxpandroid8f6d0532017-07-12 18:25:30 +0530140#define NFC_NFCC_INIT_MAX_RETRY 2
141#define NFC_NORMAL_BOOT_MODE 0
142#define NFC_FAST_BOOT_MODE 1
143#define NFC_OSU_BOOT_MODE 2
144#define UICC1_HOST ((unsigned char)0x02)
145#define UICC2_HOST ((unsigned char)0x81)
146#define DH_HOST ((unsigned char)0x00)
147#define ESE_HOST ((unsigned char)0xC0)
148#define NXP_FEATURE_ENABLED \
149 ((unsigned char)0x01) /* flag to indicate NXP feature is enabled*/
150#define NXP_FEATURE_DISABLED \
151 ((unsigned char)0x00) /* flag to indicate NXP feature is enabled*/
nxpandroid47796b52017-04-07 15:40:53 +0530152#define NXP_NFC_PARAM_SWP_SESSIONID_INT2 ((unsigned char)0xEB)
153#define NXP_NFC_PARAM_SWP_SESSION_ID_LEN 8
nxpandroid8f6d0532017-07-12 18:25:30 +0530154#define NXP_NFC_PROP_MAX_CMD_BUF_SIZE ((unsigned char)0x40)
155#define NXP_NFC_SET_MSB(x) (x |= 0x80)
156#define NXP_NFC_RESET_MSB(x) (x &= 0x7F)
nxpandroidb708f582017-09-13 16:02:41 +0530157#define NXP_NFC_ESE_CONN_PIPE_STATUS ((unsigned char)0x22)
158#define NXP_NFC_ESE_APDU_PIPE_STATUS ((unsigned char)0x23)
nxpandroid8f6d0532017-07-12 18:25:30 +0530159/**********************************************
160 * NFC Config Parameter IDs defined by NXP NFC
161 **********************************************/
162#define NXP_NFC_SET_CONFIG_PARAM_EXT \
163 ((unsigned char)0xA0) /* NXP NFC set config extension ID*/
164#define NXP_NFC_PARAM_ID_SWP1 \
165 ((unsigned char)0xEC) /* SWP1 parameter ID \
166 UICC*/
167#define NXP_NFC_PARAM_ID_SWP2 \
168 ((unsigned char)0xED) /* SWP1 parameter ID ESE \
169 */
170#define NXP_NFC_PARAM_ID_SWP1A \
171 ((unsigned char)0xD4) /* SWP1 parameter ID UICC2 */
nxf24591c1cbeab2018-02-21 17:32:26 +0530172
173#define NXP_NFC_PARAM_ID_SWPUICC3 \
174 ((unsigned char)0xDC) /* SWP1 parameter ID UICC3 */
nxpandroid8f6d0532017-07-12 18:25:30 +0530175#define NXP_NFC_PARAM_ID_NDEF_NFCEE \
176 ((unsigned char)0x95) /* SWP1 parameter ID NDEF NFCEE */
177#define NXP_NFC_PARAM_ID_RF_PARAM_UICC \
178 ((unsigned char)0xEF) /* UICC CE RF parameter */
179#define NXP_NFC_PARAM_ID_RF_PARAM_ESE \
180 ((unsigned char)0xF0) /* ESE RF parameter */
181#define NXP_NFC_PARAM_ID_NFCC_RF_CONFIG \
182 ((unsigned char)0x9B) /* NFCC RF config parameter*/
183#define NXP_NFC_EMVCO_PCD_COLLISION_DETECTED \
184 ((unsigned char)0xE4) /* Core generic error for EMVCO collision detected */
185#define NXP_NFC_PARAM_ID_RF_PARAM_UICC2 \
186 ((unsigned char)0xE8) /* UICC2 CE RF parameter */
187#define NXP_NFC_PARAM_SWP_SESSIONID_INT2 \
188 ((unsigned char)0xEB) /* param for retrieveing HCI session ID for ESE */
189#define NXP_NFC_PARAM_SWP_SESSIONID_INT1 \
190 ((unsigned char)0xEA) /* param for retrieveing HCI session ID for UICC */
191#define NXP_NFC_PARAM_SWP_SESSIONID_INT1A \
192 ((unsigned char)0x1E) /* param for retrieveing HCI session ID for UICC2 */
nxpandroidc7611652015-09-23 16:42:05 +0530193#endif
nxpandroidc7611652015-09-23 16:42:05 +0530194/**********************************************
195 * NFC Config Parameter IDs defined by NCI
196 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530197#define NFC_PMID_TOTAL_DURATION NCI_PARAM_ID_TOTAL_DURATION
nxpandroid8f6d0532017-07-12 18:25:30 +0530198#define NFC_PMID_PF_RC NCI_PARAM_ID_PF_RC
nxpandroid8f6d0532017-07-12 18:25:30 +0530199#define NFC_PMID_ATR_REQ_GEN_BYTES NCI_PARAM_ID_ATR_REQ_GEN_BYTES
nxpandroid8f6d0532017-07-12 18:25:30 +0530200#define NFC_PMID_LA_HIST_BY NCI_PARAM_ID_LA_HIST_BY
201#define NFC_PMID_LA_NFCID1 NCI_PARAM_ID_LA_NFCID1
nxpandroid8f6d0532017-07-12 18:25:30 +0530202#define NFC_PMID_LA_BIT_FRAME_SDD NCI_PARAM_ID_LA_BIT_FRAME_SDD
nxpandroidc7611652015-09-23 16:42:05 +0530203#define NFC_PMID_LA_PLATFORM_CONFIG NCI_PARAM_ID_LA_PLATFORM_CONFIG
nxpandroid8f6d0532017-07-12 18:25:30 +0530204#define NFC_PMID_LA_SEL_INFO NCI_PARAM_ID_LA_SEL_INFO
nxpandroid8f6d0532017-07-12 18:25:30 +0530205#define NFC_PMID_LB_SENSB_INFO NCI_PARAM_ID_LB_SENSB_INFO
nxpandroid8f6d0532017-07-12 18:25:30 +0530206#define NFC_PMID_LB_H_INFO NCI_PARAM_ID_LB_H_INFO_RSP
207#define NFC_PMID_LB_NFCID0 NCI_PARAM_ID_LB_NFCID0
208#define NFC_PMID_LB_APPDATA NCI_PARAM_ID_LB_APPDATA
209#define NFC_PMID_LB_SFGI NCI_PARAM_ID_LB_SFGI
210#define NFC_PMID_LB_ADC_FO NCI_PARAM_ID_LB_ADC_FO
211#define NFC_PMID_LF_T3T_ID1 NCI_PARAM_ID_LF_T3T_ID1
nxpandroid8f6d0532017-07-12 18:25:30 +0530212#define NFC_PMID_LF_PROTOCOL NCI_PARAM_ID_LF_PROTOCOL
213#define NFC_PMID_LF_T3T_PMM NCI_PARAM_ID_LF_T3T_PMM
nxpandroid8f6d0532017-07-12 18:25:30 +0530214#define NFC_PMID_LF_T3T_FLAGS2 NCI_PARAM_ID_LF_T3T_FLAGS2
215#define NFC_PMID_FWI NCI_PARAM_ID_FWI
216#define NFC_PMID_LF_CON_BITR_F NCI_PARAM_ID_LF_CON_BITR_F
217#define NFC_PMID_WT NCI_PARAM_ID_WT
218#define NFC_PMID_ATR_RES_GEN_BYTES NCI_PARAM_ID_ATR_RES_GEN_BYTES
219#define NFC_PMID_ATR_RSP_CONFIG NCI_PARAM_ID_ATR_RSP_CONFIG
220#define NFC_PMID_RF_FIELD_INFO NCI_PARAM_ID_RF_FIELD_INFO
nxpandroidc7611652015-09-23 16:42:05 +0530221
nxpandroid8f6d0532017-07-12 18:25:30 +0530222/* Technology based routing */
223#define NFC_ROUTE_TAG_TECH NCI_ROUTE_TAG_TECH
224/* Protocol based routing */
225#define NFC_ROUTE_TAG_PROTO NCI_ROUTE_TAG_PROTO
226#define NFC_ROUTE_TAG_AID NCI_ROUTE_TAG_AID /* AID routing */
Suraj Uday Kotharkar6f7757b2018-05-10 15:58:29 +0530227#define NFC_ROUTE_TAG_SYSCODE NCI_ROUTE_TAG_SYSCODE /* System Code routing*/
Suraj Uday Kotharkar11ae20f2018-07-20 23:29:36 +0530228#if (NXP_EXTNS == TRUE)
nxpandroid8f6d0532017-07-12 18:25:30 +0530229/* tag, len, 2 byte value for technology/protocol based routing */
Suraj Uday Kotharkar11ae20f2018-07-20 23:29:36 +0530230#define NFC_ROUTE_TAG_APDU NCI_ROUTE_TAG_APDU /* APDU routing*/
231#endif
nxpandroidc7611652015-09-23 16:42:05 +0530232/* For routing */
nxpandroid8f6d0532017-07-12 18:25:30 +0530233#define NFC_DH_ID NCI_DH_ID /* for DH */
nxpandroidc7611652015-09-23 16:42:05 +0530234/* To identify the loopback test */
nxpandroid8f6d0532017-07-12 18:25:30 +0530235/* use a proprietary range */
236#define NFC_TEST_ID NCI_TEST_ID
nxpandroidc7611652015-09-23 16:42:05 +0530237
nxpandroid8f6d0532017-07-12 18:25:30 +0530238#define NFC_TL_SIZE 2
239#define NFC_SAVED_CMD_SIZE 2
nxpandroidc7611652015-09-23 16:42:05 +0530240
nxpandroid8f6d0532017-07-12 18:25:30 +0530241typedef tNCI_DISCOVER_MAPS tNFC_DISCOVER_MAPS;
nxpandroidc7611652015-09-23 16:42:05 +0530242typedef tNCI_DISCOVER_PARAMS tNFC_DISCOVER_PARAMS;
243
nxpandroid8f6d0532017-07-12 18:25:30 +0530244/* all NFC Manager Callback functions have prototype like void (cback) (uint8_t
245 * event, void *p_data)
nxpandroidc7611652015-09-23 16:42:05 +0530246 * tNFC_DATA_CBACK uses connection id as the first parameter; range 0x00-0x0F.
247 * tNFC_DISCOVER_CBACK uses tNFC_DISCOVER_EVT; range 0x4000 ~
248 * tNFC_RESPONSE_CBACK uses tNFC_RESPONSE_EVT; range 0x5000 ~
249 */
250
nxpandroid8f6d0532017-07-12 18:25:30 +0530251#define NFC_FIRST_DEVT 0x4000
252#define NFC_FIRST_REVT 0x5000
253#define NFC_FIRST_CEVT 0x6000
254#define NFC_FIRST_TEVT 0x8000
nxf24591c1cbeab2018-02-21 17:32:26 +0530255
nxpandroidc7611652015-09-23 16:42:05 +0530256/* the events reported on tNFC_RESPONSE_CBACK */
nxpandroid8f6d0532017-07-12 18:25:30 +0530257enum {
258 NFC_ENABLE_REVT = NFC_FIRST_REVT, /* 0 Enable event */
259 NFC_DISABLE_REVT, /* 1 Disable event */
260 NFC_SET_CONFIG_REVT, /* 2 Set Config Response */
261 NFC_GET_CONFIG_REVT, /* 3 Get Config Response */
262 NFC_NFCEE_DISCOVER_REVT, /* 4 Discover NFCEE response */
263 NFC_NFCEE_INFO_REVT, /* 5 Discover NFCEE Notification */
264 NFC_NFCEE_MODE_SET_REVT, /* 6 NFCEE Mode Set response */
265 NFC_RF_FIELD_REVT, /* 7 RF Field information */
266 NFC_EE_ACTION_REVT, /* 8 EE Action notification */
267 NFC_EE_DISCOVER_REQ_REVT, /* 9 EE Discover Req notification */
268 NFC_SET_ROUTING_REVT, /* 10 Configure Routing response */
269 NFC_GET_ROUTING_REVT, /* 11 Retrieve Routing response */
270 NFC_RF_COMM_PARAMS_UPDATE_REVT, /* 12 RF Communication Param Update */
271 NFC_GEN_ERROR_REVT, /* 13 generic error notification */
272 NFC_NFCC_RESTART_REVT, /* 14 NFCC has been re-initialized */
273 NFC_NFCC_TIMEOUT_REVT, /* 15 NFCC is not responding */
274 NFC_NFCC_TRANSPORT_ERR_REVT, /* 16 NCI Tranport error */
275 NFC_NFCC_POWER_OFF_REVT, /* 17 NFCC turned off */
nxf24591c1cbeab2018-02-21 17:32:26 +0530276 NFC_SET_POWER_SUB_STATE_REVT, /* 18 Set power sub state response */
277 NFC_NFCEE_PL_CONTROL_REVT, /* NFCEE Power/Link Ctrl response*/
278 NFC_NFCEE_STATUS_REVT /* NFCEE Status Notification */
279 /* First vendor-specific rsp event */
nxpandroid65a02602017-01-13 19:13:19 +0530280#if (NXP_EXTNS == TRUE)
nxf24591c1cbeab2018-02-21 17:32:26 +0530281 ,NFC_NFCEE_MODE_SET_INFO /* NFCEE Mode Set Notification event*/
nxpandroid65a02602017-01-13 19:13:19 +0530282#endif
nxpandroidc7611652015-09-23 16:42:05 +0530283};
nxpandroid8f6d0532017-07-12 18:25:30 +0530284typedef uint16_t tNFC_RESPONSE_EVT;
nxpandroidc7611652015-09-23 16:42:05 +0530285
nxpandroid8f6d0532017-07-12 18:25:30 +0530286enum {
287 NFC_CONN_CREATE_CEVT = NFC_FIRST_CEVT, /* 0 Conn Create Response */
288 NFC_CONN_CLOSE_CEVT, /* 1 Conn Close Response */
289 NFC_DEACTIVATE_CEVT, /* 2 Deactivate response/notificatn*/
290 NFC_DATA_CEVT, /* 3 Data */
291 NFC_ERROR_CEVT, /* 4 generic or interface error */
nxf24591c1cbeab2018-02-21 17:32:26 +0530292 NFC_DATA_START_CEVT /* 5 received the first fragment on RF link */
nxpandroid25862ca2015-11-06 18:43:02 +0530293#if (NXP_EXTNS == TRUE)
nxf24591c1cbeab2018-02-21 17:32:26 +0530294 ,NFC_RF_WTX_CEVT, /* 6 received rf wtx */
nxpandroid8f6d0532017-07-12 18:25:30 +0530295 NFC_RF_TRANSMISSION_ERROR, /* 7 CE Error events */
nxpandroid8f6d0532017-07-12 18:25:30 +0530296 NFC_HCI_RESTART_TIMER
nxf24591c1cbeab2018-02-21 17:32:26 +0530297#endif
nxpandroidc7611652015-09-23 16:42:05 +0530298};
nxpandroid8f6d0532017-07-12 18:25:30 +0530299typedef uint16_t tNFC_CONN_EVT;
nxpandroidc7611652015-09-23 16:42:05 +0530300
nxpandroid8f6d0532017-07-12 18:25:30 +0530301#define NFC_NFCC_INFO_LEN 4
nxpandroidc7611652015-09-23 16:42:05 +0530302#ifndef NFC_NFCC_MAX_NUM_VS_INTERFACE
nxpandroid8f6d0532017-07-12 18:25:30 +0530303#define NFC_NFCC_MAX_NUM_VS_INTERFACE 5
nxpandroidc7611652015-09-23 16:42:05 +0530304#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530305typedef struct {
306 tNFC_STATUS status; /* The event status. */
307 uint8_t nci_version; /* the NCI version of NFCC */
308 uint8_t max_conn; /* max number of connections by NFCC*/
309 uint32_t nci_features; /* the NCI features of NFCC */
310 uint16_t nci_interfaces; /* the NCI interfaces of NFCC */
311 uint16_t max_ce_table; /* the max routing table size */
312 uint16_t max_param_size; /* Max Size for Large Parameters */
313 uint8_t manufacture_id; /* the Manufacture ID for NFCC */
314 uint8_t nfcc_info[NFC_NFCC_INFO_LEN]; /* the Manufacture Info for NFCC */
315 uint8_t vs_interface
316 [NFC_NFCC_MAX_NUM_VS_INTERFACE]; /* the NCI VS interfaces of NFCC */
317 uint8_t hci_packet_size; /*HCI payload size*/
318 uint8_t hci_conn_credits; /*max number of HCI credits*/
nxf24591c1cbeab2018-02-21 17:32:26 +0530319 uint16_t max_nfc_v_size; /* maximum frame size for NFC-V*/
nxpandroidc7611652015-09-23 16:42:05 +0530320} tNFC_ENABLE_REVT;
321
nxpandroid8f6d0532017-07-12 18:25:30 +0530322#define NFC_MAX_NUM_IDS 125
nxpandroidc7611652015-09-23 16:42:05 +0530323/* the data type associated with NFC_SET_CONFIG_REVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530324typedef struct {
325 tNFC_STATUS status; /* The event status. */
326 uint8_t num_param_id; /* Number of rejected NCI Param ID */
327 uint8_t param_ids[NFC_MAX_NUM_IDS]; /* NCI Param ID */
nxpandroidc7611652015-09-23 16:42:05 +0530328} tNFC_SET_CONFIG_REVT;
329
330/* the data type associated with NFC_GET_CONFIG_REVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530331typedef struct {
332 tNFC_STATUS status; /* The event status. */
333 uint16_t tlv_size; /* The length of TLV */
334 uint8_t* p_param_tlvs; /* TLV */
nxpandroidc7611652015-09-23 16:42:05 +0530335} tNFC_GET_CONFIG_REVT;
336
nxpandroid8f6d0532017-07-12 18:25:30 +0530337#if (NXP_EXTNS == TRUE)
nxf24591c1cbeab2018-02-21 17:32:26 +0530338typedef struct {
339 tNFC_STATUS status;
340 uint8_t nfcee_id;
341} tNFC_NFCEE_MODE_SET_INFO;
342
343typedef struct {
344 tNFC_STATUS status; /* The event status.*/
345 uint8_t nfcee_id; /* NFCEE ID */
346} tNFC_NFCEE_EE_PWR_LNK_REVT;
347
nxpandroidc7611652015-09-23 16:42:05 +0530348/* This data type is for FW Version */
nxpandroid8f6d0532017-07-12 18:25:30 +0530349typedef struct {
350 uint8_t rom_code_version; /* ROM code Version */
351 uint8_t major_version; /* Major Version */
352 uint8_t minor_version; /* Minor Version */
nxpandroidc7611652015-09-23 16:42:05 +0530353} tNFC_FW_VERSION;
nxpandroid70cccc72016-11-18 19:58:22 +0530354#endif
nxpandroidc7611652015-09-23 16:42:05 +0530355
356/* the data type associated with NFC_NFCEE_DISCOVER_REVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530357typedef struct {
358 tNFC_STATUS status; /* The event status. */
359 uint8_t num_nfcee; /* The number of NFCEE */
nxpandroidc7611652015-09-23 16:42:05 +0530360} tNFC_NFCEE_DISCOVER_REVT;
361
nxpandroid8f6d0532017-07-12 18:25:30 +0530362#define NFC_NFCEE_INTERFACE_APDU NCI_NFCEE_INTERFACE_APDU
363#define NFC_NFCEE_INTERFACE_HCI_ACCESS NCI_NFCEE_INTERFACE_HCI_ACCESS
364#define NFC_NFCEE_INTERFACE_T3T NCI_NFCEE_INTERFACE_T3T
365#define NFC_NFCEE_INTERFACE_TRANSPARENT NCI_NFCEE_INTERFACE_TRANSPARENT
366#define NFC_NFCEE_INTERFACE_PROPRIETARY NCI_NFCEE_INTERFACE_PROPRIETARY
nxpandroidc7611652015-09-23 16:42:05 +0530367
nxpandroid8f6d0532017-07-12 18:25:30 +0530368#define NFC_NFCEE_TAG_HW_ID NCI_NFCEE_TAG_HW_ID
369#define NFC_NFCEE_TAG_ATR_BYTES NCI_NFCEE_TAG_ATR_BYTES
370#define NFC_NFCEE_TAG_T3T_INFO NCI_NFCEE_TAG_T3T_INFO
371#define NFC_NFCEE_TAG_HCI_HOST_ID NCI_NFCEE_TAG_HCI_HOST_ID
nxpandroid8f6d0532017-07-12 18:25:30 +0530372typedef uint8_t tNFC_NFCEE_TAG;
nxpandroidc7611652015-09-23 16:42:05 +0530373/* additional NFCEE Info */
nxpandroid8f6d0532017-07-12 18:25:30 +0530374typedef struct {
375 tNFC_NFCEE_TAG tag;
376 uint8_t len;
377 uint8_t info[NFC_MAX_EE_INFO];
nxpandroidc7611652015-09-23 16:42:05 +0530378} tNFC_NFCEE_TLV;
379
nxf24591c1cbeab2018-02-21 17:32:26 +0530380#if (NXP_EXTNS == TRUE)
nxpandroide5fc6c92017-09-13 13:17:46 +0530381#define NFC_NFCEE_STS_UNRECOVERABLE_ERROR NCI_NFCEE_STS_UNRECOVERABLE_ERROR
382#define NFC_NFCEE_STS_INIT_STARTED NCI_NFCEE_STS_INIT_STARTED
383#define NFC_NFCEE_STS_INIT_COMPLETED NCI_NFCEE_STS_INIT_COMPLETED
nxf24591c1cbeab2018-02-21 17:32:26 +0530384#endif
nxpandroide5fc6c92017-09-13 13:17:46 +0530385
nxpandroid8f6d0532017-07-12 18:25:30 +0530386/* NFCEE connected and inactive */
387#define NFC_NFCEE_STATUS_INACTIVE NCI_NFCEE_STS_CONN_INACTIVE
388/* NFCEE connected and active */
389#define NFC_NFCEE_STATUS_ACTIVE NCI_NFCEE_STS_CONN_ACTIVE
390/* NFCEE removed */
391#define NFC_NFCEE_STATUS_REMOVED NCI_NFCEE_STS_REMOVED
nxpandroide5fc6c92017-09-13 13:17:46 +0530392
nxf24591c1cbeab2018-02-21 17:32:26 +0530393/* the data type associated with NFC_NFCEE_INFO_REVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530394typedef struct {
395 tNFC_STATUS status; /* The event status - place holder */
396 uint8_t nfcee_id; /* NFCEE ID */
397 uint8_t ee_status; /* The NFCEE status. */
398 uint8_t num_interface; /* number of NFCEE interfaces */
399 uint8_t ee_interface[NFC_MAX_EE_INTERFACE]; /* NFCEE interface */
400 uint8_t num_tlvs; /* number of TLVs */
401 tNFC_NFCEE_TLV ee_tlv[NFC_MAX_EE_TLVS]; /* The TLVs associated with NFCEE */
nxf24591c1cbeab2018-02-21 17:32:26 +0530402 bool nfcee_power_ctrl; /* 1, if NFCC has control of NFCEE Power Supply */
nxpandroidc7611652015-09-23 16:42:05 +0530403} tNFC_NFCEE_INFO_REVT;
404
nxpandroid8f6d0532017-07-12 18:25:30 +0530405#define NFC_MODE_ACTIVATE NCI_NFCEE_MD_ACTIVATE
406#define NFC_MODE_DEACTIVATE NCI_NFCEE_MD_DEACTIVATE
407typedef uint8_t tNFC_NFCEE_MODE;
nxpandroidc7611652015-09-23 16:42:05 +0530408/* the data type associated with NFC_NFCEE_MODE_SET_REVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530409typedef struct {
410 tNFC_STATUS status; /* The event status.*/
411 uint8_t nfcee_id; /* NFCEE ID */
412 tNFC_NFCEE_MODE mode; /* NFCEE mode */
nxpandroidc7611652015-09-23 16:42:05 +0530413} tNFC_NFCEE_MODE_SET_REVT;
414
nxf24591c1cbeab2018-02-21 17:32:26 +0530415#if (APPL_DTA_MODE == TRUE)
416/* This data type is for FW Version */
nxpandroid8f6d0532017-07-12 18:25:30 +0530417typedef struct {
nxf24591c1cbeab2018-02-21 17:32:26 +0530418 uint8_t rom_code_version; /* ROM code Version */
419 uint8_t major_version; /* Major Version */
420 uint8_t minor_version; /* Minor Version */
421} tNFC_FW_VERSION;
422#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530423#define NFC_MAX_AID_LEN NCI_MAX_AID_LEN /* 16 */
Suraj Uday Kotharkar11ae20f2018-07-20 23:29:36 +0530424#if (NXP_EXTNS == TRUE)
425#define NFC_MIN_APDU_DATA_LEN NCI_MIN_APDU_DATA_LEN
426#define NFC_MIN_APDU_MASK_LEN NCI_MIN_APDU_MASK_LEN
427#define NFC_MAX_APDU_DATA_LEN NCI_MAX_APDU_DATA_LEN
428#define NFC_MAX_APDU_MASK_LEN NCI_MAX_APDU_MASK_LEN
429#endif
nxpandroidc7611652015-09-23 16:42:05 +0530430/* the data type associated with NFC_CE_GET_ROUTING_REVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530431typedef struct {
432 tNFC_STATUS status; /* The event status */
433 uint8_t nfcee_id; /* NFCEE ID */
434 uint8_t num_tlvs; /* number of TLVs */
435 uint8_t tlv_size; /* the total len of all TLVs */
nxf24591c1cbeab2018-02-21 17:32:26 +0530436 uint8_t param_tlvs[NFC_MAX_EE_TLV_SIZE]; /* the TLVs */
nxpandroidc7611652015-09-23 16:42:05 +0530437} tNFC_GET_ROUTING_REVT;
438
nxpandroidc7611652015-09-23 16:42:05 +0530439/* the data type associated with NFC_CONN_CREATE_CEVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530440typedef struct {
441 tNFC_STATUS status; /* The event status */
442 uint8_t dest_type; /* the destination type */
443 uint8_t id; /* NFCEE ID or RF Discovery ID */
444 uint8_t buff_size; /* The max buffer size */
445 uint8_t num_buffs; /* The number of buffers */
nxpandroidc7611652015-09-23 16:42:05 +0530446} tNFC_CONN_CREATE_CEVT;
447
448/* the data type associated with NFC_CONN_CLOSE_CEVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530449typedef struct {
450 tNFC_STATUS status; /* The event status */
nxpandroidc7611652015-09-23 16:42:05 +0530451} tNFC_CONN_CLOSE_CEVT;
452
453/* the data type associated with NFC_DATA_CEVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530454typedef struct {
455 tNFC_STATUS status; /* The event status */
456 NFC_HDR* p_data; /* The received Data */
nxpandroidc7611652015-09-23 16:42:05 +0530457} tNFC_DATA_CEVT;
458
nxpandroid8f6d0532017-07-12 18:25:30 +0530459/* the data type associated with NFC_NFCEE_PL_CONTROL_REVT */
nxf24591c1cbeab2018-02-21 17:32:26 +0530460typedef struct {
461 tNFC_STATUS status; /* The event status */
462 uint8_t nfcee_id; /* NFCEE ID */
463 tNCI_NFCEE_PL_CONFIG pl_control; /* Power/Link Control command */
nxpandroid8f6d0532017-07-12 18:25:30 +0530464} tNFC_NFCEE_PL_CONTROL_REVT;
465
466/* the data type associated with NFC_NFCEE_STATUS_REVT */
nxf24591c1cbeab2018-02-21 17:32:26 +0530467typedef struct {
468 tNFC_STATUS status; /* The event status */
469 uint8_t nfcee_id; /* NFCEE ID */
470 tNCI_EE_NTF_STATUS nfcee_status; /* NFCEE status */
nxpandroid8f6d0532017-07-12 18:25:30 +0530471} tNFC_NFCEE_STATUS_REVT;
nxpandroidc7611652015-09-23 16:42:05 +0530472/* RF Field Status */
nxpandroid8f6d0532017-07-12 18:25:30 +0530473typedef uint8_t tNFC_RF_STS;
nxpandroidc7611652015-09-23 16:42:05 +0530474
475/* RF Field Technologies */
nxpandroid8f6d0532017-07-12 18:25:30 +0530476#define NFC_RF_TECHNOLOGY_A NCI_RF_TECHNOLOGY_A
477#define NFC_RF_TECHNOLOGY_B NCI_RF_TECHNOLOGY_B
478#define NFC_RF_TECHNOLOGY_F NCI_RF_TECHNOLOGY_F
nxpandroid8f6d0532017-07-12 18:25:30 +0530479typedef uint8_t tNFC_RF_TECH;
nxpandroidc7611652015-09-23 16:42:05 +0530480
nxpandroid8f6d0532017-07-12 18:25:30 +0530481extern uint8_t NFC_GetNCIVersion();
nxf24591c1cbeab2018-02-21 17:32:26 +0530482
nxpandroidc7611652015-09-23 16:42:05 +0530483/* Supported Protocols */
nxpandroid8f6d0532017-07-12 18:25:30 +0530484#define NFC_PROTOCOL_UNKNOWN NCI_PROTOCOL_UNKNOWN /* Unknown */
485/* Type1Tag - NFC-A */
486#define NFC_PROTOCOL_T1T NCI_PROTOCOL_T1T
487/* Type2Tag - NFC-A */
488#define NFC_PROTOCOL_T2T NCI_PROTOCOL_T2T
489/* Type3Tag - NFC-F */
490#define NFC_PROTOCOL_T3T NCI_PROTOCOL_T3T
nxf24591c1cbeab2018-02-21 17:32:26 +0530491/* Type5Tag - NFC-V/ISO15693*/
492#define NFC_PROTOCOL_T5T NFC_PROTOCOL_T5T_(NFC_GetNCIVersion())
493#define NFC_PROTOCOL_T5T_(x) \
494 (((x) == NCI_VERSION_2_0) ? NCI_PROTOCOL_T5T : NCI_PROTOCOL_15693)
nxpandroid8f6d0532017-07-12 18:25:30 +0530495/* Type 4A,4B - NFC-A or NFC-B */
496#define NFC_PROTOCOL_ISO_DEP NCI_PROTOCOL_ISO_DEP
497/* NFCDEP/LLCP - NFC-A or NFC-F */
498#define NFC_PROTOCOL_NFC_DEP NCI_PROTOCOL_NFC_DEP
499#define NFC_PROTOCOL_MIFARE NCI_PROTOCOL_MIFARE
nxf24591c1cbeab2018-02-21 17:32:26 +0530500#define NFC_PROTOCOL_ISO15693 NCI_PROTOCOL_15693
nxpandroid8f6d0532017-07-12 18:25:30 +0530501#define NFC_PROTOCOL_B_PRIME NCI_PROTOCOL_B_PRIME
nxpandroid8f6d0532017-07-12 18:25:30 +0530502#define NFC_PROTOCOL_KOVIO NCI_PROTOCOL_KOVIO
nxf24591c1cbeab2018-02-21 17:32:26 +0530503
504#if (NXP_EXTNS == TRUE)
505#define NFC_PROTOCOL_ISO7816 NCI_PROTOCOL_ISO7816
506#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530507typedef uint8_t tNFC_PROTOCOL;
nxpandroidc7611652015-09-23 16:42:05 +0530508
509/* Discovery Types/Detected Technology and Mode */
nxpandroid8f6d0532017-07-12 18:25:30 +0530510#define NFC_DISCOVERY_TYPE_POLL_A NCI_DISCOVERY_TYPE_POLL_A
511#define NFC_DISCOVERY_TYPE_POLL_B NCI_DISCOVERY_TYPE_POLL_B
512#define NFC_DISCOVERY_TYPE_POLL_F NCI_DISCOVERY_TYPE_POLL_F
513#define NFC_DISCOVERY_TYPE_POLL_A_ACTIVE NCI_DISCOVERY_TYPE_POLL_A_ACTIVE
514#define NFC_DISCOVERY_TYPE_POLL_F_ACTIVE NCI_DISCOVERY_TYPE_POLL_F_ACTIVE
nxf24591c1cbeab2018-02-21 17:32:26 +0530515#define NFC_DISCOVERY_TYPE_POLL_ACTIVE NCI_DISCOVERY_TYPE_POLL_ACTIVE
516#define NFC_DISCOVERY_TYPE_POLL_V NCI_DISCOVERY_TYPE_POLL_V
nxpandroid8f6d0532017-07-12 18:25:30 +0530517#define NFC_DISCOVERY_TYPE_POLL_B_PRIME NCI_DISCOVERY_TYPE_POLL_B_PRIME
518#define NFC_DISCOVERY_TYPE_POLL_KOVIO NCI_DISCOVERY_TYPE_POLL_KOVIO
519#define NFC_DISCOVERY_TYPE_LISTEN_A NCI_DISCOVERY_TYPE_LISTEN_A
520#define NFC_DISCOVERY_TYPE_LISTEN_B NCI_DISCOVERY_TYPE_LISTEN_B
521#define NFC_DISCOVERY_TYPE_LISTEN_F NCI_DISCOVERY_TYPE_LISTEN_F
522#define NFC_DISCOVERY_TYPE_LISTEN_A_ACTIVE NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE
523#define NFC_DISCOVERY_TYPE_LISTEN_F_ACTIVE NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE
nxf24591c1cbeab2018-02-21 17:32:26 +0530524#define NFC_DISCOVERY_TYPE_LISTEN_ACTIVE NCI_DISCOVERY_TYPE_LISTEN_ACTIVE
nxpandroid8f6d0532017-07-12 18:25:30 +0530525#define NFC_DISCOVERY_TYPE_LISTEN_ISO15693 NCI_DISCOVERY_TYPE_LISTEN_ISO15693
526#define NFC_DISCOVERY_TYPE_LISTEN_B_PRIME NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
527typedef uint8_t tNFC_DISCOVERY_TYPE;
528typedef uint8_t tNFC_RF_TECH_N_MODE;
nxpandroidc7611652015-09-23 16:42:05 +0530529
530/* Select Response codes */
nxpandroid8f6d0532017-07-12 18:25:30 +0530531#define NFC_SEL_RES_NFC_FORUM_T2T 0x00
nxpandroidc7611652015-09-23 16:42:05 +0530532
533/* Bit Rates */
nxpandroid8f6d0532017-07-12 18:25:30 +0530534#define NFC_BIT_RATE_212 NCI_BIT_RATE_212 /* 212 kbit/s */
535#define NFC_BIT_RATE_424 NCI_BIT_RATE_424 /* 424 kbit/s */
nxpandroid8f6d0532017-07-12 18:25:30 +0530536typedef uint8_t tNFC_BIT_RATE;
nxpandroidc7611652015-09-23 16:42:05 +0530537
538/**********************************************
539 * Interface Types
540 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530541#define NFC_INTERFACE_EE_DIRECT_RF NCI_INTERFACE_EE_DIRECT_RF
542#define NFC_INTERFACE_FRAME NCI_INTERFACE_FRAME
543#define NFC_INTERFACE_ISO_DEP NCI_INTERFACE_ISO_DEP
nxpandroid8f6d0532017-07-12 18:25:30 +0530544#define NFC_INTERFACE_NFC_DEP NCI_INTERFACE_NFC_DEP
nxpandroid8f6d0532017-07-12 18:25:30 +0530545#define NFC_INTERFACE_MIFARE NCI_INTERFACE_VS_MIFARE
nxpandroidc7611652015-09-23 16:42:05 +0530546typedef tNCI_INTF_TYPE tNFC_INTF_TYPE;
547
548/**********************************************
549 * Deactivation Type
550 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530551#define NFC_DEACTIVATE_TYPE_IDLE NCI_DEACTIVATE_TYPE_IDLE
552#define NFC_DEACTIVATE_TYPE_SLEEP NCI_DEACTIVATE_TYPE_SLEEP
553#define NFC_DEACTIVATE_TYPE_SLEEP_AF NCI_DEACTIVATE_TYPE_SLEEP_AF
554#define NFC_DEACTIVATE_TYPE_DISCOVERY NCI_DEACTIVATE_TYPE_DISCOVERY
555typedef uint8_t tNFC_DEACT_TYPE;
nxpandroidc7611652015-09-23 16:42:05 +0530556
557/**********************************************
558 * Deactivation Reasons
559 **********************************************/
nxf24591c1cbeab2018-02-21 17:32:26 +0530560#define NFC_DEACTIVATE_REASON_DH_REQ_FAILED NCI_DEACTIVATE_REASON_DH_REQ_FAILED
nxpandroid8f6d0532017-07-12 18:25:30 +0530561typedef uint8_t tNFC_DEACT_REASON;
nxpandroidc7611652015-09-23 16:42:05 +0530562
563/* the data type associated with NFC_RF_FIELD_REVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530564typedef struct {
565 tNFC_STATUS status; /* The event status - place holder. */
566 tNFC_RF_STS rf_field; /* RF Field Status */
nxpandroidc7611652015-09-23 16:42:05 +0530567} tNFC_RF_FIELD_REVT;
568
nxpandroid8f6d0532017-07-12 18:25:30 +0530569#define NFC_MAX_APP_DATA_LEN 40
570typedef struct {
571 uint8_t len_aid; /* length of application id */
572 uint8_t aid[NFC_MAX_AID_LEN]; /* application id */
nxpandroidc7611652015-09-23 16:42:05 +0530573} tNFC_AID;
nxpandroid8f6d0532017-07-12 18:25:30 +0530574typedef struct {
575 uint8_t len_aid; /* length of application id */
576 uint8_t aid[NFC_MAX_AID_LEN]; /* application id */
577 uint8_t len_data; /* len of application data */
578 uint8_t data[NFC_MAX_APP_DATA_LEN]; /* application data */
nxpandroidc7611652015-09-23 16:42:05 +0530579} tNFC_APP_INIT;
580
nxpandroid8f6d0532017-07-12 18:25:30 +0530581/* ISO 7816-4 SELECT command */
582#define NFC_EE_TRIG_SELECT NCI_EE_TRIG_7816_SELECT
583/* RF Protocol changed */
584#define NFC_EE_TRIG_RF_PROTOCOL NCI_EE_TRIG_RF_PROTOCOL
585/* RF Technology changed */
586#define NFC_EE_TRIG_RF_TECHNOLOGY NCI_EE_TRIG_RF_TECHNOLOGY
587/* Application initiation */
588#define NFC_EE_TRIG_APP_INIT NCI_EE_TRIG_APP_INIT
589typedef uint8_t tNFC_EE_TRIGGER;
590typedef struct {
591 tNFC_EE_TRIGGER trigger; /* the trigger of this event */
592 union {
593 tNFC_PROTOCOL protocol;
594 tNFC_RF_TECH technology;
595 tNFC_AID aid;
596 tNFC_APP_INIT app_init;
597 } param; /* Discovery Type specific parameters */
nxpandroidc7611652015-09-23 16:42:05 +0530598} tNFC_ACTION_DATA;
599
600/* the data type associated with NFC_EE_ACTION_REVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530601typedef struct {
602 tNFC_STATUS status; /* The event status - place holder */
603 uint8_t nfcee_id; /* NFCEE ID */
604 tNFC_ACTION_DATA act_data; /* data associated /w the action */
nxpandroidc7611652015-09-23 16:42:05 +0530605} tNFC_EE_ACTION_REVT;
606
nxpandroid8f6d0532017-07-12 18:25:30 +0530607#define NFC_EE_DISC_OP_ADD 0
nxpandroid8f6d0532017-07-12 18:25:30 +0530608typedef uint8_t tNFC_EE_DISC_OP;
609typedef struct {
610 tNFC_EE_DISC_OP op; /* add or remove this entry */
611 uint8_t nfcee_id; /* NFCEE ID */
612 tNFC_RF_TECH_N_MODE tech_n_mode; /* Discovery Technology and Mode */
613 tNFC_PROTOCOL protocol; /* NFC protocol */
nxpandroidc7611652015-09-23 16:42:05 +0530614} tNFC_EE_DISCOVER_INFO;
615
616#ifndef NFC_MAX_EE_DISC_ENTRIES
nxpandroid8f6d0532017-07-12 18:25:30 +0530617#define NFC_MAX_EE_DISC_ENTRIES 6
nxpandroidc7611652015-09-23 16:42:05 +0530618#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530619/* T, L, V(NFCEE ID, TechnMode, Protocol) */
620#define NFC_EE_DISCOVER_ENTRY_LEN 5
621#define NFC_EE_DISCOVER_INFO_LEN 3 /* NFCEE ID, TechnMode, Protocol */
nxpandroidc7611652015-09-23 16:42:05 +0530622/* the data type associated with NFC_EE_DISCOVER_REQ_REVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530623typedef struct {
624 tNFC_STATUS status; /* The event status - place holder */
625 uint8_t num_info; /* number of entries in info[] */
626 tNFC_EE_DISCOVER_INFO
627 info[NFC_MAX_EE_DISC_ENTRIES]; /* discovery request from NFCEE */
nxpandroidc7611652015-09-23 16:42:05 +0530628} tNFC_EE_DISCOVER_REQ_REVT;
629
nxpandroid8f6d0532017-07-12 18:25:30 +0530630typedef union {
631 tNFC_STATUS status; /* The event status. */
632 tNFC_ENABLE_REVT enable;
633 tNFC_SET_CONFIG_REVT set_config;
634 tNFC_GET_CONFIG_REVT get_config;
635 tNFC_NFCEE_DISCOVER_REVT nfcee_discover;
636 tNFC_NFCEE_INFO_REVT nfcee_info;
637 tNFC_NFCEE_MODE_SET_REVT mode_set;
nxf24591c1cbeab2018-02-21 17:32:26 +0530638 tNFC_NFCEE_PL_CONTROL_REVT pl_control;
639 tNFC_NFCEE_STATUS_REVT nfcee_status;
nxpandroid8f6d0532017-07-12 18:25:30 +0530640 tNFC_RF_FIELD_REVT rf_field;
641 tNFC_STATUS cfg_routing;
642 tNFC_GET_ROUTING_REVT get_routing;
643 tNFC_EE_ACTION_REVT ee_action;
644 tNFC_EE_DISCOVER_REQ_REVT ee_discover_req;
645 void* p_vs_evt_data;
nxpandroidc7611652015-09-23 16:42:05 +0530646} tNFC_RESPONSE;
647
648/*************************************
649** RESPONSE Callback Functions
650**************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530651typedef void(tNFC_RESPONSE_CBACK)(tNFC_RESPONSE_EVT event,
652 tNFC_RESPONSE* p_data);
nxpandroidc7611652015-09-23 16:42:05 +0530653
654/* The events reported on tNFC_VS_CBACK */
nxpandroid8f6d0532017-07-12 18:25:30 +0530655/* The event is (NCI_RSP_BIT|oid) for response and (NCI_NTF_BIT|oid) for
656 * notification*/
nxpandroidc7611652015-09-23 16:42:05 +0530657
nxpandroid8f6d0532017-07-12 18:25:30 +0530658typedef uint8_t tNFC_VS_EVT;
nxpandroidc7611652015-09-23 16:42:05 +0530659
660/*************************************
661** Proprietary (Vendor Specific) Callback Functions
662**************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530663typedef void(tNFC_VS_CBACK)(tNFC_VS_EVT event, uint16_t data_len,
664 uint8_t* p_data);
nxpandroidc7611652015-09-23 16:42:05 +0530665
666/* the events reported on tNFC_DISCOVER_CBACK */
nxpandroid8f6d0532017-07-12 18:25:30 +0530667enum {
668 NFC_START_DEVT = NFC_FIRST_DEVT, /* Status of NFC_DiscoveryStart */
669 NFC_MAP_DEVT, /* Status of NFC_DiscoveryMap */
670 NFC_RESULT_DEVT, /* The responses from remote device */
671 NFC_SELECT_DEVT, /* Status of NFC_DiscoverySelect */
672 NFC_ACTIVATE_DEVT, /* RF interface is activated */
673 NFC_DEACTIVATE_DEVT /* Status of RF deactivation */
nxpandroidc7611652015-09-23 16:42:05 +0530674};
nxpandroid8f6d0532017-07-12 18:25:30 +0530675typedef uint16_t tNFC_DISCOVER_EVT;
nxpandroidc7611652015-09-23 16:42:05 +0530676
677/* the data type associated with NFC_START_DEVT */
678typedef tNFC_STATUS tNFC_START_DEVT;
679
680typedef tNCI_RF_PA_PARAMS tNFC_RF_PA_PARAMS;
nxpandroid8f6d0532017-07-12 18:25:30 +0530681#define NFC_MAX_SENSB_RES_LEN NCI_MAX_SENSB_RES_LEN
682#define NFC_NFCID0_MAX_LEN 4
nxpandroid8f6d0532017-07-12 18:25:30 +0530683typedef struct {
684 uint8_t sensb_res_len; /* Length of SENSB_RES Response (Byte 2 - Byte 12 or
685 13) Available after Technology Detection */
686 uint8_t sensb_res[NFC_MAX_SENSB_RES_LEN]; /* SENSB_RES Response (ATQ) */
687 uint8_t nfcid0[NFC_NFCID0_MAX_LEN];
nxpandroidc7611652015-09-23 16:42:05 +0530688} tNFC_RF_PB_PARAMS;
689
nxpandroid8f6d0532017-07-12 18:25:30 +0530690#define NFC_MAX_SENSF_RES_LEN NCI_MAX_SENSF_RES_LEN
691#define NFC_NFCID2_LEN NCI_NFCID2_LEN
692typedef struct {
693 uint8_t bit_rate; /* NFC_BIT_RATE_212 or NFC_BIT_RATE_424 */
694 uint8_t sensf_res_len; /* Length of SENSF_RES Response (Byte 2 - Byte 17 or
695 19) Available after Technology Detection */
696 uint8_t sensf_res[NFC_MAX_SENSF_RES_LEN]; /* SENSB_RES Response */
697 uint8_t nfcid2[NFC_NFCID2_LEN]; /* NFCID2 generated by the Local NFCC for
698 NFC-DEP Protocol.Available for Frame
699 Interface */
700 uint8_t mrti_check;
701 uint8_t mrti_update;
nxpandroidc7611652015-09-23 16:42:05 +0530702} tNFC_RF_PF_PARAMS;
703
704typedef tNCI_RF_LF_PARAMS tNFC_RF_LF_PARAMS;
705
nxpandroid8f6d0532017-07-12 18:25:30 +0530706#define NFC_ISO15693_UID_LEN 8
707typedef struct {
708 uint8_t flag;
709 uint8_t dsfid;
710 uint8_t uid[NFC_ISO15693_UID_LEN];
nxpandroidc7611652015-09-23 16:42:05 +0530711} tNFC_RF_PISO15693_PARAMS;
712
713#ifndef NFC_KOVIO_MAX_LEN
nxpandroid8f6d0532017-07-12 18:25:30 +0530714#define NFC_KOVIO_MAX_LEN 32
nxpandroidc7611652015-09-23 16:42:05 +0530715#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530716typedef struct {
717 uint8_t uid_len;
718 uint8_t uid[NFC_KOVIO_MAX_LEN];
nxpandroidc7611652015-09-23 16:42:05 +0530719} tNFC_RF_PKOVIO_PARAMS;
720
nxf24591c1cbeab2018-02-21 17:32:26 +0530721typedef tNCI_RF_ACM_P_PARAMS tNFC_RF_ACM_P_PARAMS;
722
nxpandroid8f6d0532017-07-12 18:25:30 +0530723typedef union {
724 tNFC_RF_PA_PARAMS pa;
725 tNFC_RF_PB_PARAMS pb;
726 tNFC_RF_PF_PARAMS pf;
727 tNFC_RF_LF_PARAMS lf;
728 tNFC_RF_PISO15693_PARAMS pi93;
729 tNFC_RF_PKOVIO_PARAMS pk;
nxf24591c1cbeab2018-02-21 17:32:26 +0530730 tNFC_RF_ACM_P_PARAMS acm_p;
nxpandroidc7611652015-09-23 16:42:05 +0530731} tNFC_RF_TECH_PARAMU;
732
nxpandroid8f6d0532017-07-12 18:25:30 +0530733typedef struct {
734 tNFC_DISCOVERY_TYPE mode;
735 tNFC_RF_TECH_PARAMU param;
nxpandroidc7611652015-09-23 16:42:05 +0530736} tNFC_RF_TECH_PARAMS;
737
738/* the data type associated with NFC_RESULT_DEVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530739typedef struct {
740 tNFC_STATUS status; /* The event status - place holder. */
741 uint8_t rf_disc_id; /* RF Discovery ID */
742 uint8_t protocol; /* supported protocol */
743 tNFC_RF_TECH_PARAMS rf_tech_param; /* RF technology parameters */
744 uint8_t more; /* 0: last, 1: last (limit), 2: more */
nxpandroidc7611652015-09-23 16:42:05 +0530745} tNFC_RESULT_DEVT;
746
747/* the data type associated with NFC_SELECT_DEVT */
748typedef tNFC_STATUS tNFC_SELECT_DEVT;
749
750/* the data type associated with NFC_STOP_DEVT */
751typedef tNFC_STATUS tNFC_STOP_DEVT;
752
nxpandroid8f6d0532017-07-12 18:25:30 +0530753#define NFC_MAX_ATS_LEN NCI_MAX_ATS_LEN
754#define NFC_MAX_HIS_BYTES_LEN NCI_MAX_HIS_BYTES_LEN
755#define NFC_MAX_GEN_BYTES_LEN NCI_MAX_GEN_BYTES_LEN
nxpandroidc7611652015-09-23 16:42:05 +0530756
nxpandroid8f6d0532017-07-12 18:25:30 +0530757typedef struct {
758 uint8_t ats_res_len; /* Length of ATS RES */
759 uint8_t ats_res[NFC_MAX_ATS_LEN]; /* ATS RES */
760 bool nad_used; /* NAD is used or not */
761 uint8_t fwi; /* Frame Waiting time Integer */
762 uint8_t sfgi; /* Start-up Frame Guard time Integer*/
763 uint8_t his_byte_len; /* len of historical bytes */
764 uint8_t his_byte[NFC_MAX_HIS_BYTES_LEN]; /* historical bytes */
nxpandroidc7611652015-09-23 16:42:05 +0530765} tNFC_INTF_PA_ISO_DEP;
766
nxpandroid8f6d0532017-07-12 18:25:30 +0530767typedef struct { uint8_t rats; /* RATS */ } tNFC_INTF_LA_ISO_DEP;
nxpandroidc7611652015-09-23 16:42:05 +0530768
nxpandroid8f6d0532017-07-12 18:25:30 +0530769typedef struct {
770 uint8_t atr_res_len; /* Length of ATR_RES */
771 uint8_t atr_res[NFC_MAX_ATS_LEN]; /* ATR_RES (Byte 3 - Byte 17+n) */
772 uint8_t max_payload_size; /* 64, 128, 192 or 254 */
773 uint8_t gen_bytes_len; /* len of general bytes */
774 uint8_t gen_bytes[NFC_MAX_GEN_BYTES_LEN]; /* general bytes */
775 uint8_t
776 waiting_time; /* WT -> Response Waiting Time RWT = (256 x 16/fC) x 2WT */
nxpandroidc7611652015-09-23 16:42:05 +0530777} tNFC_INTF_PA_NFC_DEP;
778
nxpandroid8f6d0532017-07-12 18:25:30 +0530779/* Note: keep tNFC_INTF_PA_NFC_DEP data member in the same order as
780 * tNFC_INTF_LA_NFC_DEP */
781typedef struct {
782 uint8_t atr_req_len; /* Length of ATR_REQ */
783 uint8_t atr_req[NFC_MAX_ATS_LEN]; /* ATR_REQ (Byte 3 - Byte 18+n) */
784 uint8_t max_payload_size; /* 64, 128, 192 or 254 */
785 uint8_t gen_bytes_len; /* len of general bytes */
786 uint8_t gen_bytes[NFC_MAX_GEN_BYTES_LEN]; /* general bytes */
nxpandroidc7611652015-09-23 16:42:05 +0530787} tNFC_INTF_LA_NFC_DEP;
788typedef tNFC_INTF_LA_NFC_DEP tNFC_INTF_LF_NFC_DEP;
789typedef tNFC_INTF_PA_NFC_DEP tNFC_INTF_PF_NFC_DEP;
790
nxpandroid8f6d0532017-07-12 18:25:30 +0530791#define NFC_MAX_ATTRIB_LEN NCI_MAX_ATTRIB_LEN
nxpandroidc7611652015-09-23 16:42:05 +0530792
nxpandroid8f6d0532017-07-12 18:25:30 +0530793typedef struct {
794 uint8_t attrib_res_len; /* Length of ATTRIB RES */
795 uint8_t attrib_res[NFC_MAX_ATTRIB_LEN]; /* ATTRIB RES */
796 uint8_t hi_info_len; /* len of Higher layer Info */
797 uint8_t hi_info[NFC_MAX_GEN_BYTES_LEN]; /* Higher layer Info */
798 uint8_t mbli; /* Maximum buffer length. */
nxpandroidc7611652015-09-23 16:42:05 +0530799} tNFC_INTF_PB_ISO_DEP;
800
nxpandroid8f6d0532017-07-12 18:25:30 +0530801typedef struct {
802 uint8_t attrib_req_len; /* Length of ATTRIB REQ */
803 uint8_t attrib_req[NFC_MAX_ATTRIB_LEN]; /* ATTRIB REQ (Byte 2 - 10+k)*/
804 uint8_t hi_info_len; /* len of Higher layer Info */
805 uint8_t hi_info[NFC_MAX_GEN_BYTES_LEN]; /* Higher layer Info */
806 uint8_t nfcid0[NFC_NFCID0_MAX_LEN]; /* NFCID0 */
nxpandroidc7611652015-09-23 16:42:05 +0530807} tNFC_INTF_LB_ISO_DEP;
808
nxpandroidc7611652015-09-23 16:42:05 +0530809#ifndef NFC_MAX_RAW_PARAMS
nxpandroid8f6d0532017-07-12 18:25:30 +0530810#define NFC_MAX_RAW_PARAMS 16
nxpandroidc7611652015-09-23 16:42:05 +0530811#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530812#define NFC_MAX_RAW_PARAMS 16
813typedef struct {
814 uint8_t param_len;
815 uint8_t param[NFC_MAX_RAW_PARAMS];
nxpandroidc7611652015-09-23 16:42:05 +0530816} tNFC_INTF_FRAME;
817
nxpandroid8f6d0532017-07-12 18:25:30 +0530818typedef struct {
819 tNFC_INTF_TYPE type; /* Interface Type 1 Byte See Table 67 */
820 union {
821 tNFC_INTF_LA_ISO_DEP la_iso;
822 tNFC_INTF_PA_ISO_DEP pa_iso;
823 tNFC_INTF_LB_ISO_DEP lb_iso;
824 tNFC_INTF_PB_ISO_DEP pb_iso;
825 tNFC_INTF_LA_NFC_DEP la_nfc;
826 tNFC_INTF_PA_NFC_DEP pa_nfc;
827 tNFC_INTF_LF_NFC_DEP lf_nfc;
828 tNFC_INTF_PF_NFC_DEP pf_nfc;
829 tNFC_INTF_FRAME frame;
830 } intf_param; /* Activation Parameters 0 - n Bytes */
nxpandroidc7611652015-09-23 16:42:05 +0530831} tNFC_INTF_PARAMS;
832
833/* the data type associated with NFC_ACTIVATE_DEVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530834typedef struct {
835 uint8_t rf_disc_id; /* RF Discovery ID */
836 tNFC_PROTOCOL protocol; /* supported protocol */
837 tNFC_RF_TECH_PARAMS rf_tech_param; /* RF technology parameters */
838 tNFC_DISCOVERY_TYPE data_mode; /* for future Data Exchange */
839 tNFC_BIT_RATE tx_bitrate; /* Data Exchange Tx Bitrate */
840 tNFC_BIT_RATE rx_bitrate; /* Data Exchange Rx Bitrate */
841 tNFC_INTF_PARAMS intf_param; /* interface type and params*/
nxpandroidc7611652015-09-23 16:42:05 +0530842} tNFC_ACTIVATE_DEVT;
843
844/* the data type associated with NFC_DEACTIVATE_DEVT and NFC_DEACTIVATE_CEVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530845typedef struct {
846 tNFC_STATUS status; /* The event status. */
847 tNFC_DEACT_TYPE type; /* De-activate type */
nxf24591c1cbeab2018-02-21 17:32:26 +0530848 bool is_ntf; /* TRUE, if deactivate notif*/
849 tNFC_DEACT_REASON reason; /* De-activate reason */
nxpandroidc7611652015-09-23 16:42:05 +0530850} tNFC_DEACTIVATE_DEVT;
851
nxpandroid8f6d0532017-07-12 18:25:30 +0530852typedef union {
853 tNFC_STATUS status; /* The event status. */
854 tNFC_START_DEVT start;
855 tNFC_RESULT_DEVT result;
856 tNFC_SELECT_DEVT select;
857 tNFC_STOP_DEVT stop;
858 tNFC_ACTIVATE_DEVT activate;
859 tNFC_DEACTIVATE_DEVT deactivate;
nxpandroidc7611652015-09-23 16:42:05 +0530860} tNFC_DISCOVER;
861
nxpandroid8f6d0532017-07-12 18:25:30 +0530862typedef struct {
nxf24591c1cbeab2018-02-21 17:32:26 +0530863 bool include_rf_tech_mode; /* TRUE if including RF Tech and Mode update */
nxpandroid8f6d0532017-07-12 18:25:30 +0530864 tNFC_RF_TECH_N_MODE rf_tech_n_mode; /* RF tech and mode */
nxf24591c1cbeab2018-02-21 17:32:26 +0530865 bool include_tx_bit_rate; /* TRUE if including Tx bit rate update */
nxpandroid8f6d0532017-07-12 18:25:30 +0530866 tNFC_BIT_RATE tx_bit_rate; /* Transmit Bit Rate */
nxf24591c1cbeab2018-02-21 17:32:26 +0530867 bool include_rx_bit_rate; /* TRUE if including Rx bit rate update */
nxpandroid8f6d0532017-07-12 18:25:30 +0530868 tNFC_BIT_RATE rx_bit_rate; /* Receive Bit Rate */
nxf24591c1cbeab2018-02-21 17:32:26 +0530869 bool include_nfc_b_config; /* TRUE if including NFC-B data exchange config */
nxpandroid8f6d0532017-07-12 18:25:30 +0530870 uint8_t min_tr0; /* Minimun TR0 */
871 uint8_t min_tr1; /* Minimun TR1 */
872 uint8_t suppression_eos; /* Suppression of EoS */
873 uint8_t suppression_sos; /* Suppression of SoS */
874 uint8_t min_tr2; /* Minimun TR1 */
nxpandroidc7611652015-09-23 16:42:05 +0530875} tNFC_RF_COMM_PARAMS;
876
877/*************************************
878** DISCOVER Callback Functions
879**************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530880typedef void(tNFC_DISCOVER_CBACK)(tNFC_DISCOVER_EVT event,
881 tNFC_DISCOVER* p_data);
nxpandroidc7611652015-09-23 16:42:05 +0530882
nxpandroid8f6d0532017-07-12 18:25:30 +0530883typedef uint16_t tNFC_TEST_EVT;
nxpandroidc7611652015-09-23 16:42:05 +0530884
885/* the data type associated with NFC_LOOPBACK_TEVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530886typedef struct {
887 tNFC_STATUS status; /* The event status. */
888 NFC_HDR* p_data; /* The loop back data from NFCC */
nxpandroidc7611652015-09-23 16:42:05 +0530889} tNFC_LOOPBACK_TEVT;
890
891/* the data type associated with NFC_RF_CONTROL_TEVT */
892typedef tNFC_STATUS tNFC_RF_CONTROL_TEVT;
893
nxpandroid8f6d0532017-07-12 18:25:30 +0530894typedef union {
895 tNFC_STATUS status; /* The event status. */
896 tNFC_LOOPBACK_TEVT loop_back;
897 tNFC_RF_CONTROL_TEVT rf_control;
nxpandroidc7611652015-09-23 16:42:05 +0530898} tNFC_TEST;
899
900/*************************************
901** TEST Callback Functions
902**************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530903typedef void(tNFC_TEST_CBACK)(tNFC_TEST_EVT event, tNFC_TEST* p_data);
nxpandroidc7611652015-09-23 16:42:05 +0530904
905typedef tNFC_DEACTIVATE_DEVT tNFC_DEACTIVATE_CEVT;
nxpandroid8f6d0532017-07-12 18:25:30 +0530906typedef union {
907 tNFC_STATUS status; /* The event status. */
908 tNFC_CONN_CREATE_CEVT conn_create;
909 tNFC_CONN_CLOSE_CEVT conn_close;
910 tNFC_DEACTIVATE_CEVT deactivate;
911 tNFC_DATA_CEVT data;
nxpandroidc7611652015-09-23 16:42:05 +0530912} tNFC_CONN;
913
914/*************************************
915** Data Callback Functions
916**************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530917typedef void(tNFC_CONN_CBACK)(uint8_t conn_id, tNFC_CONN_EVT event,
918 tNFC_CONN* p_data);
919#define NFC_MAX_CONN_ID 15
920#define NFC_ILLEGAL_CONN_ID 0xFF
nxf24591c1cbeab2018-02-21 17:32:26 +0530921/* the static connection ID for RF traffic */
922#define NFC_RF_CONN_ID 0
923/* the static connection ID for HCI transport */
Suraj Uday Kotharkar71fc5802018-06-01 16:57:34 +0530924#define NFC_HCI_CONN_ID 1
nxpandroid8f6d0532017-07-12 18:25:30 +0530925#if (NXP_EXTNS == TRUE)
926#define NFC_NFCEE_CONN_ID 0x03 /* the connection ID for NFCEE */
nxpandroid70cccc72016-11-18 19:58:22 +0530927#endif
nxpandroidc7611652015-09-23 16:42:05 +0530928
929/*****************************************************************************
930** EXTERNAL FUNCTION DECLARATIONS
931*****************************************************************************/
nxpandroidc7611652015-09-23 16:42:05 +0530932
933/*******************************************************************************
934**
935** Function NFC_Enable
936**
937** Description This function enables NFC. Prior to calling NFC_Enable:
nxpandroid8f6d0532017-07-12 18:25:30 +0530938** - the NFCC must be powered up, and ready to receive
939** commands.
nxpandroidc7611652015-09-23 16:42:05 +0530940** - GKI must be enabled
941** - NFC_TASK must be started
nxpandroid8f6d0532017-07-12 18:25:30 +0530942** - NCIT_TASK must be started (if using dedicated NCI
943** transport)
nxpandroidc7611652015-09-23 16:42:05 +0530944**
945** This function opens the NCI transport (if applicable),
nxpandroid8f6d0532017-07-12 18:25:30 +0530946** resets the NFC controller, and initializes the NFC
947** subsystems.
nxpandroidc7611652015-09-23 16:42:05 +0530948**
949** When the NFC startup procedure is completed, an
950** NFC_ENABLE_REVT is returned to the application using the
951** tNFC_RESPONSE_CBACK.
952**
953** Returns tNFC_STATUS
954**
955*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530956extern tNFC_STATUS NFC_Enable(tNFC_RESPONSE_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +0530957
958/*******************************************************************************
959**
960** Function NFC_Disable
961**
962** Description This function performs clean up routines for shutting down
963** NFC and closes the NCI transport (if using dedicated NCI
964** transport).
965**
966** When the NFC shutdown procedure is completed, an
967** NFC_DISABLED_REVT is returned to the application using the
968** tNFC_RESPONSE_CBACK.
969**
970** Returns nothing
971**
972*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530973extern void NFC_Disable(void);
nxpandroidc7611652015-09-23 16:42:05 +0530974
975/*******************************************************************************
976**
977** Function NFC_Init
978**
979** Description This function initializes control blocks for NFC
980**
981** Returns nothing
982**
983*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530984extern void NFC_Init(tHAL_NFC_ENTRY* p_hal_entry_tbl);
nxpandroidc7611652015-09-23 16:42:05 +0530985
986/*******************************************************************************
987**
988** Function NFC_GetLmrtSize
989**
990** Description Called by application wto query the Listen Mode Routing
991** Table size supported by NFCC
992**
993** Returns Listen Mode Routing Table size
994**
995*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530996extern uint16_t NFC_GetLmrtSize(void);
nxpandroidc7611652015-09-23 16:42:05 +0530997
998/*******************************************************************************
999**
1000** Function NFC_SetConfig
1001**
1002** Description This function is called to send the configuration parameter
1003** TLV to NFCC. The response from NFCC is reported by
1004** tNFC_RESPONSE_CBACK as NFC_SET_CONFIG_REVT.
1005**
1006** Parameters tlv_size - the length of p_param_tlvs.
1007** p_param_tlvs - the parameter ID/Len/Value list
1008**
1009** Returns tNFC_STATUS
1010**
1011*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301012extern tNFC_STATUS NFC_SetConfig(uint8_t tlv_size, uint8_t* p_param_tlvs);
nxpandroidc7611652015-09-23 16:42:05 +05301013
1014/*******************************************************************************
1015**
1016** Function NFC_GetConfig
1017**
nxpandroid8f6d0532017-07-12 18:25:30 +05301018** Description This function is called to retrieve the parameter TLV from
1019** NFCC. The response from NFCC is reported by
1020** tNFC_RESPONSE_CBACK as NFC_GET_CONFIG_REVT.
nxpandroidc7611652015-09-23 16:42:05 +05301021**
1022** Parameters num_ids - the number of parameter IDs
1023** p_param_ids - the parameter ID list.
1024**
1025** Returns tNFC_STATUS
1026**
1027*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301028extern tNFC_STATUS NFC_GetConfig(uint8_t num_ids, uint8_t* p_param_ids);
nxpandroidc7611652015-09-23 16:42:05 +05301029
1030/*******************************************************************************
1031**
1032** Function NFC_NfceeDiscover
1033**
nxpandroid8f6d0532017-07-12 18:25:30 +05301034** Description This function is called to enable or disable NFCEE
1035** Discovery. The response from NFCC is reported by
1036** tNFC_RESPONSE_CBACK as NFC_NFCEE_DISCOVER_REVT.
1037** The notification from NFCC is reported by
1038** tNFC_RESPONSE_CBACK as NFC_NFCEE_INFO_REVT.
nxpandroidc7611652015-09-23 16:42:05 +05301039**
1040** Parameters discover - 1 to enable discover, 0 to disable.
1041**
1042** Returns tNFC_STATUS
1043**
1044*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301045extern tNFC_STATUS NFC_NfceeDiscover(bool discover);
nxpandroidc7611652015-09-23 16:42:05 +05301046
1047/*******************************************************************************
1048**
1049** Function NFC_NfceeModeSet
1050**
1051** Description This function is called to activate or de-activate an NFCEE
1052** connected to the NFCC.
1053** The response from NFCC is reported by tNFC_RESPONSE_CBACK
1054** as NFC_NFCEE_MODE_SET_REVT.
1055**
1056** Parameters nfcee_id - the NFCEE to activate or de-activate.
1057** mode - 0 to activate NFCEE, 1 to de-activate.
1058**
1059** Returns tNFC_STATUS
1060**
1061*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301062extern tNFC_STATUS NFC_NfceeModeSet(uint8_t nfcee_id, tNFC_NFCEE_MODE mode);
nxpandroidc7611652015-09-23 16:42:05 +05301063/*******************************************************************************
1064**
1065** Function NFC_DiscoveryMap
1066**
nxpandroid8f6d0532017-07-12 18:25:30 +05301067** Description This function is called to set the discovery interface
1068** mapping. The response from NFCC is reported by
1069** tNFC_DISCOVER_CBACK as. NFC_MAP_DEVT.
nxpandroidc7611652015-09-23 16:42:05 +05301070**
1071** Parameters num - the number of items in p_params.
1072** p_maps - the discovery interface mappings
1073** p_cback - the discovery callback function
1074**
1075** Returns tNFC_STATUS
1076**
1077*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301078extern tNFC_STATUS NFC_DiscoveryMap(uint8_t num, tNFC_DISCOVER_MAPS* p_maps,
1079 tNFC_DISCOVER_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301080
1081/*******************************************************************************
1082**
1083** Function NFC_DiscoveryStart
1084**
1085** Description This function is called to start Polling and/or Listening.
nxpandroid8f6d0532017-07-12 18:25:30 +05301086** The response from NFCC is reported by tNFC_DISCOVER_CBACK
1087** as NFC_START_DEVT. The notification from NFCC is reported by
nxpandroidc7611652015-09-23 16:42:05 +05301088** tNFC_DISCOVER_CBACK as NFC_RESULT_DEVT.
1089**
1090** Parameters num_params - the number of items in p_params.
1091** p_params - the discovery parameters
1092** p_cback - the discovery callback function
1093**
1094** Returns tNFC_STATUS
1095**
1096*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301097extern tNFC_STATUS NFC_DiscoveryStart(uint8_t num_params,
1098 tNFC_DISCOVER_PARAMS* p_params,
1099 tNFC_DISCOVER_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301100
1101/*******************************************************************************
1102**
1103** Function NFC_DiscoverySelect
1104**
1105** Description If tNFC_DISCOVER_CBACK reports status=NFC_MULTIPLE_PROT,
1106** the application needs to use this function to select the
1107** the logical endpoint to continue. The response from NFCC is
1108** reported by tNFC_DISCOVER_CBACK as NFC_SELECT_DEVT.
1109**
1110** Parameters rf_disc_id - The ID identifies the remote device.
1111** protocol - the logical endpoint on the remote devide
1112** rf_interface - the RF interface to communicate with NFCC
1113**
1114** Returns tNFC_STATUS
1115**
1116*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301117extern tNFC_STATUS NFC_DiscoverySelect(uint8_t rf_disc_id, uint8_t protocol,
1118 uint8_t rf_interface);
nxpandroidc7611652015-09-23 16:42:05 +05301119
1120/*******************************************************************************
1121**
1122** Function NFC_ConnCreate
1123**
1124** Description This function is called to create a logical connection with
1125** NFCC for data exchange.
1126** The response from NFCC is reported in tNFC_CONN_CBACK
1127** as NFC_CONN_CREATE_CEVT.
1128**
1129** Parameters dest_type - the destination type
1130** id - the NFCEE ID or RF Discovery ID .
1131** protocol - the protocol
nxpandroid8f6d0532017-07-12 18:25:30 +05301132** p_cback - the data callback function to receive data from
1133** NFCC
nxpandroidc7611652015-09-23 16:42:05 +05301134**
1135** Returns tNFC_STATUS
1136**
1137*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301138extern tNFC_STATUS NFC_ConnCreate(uint8_t dest_type, uint8_t id,
1139 uint8_t protocol, tNFC_CONN_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301140
1141/*******************************************************************************
1142**
1143** Function NFC_ConnClose
1144**
1145** Description This function is called to close a logical connection with
1146** NFCC.
1147** The response from NFCC is reported in tNFC_CONN_CBACK
1148** as NFC_CONN_CLOSE_CEVT.
1149**
1150** Parameters conn_id - the connection id.
1151**
1152** Returns tNFC_STATUS
1153**
1154*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301155extern tNFC_STATUS NFC_ConnClose(uint8_t conn_id);
nxpandroidc7611652015-09-23 16:42:05 +05301156
1157/*******************************************************************************
1158**
1159** Function NFC_SetStaticRfCback
1160**
1161** Description This function is called to update the data callback function
1162** to receive the data for the given connection id.
1163**
1164** Parameters p_cback - the connection callback function
1165**
1166** Returns Nothing
1167**
1168*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301169extern void NFC_SetStaticRfCback(tNFC_CONN_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301170
1171/*******************************************************************************
1172**
1173** Function NFC_SetReassemblyFlag
1174**
1175** Description This function is called to set if nfc will reassemble
1176** nci packet as much as its buffer can hold or it should not
nxpandroid8f6d0532017-07-12 18:25:30 +05301177** reassemble but forward the fragmented nci packet to layer
1178** above. If nci data pkt is fragmented, nfc may send multiple
nxpandroidc7611652015-09-23 16:42:05 +05301179** NFC_DATA_CEVT with status NFC_STATUS_CONTINUE before sending
1180** NFC_DATA_CEVT with status NFC_STATUS_OK based on reassembly
1181** configuration and reassembly buffer size
1182**
1183** Parameters reassembly - flag to indicate if nfc may reassemble or not
1184**
1185** Returns Nothing
1186**
1187*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301188extern void NFC_SetReassemblyFlag(bool reassembly);
nxpandroidc7611652015-09-23 16:42:05 +05301189
1190/*******************************************************************************
1191**
1192** Function NFC_SendData
1193**
1194** Description This function is called to send the given data packet
1195** to the connection identified by the given connection id.
1196**
1197** Parameters conn_id - the connection id.
1198** p_data - the data packet
1199**
1200** Returns tNFC_STATUS
1201**
1202*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301203extern tNFC_STATUS NFC_SendData(uint8_t conn_id, NFC_HDR* p_data);
nxpandroidc7611652015-09-23 16:42:05 +05301204
1205/*******************************************************************************
1206**
1207** Function NFC_FlushData
1208**
1209** Description This function is called to discard the tx data queue of
1210** the given connection id.
1211**
1212** Parameters conn_id - the connection id.
1213**
1214** Returns tNFC_STATUS
1215**
1216*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301217extern tNFC_STATUS NFC_FlushData(uint8_t conn_id);
nxpandroidc7611652015-09-23 16:42:05 +05301218
1219/*******************************************************************************
1220**
1221** Function NFC_Deactivate
1222**
1223** Description This function is called to stop the discovery process or
nxpandroid8f6d0532017-07-12 18:25:30 +05301224** put the listen device in sleep mode or terminate the NFC
1225** link.
nxpandroidc7611652015-09-23 16:42:05 +05301226**
1227** The response from NFCC is reported by tNFC_DISCOVER_CBACK
1228** as NFC_DEACTIVATE_DEVT.
1229**
1230** Parameters deactivate_type - NFC_DEACTIVATE_TYPE_IDLE, to IDLE mode.
1231** NFC_DEACTIVATE_TYPE_SLEEP to SLEEP mode.
nxpandroid8f6d0532017-07-12 18:25:30 +05301232** NFC_DEACTIVATE_TYPE_SLEEP_AF to SLEEP_AF
1233** mode.
nxpandroidc7611652015-09-23 16:42:05 +05301234**
1235** Returns tNFC_STATUS
1236**
1237*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301238extern tNFC_STATUS NFC_Deactivate(tNFC_DEACT_TYPE deactivate_type);
nxpandroidc7611652015-09-23 16:42:05 +05301239
1240/*******************************************************************************
1241**
1242** Function NFC_UpdateRFCommParams
1243**
nxpandroid8f6d0532017-07-12 18:25:30 +05301244** Description This function is called to update RF Communication
1245** parameters once the Frame RF Interface has been activated.
nxpandroidc7611652015-09-23 16:42:05 +05301246**
1247** The response from NFCC is reported by tNFC_RESPONSE_CBACK
1248** as NFC_RF_COMM_PARAMS_UPDATE_REVT.
1249**
1250** Returns tNFC_STATUS
1251**
1252*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301253extern tNFC_STATUS NFC_UpdateRFCommParams(tNFC_RF_COMM_PARAMS* p_params);
nxpandroidc7611652015-09-23 16:42:05 +05301254
1255/*******************************************************************************
1256**
1257** Function NFC_SetPowerOffSleep
1258**
1259** Description This function closes/opens transport and turns off/on NFCC.
1260**
1261** Returns tNFC_STATUS
1262**
1263*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301264extern tNFC_STATUS NFC_SetPowerOffSleep(bool enable);
nxpandroidc7611652015-09-23 16:42:05 +05301265
1266/*******************************************************************************
1267**
nxf24591c1cbeab2018-02-21 17:32:26 +05301268** Function NFC_SetPowerSubState
1269**
1270** Description This function is called to send the power sub state(screen
1271** state) to NFCC. The response from NFCC is reported by
1272** tNFC_RESPONSE_CBACK as NFC_SET_POWER_STATE_REVT.
1273**
1274** Parameters scree_state
1275**
1276** Returns tNFC_STATUS
1277**
1278*******************************************************************************/
1279extern tNFC_STATUS NFC_SetPowerSubState(uint8_t screen_state);
1280
1281/*******************************************************************************
1282**
nxpandroidc7611652015-09-23 16:42:05 +05301283** Function NFC_PowerCycleNFCC
1284**
1285** Description This function turns off and then on NFCC.
1286**
1287** Returns tNFC_STATUS
1288**
1289*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301290extern tNFC_STATUS NFC_PowerCycleNFCC(void);
nxpandroidc7611652015-09-23 16:42:05 +05301291
1292/*******************************************************************************
1293**
1294** Function NFC_SetRouting
1295**
1296** Description This function is called to configure the CE routing table.
1297** The response from NFCC is reported by tNFC_RESPONSE_CBACK
1298** as NFC_SET_ROUTING_REVT.
1299**
1300** Parameters
1301**
1302** Returns tNFC_STATUS
1303**
1304*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301305extern tNFC_STATUS NFC_SetRouting(bool more, uint8_t num_tlv, uint8_t tlv_size,
1306 uint8_t* p_param_tlvs);
nxpandroidc7611652015-09-23 16:42:05 +05301307
1308/*******************************************************************************
1309**
1310** Function NFC_GetRouting
1311**
nxpandroid8f6d0532017-07-12 18:25:30 +05301312** Description This function is called to retrieve the CE routing table
1313** from NFCC. The response from NFCC is reported by
1314** tNFC_RESPONSE_CBACK as NFC_GET_ROUTING_REVT.
nxpandroidc7611652015-09-23 16:42:05 +05301315**
1316** Returns tNFC_STATUS
1317**
1318*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301319extern tNFC_STATUS NFC_GetRouting(void);
nxpandroidc7611652015-09-23 16:42:05 +05301320
1321/*******************************************************************************
1322**
1323** Function NFC_RegVSCback
1324**
nxpandroid8f6d0532017-07-12 18:25:30 +05301325** Description This function is called to register or de-register a
1326** callback function to receive Proprietary NCI response and
1327** notification events.
1328** The maximum number of callback functions allowed is
1329** NFC_NUM_VS_CBACKS
nxpandroidc7611652015-09-23 16:42:05 +05301330**
1331** Returns tNFC_STATUS
1332**
1333*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301334extern tNFC_STATUS NFC_RegVSCback(bool is_register, tNFC_VS_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301335
1336/*******************************************************************************
1337**
1338** Function NFC_SendVsCommand
1339**
1340** Description This function is called to send the given vendor specific
1341** command to NFCC. The response from NFCC is reported to the
1342** given tNFC_VS_CBACK as (oid).
1343**
1344** Parameters oid - The opcode of the VS command.
1345** p_data - The parameters for the VS command
1346**
1347** Returns tNFC_STATUS
1348**
1349*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301350extern tNFC_STATUS NFC_SendVsCommand(uint8_t oid, NFC_HDR* p_data,
1351 tNFC_VS_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301352
nxpandroidc7611652015-09-23 16:42:05 +05301353/*******************************************************************************
1354**
nxf24591c1cbeab2018-02-21 17:32:26 +05301355** Function NFC_SendRawVsCommand
nxpandroidc7611652015-09-23 16:42:05 +05301356**
nxf24591c1cbeab2018-02-21 17:32:26 +05301357** Description This function is called to send the given raw command to
1358** NFCC. The response from NFCC is reported to the given
1359** tNFC_VS_CBACK.
nxpandroidc7611652015-09-23 16:42:05 +05301360**
1361** Parameters p_data - The command buffer
1362**
1363** Returns tNFC_STATUS
1364**
1365*******************************************************************************/
nxf24591c1cbeab2018-02-21 17:32:26 +05301366extern tNFC_STATUS NFC_SendRawVsCommand(NFC_HDR* p_data,
1367 tNFC_VS_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301368
1369/*******************************************************************************
1370**
1371** Function NFC_TestLoopback
1372**
1373** Description This function is called to send the given data packet
1374** to NFCC for loopback test.
1375** When loopback data is received from NFCC, tNFC_TEST_CBACK .
1376** reports a NFC_LOOPBACK_TEVT.
1377**
1378** Parameters p_data - the data packet
1379**
1380** Returns tNFC_STATUS
1381**
1382*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301383extern tNFC_STATUS NFC_TestLoopback(NFC_HDR* p_data);
nxpandroidc7611652015-09-23 16:42:05 +05301384
1385/*******************************************************************************
1386**
nxf24591c1cbeab2018-02-21 17:32:26 +05301387** Function NFC_ISODEPNakPresCheck
nxpandroidc7611652015-09-23 16:42:05 +05301388**
nxf24591c1cbeab2018-02-21 17:32:26 +05301389** Description This function is called to send the ISO DEP nak presence
1390** check cmd to check that the remote end point in RF field.
nxpandroidc7611652015-09-23 16:42:05 +05301391**
nxf24591c1cbeab2018-02-21 17:32:26 +05301392** Returns tNFC_STATUS
nxpandroidc7611652015-09-23 16:42:05 +05301393**
1394*******************************************************************************/
nxf24591c1cbeab2018-02-21 17:32:26 +05301395extern tNFC_STATUS NFC_ISODEPNakPresCheck();
nxpandroidc7611652015-09-23 16:42:05 +05301396
Soma8f4735d2018-06-19 14:24:00 +05301397#if (NXP_EXTNS == TRUE)
nxpandroidc7611652015-09-23 16:42:05 +05301398/*******************************************************************************
1399**
1400** Function nfc_ncif_getFWVersion
1401**
1402** Description This function sets the trace level for NFC. If called with
1403** a value of 0xFF, it simply returns the current trace level.
1404**
1405** Returns The new or current trace level
1406**
1407*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301408extern tNFC_FW_VERSION nfc_ncif_getFWVersion();
nxpandroidc7611652015-09-23 16:42:05 +05301409#endif
1410
nxpandroid8f6d0532017-07-12 18:25:30 +05301411/*******************************************************************************
1412**
1413** Function NFC_NfceePLConfig
1414**
nxf24591c1cbeab2018-02-21 17:32:26 +05301415** Description This function is called to set the Power and Link Control
1416** to an NFCEE connected to the NFCC.
nxpandroid8f6d0532017-07-12 18:25:30 +05301417** The response from NFCC is reported by tNFC_RESPONSE_CBACK
1418** as NFC_NFCEE_PL_CONTROL_REVT.
1419**
nxf24591c1cbeab2018-02-21 17:32:26 +05301420** Parameters nfcee_id - the NFCEE to activate or de-activate.
1421** pl_config -
1422** NFCEE_PL_CONFIG_NFCC_DECIDES -NFCC decides (default)
1423** NFCEE_PL_CONFIG_PWR_ALWAYS_ON -NFCEE power supply always on
1424** NFCEE_PL_CONFIG_LNK_ON_WHEN_PWR_ON -
1425** communication link is always active
1426** when NFCEE is powered on
1427** NFCEE_PL_CONFIG_PWR_LNK_ALWAYS_ON -
1428** power supply and communication
1429** link are always on
nxpandroid8f6d0532017-07-12 18:25:30 +05301430** Returns tNFC_STATUS
1431**
1432*******************************************************************************/
nxf24591c1cbeab2018-02-21 17:32:26 +05301433extern tNFC_STATUS NFC_NfceePLConfig(uint8_t nfcee_id,
1434 tNCI_NFCEE_PL_CONFIG pl_config);
nxpandroid8f6d0532017-07-12 18:25:30 +05301435
1436/*******************************************************************************
1437**
1438** Function NFC_SetStaticHciCback
1439**
nxf24591c1cbeab2018-02-21 17:32:26 +05301440** Description This function to update the data callback function
nxpandroid8f6d0532017-07-12 18:25:30 +05301441** to receive the data for the static Hci connection id.
1442**
1443** Parameters p_cback - the connection callback function
1444**
1445** Returns Nothing
1446**
1447*******************************************************************************/
nxf24591c1cbeab2018-02-21 17:32:26 +05301448extern void NFC_SetStaticHciCback(tNFC_CONN_CBACK* p_cback);
nxpandroid8f6d0532017-07-12 18:25:30 +05301449
1450/*******************************************************************************
1451**
nxf24591c1cbeab2018-02-21 17:32:26 +05301452** Function NFC_GetStatusName
nxpandroid8f6d0532017-07-12 18:25:30 +05301453**
nxf24591c1cbeab2018-02-21 17:32:26 +05301454** Description This function returns the status name.
nxpandroid8f6d0532017-07-12 18:25:30 +05301455**
nxf24591c1cbeab2018-02-21 17:32:26 +05301456** NOTE conditionally compiled to save memory.
nxpandroid8f6d0532017-07-12 18:25:30 +05301457**
nxf24591c1cbeab2018-02-21 17:32:26 +05301458** Returns pointer to the name
nxpandroid8f6d0532017-07-12 18:25:30 +05301459**
1460*******************************************************************************/
nxf24591c1cbeab2018-02-21 17:32:26 +05301461extern std::string NFC_GetStatusName(tNFC_STATUS status);
ubuntu279b7f52017-09-27 19:01:25 +05301462
nxpandroidc7611652015-09-23 16:42:05 +05301463#endif /* NFC_API_H */