blob: c4a654e1a5af4752827dd6b4f8af80ef50fb709c [file] [log] [blame]
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001/******************************************************************************
2 *
Evan Chue9629ba2014-01-31 11:18:47 -05003 * Copyright (C) 2009-2014 Broadcom Corporation
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08004 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19/******************************************************************************
20 *
21 * This file contains the Near Field Communication (NFC) API function
22 * external definitions.
23 *
24 ******************************************************************************/
25
26#ifndef NFC_API_H
27#define NFC_API_H
28
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -080029#include "gki.h"
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080030#include "nci_defs.h"
31#include "nfc_hal_api.h"
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -080032#include "nfc_target.h"
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080033
Jizhou Liaoacf1ec02015-06-30 10:25:41 -070034#include "vendor_cfg.h"
35
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080036/* NFC application return status codes */
Ruchi Kandoi46e6e282017-01-30 14:26:10 -080037/* Command succeeded */
38#define NFC_STATUS_OK NCI_STATUS_OK
39/* Command is rejected. */
40#define NFC_STATUS_REJECTED NCI_STATUS_REJECTED
41/* Message is corrupted */
42#define NFC_STATUS_MSG_CORRUPTED NCI_STATUS_MESSAGE_CORRUPTED
43/* buffer full */
44#define NFC_STATUS_BUFFER_FULL NCI_STATUS_BUFFER_FULL
45/* failed */
46#define NFC_STATUS_FAILED NCI_STATUS_FAILED
47/* not initialized */
48#define NFC_STATUS_NOT_INITIALIZED NCI_STATUS_NOT_INITIALIZED
49/* Syntax error */
50#define NFC_STATUS_SYNTAX_ERROR NCI_STATUS_SYNTAX_ERROR
51/* Semantic error */
52#define NFC_STATUS_SEMANTIC_ERROR NCI_STATUS_SEMANTIC_ERROR
53/* Unknown NCI Group ID */
54#define NFC_STATUS_UNKNOWN_GID NCI_STATUS_UNKNOWN_GID
55/* Unknown NCI Opcode */
56#define NFC_STATUS_UNKNOWN_OID NCI_STATUS_UNKNOWN_OID
57/* Invalid Parameter */
58#define NFC_STATUS_INVALID_PARAM NCI_STATUS_INVALID_PARAM
59/* Message size too big */
60#define NFC_STATUS_MSG_SIZE_TOO_BIG NCI_STATUS_MSG_SIZE_TOO_BIG
61/* Already started */
62#define NFC_STATUS_ALREADY_STARTED NCI_STATUS_ALREADY_STARTED
63/* Activation Failed */
64#define NFC_STATUS_ACTIVATION_FAILED NCI_STATUS_ACTIVATION_FAILED
65/* Tear Down Error */
66#define NFC_STATUS_TEAR_DOWN NCI_STATUS_TEAR_DOWN
67/* RF transmission error*/
68#define NFC_STATUS_RF_TRANSMISSION_ERR NCI_STATUS_RF_TRANSMISSION_ERR
69/* RF protocol error */
70#define NFC_STATUS_RF_PROTOCOL_ERR NCI_STATUS_RF_PROTOCOL_ERR
71/* RF Timeout */
72#define NFC_STATUS_TIMEOUT NCI_STATUS_TIMEOUT
73/* EE Intf activate err */
74#define NFC_STATUS_EE_INTF_ACTIVE_FAIL NCI_STATUS_EE_INTF_ACTIVE_FAIL
75/* EE transmission error*/
76#define NFC_STATUS_EE_TRANSMISSION_ERR NCI_STATUS_EE_TRANSMISSION_ERR
77/* EE protocol error */
78#define NFC_STATUS_EE_PROTOCOL_ERR NCI_STATUS_EE_PROTOCOL_ERR
79/* EE Timeout */
80#define NFC_STATUS_EE_TIMEOUT NCI_STATUS_EE_TIMEOUT
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080081
82/* 0xE0 ~0xFF are proprietary status codes */
Ruchi Kandoi46e6e282017-01-30 14:26:10 -080083/* Command started successfully */
84#define NFC_STATUS_CMD_STARTED 0xE3
85/* NFCC Timeout in responding to an NCI command */
86#define NFC_STATUS_HW_TIMEOUT 0xE4
87/* More (same) event to follow */
88#define NFC_STATUS_CONTINUE 0xE5
89/* API is called to perform illegal function */
90#define NFC_STATUS_REFUSED 0xE6
91/* Wrong format of R-APDU, CC file or NDEF file */
92#define NFC_STATUS_BAD_RESP 0xE7
93/* 7816 Status Word is not command complete(0x9000) */
94#define NFC_STATUS_CMD_NOT_CMPLTD 0xE8
95/* Out of GKI buffers */
96#define NFC_STATUS_NO_BUFFERS 0xE9
97/* Protocol mismatch between API and activated one */
98#define NFC_STATUS_WRONG_PROTOCOL 0xEA
99/* Another Tag command is already in progress */
100#define NFC_STATUS_BUSY 0xEB
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800101
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800102/* Link Loss */
103#define NFC_STATUS_LINK_LOSS 0xFC
104/* data len exceeds MIU */
105#define NFC_STATUS_BAD_LENGTH 0xFD
106/* invalid handle */
107#define NFC_STATUS_BAD_HANDLE 0xFE
108/* congested */
109#define NFC_STATUS_CONGESTED 0xFF
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800110typedef uint8_t tNFC_STATUS;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800111
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800112/**********************************************
113 * NFC Config Parameter IDs defined by NCI
114 **********************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800115#define NFC_PMID_TOTAL_DURATION NCI_PARAM_ID_TOTAL_DURATION
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800116#define NFC_PMID_PF_RC NCI_PARAM_ID_PF_RC
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800117#define NFC_PMID_ATR_REQ_GEN_BYTES NCI_PARAM_ID_ATR_REQ_GEN_BYTES
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800118#define NFC_PMID_LA_HIST_BY NCI_PARAM_ID_LA_HIST_BY
119#define NFC_PMID_LA_NFCID1 NCI_PARAM_ID_LA_NFCID1
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800120#define NFC_PMID_LA_BIT_FRAME_SDD NCI_PARAM_ID_LA_BIT_FRAME_SDD
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800121#define NFC_PMID_LA_PLATFORM_CONFIG NCI_PARAM_ID_LA_PLATFORM_CONFIG
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800122#define NFC_PMID_LA_SEL_INFO NCI_PARAM_ID_LA_SEL_INFO
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800123#define NFC_PMID_LB_SENSB_INFO NCI_PARAM_ID_LB_SENSB_INFO
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800124#define NFC_PMID_LB_H_INFO NCI_PARAM_ID_LB_H_INFO_RSP
125#define NFC_PMID_LB_NFCID0 NCI_PARAM_ID_LB_NFCID0
126#define NFC_PMID_LB_APPDATA NCI_PARAM_ID_LB_APPDATA
127#define NFC_PMID_LB_SFGI NCI_PARAM_ID_LB_SFGI
128#define NFC_PMID_LB_ADC_FO NCI_PARAM_ID_LB_ADC_FO
129#define NFC_PMID_LF_T3T_ID1 NCI_PARAM_ID_LF_T3T_ID1
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800130#define NFC_PMID_LF_PROTOCOL NCI_PARAM_ID_LF_PROTOCOL
131#define NFC_PMID_LF_T3T_PMM NCI_PARAM_ID_LF_T3T_PMM
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800132#define NFC_PMID_LF_T3T_FLAGS2 NCI_PARAM_ID_LF_T3T_FLAGS2
133#define NFC_PMID_FWI NCI_PARAM_ID_FWI
134#define NFC_PMID_LF_CON_BITR_F NCI_PARAM_ID_LF_CON_BITR_F
135#define NFC_PMID_WT NCI_PARAM_ID_WT
136#define NFC_PMID_ATR_RES_GEN_BYTES NCI_PARAM_ID_ATR_RES_GEN_BYTES
137#define NFC_PMID_ATR_RSP_CONFIG NCI_PARAM_ID_ATR_RSP_CONFIG
138#define NFC_PMID_RF_FIELD_INFO NCI_PARAM_ID_RF_FIELD_INFO
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800139
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800140/* Technology based routing */
141#define NFC_ROUTE_TAG_TECH NCI_ROUTE_TAG_TECH
142/* Protocol based routing */
143#define NFC_ROUTE_TAG_PROTO NCI_ROUTE_TAG_PROTO
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800144#define NFC_ROUTE_TAG_AID NCI_ROUTE_TAG_AID /* AID routing */
Love Khanna1d062772018-04-10 21:10:02 +0530145#define NFC_ROUTE_TAG_SYSCODE NCI_ROUTE_TAG_SYSCODE /* System Code routing*/
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800146/* tag, len, 2 byte value for technology/protocol based routing */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800147
148/* For routing */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800149#define NFC_DH_ID NCI_DH_ID /* for DH */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800150/* To identify the loopback test */
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800151/* use a proprietary range */
152#define NFC_TEST_ID NCI_TEST_ID
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800153
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800154#define NFC_TL_SIZE 2
155#define NFC_SAVED_CMD_SIZE 2
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800156
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800157typedef tNCI_DISCOVER_MAPS tNFC_DISCOVER_MAPS;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800158typedef tNCI_DISCOVER_PARAMS tNFC_DISCOVER_PARAMS;
159
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800160/* all NFC Manager Callback functions have prototype like void (cback) (uint8_t
161 * event, void *p_data)
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800162 * tNFC_DATA_CBACK uses connection id as the first parameter; range 0x00-0x0F.
163 * tNFC_DISCOVER_CBACK uses tNFC_DISCOVER_EVT; range 0x4000 ~
164 * tNFC_RESPONSE_CBACK uses tNFC_RESPONSE_EVT; range 0x5000 ~
165 */
166
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800167#define NFC_FIRST_DEVT 0x4000
168#define NFC_FIRST_REVT 0x5000
169#define NFC_FIRST_CEVT 0x6000
170#define NFC_FIRST_TEVT 0x8000
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800171
172/* the events reported on tNFC_RESPONSE_CBACK */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800173enum {
174 NFC_ENABLE_REVT = NFC_FIRST_REVT, /* 0 Enable event */
175 NFC_DISABLE_REVT, /* 1 Disable event */
176 NFC_SET_CONFIG_REVT, /* 2 Set Config Response */
177 NFC_GET_CONFIG_REVT, /* 3 Get Config Response */
178 NFC_NFCEE_DISCOVER_REVT, /* 4 Discover NFCEE response */
179 NFC_NFCEE_INFO_REVT, /* 5 Discover NFCEE Notification */
180 NFC_NFCEE_MODE_SET_REVT, /* 6 NFCEE Mode Set response */
181 NFC_RF_FIELD_REVT, /* 7 RF Field information */
182 NFC_EE_ACTION_REVT, /* 8 EE Action notification */
183 NFC_EE_DISCOVER_REQ_REVT, /* 9 EE Discover Req notification */
184 NFC_SET_ROUTING_REVT, /* 10 Configure Routing response */
185 NFC_GET_ROUTING_REVT, /* 11 Retrieve Routing response */
186 NFC_RF_COMM_PARAMS_UPDATE_REVT, /* 12 RF Communication Param Update */
187 NFC_GEN_ERROR_REVT, /* 13 generic error notification */
188 NFC_NFCC_RESTART_REVT, /* 14 NFCC has been re-initialized */
189 NFC_NFCC_TIMEOUT_REVT, /* 15 NFCC is not responding */
190 NFC_NFCC_TRANSPORT_ERR_REVT, /* 16 NCI Tranport error */
191 NFC_NFCC_POWER_OFF_REVT, /* 17 NFCC turned off */
Love Khanna5e4b4d72017-04-14 18:23:55 +0530192 NFC_SET_POWER_SUB_STATE_REVT, /* 18 Set power sub state response */
Love Khanna81e4f812017-06-02 17:50:19 +0530193 NFC_NFCEE_PL_CONTROL_REVT, /* NFCEE Power/Link Ctrl response*/
Ruchi Kandoi2eba59f2017-10-24 11:20:45 -0700194 NFC_NFCEE_STATUS_REVT /* NFCEE Status Notification */
195 /* First vendor-specific rsp event */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800196};
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800197typedef uint16_t tNFC_RESPONSE_EVT;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800198
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800199enum {
200 NFC_CONN_CREATE_CEVT = NFC_FIRST_CEVT, /* 0 Conn Create Response */
201 NFC_CONN_CLOSE_CEVT, /* 1 Conn Close Response */
202 NFC_DEACTIVATE_CEVT, /* 2 Deactivate response/notificatn*/
203 NFC_DATA_CEVT, /* 3 Data */
204 NFC_ERROR_CEVT, /* 4 generic or interface error */
205 NFC_DATA_START_CEVT /* 5 received the first fragment on RF link */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800206};
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800207typedef uint16_t tNFC_CONN_EVT;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800208
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800209#define NFC_NFCC_INFO_LEN 4
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800210#ifndef NFC_NFCC_MAX_NUM_VS_INTERFACE
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800211#define NFC_NFCC_MAX_NUM_VS_INTERFACE 5
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800212#endif
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800213typedef struct {
214 tNFC_STATUS status; /* The event status. */
215 uint8_t nci_version; /* the NCI version of NFCC */
216 uint8_t max_conn; /* max number of connections by NFCC*/
217 uint32_t nci_features; /* the NCI features of NFCC */
218 uint16_t nci_interfaces; /* the NCI interfaces of NFCC */
219 uint16_t max_ce_table; /* the max routing table size */
220 uint16_t max_param_size; /* Max Size for Large Parameters */
221 uint8_t manufacture_id; /* the Manufacture ID for NFCC */
222 uint8_t nfcc_info[NFC_NFCC_INFO_LEN]; /* the Manufacture Info for NFCC */
223 uint8_t vs_interface
224 [NFC_NFCC_MAX_NUM_VS_INTERFACE]; /* the NCI VS interfaces of NFCC */
Love Khannaf928d732017-04-06 18:06:53 +0530225 uint8_t hci_packet_size; /*HCI payload size*/
226 uint8_t hci_conn_credits; /*max number of HCI credits*/
227 uint16_t max_nfc_v_size; /* maximum frame size for NFC-V*/
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800228} tNFC_ENABLE_REVT;
229
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800230#define NFC_MAX_NUM_IDS 125
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800231/* the data type associated with NFC_SET_CONFIG_REVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800232typedef struct {
233 tNFC_STATUS status; /* The event status. */
234 uint8_t num_param_id; /* Number of rejected NCI Param ID */
235 uint8_t param_ids[NFC_MAX_NUM_IDS]; /* NCI Param ID */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800236} tNFC_SET_CONFIG_REVT;
237
238/* the data type associated with NFC_GET_CONFIG_REVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800239typedef struct {
240 tNFC_STATUS status; /* The event status. */
241 uint16_t tlv_size; /* The length of TLV */
242 uint8_t* p_param_tlvs; /* TLV */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800243} tNFC_GET_CONFIG_REVT;
244
245/* the data type associated with NFC_NFCEE_DISCOVER_REVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800246typedef struct {
247 tNFC_STATUS status; /* The event status. */
248 uint8_t num_nfcee; /* The number of NFCEE */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800249} tNFC_NFCEE_DISCOVER_REVT;
250
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800251#define NFC_NFCEE_INTERFACE_APDU NCI_NFCEE_INTERFACE_APDU
252#define NFC_NFCEE_INTERFACE_HCI_ACCESS NCI_NFCEE_INTERFACE_HCI_ACCESS
253#define NFC_NFCEE_INTERFACE_T3T NCI_NFCEE_INTERFACE_T3T
254#define NFC_NFCEE_INTERFACE_TRANSPARENT NCI_NFCEE_INTERFACE_TRANSPARENT
255#define NFC_NFCEE_INTERFACE_PROPRIETARY NCI_NFCEE_INTERFACE_PROPRIETARY
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800256
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800257#define NFC_NFCEE_TAG_HW_ID NCI_NFCEE_TAG_HW_ID
258#define NFC_NFCEE_TAG_ATR_BYTES NCI_NFCEE_TAG_ATR_BYTES
259#define NFC_NFCEE_TAG_T3T_INFO NCI_NFCEE_TAG_T3T_INFO
260#define NFC_NFCEE_TAG_HCI_HOST_ID NCI_NFCEE_TAG_HCI_HOST_ID
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800261typedef uint8_t tNFC_NFCEE_TAG;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800262/* additional NFCEE Info */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800263typedef struct {
264 tNFC_NFCEE_TAG tag;
265 uint8_t len;
266 uint8_t info[NFC_MAX_EE_INFO];
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800267} tNFC_NFCEE_TLV;
268
anil.hiranniah1e3a89a2018-05-11 20:48:27 +0530269/* NFCEE unrecoverable error */
270#define NFC_NFCEE_STATUS_UNRECOVERABLE_ERROR NCI_NFCEE_STS_UNRECOVERABLE_ERROR
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800271/* NFCEE connected and inactive */
272#define NFC_NFCEE_STATUS_INACTIVE NCI_NFCEE_STS_CONN_INACTIVE
273/* NFCEE connected and active */
274#define NFC_NFCEE_STATUS_ACTIVE NCI_NFCEE_STS_CONN_ACTIVE
275/* NFCEE removed */
276#define NFC_NFCEE_STATUS_REMOVED NCI_NFCEE_STS_REMOVED
Love Khanna81e4f812017-06-02 17:50:19 +0530277
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800278/* the data type associated with NFC_NFCEE_INFO_REVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800279typedef struct {
280 tNFC_STATUS status; /* The event status - place holder */
281 uint8_t nfcee_id; /* NFCEE ID */
282 uint8_t ee_status; /* The NFCEE status. */
283 uint8_t num_interface; /* number of NFCEE interfaces */
284 uint8_t ee_interface[NFC_MAX_EE_INTERFACE]; /* NFCEE interface */
285 uint8_t num_tlvs; /* number of TLVs */
286 tNFC_NFCEE_TLV ee_tlv[NFC_MAX_EE_TLVS]; /* The TLVs associated with NFCEE */
Love Khanna81e4f812017-06-02 17:50:19 +0530287 bool nfcee_power_ctrl; /* 1, if NFCC has control of NFCEE Power Supply */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800288} tNFC_NFCEE_INFO_REVT;
289
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800290#define NFC_MODE_ACTIVATE NCI_NFCEE_MD_ACTIVATE
291#define NFC_MODE_DEACTIVATE NCI_NFCEE_MD_DEACTIVATE
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800292typedef uint8_t tNFC_NFCEE_MODE;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800293/* the data type associated with NFC_NFCEE_MODE_SET_REVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800294typedef struct {
295 tNFC_STATUS status; /* The event status.*/
296 uint8_t nfcee_id; /* NFCEE ID */
297 tNFC_NFCEE_MODE mode; /* NFCEE mode */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800298} tNFC_NFCEE_MODE_SET_REVT;
299
Love Khannad7852c92017-06-02 19:55:05 +0530300#if (APPL_DTA_MODE == TRUE)
301/* This data type is for FW Version */
302typedef struct {
303 uint8_t rom_code_version; /* ROM code Version */
304 uint8_t major_version; /* Major Version */
305 uint8_t minor_version; /* Minor Version */
306} tNFC_FW_VERSION;
307#endif
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800308#define NFC_MAX_AID_LEN NCI_MAX_AID_LEN /* 16 */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800309
310/* the data type associated with NFC_CE_GET_ROUTING_REVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800311typedef struct {
312 tNFC_STATUS status; /* The event status */
313 uint8_t nfcee_id; /* NFCEE ID */
314 uint8_t num_tlvs; /* number of TLVs */
315 uint8_t tlv_size; /* the total len of all TLVs */
316 uint8_t param_tlvs[NFC_MAX_EE_TLV_SIZE]; /* the TLVs */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800317} tNFC_GET_ROUTING_REVT;
318
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800319/* the data type associated with NFC_CONN_CREATE_CEVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800320typedef struct {
321 tNFC_STATUS status; /* The event status */
322 uint8_t dest_type; /* the destination type */
323 uint8_t id; /* NFCEE ID or RF Discovery ID */
324 uint8_t buff_size; /* The max buffer size */
325 uint8_t num_buffs; /* The number of buffers */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800326} tNFC_CONN_CREATE_CEVT;
327
328/* the data type associated with NFC_CONN_CLOSE_CEVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800329typedef struct {
330 tNFC_STATUS status; /* The event status */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800331} tNFC_CONN_CLOSE_CEVT;
332
333/* the data type associated with NFC_DATA_CEVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800334typedef struct {
335 tNFC_STATUS status; /* The event status */
336 NFC_HDR* p_data; /* The received Data */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800337} tNFC_DATA_CEVT;
338
Love Khanna81e4f812017-06-02 17:50:19 +0530339/* the data type associated with NFC_NFCEE_PL_CONTROL_REVT */
340typedef struct {
341 tNFC_STATUS status; /* The event status */
342 uint8_t nfcee_id; /* NFCEE ID */
343 tNCI_NFCEE_PL_CONFIG pl_control; /* Power/Link Control command */
344} tNFC_NFCEE_PL_CONTROL_REVT;
345
346/* the data type associated with NFC_NFCEE_STATUS_REVT */
347typedef struct {
348 tNFC_STATUS status; /* The event status */
349 uint8_t nfcee_id; /* NFCEE ID */
350 tNCI_EE_NTF_STATUS nfcee_status; /* NFCEE status */
351} tNFC_NFCEE_STATUS_REVT;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800352/* RF Field Status */
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800353typedef uint8_t tNFC_RF_STS;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800354
355/* RF Field Technologies */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800356#define NFC_RF_TECHNOLOGY_A NCI_RF_TECHNOLOGY_A
357#define NFC_RF_TECHNOLOGY_B NCI_RF_TECHNOLOGY_B
358#define NFC_RF_TECHNOLOGY_F NCI_RF_TECHNOLOGY_F
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800359typedef uint8_t tNFC_RF_TECH;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800360
Ruchi Kandoi3f64b002017-03-27 16:52:28 -0700361extern uint8_t NFC_GetNCIVersion();
362
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800363/* Supported Protocols */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800364#define NFC_PROTOCOL_UNKNOWN NCI_PROTOCOL_UNKNOWN /* Unknown */
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800365/* Type1Tag - NFC-A */
366#define NFC_PROTOCOL_T1T NCI_PROTOCOL_T1T
367/* Type2Tag - NFC-A */
368#define NFC_PROTOCOL_T2T NCI_PROTOCOL_T2T
369/* Type3Tag - NFC-F */
370#define NFC_PROTOCOL_T3T NCI_PROTOCOL_T3T
Love Khanna57a3dfa2017-03-28 20:03:38 +0530371/* Type5Tag - NFC-V/ISO15693*/
372#define NFC_PROTOCOL_T5T NFC_PROTOCOL_T5T_(NFC_GetNCIVersion())
373#define NFC_PROTOCOL_T5T_(x) \
Chih-Hung Hsieh7ac6a7c2017-08-01 14:26:16 -0700374 (((x) == NCI_VERSION_2_0) ? NCI_PROTOCOL_T5T : NCI_PROTOCOL_15693)
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800375/* Type 4A,4B - NFC-A or NFC-B */
376#define NFC_PROTOCOL_ISO_DEP NCI_PROTOCOL_ISO_DEP
377/* NFCDEP/LLCP - NFC-A or NFC-F */
378#define NFC_PROTOCOL_NFC_DEP NCI_PROTOCOL_NFC_DEP
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800379#define NFC_PROTOCOL_MIFARE NCI_PROTOCOL_MIFARE
Love Khanna57a3dfa2017-03-28 20:03:38 +0530380#define NFC_PROTOCOL_ISO15693 NCI_PROTOCOL_15693
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800381#define NFC_PROTOCOL_B_PRIME NCI_PROTOCOL_B_PRIME
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800382#define NFC_PROTOCOL_KOVIO NCI_PROTOCOL_KOVIO
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800383typedef uint8_t tNFC_PROTOCOL;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800384
385/* Discovery Types/Detected Technology and Mode */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800386#define NFC_DISCOVERY_TYPE_POLL_A NCI_DISCOVERY_TYPE_POLL_A
387#define NFC_DISCOVERY_TYPE_POLL_B NCI_DISCOVERY_TYPE_POLL_B
388#define NFC_DISCOVERY_TYPE_POLL_F NCI_DISCOVERY_TYPE_POLL_F
389#define NFC_DISCOVERY_TYPE_POLL_A_ACTIVE NCI_DISCOVERY_TYPE_POLL_A_ACTIVE
390#define NFC_DISCOVERY_TYPE_POLL_F_ACTIVE NCI_DISCOVERY_TYPE_POLL_F_ACTIVE
Love Khanna78eae6d2017-04-04 16:23:47 +0530391#define NFC_DISCOVERY_TYPE_POLL_ACTIVE NCI_DISCOVERY_TYPE_POLL_ACTIVE
Love Khanna57a3dfa2017-03-28 20:03:38 +0530392#define NFC_DISCOVERY_TYPE_POLL_V NCI_DISCOVERY_TYPE_POLL_V
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800393#define NFC_DISCOVERY_TYPE_POLL_B_PRIME NCI_DISCOVERY_TYPE_POLL_B_PRIME
394#define NFC_DISCOVERY_TYPE_POLL_KOVIO NCI_DISCOVERY_TYPE_POLL_KOVIO
395#define NFC_DISCOVERY_TYPE_LISTEN_A NCI_DISCOVERY_TYPE_LISTEN_A
396#define NFC_DISCOVERY_TYPE_LISTEN_B NCI_DISCOVERY_TYPE_LISTEN_B
397#define NFC_DISCOVERY_TYPE_LISTEN_F NCI_DISCOVERY_TYPE_LISTEN_F
398#define NFC_DISCOVERY_TYPE_LISTEN_A_ACTIVE NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE
399#define NFC_DISCOVERY_TYPE_LISTEN_F_ACTIVE NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE
Love Khanna78eae6d2017-04-04 16:23:47 +0530400#define NFC_DISCOVERY_TYPE_LISTEN_ACTIVE NCI_DISCOVERY_TYPE_LISTEN_ACTIVE
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800401#define NFC_DISCOVERY_TYPE_LISTEN_ISO15693 NCI_DISCOVERY_TYPE_LISTEN_ISO15693
402#define NFC_DISCOVERY_TYPE_LISTEN_B_PRIME NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800403typedef uint8_t tNFC_DISCOVERY_TYPE;
404typedef uint8_t tNFC_RF_TECH_N_MODE;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800405
406/* Select Response codes */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800407#define NFC_SEL_RES_NFC_FORUM_T2T 0x00
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800408
409/* Bit Rates */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800410#define NFC_BIT_RATE_212 NCI_BIT_RATE_212 /* 212 kbit/s */
411#define NFC_BIT_RATE_424 NCI_BIT_RATE_424 /* 424 kbit/s */
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800412typedef uint8_t tNFC_BIT_RATE;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800413
414/**********************************************
415 * Interface Types
416 **********************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800417#define NFC_INTERFACE_EE_DIRECT_RF NCI_INTERFACE_EE_DIRECT_RF
418#define NFC_INTERFACE_FRAME NCI_INTERFACE_FRAME
419#define NFC_INTERFACE_ISO_DEP NCI_INTERFACE_ISO_DEP
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800420#define NFC_INTERFACE_NFC_DEP NCI_INTERFACE_NFC_DEP
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800421#define NFC_INTERFACE_MIFARE NCI_INTERFACE_VS_MIFARE
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800422typedef tNCI_INTF_TYPE tNFC_INTF_TYPE;
423
424/**********************************************
425 * Deactivation Type
426 **********************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800427#define NFC_DEACTIVATE_TYPE_IDLE NCI_DEACTIVATE_TYPE_IDLE
428#define NFC_DEACTIVATE_TYPE_SLEEP NCI_DEACTIVATE_TYPE_SLEEP
429#define NFC_DEACTIVATE_TYPE_SLEEP_AF NCI_DEACTIVATE_TYPE_SLEEP_AF
430#define NFC_DEACTIVATE_TYPE_DISCOVERY NCI_DEACTIVATE_TYPE_DISCOVERY
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800431typedef uint8_t tNFC_DEACT_TYPE;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800432
433/**********************************************
434 * Deactivation Reasons
435 **********************************************/
Love Khanna13c47602017-04-04 17:36:20 +0530436#define NFC_DEACTIVATE_REASON_DH_REQ_FAILED NCI_DEACTIVATE_REASON_DH_REQ_FAILED
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800437typedef uint8_t tNFC_DEACT_REASON;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800438
439/* the data type associated with NFC_RF_FIELD_REVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800440typedef struct {
441 tNFC_STATUS status; /* The event status - place holder. */
442 tNFC_RF_STS rf_field; /* RF Field Status */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800443} tNFC_RF_FIELD_REVT;
444
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800445#define NFC_MAX_APP_DATA_LEN 40
446typedef struct {
447 uint8_t len_aid; /* length of application id */
448 uint8_t aid[NFC_MAX_AID_LEN]; /* application id */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800449} tNFC_AID;
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800450typedef struct {
451 uint8_t len_aid; /* length of application id */
452 uint8_t aid[NFC_MAX_AID_LEN]; /* application id */
453 uint8_t len_data; /* len of application data */
454 uint8_t data[NFC_MAX_APP_DATA_LEN]; /* application data */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800455} tNFC_APP_INIT;
456
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800457/* ISO 7816-4 SELECT command */
458#define NFC_EE_TRIG_SELECT NCI_EE_TRIG_7816_SELECT
459/* RF Protocol changed */
460#define NFC_EE_TRIG_RF_PROTOCOL NCI_EE_TRIG_RF_PROTOCOL
461/* RF Technology changed */
462#define NFC_EE_TRIG_RF_TECHNOLOGY NCI_EE_TRIG_RF_TECHNOLOGY
463/* Application initiation */
464#define NFC_EE_TRIG_APP_INIT NCI_EE_TRIG_APP_INIT
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800465typedef uint8_t tNFC_EE_TRIGGER;
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800466typedef struct {
467 tNFC_EE_TRIGGER trigger; /* the trigger of this event */
468 union {
469 tNFC_PROTOCOL protocol;
470 tNFC_RF_TECH technology;
471 tNFC_AID aid;
472 tNFC_APP_INIT app_init;
473 } param; /* Discovery Type specific parameters */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800474} tNFC_ACTION_DATA;
475
476/* the data type associated with NFC_EE_ACTION_REVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800477typedef struct {
478 tNFC_STATUS status; /* The event status - place holder */
479 uint8_t nfcee_id; /* NFCEE ID */
480 tNFC_ACTION_DATA act_data; /* data associated /w the action */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800481} tNFC_EE_ACTION_REVT;
482
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800483#define NFC_EE_DISC_OP_ADD 0
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800484typedef uint8_t tNFC_EE_DISC_OP;
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800485typedef struct {
486 tNFC_EE_DISC_OP op; /* add or remove this entry */
487 uint8_t nfcee_id; /* NFCEE ID */
488 tNFC_RF_TECH_N_MODE tech_n_mode; /* Discovery Technology and Mode */
489 tNFC_PROTOCOL protocol; /* NFC protocol */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800490} tNFC_EE_DISCOVER_INFO;
491
492#ifndef NFC_MAX_EE_DISC_ENTRIES
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800493#define NFC_MAX_EE_DISC_ENTRIES 6
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800494#endif
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800495/* T, L, V(NFCEE ID, TechnMode, Protocol) */
496#define NFC_EE_DISCOVER_ENTRY_LEN 5
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800497#define NFC_EE_DISCOVER_INFO_LEN 3 /* NFCEE ID, TechnMode, Protocol */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800498/* the data type associated with NFC_EE_DISCOVER_REQ_REVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800499typedef struct {
500 tNFC_STATUS status; /* The event status - place holder */
501 uint8_t num_info; /* number of entries in info[] */
502 tNFC_EE_DISCOVER_INFO
503 info[NFC_MAX_EE_DISC_ENTRIES]; /* discovery request from NFCEE */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800504} tNFC_EE_DISCOVER_REQ_REVT;
505
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800506typedef union {
507 tNFC_STATUS status; /* The event status. */
508 tNFC_ENABLE_REVT enable;
509 tNFC_SET_CONFIG_REVT set_config;
510 tNFC_GET_CONFIG_REVT get_config;
511 tNFC_NFCEE_DISCOVER_REVT nfcee_discover;
512 tNFC_NFCEE_INFO_REVT nfcee_info;
513 tNFC_NFCEE_MODE_SET_REVT mode_set;
Love Khanna81e4f812017-06-02 17:50:19 +0530514 tNFC_NFCEE_PL_CONTROL_REVT pl_control;
515 tNFC_NFCEE_STATUS_REVT nfcee_status;
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800516 tNFC_RF_FIELD_REVT rf_field;
517 tNFC_STATUS cfg_routing;
518 tNFC_GET_ROUTING_REVT get_routing;
519 tNFC_EE_ACTION_REVT ee_action;
520 tNFC_EE_DISCOVER_REQ_REVT ee_discover_req;
521 void* p_vs_evt_data;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800522} tNFC_RESPONSE;
523
524/*************************************
525** RESPONSE Callback Functions
526**************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800527typedef void(tNFC_RESPONSE_CBACK)(tNFC_RESPONSE_EVT event,
528 tNFC_RESPONSE* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800529
530/* The events reported on tNFC_VS_CBACK */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800531/* The event is (NCI_RSP_BIT|oid) for response and (NCI_NTF_BIT|oid) for
532 * notification*/
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800533
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800534typedef uint8_t tNFC_VS_EVT;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800535
536/*************************************
537** Proprietary (Vendor Specific) Callback Functions
538**************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800539typedef void(tNFC_VS_CBACK)(tNFC_VS_EVT event, uint16_t data_len,
540 uint8_t* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800541
542/* the events reported on tNFC_DISCOVER_CBACK */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800543enum {
544 NFC_START_DEVT = NFC_FIRST_DEVT, /* Status of NFC_DiscoveryStart */
545 NFC_MAP_DEVT, /* Status of NFC_DiscoveryMap */
546 NFC_RESULT_DEVT, /* The responses from remote device */
547 NFC_SELECT_DEVT, /* Status of NFC_DiscoverySelect */
548 NFC_ACTIVATE_DEVT, /* RF interface is activated */
549 NFC_DEACTIVATE_DEVT /* Status of RF deactivation */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800550};
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800551typedef uint16_t tNFC_DISCOVER_EVT;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800552
553/* the data type associated with NFC_START_DEVT */
554typedef tNFC_STATUS tNFC_START_DEVT;
555
556typedef tNCI_RF_PA_PARAMS tNFC_RF_PA_PARAMS;
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800557#define NFC_MAX_SENSB_RES_LEN NCI_MAX_SENSB_RES_LEN
558#define NFC_NFCID0_MAX_LEN 4
559typedef struct {
560 uint8_t sensb_res_len; /* Length of SENSB_RES Response (Byte 2 - Byte 12 or
561 13) Available after Technology Detection */
562 uint8_t sensb_res[NFC_MAX_SENSB_RES_LEN]; /* SENSB_RES Response (ATQ) */
563 uint8_t nfcid0[NFC_NFCID0_MAX_LEN];
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800564} tNFC_RF_PB_PARAMS;
565
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800566#define NFC_MAX_SENSF_RES_LEN NCI_MAX_SENSF_RES_LEN
567#define NFC_NFCID2_LEN NCI_NFCID2_LEN
568typedef struct {
569 uint8_t bit_rate; /* NFC_BIT_RATE_212 or NFC_BIT_RATE_424 */
570 uint8_t sensf_res_len; /* Length of SENSF_RES Response (Byte 2 - Byte 17 or
571 19) Available after Technology Detection */
572 uint8_t sensf_res[NFC_MAX_SENSF_RES_LEN]; /* SENSB_RES Response */
573 uint8_t nfcid2[NFC_NFCID2_LEN]; /* NFCID2 generated by the Local NFCC for
574 NFC-DEP Protocol.Available for Frame
575 Interface */
576 uint8_t mrti_check;
577 uint8_t mrti_update;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800578} tNFC_RF_PF_PARAMS;
579
580typedef tNCI_RF_LF_PARAMS tNFC_RF_LF_PARAMS;
581
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800582#define NFC_ISO15693_UID_LEN 8
583typedef struct {
584 uint8_t flag;
585 uint8_t dsfid;
586 uint8_t uid[NFC_ISO15693_UID_LEN];
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800587} tNFC_RF_PISO15693_PARAMS;
588
Martijn Coenen5c65c3a2013-03-27 13:23:36 -0700589#ifndef NFC_KOVIO_MAX_LEN
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800590#define NFC_KOVIO_MAX_LEN 32
Martijn Coenen5c65c3a2013-03-27 13:23:36 -0700591#endif
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800592typedef struct {
593 uint8_t uid_len;
594 uint8_t uid[NFC_KOVIO_MAX_LEN];
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800595} tNFC_RF_PKOVIO_PARAMS;
596
Love Khanna78eae6d2017-04-04 16:23:47 +0530597typedef tNCI_RF_ACM_P_PARAMS tNFC_RF_ACM_P_PARAMS;
598
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800599typedef union {
600 tNFC_RF_PA_PARAMS pa;
601 tNFC_RF_PB_PARAMS pb;
602 tNFC_RF_PF_PARAMS pf;
603 tNFC_RF_LF_PARAMS lf;
604 tNFC_RF_PISO15693_PARAMS pi93;
605 tNFC_RF_PKOVIO_PARAMS pk;
Love Khanna78eae6d2017-04-04 16:23:47 +0530606 tNFC_RF_ACM_P_PARAMS acm_p;
Martijn Coenen5c65c3a2013-03-27 13:23:36 -0700607} tNFC_RF_TECH_PARAMU;
608
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800609typedef struct {
610 tNFC_DISCOVERY_TYPE mode;
611 tNFC_RF_TECH_PARAMU param;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800612} tNFC_RF_TECH_PARAMS;
613
614/* the data type associated with NFC_RESULT_DEVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800615typedef struct {
616 tNFC_STATUS status; /* The event status - place holder. */
617 uint8_t rf_disc_id; /* RF Discovery ID */
618 uint8_t protocol; /* supported protocol */
619 tNFC_RF_TECH_PARAMS rf_tech_param; /* RF technology parameters */
620 uint8_t more; /* 0: last, 1: last (limit), 2: more */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800621} tNFC_RESULT_DEVT;
622
623/* the data type associated with NFC_SELECT_DEVT */
624typedef tNFC_STATUS tNFC_SELECT_DEVT;
625
626/* the data type associated with NFC_STOP_DEVT */
627typedef tNFC_STATUS tNFC_STOP_DEVT;
628
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800629#define NFC_MAX_ATS_LEN NCI_MAX_ATS_LEN
630#define NFC_MAX_HIS_BYTES_LEN NCI_MAX_HIS_BYTES_LEN
631#define NFC_MAX_GEN_BYTES_LEN NCI_MAX_GEN_BYTES_LEN
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800632
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800633typedef struct {
634 uint8_t ats_res_len; /* Length of ATS RES */
635 uint8_t ats_res[NFC_MAX_ATS_LEN]; /* ATS RES */
636 bool nad_used; /* NAD is used or not */
637 uint8_t fwi; /* Frame Waiting time Integer */
638 uint8_t sfgi; /* Start-up Frame Guard time Integer*/
639 uint8_t his_byte_len; /* len of historical bytes */
640 uint8_t his_byte[NFC_MAX_HIS_BYTES_LEN]; /* historical bytes */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800641} tNFC_INTF_PA_ISO_DEP;
642
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800643typedef struct { uint8_t rats; /* RATS */ } tNFC_INTF_LA_ISO_DEP;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800644
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800645typedef struct {
646 uint8_t atr_res_len; /* Length of ATR_RES */
647 uint8_t atr_res[NFC_MAX_ATS_LEN]; /* ATR_RES (Byte 3 - Byte 17+n) */
648 uint8_t max_payload_size; /* 64, 128, 192 or 254 */
649 uint8_t gen_bytes_len; /* len of general bytes */
650 uint8_t gen_bytes[NFC_MAX_GEN_BYTES_LEN]; /* general bytes */
651 uint8_t
652 waiting_time; /* WT -> Response Waiting Time RWT = (256 x 16/fC) x 2WT */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800653} tNFC_INTF_PA_NFC_DEP;
654
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800655/* Note: keep tNFC_INTF_PA_NFC_DEP data member in the same order as
656 * tNFC_INTF_LA_NFC_DEP */
657typedef struct {
658 uint8_t atr_req_len; /* Length of ATR_REQ */
659 uint8_t atr_req[NFC_MAX_ATS_LEN]; /* ATR_REQ (Byte 3 - Byte 18+n) */
660 uint8_t max_payload_size; /* 64, 128, 192 or 254 */
661 uint8_t gen_bytes_len; /* len of general bytes */
662 uint8_t gen_bytes[NFC_MAX_GEN_BYTES_LEN]; /* general bytes */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800663} tNFC_INTF_LA_NFC_DEP;
664typedef tNFC_INTF_LA_NFC_DEP tNFC_INTF_LF_NFC_DEP;
665typedef tNFC_INTF_PA_NFC_DEP tNFC_INTF_PF_NFC_DEP;
666
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800667#define NFC_MAX_ATTRIB_LEN NCI_MAX_ATTRIB_LEN
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800668
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800669typedef struct {
670 uint8_t attrib_res_len; /* Length of ATTRIB RES */
671 uint8_t attrib_res[NFC_MAX_ATTRIB_LEN]; /* ATTRIB RES */
672 uint8_t hi_info_len; /* len of Higher layer Info */
673 uint8_t hi_info[NFC_MAX_GEN_BYTES_LEN]; /* Higher layer Info */
674 uint8_t mbli; /* Maximum buffer length. */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800675} tNFC_INTF_PB_ISO_DEP;
676
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800677typedef struct {
678 uint8_t attrib_req_len; /* Length of ATTRIB REQ */
679 uint8_t attrib_req[NFC_MAX_ATTRIB_LEN]; /* ATTRIB REQ (Byte 2 - 10+k)*/
680 uint8_t hi_info_len; /* len of Higher layer Info */
681 uint8_t hi_info[NFC_MAX_GEN_BYTES_LEN]; /* Higher layer Info */
682 uint8_t nfcid0[NFC_NFCID0_MAX_LEN]; /* NFCID0 */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800683} tNFC_INTF_LB_ISO_DEP;
684
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800685#ifndef NFC_MAX_RAW_PARAMS
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800686#define NFC_MAX_RAW_PARAMS 16
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800687#endif
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800688#define NFC_MAX_RAW_PARAMS 16
689typedef struct {
690 uint8_t param_len;
691 uint8_t param[NFC_MAX_RAW_PARAMS];
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800692} tNFC_INTF_FRAME;
693
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800694typedef struct {
695 tNFC_INTF_TYPE type; /* Interface Type 1 Byte See Table 67 */
696 union {
697 tNFC_INTF_LA_ISO_DEP la_iso;
698 tNFC_INTF_PA_ISO_DEP pa_iso;
699 tNFC_INTF_LB_ISO_DEP lb_iso;
700 tNFC_INTF_PB_ISO_DEP pb_iso;
701 tNFC_INTF_LA_NFC_DEP la_nfc;
702 tNFC_INTF_PA_NFC_DEP pa_nfc;
703 tNFC_INTF_LF_NFC_DEP lf_nfc;
704 tNFC_INTF_PF_NFC_DEP pf_nfc;
705 tNFC_INTF_FRAME frame;
706 } intf_param; /* Activation Parameters 0 - n Bytes */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800707} tNFC_INTF_PARAMS;
708
709/* the data type associated with NFC_ACTIVATE_DEVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800710typedef struct {
711 uint8_t rf_disc_id; /* RF Discovery ID */
712 tNFC_PROTOCOL protocol; /* supported protocol */
713 tNFC_RF_TECH_PARAMS rf_tech_param; /* RF technology parameters */
714 tNFC_DISCOVERY_TYPE data_mode; /* for future Data Exchange */
715 tNFC_BIT_RATE tx_bitrate; /* Data Exchange Tx Bitrate */
716 tNFC_BIT_RATE rx_bitrate; /* Data Exchange Rx Bitrate */
717 tNFC_INTF_PARAMS intf_param; /* interface type and params*/
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800718} tNFC_ACTIVATE_DEVT;
719
720/* the data type associated with NFC_DEACTIVATE_DEVT and NFC_DEACTIVATE_CEVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800721typedef struct {
722 tNFC_STATUS status; /* The event status. */
723 tNFC_DEACT_TYPE type; /* De-activate type */
724 bool is_ntf; /* TRUE, if deactivate notif*/
Love Khanna13c47602017-04-04 17:36:20 +0530725 tNFC_DEACT_REASON reason; /* De-activate reason */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800726} tNFC_DEACTIVATE_DEVT;
727
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800728typedef union {
729 tNFC_STATUS status; /* The event status. */
730 tNFC_START_DEVT start;
731 tNFC_RESULT_DEVT result;
732 tNFC_SELECT_DEVT select;
733 tNFC_STOP_DEVT stop;
734 tNFC_ACTIVATE_DEVT activate;
735 tNFC_DEACTIVATE_DEVT deactivate;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800736} tNFC_DISCOVER;
737
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800738typedef struct {
739 bool include_rf_tech_mode; /* TRUE if including RF Tech and Mode update */
740 tNFC_RF_TECH_N_MODE rf_tech_n_mode; /* RF tech and mode */
741 bool include_tx_bit_rate; /* TRUE if including Tx bit rate update */
742 tNFC_BIT_RATE tx_bit_rate; /* Transmit Bit Rate */
743 bool include_rx_bit_rate; /* TRUE if including Rx bit rate update */
744 tNFC_BIT_RATE rx_bit_rate; /* Receive Bit Rate */
745 bool include_nfc_b_config; /* TRUE if including NFC-B data exchange config */
746 uint8_t min_tr0; /* Minimun TR0 */
747 uint8_t min_tr1; /* Minimun TR1 */
748 uint8_t suppression_eos; /* Suppression of EoS */
749 uint8_t suppression_sos; /* Suppression of SoS */
750 uint8_t min_tr2; /* Minimun TR1 */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800751} tNFC_RF_COMM_PARAMS;
752
753/*************************************
754** DISCOVER Callback Functions
755**************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800756typedef void(tNFC_DISCOVER_CBACK)(tNFC_DISCOVER_EVT event,
757 tNFC_DISCOVER* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800758
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800759typedef uint16_t tNFC_TEST_EVT;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800760
761/* the data type associated with NFC_LOOPBACK_TEVT */
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800762typedef struct {
763 tNFC_STATUS status; /* The event status. */
764 NFC_HDR* p_data; /* The loop back data from NFCC */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800765} tNFC_LOOPBACK_TEVT;
766
767/* the data type associated with NFC_RF_CONTROL_TEVT */
768typedef tNFC_STATUS tNFC_RF_CONTROL_TEVT;
769
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800770typedef union {
771 tNFC_STATUS status; /* The event status. */
772 tNFC_LOOPBACK_TEVT loop_back;
773 tNFC_RF_CONTROL_TEVT rf_control;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800774} tNFC_TEST;
775
776/*************************************
777** TEST Callback Functions
778**************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800779typedef void(tNFC_TEST_CBACK)(tNFC_TEST_EVT event, tNFC_TEST* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800780
781typedef tNFC_DEACTIVATE_DEVT tNFC_DEACTIVATE_CEVT;
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800782typedef union {
783 tNFC_STATUS status; /* The event status. */
784 tNFC_CONN_CREATE_CEVT conn_create;
785 tNFC_CONN_CLOSE_CEVT conn_close;
786 tNFC_DEACTIVATE_CEVT deactivate;
787 tNFC_DATA_CEVT data;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800788} tNFC_CONN;
789
790/*************************************
791** Data Callback Functions
792**************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800793typedef void(tNFC_CONN_CBACK)(uint8_t conn_id, tNFC_CONN_EVT event,
794 tNFC_CONN* p_data);
795#define NFC_MAX_CONN_ID 15
796#define NFC_ILLEGAL_CONN_ID 0xFF
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800797/* the static connection ID for RF traffic */
798#define NFC_RF_CONN_ID 0
Love Khanna81e4f812017-06-02 17:50:19 +0530799/* the static connection ID for HCI transport */
800#define NFC_HCI_CONN_ID 1
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800801
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800802/*****************************************************************************
803** EXTERNAL FUNCTION DECLARATIONS
804*****************************************************************************/
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800805
806/*******************************************************************************
807**
808** Function NFC_Enable
809**
810** Description This function enables NFC. Prior to calling NFC_Enable:
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800811** - the NFCC must be powered up, and ready to receive
812** commands.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800813** - GKI must be enabled
814** - NFC_TASK must be started
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800815** - NCIT_TASK must be started (if using dedicated NCI
816** transport)
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800817**
818** This function opens the NCI transport (if applicable),
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800819** resets the NFC controller, and initializes the NFC
820** subsystems.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800821**
822** When the NFC startup procedure is completed, an
823** NFC_ENABLE_REVT is returned to the application using the
824** tNFC_RESPONSE_CBACK.
825**
826** Returns tNFC_STATUS
827**
828*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800829extern tNFC_STATUS NFC_Enable(tNFC_RESPONSE_CBACK* p_cback);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800830
831/*******************************************************************************
832**
833** Function NFC_Disable
834**
835** Description This function performs clean up routines for shutting down
836** NFC and closes the NCI transport (if using dedicated NCI
837** transport).
838**
839** When the NFC shutdown procedure is completed, an
840** NFC_DISABLED_REVT is returned to the application using the
841** tNFC_RESPONSE_CBACK.
842**
843** Returns nothing
844**
845*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800846extern void NFC_Disable(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800847
848/*******************************************************************************
849**
850** Function NFC_Init
851**
852** Description This function initializes control blocks for NFC
853**
854** Returns nothing
855**
856*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800857extern void NFC_Init(tHAL_NFC_ENTRY* p_hal_entry_tbl);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800858
859/*******************************************************************************
860**
861** Function NFC_GetLmrtSize
862**
863** Description Called by application wto query the Listen Mode Routing
864** Table size supported by NFCC
865**
866** Returns Listen Mode Routing Table size
867**
868*******************************************************************************/
Ruchi Kandoi4182dab2017-01-10 13:25:53 -0800869extern uint16_t NFC_GetLmrtSize(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800870
871/*******************************************************************************
872**
873** Function NFC_SetConfig
874**
875** Description This function is called to send the configuration parameter
876** TLV to NFCC. The response from NFCC is reported by
877** tNFC_RESPONSE_CBACK as NFC_SET_CONFIG_REVT.
878**
879** Parameters tlv_size - the length of p_param_tlvs.
880** p_param_tlvs - the parameter ID/Len/Value list
881**
882** Returns tNFC_STATUS
883**
884*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800885extern tNFC_STATUS NFC_SetConfig(uint8_t tlv_size, uint8_t* p_param_tlvs);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800886
887/*******************************************************************************
888**
889** Function NFC_GetConfig
890**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800891** Description This function is called to retrieve the parameter TLV from
892** NFCC. The response from NFCC is reported by
893** tNFC_RESPONSE_CBACK as NFC_GET_CONFIG_REVT.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800894**
895** Parameters num_ids - the number of parameter IDs
896** p_param_ids - the parameter ID list.
897**
898** Returns tNFC_STATUS
899**
900*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800901extern tNFC_STATUS NFC_GetConfig(uint8_t num_ids, uint8_t* p_param_ids);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800902
903/*******************************************************************************
904**
905** Function NFC_NfceeDiscover
906**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800907** Description This function is called to enable or disable NFCEE
908** Discovery. The response from NFCC is reported by
909** tNFC_RESPONSE_CBACK as NFC_NFCEE_DISCOVER_REVT.
910** The notification from NFCC is reported by
911** tNFC_RESPONSE_CBACK as NFC_NFCEE_INFO_REVT.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800912**
913** Parameters discover - 1 to enable discover, 0 to disable.
914**
915** Returns tNFC_STATUS
916**
917*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800918extern tNFC_STATUS NFC_NfceeDiscover(bool discover);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800919
920/*******************************************************************************
921**
922** Function NFC_NfceeModeSet
923**
924** Description This function is called to activate or de-activate an NFCEE
925** connected to the NFCC.
926** The response from NFCC is reported by tNFC_RESPONSE_CBACK
927** as NFC_NFCEE_MODE_SET_REVT.
928**
929** Parameters nfcee_id - the NFCEE to activate or de-activate.
930** mode - 0 to activate NFCEE, 1 to de-activate.
931**
932** Returns tNFC_STATUS
933**
934*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800935extern tNFC_STATUS NFC_NfceeModeSet(uint8_t nfcee_id, tNFC_NFCEE_MODE mode);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800936/*******************************************************************************
937**
938** Function NFC_DiscoveryMap
939**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800940** Description This function is called to set the discovery interface
941** mapping. The response from NFCC is reported by
942** tNFC_DISCOVER_CBACK as. NFC_MAP_DEVT.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800943**
944** Parameters num - the number of items in p_params.
945** p_maps - the discovery interface mappings
946** p_cback - the discovery callback function
947**
948** Returns tNFC_STATUS
949**
950*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800951extern tNFC_STATUS NFC_DiscoveryMap(uint8_t num, tNFC_DISCOVER_MAPS* p_maps,
952 tNFC_DISCOVER_CBACK* p_cback);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800953
954/*******************************************************************************
955**
956** Function NFC_DiscoveryStart
957**
958** Description This function is called to start Polling and/or Listening.
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800959** The response from NFCC is reported by tNFC_DISCOVER_CBACK
960** as NFC_START_DEVT. The notification from NFCC is reported by
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800961** tNFC_DISCOVER_CBACK as NFC_RESULT_DEVT.
962**
963** Parameters num_params - the number of items in p_params.
964** p_params - the discovery parameters
965** p_cback - the discovery callback function
966**
967** Returns tNFC_STATUS
968**
969*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800970extern tNFC_STATUS NFC_DiscoveryStart(uint8_t num_params,
971 tNFC_DISCOVER_PARAMS* p_params,
972 tNFC_DISCOVER_CBACK* p_cback);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800973
974/*******************************************************************************
975**
976** Function NFC_DiscoverySelect
977**
978** Description If tNFC_DISCOVER_CBACK reports status=NFC_MULTIPLE_PROT,
979** the application needs to use this function to select the
980** the logical endpoint to continue. The response from NFCC is
981** reported by tNFC_DISCOVER_CBACK as NFC_SELECT_DEVT.
982**
983** Parameters rf_disc_id - The ID identifies the remote device.
984** protocol - the logical endpoint on the remote devide
985** rf_interface - the RF interface to communicate with NFCC
986**
987** Returns tNFC_STATUS
988**
989*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800990extern tNFC_STATUS NFC_DiscoverySelect(uint8_t rf_disc_id, uint8_t protocol,
991 uint8_t rf_interface);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800992
993/*******************************************************************************
994**
995** Function NFC_ConnCreate
996**
997** Description This function is called to create a logical connection with
998** NFCC for data exchange.
999** The response from NFCC is reported in tNFC_CONN_CBACK
1000** as NFC_CONN_CREATE_CEVT.
1001**
1002** Parameters dest_type - the destination type
1003** id - the NFCEE ID or RF Discovery ID .
1004** protocol - the protocol
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001005** p_cback - the data callback function to receive data from
1006** NFCC
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001007**
1008** Returns tNFC_STATUS
1009**
1010*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001011extern tNFC_STATUS NFC_ConnCreate(uint8_t dest_type, uint8_t id,
1012 uint8_t protocol, tNFC_CONN_CBACK* p_cback);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001013
1014/*******************************************************************************
1015**
1016** Function NFC_ConnClose
1017**
1018** Description This function is called to close a logical connection with
1019** NFCC.
1020** The response from NFCC is reported in tNFC_CONN_CBACK
1021** as NFC_CONN_CLOSE_CEVT.
1022**
1023** Parameters conn_id - the connection id.
1024**
1025** Returns tNFC_STATUS
1026**
1027*******************************************************************************/
Ruchi Kandoi4182dab2017-01-10 13:25:53 -08001028extern tNFC_STATUS NFC_ConnClose(uint8_t conn_id);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001029
1030/*******************************************************************************
1031**
1032** Function NFC_SetStaticRfCback
1033**
1034** Description This function is called to update the data callback function
1035** to receive the data for the given connection id.
1036**
1037** Parameters p_cback - the connection callback function
1038**
1039** Returns Nothing
1040**
1041*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001042extern void NFC_SetStaticRfCback(tNFC_CONN_CBACK* p_cback);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001043
1044/*******************************************************************************
1045**
Evan Chua24be4f2013-11-13 15:30:16 -05001046** Function NFC_SetReassemblyFlag
1047**
1048** Description This function is called to set if nfc will reassemble
1049** nci packet as much as its buffer can hold or it should not
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001050** reassemble but forward the fragmented nci packet to layer
1051** above. If nci data pkt is fragmented, nfc may send multiple
Evan Chua24be4f2013-11-13 15:30:16 -05001052** NFC_DATA_CEVT with status NFC_STATUS_CONTINUE before sending
1053** NFC_DATA_CEVT with status NFC_STATUS_OK based on reassembly
1054** configuration and reassembly buffer size
1055**
1056** Parameters reassembly - flag to indicate if nfc may reassemble or not
1057**
1058** Returns Nothing
1059**
1060*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001061extern void NFC_SetReassemblyFlag(bool reassembly);
Evan Chua24be4f2013-11-13 15:30:16 -05001062
1063/*******************************************************************************
1064**
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001065** Function NFC_SendData
1066**
1067** Description This function is called to send the given data packet
1068** to the connection identified by the given connection id.
1069**
1070** Parameters conn_id - the connection id.
1071** p_data - the data packet
1072**
1073** Returns tNFC_STATUS
1074**
1075*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001076extern tNFC_STATUS NFC_SendData(uint8_t conn_id, NFC_HDR* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001077
1078/*******************************************************************************
1079**
1080** Function NFC_FlushData
1081**
1082** Description This function is called to discard the tx data queue of
1083** the given connection id.
1084**
1085** Parameters conn_id - the connection id.
1086**
1087** Returns tNFC_STATUS
1088**
1089*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001090extern tNFC_STATUS NFC_FlushData(uint8_t conn_id);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001091
1092/*******************************************************************************
1093**
1094** Function NFC_Deactivate
1095**
1096** Description This function is called to stop the discovery process or
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001097** put the listen device in sleep mode or terminate the NFC
1098** link.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001099**
1100** The response from NFCC is reported by tNFC_DISCOVER_CBACK
1101** as NFC_DEACTIVATE_DEVT.
1102**
1103** Parameters deactivate_type - NFC_DEACTIVATE_TYPE_IDLE, to IDLE mode.
1104** NFC_DEACTIVATE_TYPE_SLEEP to SLEEP mode.
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001105** NFC_DEACTIVATE_TYPE_SLEEP_AF to SLEEP_AF
1106** mode.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001107**
1108** Returns tNFC_STATUS
1109**
1110*******************************************************************************/
Ruchi Kandoi4182dab2017-01-10 13:25:53 -08001111extern tNFC_STATUS NFC_Deactivate(tNFC_DEACT_TYPE deactivate_type);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001112
1113/*******************************************************************************
1114**
1115** Function NFC_UpdateRFCommParams
1116**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001117** Description This function is called to update RF Communication
1118** parameters once the Frame RF Interface has been activated.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001119**
1120** The response from NFCC is reported by tNFC_RESPONSE_CBACK
1121** as NFC_RF_COMM_PARAMS_UPDATE_REVT.
1122**
1123** Returns tNFC_STATUS
1124**
1125*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001126extern tNFC_STATUS NFC_UpdateRFCommParams(tNFC_RF_COMM_PARAMS* p_params);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001127
1128/*******************************************************************************
1129**
1130** Function NFC_SetPowerOffSleep
1131**
1132** Description This function closes/opens transport and turns off/on NFCC.
1133**
1134** Returns tNFC_STATUS
1135**
1136*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001137extern tNFC_STATUS NFC_SetPowerOffSleep(bool enable);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001138
1139/*******************************************************************************
1140**
Love Khanna5e4b4d72017-04-14 18:23:55 +05301141** Function NFC_SetPowerSubState
1142**
1143** Description This function is called to send the power sub state(screen
1144** state) to NFCC. The response from NFCC is reported by
1145** tNFC_RESPONSE_CBACK as NFC_SET_POWER_STATE_REVT.
1146**
1147** Parameters scree_state
1148**
1149** Returns tNFC_STATUS
1150**
1151*******************************************************************************/
1152extern tNFC_STATUS NFC_SetPowerSubState(uint8_t screen_state);
1153
1154/*******************************************************************************
1155**
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001156** Function NFC_PowerCycleNFCC
1157**
1158** Description This function turns off and then on NFCC.
1159**
1160** Returns tNFC_STATUS
1161**
1162*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001163extern tNFC_STATUS NFC_PowerCycleNFCC(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001164
1165/*******************************************************************************
1166**
1167** Function NFC_SetRouting
1168**
1169** Description This function is called to configure the CE routing table.
1170** The response from NFCC is reported by tNFC_RESPONSE_CBACK
1171** as NFC_SET_ROUTING_REVT.
1172**
1173** Parameters
1174**
1175** Returns tNFC_STATUS
1176**
1177*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001178extern tNFC_STATUS NFC_SetRouting(bool more, uint8_t num_tlv, uint8_t tlv_size,
1179 uint8_t* p_param_tlvs);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001180
1181/*******************************************************************************
1182**
1183** Function NFC_GetRouting
1184**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001185** Description This function is called to retrieve the CE routing table
1186** from NFCC. The response from NFCC is reported by
1187** tNFC_RESPONSE_CBACK as NFC_GET_ROUTING_REVT.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001188**
1189** Returns tNFC_STATUS
1190**
1191*******************************************************************************/
Ruchi Kandoi4182dab2017-01-10 13:25:53 -08001192extern tNFC_STATUS NFC_GetRouting(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001193
1194/*******************************************************************************
1195**
1196** Function NFC_RegVSCback
1197**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001198** Description This function is called to register or de-register a
1199** callback function to receive Proprietary NCI response and
1200** notification events.
1201** The maximum number of callback functions allowed is
1202** NFC_NUM_VS_CBACKS
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001203**
1204** Returns tNFC_STATUS
1205**
1206*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001207extern tNFC_STATUS NFC_RegVSCback(bool is_register, tNFC_VS_CBACK* p_cback);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001208
1209/*******************************************************************************
1210**
1211** Function NFC_SendVsCommand
1212**
1213** Description This function is called to send the given vendor specific
1214** command to NFCC. The response from NFCC is reported to the
1215** given tNFC_VS_CBACK as (oid).
1216**
1217** Parameters oid - The opcode of the VS command.
1218** p_data - The parameters for the VS command
1219**
1220** Returns tNFC_STATUS
1221**
1222*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001223extern tNFC_STATUS NFC_SendVsCommand(uint8_t oid, NFC_HDR* p_data,
1224 tNFC_VS_CBACK* p_cback);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001225
1226/*******************************************************************************
1227**
Love Khannad7852c92017-06-02 19:55:05 +05301228** Function NFC_SendRawVsCommand
1229**
1230** Description This function is called to send the given raw command to
1231** NFCC. The response from NFCC is reported to the given
1232** tNFC_VS_CBACK.
1233**
1234** Parameters p_data - The command buffer
1235**
1236** Returns tNFC_STATUS
1237**
1238*******************************************************************************/
1239extern tNFC_STATUS NFC_SendRawVsCommand(NFC_HDR* p_data,
1240 tNFC_VS_CBACK* p_cback);
1241
1242/*******************************************************************************
1243**
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001244** Function NFC_TestLoopback
1245**
1246** Description This function is called to send the given data packet
1247** to NFCC for loopback test.
1248** When loopback data is received from NFCC, tNFC_TEST_CBACK .
1249** reports a NFC_LOOPBACK_TEVT.
1250**
1251** Parameters p_data - the data packet
1252**
1253** Returns tNFC_STATUS
1254**
1255*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001256extern tNFC_STATUS NFC_TestLoopback(NFC_HDR* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001257
1258/*******************************************************************************
1259**
Love Khannad09d4bf2017-04-06 14:31:48 +05301260** Function NFC_ISODEPNakPresCheck
1261**
1262** Description This function is called to send the ISO DEP nak presence
1263** check cmd to check that the remote end point in RF field.
1264**
1265** Returns tNFC_STATUS
1266**
1267*******************************************************************************/
1268extern tNFC_STATUS NFC_ISODEPNakPresCheck();
1269
Love Khannad7852c92017-06-02 19:55:05 +05301270#if (APPL_DTA_MODE == TRUE)
1271/*******************************************************************************
1272**
1273** Function nfc_ncif_getFWVersion
1274**
1275** Description This function sets the trace level for NFC. If called with
1276** a value of 0xFF, it simply returns the current trace level.
1277**
1278** Returns The new or current trace level
1279**
1280*******************************************************************************/
1281extern tNFC_FW_VERSION nfc_ncif_getFWVersion();
1282#endif
1283
Love Khanna81e4f812017-06-02 17:50:19 +05301284/*******************************************************************************
1285**
1286** Function NFC_NfceePLConfig
1287**
1288** Description This function is called to set the Power and Link Control
1289** to an NFCEE connected to the NFCC.
1290** The response from NFCC is reported by tNFC_RESPONSE_CBACK
1291** as NFC_NFCEE_PL_CONTROL_REVT.
1292**
1293** Parameters nfcee_id - the NFCEE to activate or de-activate.
1294** pl_config -
1295** NFCEE_PL_CONFIG_NFCC_DECIDES -NFCC decides (default)
1296** NFCEE_PL_CONFIG_PWR_ALWAYS_ON -NFCEE power supply always on
1297** NFCEE_PL_CONFIG_LNK_ON_WHEN_PWR_ON -
1298** communication link is always active
1299** when NFCEE is powered on
1300** NFCEE_PL_CONFIG_PWR_LNK_ALWAYS_ON -
1301** power supply and communication
1302** link are always on
1303** Returns tNFC_STATUS
1304**
1305*******************************************************************************/
1306extern tNFC_STATUS NFC_NfceePLConfig(uint8_t nfcee_id,
1307 tNCI_NFCEE_PL_CONFIG pl_config);
1308
1309/*******************************************************************************
1310**
1311** Function NFC_SetStaticHciCback
1312**
1313** Description This function to update the data callback function
1314** to receive the data for the static Hci connection id.
1315**
1316** Parameters p_cback - the connection callback function
1317**
1318** Returns Nothing
1319**
1320*******************************************************************************/
1321extern void NFC_SetStaticHciCback(tNFC_CONN_CBACK* p_cback);
1322
Evan Chua24be4f2013-11-13 15:30:16 -05001323/*******************************************************************************
1324**
1325** Function NFC_GetStatusName
1326**
1327** Description This function returns the status name.
1328**
1329** NOTE conditionally compiled to save memory.
1330**
1331** Returns pointer to the name
1332**
1333*******************************************************************************/
Ruchi Kandoi7dab0e52017-08-03 13:09:49 -07001334extern std::string NFC_GetStatusName(tNFC_STATUS status);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001335
1336#endif /* NFC_API_H */