blob: a3488ea1516973d82d12aa13fc46781354e1691d [file] [log] [blame]
nxpandroidc7611652015-09-23 16:42:05 +05301/******************************************************************************
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 *
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 ******************************************************************************/
37
38/******************************************************************************
39 *
40 * This is the public interface file for NFA, Broadcom's NFC application
41 * layer for mobile phones.
42 *
43 ******************************************************************************/
44#ifndef NFA_API_H
45#define NFA_API_H
46
nxpandroidc7611652015-09-23 16:42:05 +053047#include "gki.h"
nxf24591c1cbeab2018-02-21 17:32:26 +053048#include "nci_defs.h"
49#include "nfc_api.h"
50#include "nfc_hal_api.h"
51#include "nfc_target.h"
52#include "rw_api.h"
53#include "tags_defs.h"
nxpandroidc7611652015-09-23 16:42:05 +053054
nxpandroidc7611652015-09-23 16:42:05 +053055/*****************************************************************************
56** Constants and data types
57*****************************************************************************/
58
nxpandroid70cccc72016-11-18 19:58:22 +053059/* Max length of Appliction ID in 7816-4 */
nxpandroid8f6d0532017-07-12 18:25:30 +053060#define NFA_MAX_AID_LEN NFC_MAX_AID_LEN
61#define NFA_MIN_AID_LEN 5 /* per NCI specification */
nxf24591c1cbeab2018-02-21 17:32:26 +053062
nxpandroid8f6d0532017-07-12 18:25:30 +053063/* Command succeeded */
64#define NFA_STATUS_OK NCI_STATUS_OK
65/* Command is rejected. */
66#define NFA_STATUS_REJECTED NCI_STATUS_REJECTED
nxpandroid8f6d0532017-07-12 18:25:30 +053067/* buffer full */
68#define NFA_STATUS_BUFFER_FULL NCI_STATUS_BUFFER_FULL
69/* failed */
70#define NFA_STATUS_FAILED NCI_STATUS_FAILED
Suraj Uday Kotharkar6f7757b2018-05-10 15:58:29 +053071/* Optional feature of NCI Spec not supported */
72#define NFA_STATUS_NOT_SUPPORTED NCI_STATUS_NOT_SUPPORTED
nxpandroid8f6d0532017-07-12 18:25:30 +053073/* Semantic error */
74#define NFA_STATUS_SEMANTIC_ERROR NCI_STATUS_SEMANTIC_ERROR
75/* Unknown NCI Group ID */
76#define NFA_STATUS_UNKNOWN_GID NCI_STATUS_UNKNOWN_GID
nxpandroid8f6d0532017-07-12 18:25:30 +053077/* Invalid Parameter */
78#define NFA_STATUS_INVALID_PARAM NCI_STATUS_INVALID_PARAM
nxpandroid8f6d0532017-07-12 18:25:30 +053079/* Already started */
80#define NFA_STATUS_ALREADY_STARTED NCI_STATUS_ALREADY_STARTED
nxpandroid8f6d0532017-07-12 18:25:30 +053081/* RF Timeout */
82#define NFA_STATUS_TIMEOUT NCI_STATUS_TIMEOUT
nxpandroidc7611652015-09-23 16:42:05 +053083
nxpandroid8f6d0532017-07-12 18:25:30 +053084/* Out of GKI buffers */
85#define NFA_STATUS_NO_BUFFERS NFC_STATUS_NO_BUFFERS
86/* Protocol mismatch between API and activated one */
87#define NFA_STATUS_WRONG_PROTOCOL NFC_STATUS_WRONG_PROTOCOL
88/* Another Tag command is already in progress */
89#define NFA_STATUS_BUSY NFC_STATUS_BUSY
nxpandroidc7611652015-09-23 16:42:05 +053090
nxpandroid8f6d0532017-07-12 18:25:30 +053091/* data len exceeds MIU */
92#define NFA_STATUS_BAD_LENGTH NFC_STATUS_BAD_LENGTH
93/* invalid handle */
94#define NFA_STATUS_BAD_HANDLE NFC_STATUS_BAD_HANDLE
95/* congested */
96#define NFA_STATUS_CONGESTED NFC_STATUS_CONGESTED
nxpandroid70cccc72016-11-18 19:58:22 +053097#if (NXP_EXTNS == TRUE)
nxpandroid8f6d0532017-07-12 18:25:30 +053098#define NFA_STATUS_ALREADY_INITIALIZED NFC_STATUS_ALREADY_INITIALIZED
nxf24591c1cbeab2018-02-21 17:32:26 +053099/* API is called to perform illegal function */
100#define NFA_STATUS_REFUSED NFC_STATUS_REFUSED
Suraj Uday Kotharkarc4ef3e72018-06-08 14:33:26 +0530101#define NFA_STATUS_HCI_WTX_TIMEOUT 0xE0
nxpandroid70cccc72016-11-18 19:58:22 +0530102#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530103typedef uint8_t tNFA_STATUS;
nxpandroidc7611652015-09-23 16:42:05 +0530104
105/* Handle for NFA registrations and connections */
nxpandroid8f6d0532017-07-12 18:25:30 +0530106typedef uint16_t tNFA_HANDLE;
107#define NFA_HANDLE_INVALID (0xFFFF)
nxpandroidc7611652015-09-23 16:42:05 +0530108/* NFA Handle definitions */
109
110/* The upper byte of NFA_HANDLE signifies the handle group */
nxpandroid8f6d0532017-07-12 18:25:30 +0530111/* NDEF Type Handler handles */
112#define NFA_HANDLE_GROUP_NDEF_HANDLER 0x0200
113/* DH Card Emulation handles */
114#define NFA_HANDLE_GROUP_CE 0x0300
115/* Handles to identify NFCEE */
116#define NFA_HANDLE_GROUP_EE 0x0400
117/* P2P handles */
118#define NFA_HANDLE_GROUP_P2P 0x0500
nxpandroid8f6d0532017-07-12 18:25:30 +0530119/* HCI handles */
120#define NFA_HANDLE_GROUP_HCI 0x0800
121/* Local NDEF message handle */
nxpandroid8f6d0532017-07-12 18:25:30 +0530122#define NFA_HANDLE_GROUP_MASK 0xFF00
123#define NFA_HANDLE_MASK 0x00FF
nxpandroidc7611652015-09-23 16:42:05 +0530124
125/* NCI Parameter IDs */
nxpandroid8f6d0532017-07-12 18:25:30 +0530126typedef uint8_t tNFA_PMID;
nxpandroidc7611652015-09-23 16:42:05 +0530127
128/* Definitions for tNFA_TECHNOLOGY_MASK */
nxpandroid8f6d0532017-07-12 18:25:30 +0530129#define NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
130#define NFA_TECHNOLOGY_MASK_B 0x02 /* NFC Technology B */
131#define NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
nxf24591c1cbeab2018-02-21 17:32:26 +0530132/* TECHNOLOGY_MASK_V in NCI2.0 and TECHNOLOGY_MASK_15693 proprietary in NCI1.0*/
133#define NFA_TECHNOLOGY_MASK_V 0x08
nxpandroid8f6d0532017-07-12 18:25:30 +0530134#define NFA_TECHNOLOGY_MASK_B_PRIME 0x10 /* Proprietary Technology */
135#define NFA_TECHNOLOGY_MASK_KOVIO 0x20 /* Proprietary Technology */
nxf24591c1cbeab2018-02-21 17:32:26 +0530136/* NFC technology NFC-DEP protocol active mode */
137#define NFA_TECHNOLOGY_MASK_ACTIVE 0x40
nxpandroid8f6d0532017-07-12 18:25:30 +0530138/* NFC Technology A active mode */
139#define NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40
140/* NFC Technology F active mode */
141#define NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80
142/* All supported technologies */
nxpandroid8f6d0532017-07-12 18:25:30 +0530143typedef uint8_t tNFA_TECHNOLOGY_MASK;
nxpandroidc7611652015-09-23 16:42:05 +0530144
145/* Definitions for NFC protocol for RW, CE and P2P APIs */
nxpandroid8f6d0532017-07-12 18:25:30 +0530146/* Type1Tag - NFC-A */
147#define NFA_PROTOCOL_T1T NFC_PROTOCOL_T1T
148/* MIFARE/Type2Tag - NFC-A */
149#define NFA_PROTOCOL_T2T NFC_PROTOCOL_T2T
150/* Felica/Type3Tag - NFC-F */
151#define NFA_PROTOCOL_T3T NFC_PROTOCOL_T3T
152/* Type 4A,4B - NFC-A or NFC-B */
153#define NFA_PROTOCOL_ISO_DEP NFC_PROTOCOL_ISO_DEP
154/* NFCDEP/LLCP - NFC-A or NFC-F */
155#define NFA_PROTOCOL_NFC_DEP NFC_PROTOCOL_NFC_DEP
nxf24591c1cbeab2018-02-21 17:32:26 +0530156/* NFC_PROTOCOL_T5T in NCI2.0 and NFC_PROTOCOL_ISO15693 proprietary in NCI1.0*/
157#define NFA_PROTOCOL_T5T NFC_PROTOCOL_T5T
nxpandroidcdd30442016-05-27 17:26:18 +0530158#if (NXP_EXTNS == TRUE)
nxf24591c1cbeab2018-02-21 17:32:26 +0530159#define NFA_PROTOCOL_MIFARE NFC_PROTOCOL_MIFARE
nxpandroid8f6d0532017-07-12 18:25:30 +0530160#define NFA_PROTOCOL_T3BT NFC_PROTOCOL_T3BT
161#define NFA_NORMAL_BOOT_MODE NFC_NORMAL_BOOT_MODE
162#define NFA_FAST_BOOT_MODE NFC_FAST_BOOT_MODE
163#define NFA_OSU_BOOT_MODE NFC_OSU_BOOT_MODE
nxf24591c1cbeab2018-02-21 17:32:26 +0530164
165#define NFA_MAX_NUM_PROTOCOLS 8
nxpandroidc7611652015-09-23 16:42:05 +0530166#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530167#define NFA_PROTOCOL_INVALID 0xFF
nxpandroid8f6d0532017-07-12 18:25:30 +0530168typedef uint8_t tNFA_NFC_PROTOCOL;
nxpandroidc7611652015-09-23 16:42:05 +0530169
170/* Definitions for tNFA_PROTOCOL_MASK */
nxpandroid8f6d0532017-07-12 18:25:30 +0530171#define NFA_PROTOCOL_MASK_T1T 0x01 /* Type 1 tag */
172#define NFA_PROTOCOL_MASK_T2T 0x02 /* MIFARE / Type 2 tag */
173#define NFA_PROTOCOL_MASK_T3T 0x04 /* FeliCa / Type 3 tag */
174#define NFA_PROTOCOL_MASK_ISO_DEP 0x08 /* ISODEP/4A,4B */
175#define NFA_PROTOCOL_MASK_NFC_DEP 0x10 /* NFCDEP/LLCP */
176#if (NXP_EXTNS == TRUE)
177#define NFC_PROTOCOL_MASK_ISO7816 0x20 /*ISO 7816 - Aid Default Route */
nxpandroidc7611652015-09-23 16:42:05 +0530178#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530179typedef uint8_t tNFA_PROTOCOL_MASK;
nxpandroidc7611652015-09-23 16:42:05 +0530180
181/* NFA_DM callback events */
nxpandroid8f6d0532017-07-12 18:25:30 +0530182/* Result of NFA_Enable */
183#define NFA_DM_ENABLE_EVT 0
184/* Result of NFA_Disable */
185#define NFA_DM_DISABLE_EVT 1
186/* Result of NFA_SetConfig */
187#define NFA_DM_SET_CONFIG_EVT 2
188/* Result of NFA_GetConfig */
189#define NFA_DM_GET_CONFIG_EVT 3
190/* Result of NFA_PowerOffSleepMode */
191#define NFA_DM_PWR_MODE_CHANGE_EVT 4
192#define NFA_DM_RF_FIELD_EVT 5 /* Status of RF Field */
193/* NFCC is not responding */
194#define NFA_DM_NFCC_TIMEOUT_EVT 6
195/* NCI Tranport error */
196#define NFA_DM_NFCC_TRANSPORT_ERR_EVT 7
nxf24591c1cbeab2018-02-21 17:32:26 +0530197/* Result of NFA_SetPowerSubStateForScreenState */
198#define NFA_DM_SET_POWER_SUB_STATE_EVT 11
nxpandroid8f6d0532017-07-12 18:25:30 +0530199#if (NXP_EXTNS == TRUE)
nxf24591c1cbeab2018-02-21 17:32:26 +0530200#define NFA_DM_EE_HCI_DISABLE 24
nxpandroid8f6d0532017-07-12 18:25:30 +0530201/*Status when EE HCI susbsystems enabled*/
nxf24591c1cbeab2018-02-21 17:32:26 +0530202#define NFA_DM_EE_HCI_ENABLE 25
Ravishinde26233bb2018-08-06 22:16:08 +0530203/*Status when Transit Config is set*/
204#define NFA_DM_SET_TRANSIT_CONFIG_EVT 14
nxpandroidc7611652015-09-23 16:42:05 +0530205#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530206/* T1T HR length */
207#define NFA_T1T_HR_LEN T1T_HR_LEN
208/* Max UID length of T1/T2 */
209#define NFA_MAX_UID_LEN TAG_MAX_UID_LEN
nxpandroid8f6d0532017-07-12 18:25:30 +0530210/* UID len for T1T cmds */
211#define NFA_T1T_CMD_UID_LEN T1T_CMD_UID_LEN
212/* T2T UID length */
nxpandroidc7611652015-09-23 16:42:05 +0530213
nxpandroid8f6d0532017-07-12 18:25:30 +0530214/* Tag formated for NDEF */
215#define NFA_RW_NDEF_FL_FORMATED RW_NDEF_FL_FORMATED
216/* NDEF supported by the tag */
217#define NFA_RW_NDEF_FL_SUPPORTED RW_NDEF_FL_SUPPORTED
218/* Unable to find if tag is ndef capable/formated/read only */
219#define NFA_RW_NDEF_FL_UNKNOWN RW_NDEF_FL_UNKNOWN
220/* Tag supports format operation */
221#define NFA_RW_NDEF_FL_FORMATABLE RW_NDEF_FL_FORMATABLE
nxpandroidc7611652015-09-23 16:42:05 +0530222
nxpandroid8f6d0532017-07-12 18:25:30 +0530223typedef uint8_t tNFA_RW_NDEF_FLAG;
nxpandroidc7611652015-09-23 16:42:05 +0530224
225/* Data for NFA_DM_SET_CONFIG_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530226typedef struct {
227 tNFA_STATUS status; /* NFA_STATUS_OK if successful */
228 uint8_t num_param_id; /* Number of rejected Param ID */
229 tNFA_PMID param_ids[NFC_MAX_NUM_IDS]; /* Rejected Param ID */
nxpandroidc7611652015-09-23 16:42:05 +0530230} tNFA_SET_CONFIG;
231
232/* Data for NFA_DM_GET_CONFIG_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530233typedef struct {
234 tNFA_STATUS status; /* NFA_STATUS_OK if successful */
235 uint16_t tlv_size; /* The length of TLV */
nxf24591c1cbeab2018-02-21 17:32:26 +0530236 uint8_t* param_tlvs; /* TLV (Parameter ID-Len-Value byte stream) */
nxpandroidc7611652015-09-23 16:42:05 +0530237} tNFA_GET_CONFIG;
238
nxf24591c1cbeab2018-02-21 17:32:26 +0530239/* Structure to store screen state */
240typedef enum screen_state {
241 NFA_SCREEN_STATE_UNKNOWN = 0x00,
242 NFA_SCREEN_STATE_OFF_UNLOCKED = 0x01,
243 NFA_SCREEN_STATE_OFF_LOCKED = 0x02,
244 NFA_SCREEN_STATE_ON_LOCKED = 0x04,
245 NFA_SCREEN_STATE_ON_UNLOCKED = 0x08
246} eScreenState_t;
nxpandroidc7611652015-09-23 16:42:05 +0530247
nxf24591c1cbeab2018-02-21 17:32:26 +0530248typedef enum power_substate {
249 SCREEN_STATE_ON_UNLOCKED = 0x00,
250 SCREEN_STATE_OFF_UNLOCKED,
251 SCREEN_STATE_ON_LOCKED,
252 SCREEN_STATE_OFF_LOCKED,
nxf245911fec7142018-06-06 14:29:48 +0530253#if (NXP_EXTNS == TRUE)
254 SCREEN_STATE_INVALID = 0xFF
255#endif
nxf24591c1cbeab2018-02-21 17:32:26 +0530256} epower_substate_t;
257
258#define NFA_SCREEN_STATE_MASK 0x0F
Ravishinde26233bb2018-08-06 22:16:08 +0530259#if (NXP_EXTNS == TRUE)
260typedef struct { tNFA_STATUS status; } tNFA_SET_TRANSIT_CONFIG;
261#endif
nxf24591c1cbeab2018-02-21 17:32:26 +0530262/* CONN_DISCOVER_PARAM */
nxpandroid8f6d0532017-07-12 18:25:30 +0530263#define NFA_DM_PWR_MODE_FULL 0x04
264#define NFA_DM_PWR_MODE_OFF_SLEEP 0x00
nxpandroidc7611652015-09-23 16:42:05 +0530265
nxpandroid8f6d0532017-07-12 18:25:30 +0530266typedef uint8_t tNFA_DM_PWR_MODE;
nxpandroidc7611652015-09-23 16:42:05 +0530267
268/* Data for NFA_DM_PWR_MODE_CHANGE_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530269typedef struct {
270 tNFA_STATUS status; /* NFA_STATUS_OK if successful */
271 /* NFA_DM_PWR_MODE_FULL or NFA_DM_PWR_MODE_OFF_SLEEP */
272 tNFA_DM_PWR_MODE power_mode;
nxpandroidc7611652015-09-23 16:42:05 +0530273} tNFA_DM_PWR_MODE_CHANGE;
274
nxpandroid8f6d0532017-07-12 18:25:30 +0530275/* Data for NFA_DM_RF_FIELD_EVT */
276#define NFA_DM_RF_FIELD_OFF 0x00
277#define NFA_DM_RF_FIELD_ON 0x01
278
279typedef struct {
280 tNFA_STATUS status; /* NFA_STATUS_OK if successful */
281 /* NFA_DM_RF_FIELD_ON if operating field generated by remote */
282 uint8_t rf_field_status;
nxpandroidc7611652015-09-23 16:42:05 +0530283} tNFA_DM_RF_FIELD;
284
nxf24591c1cbeab2018-02-21 17:32:26 +0530285typedef struct {
286 tNFA_STATUS status; /* NFA_STATUS_OK if successful */
287 uint8_t power_state; /* current screen/power state */
288} tNFA_DM_POWER_STATE;
289
nxpandroidc7611652015-09-23 16:42:05 +0530290/* Union of all DM callback structures */
nxpandroid8f6d0532017-07-12 18:25:30 +0530291typedef union {
nxf24591c1cbeab2018-02-21 17:32:26 +0530292 tNFA_STATUS status; /* NFA_DM_ENABLE_EVT */
293 tNFA_SET_CONFIG set_config; /* NFA_DM_SET_CONFIG_EVT */
294 tNFA_GET_CONFIG get_config; /* NFA_DM_GET_CONFIG_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530295 tNFA_DM_PWR_MODE_CHANGE power_mode; /* NFA_DM_PWR_MODE_CHANGE_EVT */
296 tNFA_DM_RF_FIELD rf_field; /* NFA_DM_RF_FIELD_EVT */
297 void* p_vs_evt_data; /* Vendor-specific evt data */
298 tNFA_DM_POWER_STATE power_sub_state; /* power sub state */
Ravishinde26233bb2018-08-06 22:16:08 +0530299#if (NXP_EXTNS == TRUE)
300 tNFA_SET_TRANSIT_CONFIG set_transit_config; /* NFA_DM_SET_TRANSIT_CONFIG */
301#endif
nxpandroidc7611652015-09-23 16:42:05 +0530302} tNFA_DM_CBACK_DATA;
303
304/* NFA_DM callback */
nxpandroid8f6d0532017-07-12 18:25:30 +0530305typedef void(tNFA_DM_CBACK)(uint8_t event, tNFA_DM_CBACK_DATA* p_data);
nxpandroidc7611652015-09-23 16:42:05 +0530306
nxpandroidc7611652015-09-23 16:42:05 +0530307/* NFA Enable DTA Type Mode */
nxpandroid8f6d0532017-07-12 18:25:30 +0530308typedef enum {
309 NFA_DTA_DEFAULT_MODE = 0x00000001,
310 NFA_DTA_LLCP_MODE = 0x00000002,
nxpandroid8f6d0532017-07-12 18:25:30 +0530311 NFA_DTA_HCEF_MODE = 0x00000004,
312 NFA_DTA_CR8 = 0x00000080,
Soma8f4735d2018-06-19 14:24:00 +0530313 NFA_DTA_CR9 = 0x00000090,
314 NFA_DTA_CR10 = 0x000000A0,
315 NFA_DTA_CR11 = 0x000000B0,
316 NFA_DTA_CR12 = 0x000000C0,
nxpandroid8f6d0532017-07-12 18:25:30 +0530317} tNFA_eDtaModes;
nxf24591c1cbeab2018-02-21 17:32:26 +0530318
319#if (NXP_EXTNS == TRUE)
nxpandroid8f6d0532017-07-12 18:25:30 +0530320typedef struct {
321 uint32_t validation; /* indicates on which platform validation is done like
322 pn547, pn548, pn65T, pn66T */
323 uint8_t android_version; /* Nxp's android version */
324 uint8_t major_version; /* Major Version of MW*/
325 uint8_t minor_version; /* Minor Version of Mw */
nxf24591c1cbeab2018-02-21 17:32:26 +0530326 uint8_t rc_version; /*RC version*/
nxpandroid8f6d0532017-07-12 18:25:30 +0530327} tNFA_MW_VERSION;
nxpandroidc7611652015-09-23 16:42:05 +0530328#endif
329
330/* NFA Connection Callback Events */
nxpandroid8f6d0532017-07-12 18:25:30 +0530331#define NFA_POLL_ENABLED_EVT 0 /* Polling enabled event */
332#define NFA_POLL_DISABLED_EVT 1 /* Polling disabled event */
nxf24591c1cbeab2018-02-21 17:32:26 +0530333/* NFC link/protocol discovery notificaiton */
nxpandroid8f6d0532017-07-12 18:25:30 +0530334#define NFA_DISC_RESULT_EVT 2
335/* NFC link/protocol discovery select response */
336#define NFA_SELECT_RESULT_EVT 3
337#define NFA_DEACTIVATE_FAIL_EVT 4 /* NFA_Deactivate failure */
338/* NFC link/protocol activated */
339#define NFA_ACTIVATED_EVT 5
340/* NFC link/protocol deactivated */
341#define NFA_DEACTIVATED_EVT 6
342#define NFA_TLV_DETECT_EVT 7 /* TLV Detection complete */
343/* NDEF Detection complete */
344#define NFA_NDEF_DETECT_EVT 8
345#define NFA_DATA_EVT 9 /* Data message received */
346#define NFA_SELECT_CPLT_EVT 10 /* Select completed */
347#define NFA_READ_CPLT_EVT 11 /* Read completed */
348#define NFA_WRITE_CPLT_EVT 12 /* Write completed */
349#define NFA_LLCP_ACTIVATED_EVT 13 /* LLCP link is activated */
350/* LLCP link is deactivated */
351#define NFA_LLCP_DEACTIVATED_EVT 14
352/* Response to NFA_RwPresenceCheck */
353#define NFA_PRESENCE_CHECK_EVT 15
354/* Tag Formating completed */
355#define NFA_FORMAT_CPLT_EVT 16
356/* ISO 15693 command completed */
357#define NFA_I93_CMD_CPLT_EVT 17
358#define NFA_SET_TAG_RO_EVT 18 /* Tag set as Read only */
359/* Result for NFA_RequestExclusiveRfControl */
360#define NFA_EXCLUSIVE_RF_CONTROL_STARTED_EVT 19
361/* Result for NFA_ReleaseExclusiveRfControl */
362#define NFA_EXCLUSIVE_RF_CONTROL_STOPPED_EVT 20
nxf24591c1cbeab2018-02-21 17:32:26 +0530363/* DH Card emulation: AID or System code reg'd */
nxpandroid8f6d0532017-07-12 18:25:30 +0530364#define NFA_CE_REGISTERED_EVT 21
365/* DH Card emulation: AID or System code dereg'd */
366#define NFA_CE_DEREGISTERED_EVT 22
367/* DH Card emulation: data received event */
368#define NFA_CE_DATA_EVT 23
369/* DH Card emulation: activation event */
370#define NFA_CE_ACTIVATED_EVT 24
371/* DH Card emulation: deactivation event */
372#define NFA_CE_DEACTIVATED_EVT 25
373/* DH Card emulation: local NDEF configured */
374#define NFA_CE_LOCAL_TAG_CONFIGURED_EVT 26
375/* DH Card emulation: NDEF write started */
376#define NFA_CE_NDEF_WRITE_START_EVT 27
377/* DH Card emulation: NDEF write completed */
378#define NFA_CE_NDEF_WRITE_CPLT_EVT 28
379#define NFA_CE_UICC_LISTEN_CONFIGURED_EVT 29 /* UICC Listen configured */
380/* RF Discovery started event */
381#define NFA_RF_DISCOVERY_STARTED_EVT 30
382/* RF Discovery stopped event */
383#define NFA_RF_DISCOVERY_STOPPED_EVT 31
384/* status of updating RF communication paramters */
385#define NFA_UPDATE_RF_PARAM_RESULT_EVT 32
386/* RF Interface error event */
387#define NFA_RW_INTF_ERROR_EVT 34
388/* status of setting P2P listen technologies */
389#define NFA_SET_P2P_LISTEN_TECH_EVT 33
390/* First packet received over LLCP link */
391#define NFA_LLCP_FIRST_PACKET_RECEIVED_EVT 35
392/* Listening enabled event */
393#define NFA_LISTEN_ENABLED_EVT 36
394/* Listening disabled event */
395#define NFA_LISTEN_DISABLED_EVT 37
396/* P2P services paused event */
397#define NFA_P2P_PAUSED_EVT 38
398/* P2P services resumed event */
399#define NFA_P2P_RESUMED_EVT 39
nxf24591c1cbeab2018-02-21 17:32:26 +0530400
nxpandroidc7611652015-09-23 16:42:05 +0530401/* NFC deactivation type */
nxpandroid8f6d0532017-07-12 18:25:30 +0530402#define NFA_DEACTIVATE_TYPE_IDLE NFC_DEACTIVATE_TYPE_IDLE
403#define NFA_DEACTIVATE_TYPE_SLEEP NFC_DEACTIVATE_TYPE_SLEEP
404#define NFA_DEACTIVATE_TYPE_DISCOVERY NFC_DEACTIVATE_TYPE_DISCOVERY
nxpandroidc7611652015-09-23 16:42:05 +0530405
nxpandroid8f6d0532017-07-12 18:25:30 +0530406typedef uint8_t tNFA_DEACTIVATE_TYPE;
nxpandroidc7611652015-09-23 16:42:05 +0530407
408/* Data for NFA_DISC_RESULT_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530409typedef struct {
410 tNFA_STATUS status; /* NFA_STATUS_OK if successful */
411 tNFC_RESULT_DEVT discovery_ntf; /* RF discovery notification details */
nxpandroidc7611652015-09-23 16:42:05 +0530412} tNFA_DISC_RESULT;
413
414/* Data for NFA_ACTIVATED_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530415typedef struct {
416 uint8_t hr[NFA_T1T_HR_LEN]; /* HR of Type 1 tag */
417 uint8_t uid[NFA_T1T_CMD_UID_LEN]; /* UID used in T1T Commands */
nxpandroidc7611652015-09-23 16:42:05 +0530418} tNFA_T1T_PARAMS;
419
nxpandroid8f6d0532017-07-12 18:25:30 +0530420typedef struct {
421 uint8_t uid[NFA_MAX_UID_LEN]; /* UID of T2T tag */
nxpandroidc7611652015-09-23 16:42:05 +0530422} tNFA_T2T_PARAMS;
423
nxpandroid8f6d0532017-07-12 18:25:30 +0530424typedef struct {
425 uint8_t num_system_codes; /* Number of system codes supporte by tag */
426 uint16_t* p_system_codes; /* Pointer to list of system codes */
nxpandroidc7611652015-09-23 16:42:05 +0530427} tNFA_T3T_PARAMS;
428
nxpandroid8f6d0532017-07-12 18:25:30 +0530429typedef struct {
430 uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB */
431 uint8_t info_flags; /* information flags */
432 uint8_t dsfid; /* DSFID if I93_INFO_FLAG_DSFID */
433 uint8_t afi; /* AFI if I93_INFO_FLAG_AFI */
434 uint16_t num_block; /* number of blocks if I93_INFO_FLAG_MEM_SIZE */
435 uint8_t block_size; /* block size in byte if I93_INFO_FLAG_MEM_SIZE */
436 uint8_t IC_reference; /* IC Reference if I93_INFO_FLAG_IC_REF */
nxpandroidc7611652015-09-23 16:42:05 +0530437} tNFA_I93_PARAMS;
438
nxpandroid8f6d0532017-07-12 18:25:30 +0530439typedef union {
440 tNFA_T1T_PARAMS t1t; /* HR and UID of T1T */
441 tNFA_T2T_PARAMS t2t; /* UID of T2T */
442 tNFA_T3T_PARAMS t3t; /* System codes */
443 tNFA_I93_PARAMS i93; /* System Information of ISO 15693 */
nxpandroidc7611652015-09-23 16:42:05 +0530444} tNFA_TAG_PARAMS;
445
nxpandroid8f6d0532017-07-12 18:25:30 +0530446typedef struct {
447 tNFC_ACTIVATE_DEVT activate_ntf; /* RF discovery activation details */
448 tNFA_TAG_PARAMS params; /* additional informaiton of tag */
nxpandroidc7611652015-09-23 16:42:05 +0530449} tNFA_ACTIVATED;
450
451/* Data for NFA_DEACTIVATED_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530452typedef struct {
453 /* NFA_DEACTIVATE_TYPE_IDLE or NFA_DEACTIVATE_TYPE_SLEEP */
454 tNFA_DEACTIVATE_TYPE type;
nxpandroidc7611652015-09-23 16:42:05 +0530455} tNFA_DEACTIVATED;
456
457/* Structure for NFA_NDEF_DETECT_EVT event data */
nxpandroid8f6d0532017-07-12 18:25:30 +0530458typedef struct {
459 tNFA_STATUS status; /* Status of the ndef detecton */
460 tNFA_NFC_PROTOCOL protocol; /* protocol used to detect NDEF */
461 uint32_t max_size; /* max number of bytes available for NDEF data */
462 uint32_t cur_size; /* current size of stored NDEF data (in bytes) */
463 /* Flags to indicate NDEF capability, is formated, soft/hard lockable,
464 * formatable, otp and read only */
465 tNFA_RW_NDEF_FLAG flags;
nxpandroidc7611652015-09-23 16:42:05 +0530466} tNFA_NDEF_DETECT;
467
nxpandroidc7611652015-09-23 16:42:05 +0530468/* Structure for NFA_TLV_DETECT_EVT event data */
nxpandroid8f6d0532017-07-12 18:25:30 +0530469typedef struct {
470 tNFA_STATUS status; /* Status of the tlv detecton */
471 tNFA_NFC_PROTOCOL protocol; /* protocol used to detect TLV */
472 uint8_t num_tlvs; /* number of tlvs present in the tag */
473 uint8_t num_bytes; /* number of lock/reserved bytes */
nxpandroidc7611652015-09-23 16:42:05 +0530474} tNFA_TLV_DETECT;
475
476/* Structure for NFA_DATA_EVT data */
nxpandroid8f6d0532017-07-12 18:25:30 +0530477typedef struct {
478 tNFA_STATUS status; /* Status of Data received */
479 uint8_t* p_data; /* Data buffer */
480 uint16_t len; /* Length of data */
nxpandroidc7611652015-09-23 16:42:05 +0530481} tNFA_RX_DATA;
482
483/* Structure for NFA_CE_NDEF_WRITE_CPLT_EVT data */
nxpandroid8f6d0532017-07-12 18:25:30 +0530484typedef struct {
485 tNFA_STATUS status; /* Status of the ndef write op */
486 uint32_t len; /* Update length of NDEF data */
487 uint8_t* p_data; /* data buffer */
nxpandroidc7611652015-09-23 16:42:05 +0530488} tNFA_CE_NDEF_WRITE_CPLT;
489
490/* Data for NFA_LLCP_ACTIVATED_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530491typedef struct {
nxf24591c1cbeab2018-02-21 17:32:26 +0530492 bool is_initiator; /* TRUE if initiator */
nxpandroid8f6d0532017-07-12 18:25:30 +0530493 uint16_t remote_wks; /* Well-Known service mask of peer */
494 uint8_t remote_lsc; /* Link Service Class of peer */
495 uint16_t remote_link_miu; /* Link MIU of peer */
496 uint16_t local_link_miu; /* Link MIU of local */
497 uint8_t remote_version; /* LLCP version of remote */
nxpandroidc7611652015-09-23 16:42:05 +0530498} tNFA_LLCP_ACTIVATED;
499
500/* Data for NFA_LLCP_DEACTIVATED_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530501typedef struct {
502 uint8_t reason; /* reason of deactivation */
nxpandroidc7611652015-09-23 16:42:05 +0530503} tNFA_LLCP_DEACTIVATED;
504
505/* Data for NFA_I93_CMD_CPLT_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530506typedef struct {
507 uint8_t dsfid; /* DSFID */
508 uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB */
nxpandroidc7611652015-09-23 16:42:05 +0530509} tNFA_I93_INVENTORY;
510
nxpandroid8f6d0532017-07-12 18:25:30 +0530511typedef struct /* RW_I93_SYS_INFO_EVT */
nxf24591c1cbeab2018-02-21 17:32:26 +0530512{
nxpandroid8f6d0532017-07-12 18:25:30 +0530513 uint8_t info_flags; /* information flags */
514 uint8_t uid[I93_UID_BYTE_LEN]; /* UID */
515 uint8_t dsfid; /* DSFID if I93_INFO_FLAG_DSFID */
516 uint8_t afi; /* AFI if I93_INFO_FLAG_AFI */
517 uint16_t num_block; /* number of blocks if I93_INFO_FLAG_MEM_SIZE */
518 uint8_t block_size; /* block size in byte if I93_INFO_FLAG_MEM_SIZE */
519 uint8_t IC_reference; /* IC Reference if I93_INFO_FLAG_IC_REF */
nxpandroidc7611652015-09-23 16:42:05 +0530520} tNFA_I93_SYS_INFO;
521
nxpandroid8f6d0532017-07-12 18:25:30 +0530522typedef struct {
523 tNFA_STATUS status; /* Status of sending command */
524 uint8_t sent_command; /* sent command to tag */
525 union {
526 uint8_t error_code; /* error code defined in ISO 15693 */
527 tNFA_I93_INVENTORY inventory; /* inventory response */
528 tNFA_I93_SYS_INFO sys_info; /* system information */
529 } params;
nxpandroidc7611652015-09-23 16:42:05 +0530530} tNFA_I93_CMD_CPLT;
531
532/* Data for NFA_CE_REGISTERED_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530533typedef struct {
534 tNFA_STATUS status; /* NFA_STATUS_OK if successful */
535 tNFA_HANDLE handle; /* handle for NFA_CeRegisterFelicaSystemCodeOnDH () */
536 /* NFA_CeRegisterT4tAidOnDH () */
nxpandroidc7611652015-09-23 16:42:05 +0530537} tNFA_CE_REGISTERED;
538
539/* Data for NFA_CE_DEREGISTERED_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530540typedef struct {
541 tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT */
nxpandroidc7611652015-09-23 16:42:05 +0530542} tNFA_CE_DEREGISTERED;
543
544/* Data for NFA_CE_ACTIVATED_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530545typedef struct {
546 tNFA_STATUS status; /* NFA_STATUS_OK if successful */
547 tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT */
548 tNFC_ACTIVATE_DEVT activate_ntf; /* RF discovery activation details */
nxpandroidc7611652015-09-23 16:42:05 +0530549} tNFA_CE_ACTIVATED;
550
551/* Data for NFA_CE_DEACTIVATED_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530552typedef struct {
553 tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT */
554 /* NFA_DEACTIVATE_TYPE_IDLE or NFA_DEACTIVATE_TYPE_SLEEP */
555 tNFA_DEACTIVATE_TYPE type;
nxpandroidc7611652015-09-23 16:42:05 +0530556} tNFA_CE_DEACTIVATED;
557
558/* Structure for NFA_CE_DATA_EVT data */
nxpandroid8f6d0532017-07-12 18:25:30 +0530559typedef struct {
560 tNFA_STATUS status; /* NFA_STATUS_OK if complete packet */
561 tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT */
562 uint8_t* p_data; /* Data buffer */
563 uint16_t len; /* Length of data */
nxpandroidc7611652015-09-23 16:42:05 +0530564} tNFA_CE_DATA;
565
nxpandroidc7611652015-09-23 16:42:05 +0530566/* Union of all connection callback structures */
nxpandroid8f6d0532017-07-12 18:25:30 +0530567typedef union {
568 tNFA_STATUS status; /* NFA_POLL_ENABLED_EVT */
nxpandroid8f6d0532017-07-12 18:25:30 +0530569 tNFA_DISC_RESULT disc_result; /* NFA_DISC_RESULT_EVT */
570 tNFA_ACTIVATED activated; /* NFA_ACTIVATED_EVT */
571 tNFA_DEACTIVATED deactivated; /* NFA_DEACTIVATED_EVT */
572 tNFA_NDEF_DETECT ndef_detect; /* NFA_NDEF_DETECT_EVT */
573 tNFA_TLV_DETECT tlv_detect; /* NFA_TLV_DETECT_EVT */
574 tNFA_RX_DATA data; /* NFA_DATA_EVT */
575 tNFA_CE_NDEF_WRITE_CPLT ndef_write_cplt; /* NFA_CE_NDEF_WRITE_CPLT_EVT */
576 tNFA_LLCP_ACTIVATED llcp_activated; /* NFA_LLCP_ACTIVATED_EVT */
577 tNFA_LLCP_DEACTIVATED llcp_deactivated; /* NFA_LLCP_DEACTIVATED_EVT */
578 tNFA_I93_CMD_CPLT i93_cmd_cplt; /* NFA_I93_CMD_CPLT_EVT */
579 tNFA_CE_REGISTERED ce_registered; /* NFA_CE_REGISTERED_EVT */
580 tNFA_CE_DEREGISTERED ce_deregistered; /* NFA_CE_DEREGISTERED_EVT */
581 tNFA_CE_ACTIVATED ce_activated; /* NFA_CE_ACTIVATED_EVT */
582 tNFA_CE_DEACTIVATED ce_deactivated; /* NFA_CE_DEACTIVATED_EVT */
583 tNFA_CE_DATA ce_data; /* NFA_CE_DATA_EVT */
nxpandroidc7611652015-09-23 16:42:05 +0530584
585} tNFA_CONN_EVT_DATA;
586
587/* NFA Connection Callback */
nxpandroid8f6d0532017-07-12 18:25:30 +0530588typedef void(tNFA_CONN_CBACK)(uint8_t event, tNFA_CONN_EVT_DATA* p_data);
nxpandroidc7611652015-09-23 16:42:05 +0530589
590#ifndef NFA_DM_NUM_INTERFACE_MAP
nxpandroid8f6d0532017-07-12 18:25:30 +0530591#define NFA_DM_NUM_INTERFACE_MAP 3
nxpandroidc7611652015-09-23 16:42:05 +0530592#endif
593
nxpandroid8f6d0532017-07-12 18:25:30 +0530594/* compile-time configuration structure for the RF Discovery Frequency for each
595 * technology */
596typedef struct {
597 uint8_t pa; /* Frequency for NFC Technology A */
598 uint8_t pb; /* Frequency for NFC Technology B */
599 uint8_t pf; /* Frequency for NFC Technology F */
600 uint8_t pi93; /* Frequency for Proprietary Technology/15693 */
601 uint8_t pbp; /* Frequency for Proprietary Technology/B-Prime */
602 uint8_t pk; /* Frequency for Proprietary Technology/Kovio */
603 uint8_t paa; /* Frequency for NFC Technology A active mode */
604 uint8_t pfa; /* Frequency for NFC Technology F active mode */
nxf24591c1cbeab2018-02-21 17:32:26 +0530605 uint8_t pacm; /* Frequency for NFC Technology active mode */
nxpandroidc7611652015-09-23 16:42:05 +0530606} tNFA_DM_DISC_FREQ_CFG;
607
608/* definitions for tNFA_DM_CFG.presence_check_option */
nxpandroid8f6d0532017-07-12 18:25:30 +0530609/* if NDEF is not supported by the tag, use sleep/wake(last interface) */
610#define NFA_DM_PCO_ISO_SLEEP_WAKE 0x01
611/* NFA_SendRawFrame() has been used, use empty I block for presence check
612 * if this bit is not set, use read-binary on channel 3 for presence check */
613#define NFA_DM_PCO_EMPTY_I_BLOCK 0x02
nxpandroidc7611652015-09-23 16:42:05 +0530614
615/* compile-time configuration structure */
nxpandroid8f6d0532017-07-12 18:25:30 +0530616typedef struct {
617 /* Automatic NDEF detection (when not in exclusive RF mode) */
618 bool auto_detect_ndef;
619 /* Automatic NDEF read (when not in exclusive RF mode) */
620 bool auto_read_ndef;
621 /* Automatic presence check */
622 bool auto_presence_check;
623 /* Use sleep/wake(last interface) for ISODEP presence check */
624 uint8_t presence_check_option;
625 /* Maximum time to wait for presence check response */
626 uint16_t presence_check_timeout;
nxpandroidc7611652015-09-23 16:42:05 +0530627} tNFA_DM_CFG;
628
629/* compile-time configuration structure for HCI */
nxpandroid8f6d0532017-07-12 18:25:30 +0530630typedef struct {
631 /* Maximum idle(no HCP Pkt) time to wait for EE DISC REQ Ntf(s) */
632 uint16_t hci_netwk_enable_timeout;
633 /* Maximum time to wait for EE DISC REQ NTF(s) after HOT PLUG EVT(s) */
634 uint16_t hcp_response_timeout;
635 /* Number of host in the whitelist of Terminal host */
nxf24591193ee782018-06-06 14:26:10 +0530636#if(NXP_EXTNS == TRUE)
637 /* Maximum time to wait for HCI response */
638 uint8_t max_wtx_count;
639#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530640 uint8_t num_whitelist_host;
641 /* Whitelist of Terminal Host */
642 uint8_t* p_whitelist;
nxpandroidc7611652015-09-23 16:42:05 +0530643} tNFA_HCI_CFG;
644
645/*
646** Exclusive RF mode listen configuration
647*/
648
nxpandroid8f6d0532017-07-12 18:25:30 +0530649#define NFA_LB_MAX_NFCID0_LEN 4
650#define NFA_LF_MAX_SC_NFCID2 1
651#define NFA_LA_MAX_HIST_BYTES 15
652#define NFA_LB_MAX_H_INFO_LEN 15
nxpandroidc7611652015-09-23 16:42:05 +0530653
nxpandroid8f6d0532017-07-12 18:25:30 +0530654typedef struct {
655 /*
656 ** Discovery Configuration Parameters for Listen A
657 */
nxf24591c1cbeab2018-02-21 17:32:26 +0530658 bool la_enable; /* TRUE if listening A */
nxpandroid8f6d0532017-07-12 18:25:30 +0530659 uint8_t la_bit_frame_sdd; /* Bit Frame SDD in Byte 1 of SENS_RES */
660 uint8_t la_platform_config; /* Platform Config in Byte 2 of SENS_RES */
661 uint8_t la_sel_info; /* Byte of SEL_RES */
662 uint8_t la_nfcid1_len; /* NFCID1 (0, 4, 7 or 10 bytes) */
663 uint8_t la_nfcid1[NCI_NFCID1_MAX_LEN]; /* if empty, NFCC will decide */
nxpandroidc7611652015-09-23 16:42:05 +0530664
nxpandroid8f6d0532017-07-12 18:25:30 +0530665 /*
666 ** Discovery Configuration Parameters for Listen B
667 */
nxf24591c1cbeab2018-02-21 17:32:26 +0530668 bool lb_enable; /* TRUE if listening B */
nxpandroid8f6d0532017-07-12 18:25:30 +0530669 uint8_t lb_sensb_info; /* Byte 2 of Protocol Info within SENSB_RES */
670 uint8_t lb_nfcid0_len; /* NFCID0 (0, 1 or 4 bytes) */
671 uint8_t
672 lb_nfcid0[NFA_LB_MAX_NFCID0_LEN]; /* if empty, NFCC will decide */
673 uint8_t lb_app_data[NCI_PARAM_LEN_LB_APPDATA]; /* Bytes 6 - 9 in SENSB_RES */
674 uint8_t lb_sfgi; /* Start-Up Frame Guard Time */
675 uint8_t lb_adc_fo; /* Byte 12 in SENSB_RES */
nxpandroidc7611652015-09-23 16:42:05 +0530676
nxpandroid8f6d0532017-07-12 18:25:30 +0530677 /*
678 ** Discovery Configuration Parameters for Listen F
679 */
nxf24591c1cbeab2018-02-21 17:32:26 +0530680 bool lf_enable; /* TRUE if listening F */
nxpandroid8f6d0532017-07-12 18:25:30 +0530681 uint8_t lf_con_bitr_f; /* bit rate to listen */
682 uint8_t lf_protocol_type; /* Supported Protocols */
683 /* bit field indicating which lf_t3t_identifier are enabled */
684 uint16_t lf_t3t_flags;
nxf24591c1cbeab2018-02-21 17:32:26 +0530685 uint8_t lf_t3t_identifier[NFA_LF_MAX_SC_NFCID2]
686 [NCI_SYSTEMCODE_LEN + NCI_NFCID2_LEN];
nxpandroid8f6d0532017-07-12 18:25:30 +0530687 /* System Code and NFCID2 */
688 uint8_t lf_t3t_pmm[NCI_T3T_PMM_LEN]; /* Bytes 10 - 17 in SENSF_RES */
nxpandroidc7611652015-09-23 16:42:05 +0530689
nxpandroid8f6d0532017-07-12 18:25:30 +0530690 /*
691 ** Discovery Configuration Parameters for Listen ISO-DEP
692 */
nxf24591c1cbeab2018-02-21 17:32:26 +0530693 bool li_enable; /* TRUE if listening ISO-DEP */
nxpandroid8f6d0532017-07-12 18:25:30 +0530694 uint8_t li_fwi; /* Frame Waiting Time Integer */
695 uint8_t la_hist_bytes_len; /* historical bytes for Listen-A */
696 uint8_t la_hist_bytes[NFA_LA_MAX_HIST_BYTES];
697 uint8_t lb_h_info_resp_len; /* higher layer response for Listen-B */
698 uint8_t lb_h_info_resp[NFA_LB_MAX_H_INFO_LEN];
nxpandroidc7611652015-09-23 16:42:05 +0530699
nxpandroid8f6d0532017-07-12 18:25:30 +0530700 /*
701 ** Discovery Configuration Parameters for Listen NFC-DEP
702 */
nxf24591c1cbeab2018-02-21 17:32:26 +0530703 bool ln_enable; /* TRUE if listening NFC-DEP */
nxpandroid8f6d0532017-07-12 18:25:30 +0530704 uint8_t ln_wt; /* Waiting Time Integer */
705 uint8_t ln_atr_res_gen_bytes_len; /* General bytes in ATR_RES */
706 uint8_t ln_atr_res_gen_bytes[NCI_MAX_GEN_BYTES_LEN];
707 uint8_t ln_atr_res_config; /* Optional parameters (PPt) in ATR_RES */
nxpandroidc7611652015-09-23 16:42:05 +0530708} tNFA_LISTEN_CFG;
709
710/* Data for NFA_UpdateRFCommParams () */
711typedef tNFC_RF_COMM_PARAMS tNFA_RF_COMM_PARAMS;
712
713/* RF Interface type */
nxpandroid8f6d0532017-07-12 18:25:30 +0530714#define NFA_INTERFACE_FRAME NFC_INTERFACE_FRAME
715#define NFA_INTERFACE_ISO_DEP NFC_INTERFACE_ISO_DEP
716#define NFA_INTERFACE_NFC_DEP NFC_INTERFACE_NFC_DEP
717#define NFA_INTERFACE_MIFARE NFC_INTERFACE_MIFARE
nxpandroidc7611652015-09-23 16:42:05 +0530718typedef tNFC_INTF_TYPE tNFA_INTF_TYPE;
719
720/*******************************************************************************
721** NDEF Definitions
722*******************************************************************************/
723
724/* Definitions for tNFA_TNF (NDEF type name format ID) */
nxf24591c1cbeab2018-02-21 17:32:26 +0530725/* Empty or no type specified */
nxpandroid8f6d0532017-07-12 18:25:30 +0530726#define NFA_TNF_EMPTY NDEF_TNF_EMPTY
nxf24591c1cbeab2018-02-21 17:32:26 +0530727/* NFC Forum well-known type [NFC RTD] */
nxpandroid8f6d0532017-07-12 18:25:30 +0530728#define NFA_TNF_WKT NDEF_TNF_WKT
nxf24591c1cbeab2018-02-21 17:32:26 +0530729/* Media-type as defined in RFC 2046 [RFC 2046] */
nxpandroid8f6d0532017-07-12 18:25:30 +0530730#define NFA_TNF_RFC2046_MEDIA NDEF_TNF_MEDIA
nxf24591c1cbeab2018-02-21 17:32:26 +0530731/* Absolute URI as defined in RFC 3986 [RFC 3986] */
nxpandroid8f6d0532017-07-12 18:25:30 +0530732#define NFA_TNF_RFC3986_URI NDEF_TNF_URI
nxf24591c1cbeab2018-02-21 17:32:26 +0530733/* NFC Forum external type [NFC RTD] */
nxpandroid8f6d0532017-07-12 18:25:30 +0530734#define NFA_TNF_EXTERNAL NDEF_TNF_EXT
nxf24591c1cbeab2018-02-21 17:32:26 +0530735/* Unknown */
nxpandroid8f6d0532017-07-12 18:25:30 +0530736#define NFA_TNF_UNKNOWN NDEF_TNF_UNKNOWN
nxf24591c1cbeab2018-02-21 17:32:26 +0530737/* Unchanged */
nxpandroid8f6d0532017-07-12 18:25:30 +0530738#define NFA_TNF_UNCHANGED NDEF_TNF_UNCHANGED
nxf24591c1cbeab2018-02-21 17:32:26 +0530739/* Reserved */
nxpandroid8f6d0532017-07-12 18:25:30 +0530740#define NFA_TNF_RESERVED NDEF_TNF_RESERVED
nxf24591c1cbeab2018-02-21 17:32:26 +0530741/* Used to register default NDEF type handler */
nxpandroid8f6d0532017-07-12 18:25:30 +0530742#define NFA_TNF_DEFAULT 0xFF
743typedef uint8_t tNFA_TNF;
nxpandroidc7611652015-09-23 16:42:05 +0530744
nxpandroid8f6d0532017-07-12 18:25:30 +0530745/* Definitions for tNFA_NDEF_URI_ID (Frequently used prefixes. For additional
746 * values, see [NFC RTD URI] */
747#define NFA_NDEF_URI_ID_ABSOLUTE 0x00 /* Unabridged URI. */
748#define NFA_NDEF_URI_ID_HTTP 0x03 /* http:// */
749#define NFA_NDEF_URI_ID_HTTPS 0x04 /* https:// */
750#define NFA_NDEF_URI_ID_TEL 0x05 /* tel: */
751#define NFA_NDEF_URI_ID_MAILTO 0x06 /* mailto: */
752#define NFA_NDEF_URI_ID_FTP 0x0D /* ftp:// */
753#define NFA_NDEF_URI_ID_FILE 0x1D /* file:// */
nxpandroidc7611652015-09-23 16:42:05 +0530754
nxpandroid8f6d0532017-07-12 18:25:30 +0530755typedef uint8_t tNFA_NDEF_URI_ID;
nxpandroidc7611652015-09-23 16:42:05 +0530756
757/* Events for tNFA_NDEF_CBACK */
nxpandroid8f6d0532017-07-12 18:25:30 +0530758/* NDEF record type registered. (In response to NFA_RegisterNDefTypeHandler) */
759#define NFA_NDEF_REGISTER_EVT 0
760/* Received an NDEF message with the registered type. See [tNFA_NDEF_DATA] */
761#define NFA_NDEF_DATA_EVT 1
762typedef uint8_t tNFA_NDEF_EVT;
nxpandroidc7611652015-09-23 16:42:05 +0530763
764/* Structure for NFA_NDEF_REGISTER_EVT event data */
nxpandroid8f6d0532017-07-12 18:25:30 +0530765typedef struct {
766 tNFA_STATUS status; /* Status of the registration */
767 tNFA_HANDLE ndef_type_handle; /* Handle for this NDEF type registration. */
nxpandroidc7611652015-09-23 16:42:05 +0530768} tNFA_NDEF_REGISTER;
769
770/* Structure for NFA_NDEF_DATA_EVT event data */
nxpandroid8f6d0532017-07-12 18:25:30 +0530771typedef struct {
772 tNFA_HANDLE ndef_type_handle; /* Handle for NDEF type registration. */
773 uint8_t* p_data; /* Data buffer */
774 uint32_t len; /* Length of data */
nxpandroidc7611652015-09-23 16:42:05 +0530775} tNFA_NDEF_DATA;
776
777/* Union of all NDEF callback structures */
nxpandroid8f6d0532017-07-12 18:25:30 +0530778typedef union {
779 /* Structure for NFA_NDEF_REGISTER_EVT event data */
780 tNFA_NDEF_REGISTER ndef_reg;
781 /* Structure for NFA_NDEF_DATA_EVT event data */
782 tNFA_NDEF_DATA ndef_data;
nxpandroidc7611652015-09-23 16:42:05 +0530783} tNFA_NDEF_EVT_DATA;
784
785/* NFA_NDEF callback */
nxpandroid8f6d0532017-07-12 18:25:30 +0530786typedef void(tNFA_NDEF_CBACK)(tNFA_NDEF_EVT event, tNFA_NDEF_EVT_DATA* p_data);
nxpandroidc7611652015-09-23 16:42:05 +0530787
788/* NFA VSC Callback */
nxpandroid8f6d0532017-07-12 18:25:30 +0530789typedef void(tNFA_VSC_CBACK)(uint8_t event, uint16_t param_len,
790 uint8_t* p_param);
nxpandroidc7611652015-09-23 16:42:05 +0530791
792/*****************************************************************************
793** External Function Declarations
794*****************************************************************************/
nxpandroidc7611652015-09-23 16:42:05 +0530795
796/*******************************************************************************
797**
798** Function NFA_Init
799**
800** Description This function initializes control blocks for NFA
801**
802** p_hal_entry_tbl points to a table of HAL entry points
803**
804** NOTE: the buffer that p_hal_entry_tbl points must be
805** persistent until NFA is disabled.
806**
807**
808** Returns none
809**
810*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530811extern void NFA_Init(tHAL_NFC_ENTRY* p_hal_entry_tbl);
nxpandroidc7611652015-09-23 16:42:05 +0530812
813/*******************************************************************************
814**
815** Function NFA_Enable
816**
817** Description This function enables NFC. Prior to calling NFA_Enable,
818** the NFCC must be powered up, and ready to receive commands.
819** This function enables the tasks needed by NFC, opens the NCI
820** transport, resets the NFC controller, downloads patches to
821** the NFCC (if necessary), and initializes the NFC subsystems.
822**
nxpandroid8f6d0532017-07-12 18:25:30 +0530823** This function should only be called once - typically when
824** NFC is enabled during boot-up, or when NFC is enabled from a
nxpandroidc7611652015-09-23 16:42:05 +0530825** settings UI. Subsequent calls to NFA_Enable while NFA is
826** enabling or enabled will be ignored. When the NFC startup
nxpandroid8f6d0532017-07-12 18:25:30 +0530827** procedure is completed, an NFA_DM_ENABLE_EVT is returned to
828** the application using the tNFA_DM_CBACK.
nxpandroidc7611652015-09-23 16:42:05 +0530829**
830** The tNFA_CONN_CBACK parameter is used to register a callback
831** for polling, p2p and card emulation events.
832**
833**
834** Returns NFA_STATUS_OK if successfully initiated
835** NFA_STATUS_FAILED otherwise
836**
837*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530838extern tNFA_STATUS NFA_Enable(tNFA_DM_CBACK* p_dm_cback,
839 tNFA_CONN_CBACK* p_conn_cback);
nxpandroidc7611652015-09-23 16:42:05 +0530840
841/*******************************************************************************
842**
843** Function NFA_Disable
844**
845** Description This function is called to shutdown NFC. The tasks for NFC
846** are terminated, and clean up routines are performed. This
847** function is typically called during platform shut-down, or
848** when NFC is disabled from a settings UI. When the NFC
849** shutdown procedure is completed, an NFA_DM_DISABLE_EVT is
850** returned to the application using the tNFA_DM_CBACK.
851**
852** The platform should wait until the NFC_DISABLE_REVT is
nxpandroid8f6d0532017-07-12 18:25:30 +0530853** received before powering down the NFC chip and NCI
854** transport. This is required to so that NFA can gracefully
855** shut down any open connections.
nxpandroidc7611652015-09-23 16:42:05 +0530856**
857** Returns NFA_STATUS_OK if successfully initiated
858** NFA_STATUS_FAILED otherwise
859**
860*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530861extern tNFA_STATUS NFA_Disable(bool graceful);
nxpandroidc7611652015-09-23 16:42:05 +0530862
863/*******************************************************************************
864**
865** Function NFA_SetConfig
866**
867** Description Set the configuration parameters to NFCC. The result is
868** reported with an NFA_DM_SET_CONFIG_EVT in the tNFA_DM_CBACK
869** callback.
870**
nxpandroid8f6d0532017-07-12 18:25:30 +0530871** Note: If RF discovery is started,
872** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
873** happen before calling this function. Most Configuration
nxpandroidc7611652015-09-23 16:42:05 +0530874** parameters are related to RF discovery.
875**
876** Returns NFA_STATUS_OK if successfully initiated
877** NFA_STATUS_BUSY if previous setting is on-going
878** NFA_STATUS_FAILED otherwise
879**
880*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530881extern tNFA_STATUS NFA_SetConfig(tNFA_PMID param_id, uint8_t length,
882 uint8_t* p_data);
nxpandroidc7611652015-09-23 16:42:05 +0530883
884/*******************************************************************************
885**
886** Function NFA_GetConfig
887**
888** Description Get the configuration parameters from NFCC. The result is
889** reported with an NFA_DM_GET_CONFIG_EVT in the tNFA_DM_CBACK
890** callback.
891**
892** Returns NFA_STATUS_OK if successfully initiated
893** NFA_STATUS_FAILED otherwise
894**
895*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530896extern tNFA_STATUS NFA_GetConfig(uint8_t num_ids, tNFA_PMID* p_param_ids);
Ravishinde26233bb2018-08-06 22:16:08 +0530897#if (NXP_EXTNS == TRUE)
898/*******************************************************************************
899**
900** Function NFA_SetTransitConfig
901**
902** Description Get the Transit configuration value from NFC Service. The
903** result is reported with an NFA_DM_SET_TRANSIT_CONFIG_EVT in
904** the tNFA_DM_CBACK callback.
905**
906** Returns NFA_STATUS_OK if successfully initiated
907** NFA_STATUS_BUSY if previous setting is on-going
908** NFA_STATUS_FAILED otherwise
909**
910*******************************************************************************/
911extern tNFA_STATUS NFA_SetTransitConfig(std::string config);
912#endif
nxpandroidc7611652015-09-23 16:42:05 +0530913/*******************************************************************************
914**
915** Function NFA_RequestExclusiveRfControl
916**
917** Description Request exclusive control of NFC.
918** - Previous behavior (polling/tag reading, DH card emulation)
919** will be suspended .
920** - Polling and listening will be done based on the specified
921** params
922**
923** The NFA_EXCLUSIVE_RF_CONTROL_STARTED_EVT event of
924** tNFA_CONN_CBACK indicates the status of the operation.
925**
926** NFA_ACTIVATED_EVT and NFA_DEACTIVATED_EVT indicates link
927** activation/deactivation.
928**
nxpandroid8f6d0532017-07-12 18:25:30 +0530929** NFA_SendRawFrame is used to send data to the peer.
930** NFA_DATA_EVT indicates data from the peer.
nxpandroidc7611652015-09-23 16:42:05 +0530931**
932** If a tag is activated, then the NFA_RW APIs may be used to
933** send commands to the tag. Incoming NDEF messages are sent to
934** the NDEF callback.
935**
936** Once exclusive RF control has started, NFA will not activate
937** LLCP internally. The application has exclusive control of
938** the link.
939**
nxpandroid8f6d0532017-07-12 18:25:30 +0530940** Note: If RF discovery is started,
941** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
942** happen before calling this function
nxpandroidc7611652015-09-23 16:42:05 +0530943**
944** Returns NFA_STATUS_OK if successfully initiated
945** NFA_STATUS_FAILED otherwise
946**
947*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530948extern tNFA_STATUS NFA_RequestExclusiveRfControl(tNFA_TECHNOLOGY_MASK poll_mask,
949 tNFA_LISTEN_CFG* p_listen_cfg,
950 tNFA_CONN_CBACK* p_conn_cback,
951 tNFA_NDEF_CBACK* p_ndef_cback);
nxpandroidc7611652015-09-23 16:42:05 +0530952
953/*******************************************************************************
954**
955** Function NFA_ReleaseExclusiveRfControl
956**
957** Description Release exclusive control of NFC. Once released, behavior
958** prior to obtaining exclusive RF control will resume.
959**
960Note??
961** Returns NFA_STATUS_OK if successfully initiated
962** NFA_STATUS_FAILED otherwise
963**
964*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530965extern tNFA_STATUS NFA_ReleaseExclusiveRfControl(void);
nxpandroidc7611652015-09-23 16:42:05 +0530966
967/*******************************************************************************
968**
969** Function NFA_EnablePolling
970**
971** Description Enable polling for technologies specified by poll_mask.
972**
973** The following events (notified using the connection
974** callback registered with NFA_Enable) are generated during
975** polling:
976**
977** - NFA_POLL_ENABLED_EVT indicates whether or not polling
978** successfully enabled.
nxpandroid8f6d0532017-07-12 18:25:30 +0530979** - NFA_DISC_RESULT_EVT indicates there are more than one
980** devices, so application must select one of tags by calling
981** NFA_Select().
982** - NFA_SELECT_RESULT_EVT indicates whether previous selection
983** was successful or not. If it was failed then application
984** must select again or deactivate by calling
985** NFA_Deactivate().
986** - NFA_ACTIVATED_EVT is generated when an NFC link is
987** activated.
nxpandroidc7611652015-09-23 16:42:05 +0530988** - NFA_NDEF_DETECT_EVT is generated if tag is activated
nxpandroid8f6d0532017-07-12 18:25:30 +0530989** - NFA_LLCP_ACTIVATED_EVT/NFA_LLCP_DEACTIVATED_EVT is
990** generated if NFC-DEP is activated
991** - NFA_DEACTIVATED_EVT will be returned after deactivating
992** NFC link.
nxpandroidc7611652015-09-23 16:42:05 +0530993**
nxpandroid8f6d0532017-07-12 18:25:30 +0530994** Note: If RF discovery is started,
995** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
996** happen before calling this function
nxpandroidc7611652015-09-23 16:42:05 +0530997**
998** Returns NFA_STATUS_OK if successfully initiated
999** NFA_STATUS_FAILED otherwise
1000**
1001*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301002extern tNFA_STATUS NFA_EnablePolling(tNFA_TECHNOLOGY_MASK poll_mask);
nxpandroidc7611652015-09-23 16:42:05 +05301003
1004/*******************************************************************************
1005**
1006** Function NFA_DisablePolling
1007**
1008** Description Disable polling
nxpandroid8f6d0532017-07-12 18:25:30 +05301009** NFA_POLL_DISABLED_EVT will be returned after stopping
1010** polling.
nxpandroidc7611652015-09-23 16:42:05 +05301011**
nxpandroid8f6d0532017-07-12 18:25:30 +05301012** Note: If RF discovery is started,
1013** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
1014** happen before calling this function
nxpandroidc7611652015-09-23 16:42:05 +05301015**
1016** Returns NFA_STATUS_OK if successfully initiated
1017** NFA_STATUS_FAILED otherwise
1018**
1019*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301020extern tNFA_STATUS NFA_DisablePolling(void);
nxpandroidc7611652015-09-23 16:42:05 +05301021
1022/*******************************************************************************
1023**
1024** Function NFA_EnableListening
1025**
1026** Description Enable listening.
nxpandroid8f6d0532017-07-12 18:25:30 +05301027** NFA_LISTEN_ENABLED_EVT will be returned after listening is
1028** allowed.
nxpandroidc7611652015-09-23 16:42:05 +05301029**
1030** The actual listening technologies are specified by other NFA
1031** API functions. Such functions include (but not limited to)
1032** NFA_CeConfigureUiccListenTech.
nxpandroid8f6d0532017-07-12 18:25:30 +05301033** If NFA_DisableListening () is called to ignore the listening
1034** technologies, NFA_EnableListening () is called to restore
1035** the listening technologies set by these functions.
nxpandroidc7611652015-09-23 16:42:05 +05301036**
nxpandroid8f6d0532017-07-12 18:25:30 +05301037** Note: If RF discovery is started,
1038** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
1039** happen before calling this function
nxpandroidc7611652015-09-23 16:42:05 +05301040**
1041** Returns NFA_STATUS_OK if successfully initiated
1042** NFA_STATUS_FAILED otherwise
1043**
1044*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301045extern tNFA_STATUS NFA_EnableListening(void);
nxpandroidc7611652015-09-23 16:42:05 +05301046
1047/*******************************************************************************
1048**
1049** Function NFA_DisableListening
1050**
1051** Description Disable listening
nxpandroid8f6d0532017-07-12 18:25:30 +05301052** NFA_LISTEN_DISABLED_EVT will be returned after stopping
1053** listening. This function is called to exclude listen at RF
1054** discovery.
nxpandroidc7611652015-09-23 16:42:05 +05301055**
nxpandroid8f6d0532017-07-12 18:25:30 +05301056** Note: If RF discovery is started,
1057** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
1058** happen before calling this function
nxpandroidc7611652015-09-23 16:42:05 +05301059**
1060** Returns NFA_STATUS_OK if successfully initiated
1061** NFA_STATUS_FAILED otherwise
1062**
1063*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301064extern tNFA_STATUS NFA_DisableListening(void);
nxpandroidc7611652015-09-23 16:42:05 +05301065
Ayushdf7ad672018-07-30 12:02:58 +05301066#if (NXP_EXTNS == TRUE)
1067/*******************************************************************************
1068**
1069** Function NFA_ChangeDiscoveryTech
1070**
1071** Description Change listening mask.
1072** NFA_LISTEN_CHANGED_EVT will be returned.
1073**
1074** The actual listening technologies are specified by other NFA
1075** API functions. Such functions include (but not limited to)
1076** NFA_CeConfigureUiccListenTech.
1077** If NFA_DisableListening () is called to ignore the listening technologies,
1078** NFA_EnableListening () is called to restore the listening technologies
1079** set by these functions. NFA_ChangeDiscoveryTech() is called to set the listening mask.
1080**
1081** Note: If RF discovery is started, NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT
1082** may happen before calling this function
1083**
1084** Returns NFA_STATUS_OK if successfully initiated
1085** NFA_STATUS_FAILED otherwise
1086**
1087*******************************************************************************/
1088extern tNFA_STATUS NFA_ChangeDiscoveryTech (tNFA_TECHNOLOGY_MASK pollTech, tNFA_TECHNOLOGY_MASK listenTech);
1089#endif
nxpandroid3e4012e2016-08-01 19:09:55 +05301090/*******************************************************************************
1091**
nxpandroidc7611652015-09-23 16:42:05 +05301092** Function NFA_PauseP2p
1093**
1094** Description Pause P2P services.
1095** NFA_P2P_PAUSED_EVT will be returned after P2P services are
1096** disabled.
1097**
1098** The P2P services enabled by NFA_P2p* API functions are not
1099** available. NFA_ResumeP2p() is called to resume the P2P
1100** services.
1101**
nxpandroid8f6d0532017-07-12 18:25:30 +05301102** Note: If RF discovery is started,
1103** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
1104** happen before calling this function
nxpandroidc7611652015-09-23 16:42:05 +05301105**
1106** Returns NFA_STATUS_OK if successfully initiated
1107** NFA_STATUS_FAILED otherwise
1108**
1109*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301110extern tNFA_STATUS NFA_PauseP2p(void);
nxpandroidc7611652015-09-23 16:42:05 +05301111
1112/*******************************************************************************
1113**
1114** Function NFA_ResumeP2p
1115**
1116** Description Resume P2P services.
1117** NFA_P2P_RESUMED_EVT will be returned after P2P services are.
1118** enables again.
1119**
nxpandroid8f6d0532017-07-12 18:25:30 +05301120** Note: If RF discovery is started,
1121** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
1122** happen before calling this function
nxpandroidc7611652015-09-23 16:42:05 +05301123**
1124** Returns NFA_STATUS_OK if successfully initiated
1125** NFA_STATUS_FAILED otherwise
1126**
1127*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301128extern tNFA_STATUS NFA_ResumeP2p(void);
nxpandroidc7611652015-09-23 16:42:05 +05301129
1130/*******************************************************************************
1131**
1132** Function NFA_SetP2pListenTech
1133**
nxpandroid8f6d0532017-07-12 18:25:30 +05301134** Description This function is called to set listen technology for
1135** NFC-DEP. This funtion may be called before or after starting
1136** any server on NFA P2P/CHO/SNEP.
nxpandroidc7611652015-09-23 16:42:05 +05301137** If there is no technology for NFC-DEP, P2P listening will be
1138** stopped.
1139**
1140** NFA_SET_P2P_LISTEN_TECH_EVT without data will be returned.
1141**
nxpandroid8f6d0532017-07-12 18:25:30 +05301142** Note: If RF discovery is started,
1143** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
1144** happen before calling this function
nxpandroidc7611652015-09-23 16:42:05 +05301145**
1146** Returns NFA_STATUS_OK if successfully initiated
1147** NFA_STATUS_FAILED otherwise
1148**
1149*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301150extern tNFA_STATUS NFA_SetP2pListenTech(tNFA_TECHNOLOGY_MASK tech_mask);
nxpandroidc7611652015-09-23 16:42:05 +05301151
1152/*******************************************************************************
1153**
1154** Function NFA_StartRfDiscovery
1155**
1156** Description Start RF discovery
1157** RF discovery parameters shall be set by other APIs.
1158**
nxpandroid8f6d0532017-07-12 18:25:30 +05301159** An NFA_RF_DISCOVERY_STARTED_EVT indicates whether starting
1160** was successful or not.
nxpandroidc7611652015-09-23 16:42:05 +05301161**
1162** Returns NFA_STATUS_OK if successfully initiated
1163** NFA_STATUS_FAILED otherwise
1164**
1165*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301166extern tNFA_STATUS NFA_StartRfDiscovery(void);
nxpandroidc7611652015-09-23 16:42:05 +05301167
1168/*******************************************************************************
1169**
1170** Function NFA_StopRfDiscovery
1171**
1172** Description Stop RF discovery
1173**
nxpandroid8f6d0532017-07-12 18:25:30 +05301174** An NFA_RF_DISCOVERY_STOPPED_EVT indicates whether stopping
1175** was successful or not.
nxpandroidc7611652015-09-23 16:42:05 +05301176**
1177** Returns NFA_STATUS_OK if successfully initiated
1178** NFA_STATUS_FAILED otherwise
1179**
1180*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301181extern tNFA_STATUS NFA_StopRfDiscovery(void);
nxpandroidc7611652015-09-23 16:42:05 +05301182
1183/*******************************************************************************
1184**
1185** Function NFA_SetRfDiscoveryDuration
1186**
1187** Description Set the duration of the single discovery period in [ms].
1188** Allowable range: 0 ms to 0xFFFF ms.
1189**
1190** Note: If discovery is already started, the application should
1191** call NFA_StopRfDiscovery prior to calling
1192** NFA_SetRfDiscoveryDuration, and then call
1193** NFA_StartRfDiscovery afterwards to restart discovery using
1194** the new duration.
1195**
1196** Returns:
1197** NFA_STATUS_OK, if command accepted
1198** NFA_STATUS_FAILED: otherwise
1199**
1200*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301201extern tNFA_STATUS NFA_SetRfDiscoveryDuration(uint16_t discovery_period_ms);
nxpandroidc7611652015-09-23 16:42:05 +05301202
1203/*******************************************************************************
1204**
1205** Function NFA_Select
1206**
nxpandroid8f6d0532017-07-12 18:25:30 +05301207** Description Select one from detected devices by NFA_DISC_RESULT_EVT
1208** after the last discovery result is received.
1209** An NFA_SELECT_RESULT_EVT indicates whether selection was
1210** successful or not. If failed then application must select
1211** again or deactivate by NFA_Deactivate ().
nxpandroidc7611652015-09-23 16:42:05 +05301212**
1213** Returns NFA_STATUS_OK if successfully initiated
nxpandroid8f6d0532017-07-12 18:25:30 +05301214** NFA_STATUS_INVALID_PARAM if RF interface is not matched
1215** protocol
nxpandroidc7611652015-09-23 16:42:05 +05301216** NFA_STATUS_FAILED otherwise
1217**
1218*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301219extern tNFA_STATUS NFA_Select(uint8_t rf_disc_id, tNFA_NFC_PROTOCOL protocol,
1220 tNFA_INTF_TYPE rf_interface);
nxpandroidc7611652015-09-23 16:42:05 +05301221
1222/*******************************************************************************
1223**
1224** Function NFA_UpdateRFCommParams
1225**
nxpandroid8f6d0532017-07-12 18:25:30 +05301226** Description This function is called to update RF Communication
1227** parameters once the Frame RF Interface has been activated.
nxpandroidc7611652015-09-23 16:42:05 +05301228**
1229** An NFA_UPDATE_RF_PARAM_RESULT_EVT indicates whether updating
1230** was successful or not.
1231**
1232** Returns NFA_STATUS_OK if successfully initiated
1233** NFA_STATUS_FAILED otherwise
1234**
1235*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301236extern tNFA_STATUS NFA_UpdateRFCommParams(tNFA_RF_COMM_PARAMS* p_params);
nxpandroidc7611652015-09-23 16:42:05 +05301237
1238/*******************************************************************************
1239**
1240** Function NFA_Deactivate
1241**
1242** Description
nxf24591c1cbeab2018-02-21 17:32:26 +05301243** If sleep_mode=TRUE:
nxpandroid8f6d0532017-07-12 18:25:30 +05301244** Deselect the activated device by deactivating into sleep
1245** mode.
nxpandroidc7611652015-09-23 16:42:05 +05301246**
nxpandroid8f6d0532017-07-12 18:25:30 +05301247** An NFA_DEACTIVATE_FAIL_EVT indicates that selection was
nxf24591c1cbeab2018-02-21 17:32:26 +05301248** not successful. Application can select another
nxpandroid8f6d0532017-07-12 18:25:30 +05301249** discovered device or deactivate by NFA_Deactivate ()
nxpandroidc7611652015-09-23 16:42:05 +05301250** after receiving NFA_DEACTIVATED_EVT.
1251**
nxpandroid8f6d0532017-07-12 18:25:30 +05301252** Deactivating to sleep mode is not allowed when NFCC is
1253** in wait-for-host-select mode, or in listen-sleep states;
1254** NFA will deactivate to idle or discovery state for these
1255** cases respectively.
nxpandroidc7611652015-09-23 16:42:05 +05301256**
1257**
nxf24591c1cbeab2018-02-21 17:32:26 +05301258** If sleep_mode=FALSE:
nxpandroid8f6d0532017-07-12 18:25:30 +05301259** Deactivate the connection (e.g. as a result of presence
1260** check failure) NFA_DEACTIVATED_EVT will indicate that
nxf24591c1cbeab2018-02-21 17:32:26 +05301261** link is deactivated. Polling/listening will resume
nxpandroid8f6d0532017-07-12 18:25:30 +05301262** (unless the nfcc is in wait_for-all-discoveries state)
nxpandroidc7611652015-09-23 16:42:05 +05301263**
1264**
1265** Returns NFA_STATUS_OK if successfully initiated
1266** NFA_STATUS_FAILED otherwise
1267**
1268*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301269extern tNFA_STATUS NFA_Deactivate(bool sleep_mode);
nxpandroidc7611652015-09-23 16:42:05 +05301270
1271/*******************************************************************************
1272**
1273** Function NFA_SendRawFrame
1274**
1275** Description Send a raw frame over the activated interface with the NFCC.
nxpandroid8f6d0532017-07-12 18:25:30 +05301276** This function can only be called after NFC link is
1277** activated.
nxpandroidc7611652015-09-23 16:42:05 +05301278**
nxpandroid8f6d0532017-07-12 18:25:30 +05301279** If the activated interface is a tag and auto-presence check
1280** is enabled then presence_check_start_delay can be used to
1281** indicate the delay in msec after which the next auto
1282** presence check command can be sent.
1283** NFA_DM_DEFAULT_PRESENCE_CHECK_START_DELAY can be used as the
1284** default value for the delay.
nxpandroidc7611652015-09-23 16:42:05 +05301285**
1286** Returns NFA_STATUS_OK if successfully initiated
1287** NFA_STATUS_FAILED otherwise
1288**
1289*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301290extern tNFA_STATUS NFA_SendRawFrame(uint8_t* p_raw_data, uint16_t data_len,
1291 uint16_t presence_check_start_delay);
nxpandroidc7611652015-09-23 16:42:05 +05301292
1293/*******************************************************************************
1294** NDEF APIs
1295*******************************************************************************/
1296
1297/*******************************************************************************
1298**
1299** Function NFA_RegisterNDefTypeHandler
1300**
1301** Description This function allows the applications to register for
1302** specific types of NDEF records. When NDEF records are
1303** received, NFA will parse the record-type field, and pass
1304** the record to the registered tNFA_NDEF_CBACK.
1305**
1306** For records types which were not registered, the record will
1307** be sent to the default handler. A default type-handler may
1308** be registered by calling this NFA_RegisterNDefTypeHandler
1309** with tnf=NFA_TNF_DEFAULT. In this case, all un-registered
1310** record types will be sent to the callback. Only one default
1311** handler may be registered at a time.
1312**
1313** An NFA_NDEF_REGISTER_EVT will be sent to the tNFA_NDEF_CBACK
1314** to indicate that registration was successful, and provide a
1315** handle for this record type.
1316**
1317**
1318** Returns NFA_STATUS_OK if successfully initiated
1319** NFA_STATUS_FAILED otherwise
1320**
1321*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301322extern tNFA_STATUS NFA_RegisterNDefTypeHandler(bool handle_whole_message,
1323 tNFA_TNF tnf,
1324 uint8_t* p_type_name,
1325 uint8_t type_name_len,
1326 tNFA_NDEF_CBACK* p_ndef_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301327
1328/*******************************************************************************
1329**
1330** Function NFA_RegisterNDefUriHandler
1331**
1332** Description This API is a special-case of NFA_RegisterNDefTypeHandler
nxpandroid8f6d0532017-07-12 18:25:30 +05301333** with TNF=NFA_TNF_WKT, and type_name='U' (URI record); and
1334** allows registering for specific URI types (e.g. 'tel:' or
1335** 'mailto:').
nxpandroidc7611652015-09-23 16:42:05 +05301336**
1337** An NFA_NDEF_REGISTER_EVT will be sent to the tNFA_NDEF_CBACK
1338** to indicate that registration was successful, and provide a
1339** handle for this registration.
1340**
nxpandroid8f6d0532017-07-12 18:25:30 +05301341** If uri_id=NFA_NDEF_URI_ID_ABSOLUTE, then p_abs_uri contains
1342** the unabridged URI. For all other uri_id values, the
1343** p_abs_uri parameter is ignored (i.e the URI prefix is
1344** implied by uri_id).
1345**
nxpandroidc7611652015-09-23 16:42:05 +05301346** See [NFC RTD URI] for more information.
1347**
1348** Returns NFA_STATUS_OK if successfully initiated
1349** NFA_STATUS_FAILED otherwise
1350**
1351*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301352extern tNFA_STATUS NFA_RegisterNDefUriHandler(bool handle_whole_message,
1353 tNFA_NDEF_URI_ID uri_id,
1354 uint8_t* p_abs_uri,
1355 uint8_t uri_id_len,
1356 tNFA_NDEF_CBACK* p_ndef_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301357
1358/*******************************************************************************
1359**
1360** Function NFA_DeregisterNDefTypeHandler
1361**
1362** Description Deregister NDEF record type handler.
1363**
1364** Returns NFA_STATUS_OK if successfully initiated
1365** NFA_STATUS_FAILED otherwise
1366**
1367*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301368extern tNFA_STATUS NFA_DeregisterNDefTypeHandler(tNFA_HANDLE ndef_type_handle);
nxpandroidc7611652015-09-23 16:42:05 +05301369
1370/*******************************************************************************
1371**
1372** Function NFA_PowerOffSleepMode
1373**
nxpandroid8f6d0532017-07-12 18:25:30 +05301374** Description This function is called to enter or leave NFCC Power Off
1375** Sleep mode
nxpandroidc7611652015-09-23 16:42:05 +05301376** NFA_DM_PWR_MODE_CHANGE_EVT will be sent to indicate status.
1377**
nxf24591c1cbeab2018-02-21 17:32:26 +05301378** start_stop : TRUE if entering Power Off Sleep mode
1379** FALSE if leaving Power Off Sleep mode
nxpandroidc7611652015-09-23 16:42:05 +05301380**
1381Note??
1382** Returns NFA_STATUS_OK if successfully initiated
1383** NFA_STATUS_FAILED otherwise
1384**
1385*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301386extern tNFA_STATUS NFA_PowerOffSleepMode(bool start_stop);
nxpandroidc7611652015-09-23 16:42:05 +05301387
1388/*******************************************************************************
1389**
1390** Function NFA_RegVSCback
1391**
nxpandroid8f6d0532017-07-12 18:25:30 +05301392** Description This function is called to register or de-register a
1393** callback function to receive Proprietary NCI response and
1394** notification events.
1395** The maximum number of callback functions allowed is
1396** NFC_NUM_VS_CBACKS
nxpandroidc7611652015-09-23 16:42:05 +05301397**
1398** Returns tNFC_STATUS
1399**
1400*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301401extern tNFC_STATUS NFA_RegVSCback(bool is_register, tNFA_VSC_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301402
1403/*******************************************************************************
1404**
1405** Function NFA_SendVsCommand
1406**
1407** Description This function is called to send an NCI Vendor Specific
1408** command to NFCC.
1409**
1410** oid - The opcode of the VS command.
1411** cmd_params_len - The command parameter len
1412** p_cmd_params - The command parameter
nxpandroid8f6d0532017-07-12 18:25:30 +05301413** p_cback - The callback function to receive the
1414** command status
nxpandroidc7611652015-09-23 16:42:05 +05301415**
1416** Returns NFA_STATUS_OK if successfully initiated
1417** NFA_STATUS_FAILED otherwise
1418**
1419*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301420extern tNFA_STATUS NFA_SendVsCommand(uint8_t oid, uint8_t cmd_params_len,
1421 uint8_t* p_cmd_params,
1422 tNFA_VSC_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301423
nxpandroidc7611652015-09-23 16:42:05 +05301424/*******************************************************************************
1425**
nxf24591c1cbeab2018-02-21 17:32:26 +05301426** Function NFA_SendRawVsCommand
nxpandroidc7611652015-09-23 16:42:05 +05301427**
nxf24591c1cbeab2018-02-21 17:32:26 +05301428** Description This function is called to send raw vendor specific
nxpandroidc7611652015-09-23 16:42:05 +05301429** command to NFCC.
1430**
1431** cmd_params_len - The command parameter len
1432** p_cmd_params - The command parameter
nxpandroid8f6d0532017-07-12 18:25:30 +05301433** p_cback - The callback function to receive the
nxf24591c1cbeab2018-02-21 17:32:26 +05301434** command
nxpandroidc7611652015-09-23 16:42:05 +05301435**
1436** Returns NFA_STATUS_OK if successfully initiated
1437** NFA_STATUS_FAILED otherwise
1438**
1439*******************************************************************************/
1440
nxf24591c1cbeab2018-02-21 17:32:26 +05301441extern tNFA_STATUS NFA_SendRawVsCommand(uint8_t cmd_params_len,
1442 uint8_t* p_cmd_params,
1443 tNFA_VSC_CBACK* p_cback);
nxpandroidc7611652015-09-23 16:42:05 +05301444
nxpandroid8f6d0532017-07-12 18:25:30 +05301445/*******************************************************************************
nxf24591c1cbeab2018-02-21 17:32:26 +05301446** Function: NFA_EnableDTA_TypeMode
1447**
1448** Description: Initialize and get global DTA type mode from .conf
1449**
1450** Returns: none:
1451**
1452*******************************************************************************/
1453extern void NFA_EnableDtamode(tNFA_eDtaModes eDtaMode);
1454
1455/*******************************************************************************
1456** Function NFA_GetNCIVersion
1457**
1458** Description Called by higher layer to get the current nci
1459** version of nfc.
1460**
1461** Returns NCI version NCI2.0 / NCI1.0
1462**
1463*******************************************************************************/
1464extern uint8_t NFA_GetNCIVersion();
1465
1466/*******************************************************************************
1467** Function: NFA_SetPowerSubStateForScreenState
1468**
1469** Description: This function send the current screen state
1470**
1471** Returns: NFA_STATUS_OK if successfully initiated
1472** NFA_STATUS_FAILED otherwise
1473*******************************************************************************/
1474extern tNFA_STATUS NFA_SetPowerSubStateForScreenState(uint8_t ScreenState);
1475
1476#if (NXP_EXTNS == TRUE)
1477/*******************************************************************************
nxpandroid8f6d0532017-07-12 18:25:30 +05301478**
1479** Function NFA_Send_Core_Reset
1480**
1481** Description Performs NCI Core Reset dynamically based on NCI version
1482**
1483**
1484** Returns SUCCESS/FAIL
1485**
1486*******************************************************************************/
1487extern tNFA_STATUS NFA_Send_Core_Reset();
1488
1489/*******************************************************************************
1490**
1491** Function NFA_Send_Core_Init
1492**
1493** Description Performs NCI Core Init dynamically based on NCI version
1494**
1495**
1496** Returns void
1497**
1498*******************************************************************************/
1499extern void NFA_Send_Core_Init(uint8_t** p);
nxpandroidc7611652015-09-23 16:42:05 +05301500
nxpandroid6154b732016-01-14 20:39:23 +05301501/*******************************************************************************
1502**
1503** Function NFA_SetBootMode
1504**
1505** Description This function enables the boot mode for NFC.
1506** boot_mode 0 NORMAL_BOOT 1 FAST_BOOT
1507** By default , the mode is set to NORMAL_BOOT.
1508
1509**
1510** Returns none
1511**
1512*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301513extern void NFA_SetBootMode(uint8_t boot_mode);
nxpandroid6154b732016-01-14 20:39:23 +05301514
nxpandroidc7611652015-09-23 16:42:05 +05301515
1516/*******************************************************************************
1517**
1518** Function: NFA_GetMwVersion
1519**
1520** Description: This function gets the Middleware Version
1521**
1522** Returns: First 8 bit Major Version
1523** Last 8 bit Minor Version
1524**
1525*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301526extern tNFA_MW_VERSION NFA_GetMwVersion();
nxpandroid70cccc72016-11-18 19:58:22 +05301527
nxf24591c1cbeab2018-02-21 17:32:26 +05301528extern void NFA_EE_HCI_Control(bool mode);
1529extern tNFA_STATUS NFA_ResetNfcc();
nxpandroid70cccc72016-11-18 19:58:22 +05301530/*******************************************************************************
1531**
1532** Function NFA_checkNfcStateBusy()
1533**
1534** Description This function returns whether NFC process is busy or not.
1535**
1536** Returns if Nfc state busy return true otherwise false.
1537**
1538+*******************************************************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +05301539extern bool NFA_checkNfcStateBusy();
Ravishinde26233bb2018-08-06 22:16:08 +05301540/*******************************************************************************
1541**
1542** Function nfc_ncif_getMaxRoutingTableSize
1543**
1544** Description This function is called to get the Max supported routing
1545*Table size.
1546**
1547** Returns Max supported routing Table size
1548**
1549*******************************************************************************/
1550extern uint16_t nfc_ncif_getMaxRoutingTableSize();
1551
1552/*******************************************************************************
1553**
1554** Function: NFA_SetPreferredUiccId
1555**
1556** Description: Set Preferred Uicc ID
1557** 0x02 - UICC1
1558** 0x81 - UICC2
1559**
1560** Returns: none:
1561**
1562*******************************************************************************/
1563extern void NFA_SetPreferredUiccId(uint8_t uicc_id);
nxpandroidc7611652015-09-23 16:42:05 +05301564#endif
nxpandroidc7611652015-09-23 16:42:05 +05301565#endif /* NFA_API_H */