blob: 7388155ffe5d3d7ab36ce06729f9c668eb127d44 [file] [log] [blame]
nxpandroidc7611652015-09-23 16:42:05 +05301/******************************************************************************
2 *
3 * Copyright (C) 1999-2014 Broadcom Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18/******************************************************************************
19 *
nxf24591c1cbeab2018-02-21 17:32:26 +053020 * The original Work has been changed by NXP.
nxpandroidc7611652015-09-23 16:42:05 +053021 *
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
25 *
26 * http://www.apache.org/licenses/LICENSE-2.0
27 *
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
33 *
nxf24591c1cbeab2018-02-21 17:32:26 +053034 * Copyright 2018 NXP
35 *
nxpandroidc7611652015-09-23 16:42:05 +053036 ******************************************************************************/
nxpandroidc7611652015-09-23 16:42:05 +053037/******************************************************************************
38 *
39 * This file contains the definition from NCI specification
40 *
41 ******************************************************************************/
42
43#ifndef NFC_NCI_DEFS_H
44#define NFC_NCI_DEFS_H
45
nxpandroid8f6d0532017-07-12 18:25:30 +053046#include <stdint.h>
47
nxpandroidc7611652015-09-23 16:42:05 +053048/* Define the message header size for all NCI Commands and Notifications.
49*/
nxpandroid8f6d0532017-07-12 18:25:30 +053050#define NCI_MSG_HDR_SIZE 3 /* per NCI spec */
51#define NCI_DATA_HDR_SIZE 3 /* per NCI spec */
52#define NCI_MAX_PAYLOAD_SIZE 0xFE
nxpandroid8f6d0532017-07-12 18:25:30 +053053#define NCI_CTRL_INIT_SIZE 32 /* initial NFCC control payload size */
54#define NCI_MAX_VSC_SIZE 0xFF
nxf24591c1cbeab2018-02-21 17:32:26 +053055#define APPL_DTA_MODE FALSE
nxpandroid8f6d0532017-07-12 18:25:30 +053056/* NCI header (3) + callback function pointer(8; use 8 to be safe) + HCIT (1
57 * byte) */
58#define NCI_VSC_MSG_HDR_SIZE 12
nxf24591c1cbeab2018-02-21 17:32:26 +053059
nxpandroid8f6d0532017-07-12 18:25:30 +053060/* Max frame size (256) - Prologue (1) - Epilogue (2) in ISO-DEP, CID and NAD
61 * are not used*/
62#define NCI_ISO_DEP_MAX_INFO 253
63/* Max payload (254) - Protocol Header (3) in NFC-DEP, DID and NAD are not used
64 */
65#define NCI_NFC_DEP_MAX_DATA 251
nxpandroidc7611652015-09-23 16:42:05 +053066
67/* NCI Command and Notification Format:
68 * 3 byte message header:
69 * byte 0: MT PBF GID
70 * byte 1: OID
71 * byte 2: Message Length */
72/* MT: Message Type (byte 0) */
nxpandroid8f6d0532017-07-12 18:25:30 +053073#define NCI_MT_MASK 0xE0
74#define NCI_MT_SHIFT 5
75#define NCI_MT_DATA 0x00
76#define NCI_MT_CMD 1 /* (NCI_MT_CMD << NCI_MT_SHIFT) = 0x20 */
77#define NCI_MT_RSP 2 /* (NCI_MT_RSP << NCI_MT_SHIFT) = 0x40 */
78#define NCI_MT_NTF 3 /* (NCI_MT_NTF << NCI_MT_SHIFT) = 0x60 */
nxpandroidc7611652015-09-23 16:42:05 +053079
nxpandroid8f6d0532017-07-12 18:25:30 +053080#define NCI_NTF_BIT 0x80 /* the tNFC_VS_EVT is a notification */
81#define NCI_RSP_BIT 0x40 /* the tNFC_VS_EVT is a response */
nxpandroidc7611652015-09-23 16:42:05 +053082
83/* for internal use only; not from specification */
nxpandroid8f6d0532017-07-12 18:25:30 +053084/* the following 2 flags are used in layer_specific for fragmentation/reassembly
85 * of data packets */
nxpandroidc7611652015-09-23 16:42:05 +053086
87/* PBF: Packet Boundary Flag (byte 0) */
nxpandroid8f6d0532017-07-12 18:25:30 +053088#define NCI_PBF_MASK 0x10
89#define NCI_PBF_SHIFT 4
nxpandroidc7611652015-09-23 16:42:05 +053090
91/* GID: Group Identifier (byte 0) */
nxpandroid8f6d0532017-07-12 18:25:30 +053092#define NCI_GID_MASK 0x0F
nxpandroid8f6d0532017-07-12 18:25:30 +053093#define NCI_GID_CORE 0x00 /* 0000b NCI Core group */
94#define NCI_GID_RF_MANAGE 0x01 /* 0001b RF Management group */
95#define NCI_GID_EE_MANAGE 0x02 /* 0010b NFCEE Management group */
96#define NCI_GID_PROP 0x0F /* 1111b Proprietary */
nxpandroidc7611652015-09-23 16:42:05 +053097/* 0111b - 1110b RFU */
98
99/* OID: Opcode Identifier (byte 1) */
nxpandroid8f6d0532017-07-12 18:25:30 +0530100#define NCI_OID_MASK 0x3F
101#define NCI_OID_SHIFT 0
nxpandroidc7611652015-09-23 16:42:05 +0530102
103/* For routing */
nxpandroid8f6d0532017-07-12 18:25:30 +0530104#define NCI_DH_ID 0 /* for DH */
nxpandroidc7611652015-09-23 16:42:05 +0530105/* To identify the loopback test */
nxpandroid8f6d0532017-07-12 18:25:30 +0530106#define NCI_TEST_ID 0xFE /* for loopback test */
nxpandroidc7611652015-09-23 16:42:05 +0530107
108/* Destination Type */
nxpandroid8f6d0532017-07-12 18:25:30 +0530109#define NCI_DEST_TYPE_NFCC 1 /* NFCC - loopback */
110#define NCI_DEST_TYPE_REMOTE 2 /* Remote NFC Endpoint */
111#define NCI_DEST_TYPE_NFCEE 3 /* NFCEE */
nxpandroidc7611652015-09-23 16:42:05 +0530112
113/* builds byte0 of NCI Command and Notification packet */
114#define NCI_MSG_BLD_HDR0(p, mt, gid) \
nxpandroid8f6d0532017-07-12 18:25:30 +0530115 *(p)++ = (uint8_t)(((mt) << NCI_MT_SHIFT) | (gid));
nxpandroidc7611652015-09-23 16:42:05 +0530116
nxpandroidc7611652015-09-23 16:42:05 +0530117/* builds byte1 of NCI Command and Notification packet */
nxpandroid8f6d0532017-07-12 18:25:30 +0530118#define NCI_MSG_BLD_HDR1(p, oid) *(p)++ = (uint8_t)(((oid) << NCI_OID_SHIFT));
nxpandroidc7611652015-09-23 16:42:05 +0530119
120/* parse byte0 of NCI packet */
nxf24591c1cbeab2018-02-21 17:32:26 +0530121#define NCI_MSG_PRS_HDR0(p, mt, pbf, gid) \
122 mt = (*(p)&NCI_MT_MASK) >> NCI_MT_SHIFT; \
123 (pbf) = (*(p)&NCI_PBF_MASK) >> NCI_PBF_SHIFT; \
124 (gid) = *(p)++ & NCI_GID_MASK;
nxpandroidc7611652015-09-23 16:42:05 +0530125
126/* parse byte1 of NCI Cmd/Ntf */
127#define NCI_MSG_PRS_HDR1(p, oid) \
nxf24591c1cbeab2018-02-21 17:32:26 +0530128 (oid) = (*(p)&NCI_OID_MASK); \
nxpandroid8f6d0532017-07-12 18:25:30 +0530129 (p)++;
nxpandroidc7611652015-09-23 16:42:05 +0530130
131/* NCI Data Format:
132 * byte 0: MT(0) PBF CID
133 * byte 1: RFU
134 * byte 2: Data Length */
nxpandroid8f6d0532017-07-12 18:25:30 +0530135/* CID: Connection Identifier (byte 0) 1-0xF Dynamically assigned (by NFCC), 0
136 * is predefined */
137#define NCI_CID_MASK 0x0F
nxpandroidc7611652015-09-23 16:42:05 +0530138
nxpandroid8f6d0532017-07-12 18:25:30 +0530139#define NCI_DATA_PBLD_HDR(p, pbf, cid, len) \
140 *(p)++ = (uint8_t)(((pbf) << NCI_PBF_SHIFT) | (cid)); \
141 *(p)++ = 0; \
142 *(p)++ = (len);
nxpandroidc7611652015-09-23 16:42:05 +0530143
nxpandroid8f6d0532017-07-12 18:25:30 +0530144#define NCI_DATA_PRS_HDR(p, pbf, cid, len) \
145 (pbf) = (*(p)&NCI_PBF_MASK) >> NCI_PBF_SHIFT; \
146 (cid) = (*(p)&NCI_CID_MASK); \
nxf24591c1cbeab2018-02-21 17:32:26 +0530147 (p)++; \
148 (p)++; \
nxpandroid8f6d0532017-07-12 18:25:30 +0530149 (len) = *(p)++;
nxpandroidc7611652015-09-23 16:42:05 +0530150
151/* Logical target ID 0x01-0xFE */
nxf24591c1cbeab2018-02-21 17:32:26 +0530152
nxpandroid8f6d0532017-07-12 18:25:30 +0530153/* CORE_RESET_NTF reset trigger type*/
nxf24591c1cbeab2018-02-21 17:32:26 +0530154#define NCI2_0_RESET_TRIGGER_TYPE_POWERED_ON 0x01
nxpandroid8f6d0532017-07-12 18:25:30 +0530155#define NCI2_0_RESET_TRIGGER_TYPE_CORE_RESET_CMD_RECEIVED 0x02
nxf24591c1cbeab2018-02-21 17:32:26 +0530156
nxpandroidc7611652015-09-23 16:42:05 +0530157/* Status Codes */
nxpandroid8f6d0532017-07-12 18:25:30 +0530158#define NCI_STATUS_OK 0x00
159#define NCI_STATUS_REJECTED 0x01
160#define NCI_STATUS_MESSAGE_CORRUPTED 0x02
161#define NCI_STATUS_BUFFER_FULL 0xE0
162#define NCI_STATUS_FAILED 0x03
163#define NCI_STATUS_NOT_INITIALIZED 0x04
164#define NCI_STATUS_SYNTAX_ERROR 0x05
165#define NCI_STATUS_SEMANTIC_ERROR 0x06
166#define NCI_STATUS_UNKNOWN_GID 0x07
167#define NCI_STATUS_UNKNOWN_OID 0x08
168#define NCI_STATUS_INVALID_PARAM 0x09
169#define NCI_STATUS_MSG_SIZE_TOO_BIG 0x0A
Suraj Uday Kotharkar6f7757b2018-05-10 15:58:29 +0530170#define NCI_STATUS_NOT_SUPPORTED 0x0B
nxpandroidc7611652015-09-23 16:42:05 +0530171/* discovery */
nxpandroid8f6d0532017-07-12 18:25:30 +0530172#define NCI_STATUS_ALREADY_STARTED 0xA0
173#define NCI_STATUS_ACTIVATION_FAILED 0xA1
174#define NCI_STATUS_TEAR_DOWN 0xA2
nxpandroidc7611652015-09-23 16:42:05 +0530175/* RF Interface */
nxpandroid8f6d0532017-07-12 18:25:30 +0530176#define NCI_STATUS_RF_TRANSMISSION_ERR 0xB0
177#define NCI_STATUS_RF_PROTOCOL_ERR 0xB1
178#define NCI_STATUS_TIMEOUT 0xB2
nxpandroidc7611652015-09-23 16:42:05 +0530179/* NFCEE Interface */
nxpandroid8f6d0532017-07-12 18:25:30 +0530180#define NCI_STATUS_EE_INTF_ACTIVE_FAIL 0xC0
181#define NCI_STATUS_EE_TRANSMISSION_ERR 0xC1
182#define NCI_STATUS_EE_PROTOCOL_ERR 0xC2
183#define NCI_STATUS_EE_TIMEOUT 0xC3
nxpandroidc7611652015-09-23 16:42:05 +0530184
185/* RF Technologies */
nxpandroid8f6d0532017-07-12 18:25:30 +0530186#define NCI_RF_TECHNOLOGY_A 0x00
187#define NCI_RF_TECHNOLOGY_B 0x01
188#define NCI_RF_TECHNOLOGY_F 0x02
nxf24591c1cbeab2018-02-21 17:32:26 +0530189#define NCI_RF_TECHNOLOGY_V 0x03
nxpandroidc7611652015-09-23 16:42:05 +0530190
191/* Bit Rates */
nxpandroid8f6d0532017-07-12 18:25:30 +0530192#define NCI_BIT_RATE_106 0x00 /* 106 kbit/s */
193#define NCI_BIT_RATE_212 0x01 /* 212 kbit/s */
194#define NCI_BIT_RATE_424 0x02 /* 424 kbit/s */
195#define NCI_BIT_RATE_848 0x03 /* 848 Kbit/s */
196#define NCI_BIT_RATE_1696 0x04 /* 1696 Kbit/s*/
197#define NCI_BIT_RATE_3392 0x05 /* 3392 Kbit/s*/
198#define NCI_BIT_RATE_6784 0x06 /* 6784 Kbit/s*/
nxpandroidc7611652015-09-23 16:42:05 +0530199
200/**********************************************
201 * NCI Core Group Opcode - 0
202 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530203#define NCI_MSG_CORE_RESET 0
204#define NCI_MSG_CORE_INIT 1
205#define NCI_MSG_CORE_SET_CONFIG 2
206#define NCI_MSG_CORE_GET_CONFIG 3
207#define NCI_MSG_CORE_CONN_CREATE 4
208#define NCI_MSG_CORE_CONN_CLOSE 5
209#define NCI_MSG_CORE_CONN_CREDITS 6
210#define NCI_MSG_CORE_GEN_ERR_STATUS 7
211#define NCI_MSG_CORE_INTF_ERR_STATUS 8
nxf24591c1cbeab2018-02-21 17:32:26 +0530212#define NCI_MSG_CORE_SET_POWER_SUB_STATE 9
nxpandroidc7611652015-09-23 16:42:05 +0530213
214/**********************************************
215 * RF MANAGEMENT Group Opcode - 1
216 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530217#define NCI_MSG_RF_DISCOVER_MAP 0
218#define NCI_MSG_RF_SET_ROUTING 1
219#define NCI_MSG_RF_GET_ROUTING 2
220#define NCI_MSG_RF_DISCOVER 3
221#define NCI_MSG_RF_DISCOVER_SELECT 4
222#define NCI_MSG_RF_INTF_ACTIVATED 5
223#define NCI_MSG_RF_DEACTIVATE 6
224#define NCI_MSG_RF_FIELD 7
225#define NCI_MSG_RF_T3T_POLLING 8
226#define NCI_MSG_RF_EE_ACTION 9
227#define NCI_MSG_RF_EE_DISCOVERY_REQ 10
228#define NCI_MSG_RF_PARAMETER_UPDATE 11
229#define NCI_MSG_RF_ISO_DEP_NAK_PRESENCE 16
nxf24591c1cbeab2018-02-21 17:32:26 +0530230
nxpandroidc7611652015-09-23 16:42:05 +0530231/**********************************************
232 * NFCEE MANAGEMENT Group Opcode - 2
233 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530234#define NCI_MSG_NFCEE_DISCOVER 0
235#define NCI_MSG_NFCEE_MODE_SET 1
nxf24591c1cbeab2018-02-21 17:32:26 +0530236#define NCI_MSG_NFCEE_STATUS 2
237#define NCI_MSG_NFCEE_POWER_LINK_CTRL 3
nxpandroidc7611652015-09-23 16:42:05 +0530238/**********************************************
239 * NCI Proprietary Group - F
240 **********************************************/
241
242/**********************************************
243 * NCI Core Group Params
244 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530245#define NCI_CORE_PARAM_SIZE_RESET 0x01
nxf24591c1cbeab2018-02-21 17:32:26 +0530246
nxpandroid8f6d0532017-07-12 18:25:30 +0530247/**********************************************
248 * NCI Feature Bit
249 **********************************************/
nxf24591c1cbeab2018-02-21 17:32:26 +0530250#define NCI_FEAT_HCI_NETWORK 0x00000008
251
nxpandroid8f6d0532017-07-12 18:25:30 +0530252#define NCI_CORE_PARAM_SIZE_INIT(X) (((X) == NCI_VERSION_2_0) ? (0x02) : (0x00))
253#define NCI2_0_CORE_INIT_CMD_BYTE_0 0x00
254#define NCI2_0_CORE_INIT_CMD_BYTE_1 0x00
nxpandroidc7611652015-09-23 16:42:05 +0530255
nxpandroid8f6d0532017-07-12 18:25:30 +0530256/* Status (1 octet) and number of params */
nxf24591c1cbeab2018-02-21 17:32:26 +0530257#define NCI_CORE_PARAM_SIZE_SET_POWER_SUB_STATE 0x01
nxpandroidc7611652015-09-23 16:42:05 +0530258
nxpandroid8f6d0532017-07-12 18:25:30 +0530259#define NCI_CORE_PARAM_SIZE_CON_CREATE 0x02 /* handle, num_tlv, (tlv) */
260/* status, size, credits, conn_id */
nxpandroid8f6d0532017-07-12 18:25:30 +0530261#define NCI_CON_CREATE_TAG_RF_DISC_ID 0x00
262#define NCI_CON_CREATE_TAG_NFCEE_VAL 0x01
nxpandroidc7611652015-09-23 16:42:05 +0530263
nxpandroid8f6d0532017-07-12 18:25:30 +0530264#define NCI_CORE_PARAM_SIZE_CON_CLOSE 0x01 /* Conn ID (1 octet) */
nxf24591c1cbeab2018-02-21 17:32:26 +0530265#if (NXP_EXTNS == TRUE)
nxpandroid8f6d0532017-07-12 18:25:30 +0530266/* Keep the NCI configuration (if possible) and perform NCI initialization. */
267#define NCI_RESET_TYPE_KEEP_CFG 0x00
nxf24591c1cbeab2018-02-21 17:32:26 +0530268#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530269/* Reset the NCI configuration, and perform NCI initialization. */
270#define NCI_RESET_TYPE_RESET_CFG 0x01
nxpandroidc7611652015-09-23 16:42:05 +0530271
nxpandroid8f6d0532017-07-12 18:25:30 +0530272/* No operating field generated by remote device */
273#define NCI_RF_STS_NO_REMOTE 0x00
274/* Operating field generated by remote device */
275#define NCI_RF_STS_REMOTE 0x01
nxpandroidc7611652015-09-23 16:42:05 +0530276
nxf24591c1cbeab2018-02-21 17:32:26 +0530277/* Discovery Action (1 octet) */
278#define NCI_PARAM_SIZE_DISCOVER_NFCEE(X) \
279 (((X) == NCI_VERSION_2_0) ? 0X00 : 0X01)
nxpandroidc7611652015-09-23 16:42:05 +0530280
nxpandroid8f6d0532017-07-12 18:25:30 +0530281#define NCI_DISCOVER_ACTION_DISABLE 0
282#define NCI_DISCOVER_ACTION_ENABLE 1
nxpandroidc7611652015-09-23 16:42:05 +0530283
nxpandroid8f6d0532017-07-12 18:25:30 +0530284#define NCI_RF_PARAM_ID_TECH_N_MODE 0x00 /* RF Technology and Mode */
285#define NCI_RF_PARAM_ID_TX_BIT_RATE 0x01 /* Transmit Bit Rate */
286#define NCI_RF_PARAM_ID_RX_BIT_RATE 0x02 /* Receive Bit Rate */
287#define NCI_RF_PARAM_ID_B_DATA_EX_PARAM \
288 0x03 /* B Data Exchange config param \
289 */
nxf24591c1cbeab2018-02-21 17:32:26 +0530290#if (NXP_EXTNS == TRUE)
nxpandroide5fc6c92017-09-13 13:17:46 +0530291/****************************************************
292 * NCI NFCEE status
293 ****************************************************/
294#define NCI_NFCEE_STS_UNRECOVERABLE_ERROR 0x00
295#define NCI_NFCEE_STS_INIT_STARTED 0x01
296#define NCI_NFCEE_STS_INIT_COMPLETED 0x02
nxf24591c1cbeab2018-02-21 17:32:26 +0530297#endif
nxpandroidc7611652015-09-23 16:42:05 +0530298
nxpandroid8f6d0532017-07-12 18:25:30 +0530299#define NCI_NFCEE_INTERFACE_APDU 0x00
300#define NCI_NFCEE_INTERFACE_HCI_ACCESS 0x01
301#define NCI_NFCEE_INTERFACE_T3T 0x02
302#define NCI_NFCEE_INTERFACE_TRANSPARENT 0x03
303#define NCI_NFCEE_INTERFACE_PROPRIETARY 0x80
nxpandroid8f6d0532017-07-12 18:25:30 +0530304/****************************************************
305 * NCI NFCEE INterface specific status Codes
306 ****************************************************/
307#define NCI_NFCEE_STS_INTF_ACTIVATION_FAILED 0xC0
nxf24591c1cbeab2018-02-21 17:32:26 +0530308#define NCI_NFCEE_STS_TRANSMISSION_ERROR 0xC1
309#define NCI_NFCEE_STS_PROTOCOL_ERROR 0xC2
310#define NCI_NFCEE_STS_TIMEOUT_ERROR 0xC3
nxpandroidc7611652015-09-23 16:42:05 +0530311
nxpandroid8f6d0532017-07-12 18:25:30 +0530312#define NCI_NFCEE_STS_CONN_ACTIVE 0x00
313#define NCI_NFCEE_STS_CONN_INACTIVE 0x01
314#define NCI_NFCEE_STS_REMOVED 0x02
nxpandroidc7611652015-09-23 16:42:05 +0530315
nxpandroid8f6d0532017-07-12 18:25:30 +0530316/* Logical Target ID (1 octet)NFCEE Mode (1 octet) */
317#define NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET 0x02
nxpandroidc7611652015-09-23 16:42:05 +0530318
nxpandroid8f6d0532017-07-12 18:25:30 +0530319/* Deactivate the connected NFCEE */
320#define NCI_NFCEE_MD_DEACTIVATE 0x00
321/* Activate the connected NFCEE */
322#define NCI_NFCEE_MD_ACTIVATE 0x01
323#define NCI_NUM_NFCEE_MODE 2
nxpandroidc7611652015-09-23 16:42:05 +0530324
325/**********************************************
326 * NCI Deactivation Type
327 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530328#define NCI_DEACTIVATE_TYPE_IDLE 0 /* Idle Mode */
329#define NCI_DEACTIVATE_TYPE_SLEEP 1 /* Sleep Mode */
330#define NCI_DEACTIVATE_TYPE_SLEEP_AF 2 /* Sleep_AF Mode */
331#define NCI_DEACTIVATE_TYPE_DISCOVERY 3 /* Discovery */
nxpandroidc7611652015-09-23 16:42:05 +0530332
333/**********************************************
334 * NCI Deactivation Reasons
335 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530336#define NCI_DEACTIVATE_REASON_DH_REQ 0 /* DH Request */
337#define NCI_DEACTIVATE_REASON_ENDPOINT_REQ 1 /* Endpoint Request */
338#define NCI_DEACTIVATE_REASON_RF_LINK_LOSS 2 /* RF Link Loss */
339#define NCI_DEACTIVATE_REASON_NFCB_BAD_AFI 3 /* NFC-B Bad AFI */
nxf24591c1cbeab2018-02-21 17:32:26 +0530340/* DH Request Failed due to error */
341#define NCI_DEACTIVATE_REASON_DH_REQ_FAILED 4
nxpandroid8f6d0532017-07-12 18:25:30 +0530342
343/* The NFCEE status in NFCEE Status Notification */
nxpandroid8f6d0532017-07-12 18:25:30 +0530344typedef uint8_t tNCI_EE_NTF_STATUS;
345
346/* NFCEE Power and Link Configuration */
nxpandroid8f6d0532017-07-12 18:25:30 +0530347typedef uint8_t tNCI_NFCEE_PL_CONFIG;
348
349/**********************************************
350* NCI Interface Mode
351**********************************************/
nxf24591c1cbeab2018-02-21 17:32:26 +0530352#if (NXP_EXTNS == TRUE)
nxpandroid8f6d0532017-07-12 18:25:30 +0530353#define NCI_INTERFACE_MODE_POLL 1
354#define NCI_INTERFACE_MODE_LISTEN 2
nxf24591c1cbeab2018-02-21 17:32:26 +0530355#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530356#define NCI_INTERFACE_MODE_POLL_N_LISTEN 3
nxpandroidc7611652015-09-23 16:42:05 +0530357
358/**********************************************
359 * NCI Interface Types
360 **********************************************/
Suraj Uday Kotharkar71fc5802018-06-01 16:57:34 +0530361#if (NXP_EXTNS == TRUE)
nxf2459148793b62018-06-06 14:40:49 +0530362#define NCI_INTERFACE_UICC_DIRECT 0x82
363#define NCI_INTERFACE_ESE_DIRECT 0x83
Suraj Uday Kotharkar71fc5802018-06-01 16:57:34 +0530364#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530365#define NCI_INTERFACE_EE_DIRECT_RF 0
366#define NCI_INTERFACE_FRAME 1
367#define NCI_INTERFACE_ISO_DEP 2
368#define NCI_INTERFACE_NFC_DEP 3
nxpandroid8f6d0532017-07-12 18:25:30 +0530369#define NCI_INTERFACE_MAX NCI_INTERFACE_NFC_DEP
370#define NCI_INTERFACE_EXTENSION_MAX 2
371#define NCI_INTERFACE_FIRST_VS 0x80
nxpandroid8f6d0532017-07-12 18:25:30 +0530372typedef uint8_t tNCI_INTF_TYPE;
nxpandroidc7611652015-09-23 16:42:05 +0530373
374/**********************************************
375 * NCI RF Management / DISCOVERY Group Params
376 **********************************************/
nxpandroidc7611652015-09-23 16:42:05 +0530377
nxpandroid8f6d0532017-07-12 18:25:30 +0530378#define NCI_DISCOVER_PARAM_SIZE_SELECT 0x03 /* ID, protocol, interface */
nxpandroid8f6d0532017-07-12 18:25:30 +0530379#define NCI_DISCOVER_PARAM_SIZE_DEACT 0x01 /* type */
nxpandroidc7611652015-09-23 16:42:05 +0530380
381/**********************************************
382 * Supported Protocols
383 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530384#define NCI_PROTOCOL_UNKNOWN 0x00
385#define NCI_PROTOCOL_T1T 0x01
386#define NCI_PROTOCOL_T2T 0x02
387#define NCI_PROTOCOL_T3T 0x03
nxf24591c1cbeab2018-02-21 17:32:26 +0530388#define NCI_PROTOCOL_T5T 0x06
nxpandroid8f6d0532017-07-12 18:25:30 +0530389#define NCI_PROTOCOL_ISO_DEP 0x04
390#define NCI_PROTOCOL_NFC_DEP 0x05
nxf24591c1cbeab2018-02-21 17:32:26 +0530391
nxpandroid25862ca2015-11-06 18:43:02 +0530392#if (NXP_EXTNS == TRUE)
nxpandroid8f6d0532017-07-12 18:25:30 +0530393#define NCI_PROTOCOL_ISO7816 0xA0
nxf24591c1cbeab2018-02-21 17:32:26 +0530394
nxpandroidc7611652015-09-23 16:42:05 +0530395/**********************************************
396 * Proprietary Protocols
397 **********************************************/
nxpandroidc7611652015-09-23 16:42:05 +0530398#ifndef NCI_PROTOCOL_T3BT
nxpandroid8f6d0532017-07-12 18:25:30 +0530399#define NCI_PROTOCOL_T3BT 0x8b
nxpandroidc7611652015-09-23 16:42:05 +0530400#endif
401#endif
402
nxpandroidc7611652015-09-23 16:42:05 +0530403/* Discovery Types/Detected Technology and Mode */
nxpandroid8f6d0532017-07-12 18:25:30 +0530404#define NCI_DISCOVERY_TYPE_POLL_A 0x00
405#define NCI_DISCOVERY_TYPE_POLL_B 0x01
406#define NCI_DISCOVERY_TYPE_POLL_F 0x02
nxf24591c1cbeab2018-02-21 17:32:26 +0530407#define NCI_DISCOVERY_TYPE_POLL_V 0x06
nxpandroid8f6d0532017-07-12 18:25:30 +0530408#define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 0x03
nxf24591c1cbeab2018-02-21 17:32:26 +0530409/* NCI2.0 standardizes P2P poll active*/
410#define NCI_DISCOVERY_TYPE_POLL_ACTIVE 0x03
nxpandroid8f6d0532017-07-12 18:25:30 +0530411#define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 0x05
412#define NCI_DISCOVERY_TYPE_LISTEN_A 0x80
413#define NCI_DISCOVERY_TYPE_LISTEN_B 0x81
414#define NCI_DISCOVERY_TYPE_LISTEN_F 0x82
415#define NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE 0x83
nxf24591c1cbeab2018-02-21 17:32:26 +0530416/* NCI2.0 standardizes P2P listen active*/
417#define NCI_DISCOVERY_TYPE_LISTEN_ACTIVE 0x83
nxpandroid8f6d0532017-07-12 18:25:30 +0530418#define NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE 0x85
nxpandroid8f6d0532017-07-12 18:25:30 +0530419#define NCI_DISCOVERY_TYPE_LISTEN_ISO15693 0x86
nxpandroidc7611652015-09-23 16:42:05 +0530420
nxpandroid8f6d0532017-07-12 18:25:30 +0530421typedef uint8_t tNCI_DISCOVERY_TYPE;
nxpandroidc7611652015-09-23 16:42:05 +0530422
nxpandroid8f6d0532017-07-12 18:25:30 +0530423#define NCI_EE_TRIG_7816_SELECT 0x00
424#define NCI_EE_TRIG_RF_PROTOCOL 0x01
425#define NCI_EE_TRIG_RF_TECHNOLOGY 0x02
426#define NCI_EE_TRIG_APP_INIT 0x10
nxpandroidc7611652015-09-23 16:42:05 +0530427
nxpandroid8f6d0532017-07-12 18:25:30 +0530428#define NCI_EE_ACT_TAG_AID 0xC0 /* AID */
nxpandroid8f6d0532017-07-12 18:25:30 +0530429#define NCI_EE_ACT_TAG_DATA 0xC3 /* hex data for app */
nxpandroidc7611652015-09-23 16:42:05 +0530430
nxf24591c1cbeab2018-02-21 17:32:26 +0530431/* NFCEE ID (1 octet) PL config (1 octet) */
432#define NCI_CORE_PARAM_SIZE_NFCEE_PL_CTRL 0x02
433/* Status (1 octet) */
nxpandroid8f6d0532017-07-12 18:25:30 +0530434/* Technology based routing */
435#define NCI_ROUTE_TAG_TECH 0x00
436/* Protocol based routing */
437#define NCI_ROUTE_TAG_PROTO 0x01
438#define NCI_ROUTE_TAG_AID 0x02 /* AID routing */
Suraj Uday Kotharkar6f7757b2018-05-10 15:58:29 +0530439#define NCI_ROUTE_TAG_SYSCODE 0x03 /* SystemCode routing */
Suraj Uday Kotharkar11ae20f2018-07-20 23:29:36 +0530440#if (NXP_EXTNS == TRUE)
441#define NCI_ROUTE_TAG_APDU 0x4 /* APDU routing*/
nxpandroid8f6d0532017-07-12 18:25:30 +0530442
Suraj Uday Kotharkar11ae20f2018-07-20 23:29:36 +0530443#define NCI_MIN_APDU_DATA_LEN 1
444#define NCI_MIN_APDU_MASK_LEN 1
445#define NCI_MAX_APDU_DATA_LEN 124
446#define NCI_MAX_APDU_MASK_LEN 124
447#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530448#define NCI_ROUTE_PWR_STATE_ON 0x01 /* The device is on */
449/* The device is switched off */
450#define NCI_ROUTE_PWR_STATE_SWITCH_OFF 0x02
451/* The device's battery is removed */
452#define NCI_ROUTE_PWR_STATE_BATT_OFF 0x04
nxpandroid8f6d0532017-07-12 18:25:30 +0530453/* The device is screen off Unlock mode */
Suraj Uday Kotharkar1e7b99a2018-05-10 16:14:37 +0530454#define NCI_ROUTE_PWR_STATE_SCREEN_OFF_UNLOCK() \
455 ((NFC_GetNCIVersion() == NCI_VERSION_2_0) ? 0x08 : 0x80)
nxpandroid8f6d0532017-07-12 18:25:30 +0530456/* The device is screen on lock mode */
Suraj Uday Kotharkar1e7b99a2018-05-10 16:14:37 +0530457#define NCI_ROUTE_PWR_STATE_SCREEN_ON_LOCK() \
458 ((NFC_GetNCIVersion() == NCI_VERSION_2_0) ? 0x10 : 0x40)
nxpandroid8f6d0532017-07-12 18:25:30 +0530459/* The device is screen off lock mode */
Suraj Uday Kotharkar1e7b99a2018-05-10 16:14:37 +0530460#define NCI_ROUTE_PWR_STATE_SCREEN_OFF_LOCK() \
461 ((NFC_GetNCIVersion() == NCI_VERSION_2_0) ? 0x20 : 0x00)
462
nxpandroid8f6d0532017-07-12 18:25:30 +0530463/* Hardware / Registration Identification */
464#define NCI_NFCEE_TAG_HW_ID 0x00
465#define NCI_NFCEE_TAG_ATR_BYTES 0x01 /* ATR Bytes */
466/* T3T Command Set Interface Supplementary Info */
467#define NCI_NFCEE_TAG_T3T_INFO 0x02
468#define NCI_NFCEE_TAG_HCI_HOST_ID 0xA0 /* HCI host ID */
nxpandroidc7611652015-09-23 16:42:05 +0530469
nxpandroid8f6d0532017-07-12 18:25:30 +0530470#define NCI_DISCOVER_NTF_LAST 0x00
471#define NCI_DISCOVER_NTF_LAST_ABORT 0x01
472#define NCI_DISCOVER_NTF_MORE 0x02
nxpandroidc7611652015-09-23 16:42:05 +0530473
474/* NCI RF Management Group Params */
nxpandroid8f6d0532017-07-12 18:25:30 +0530475#define NCI_RF_PARAM_SIZE_T3T_POLLING 0x04 /* System Code, RC, TSN */
nxpandroidc7611652015-09-23 16:42:05 +0530476
477/**********************************************
478 * NCI Parameter IDs
479 **********************************************/
480
nxpandroid8f6d0532017-07-12 18:25:30 +0530481#define NCI_PARAM_ID_TOTAL_DURATION 0x00
482#define NCI_PARAM_ID_CON_DEVICES_LIMIT 0x01
nxpandroidc0fd8b72017-07-12 21:09:02 +0530483#define NCI_PARAM_ID_CON_DISCOVERY_PARAM 0x02
nxpandroid8f6d0532017-07-12 18:25:30 +0530484#define NCI_PARAM_ID_PA_BAILOUT 0x08
485#define NCI_PARAM_ID_PB_AFI 0x10
486#define NCI_PARAM_ID_PB_BAILOUT 0x11
487#define NCI_PARAM_ID_PB_ATTRIB_PARAM1 0x12
488#define NCI_PARAM_ID_PF_BIT_RATE 0x18
489#define NCI_PARAM_ID_PF_RC 0x19
490#define NCI_PARAM_ID_PB_H_INFO 0x20
491#define NCI_PARAM_ID_PI_BIT_RATE 0x21
nxpandroidc7611652015-09-23 16:42:05 +0530492
nxpandroid8f6d0532017-07-12 18:25:30 +0530493#define NCI_PARAM_ID_BITR_NFC_DEP 0x28
494#define NCI_PARAM_ID_ATR_REQ_GEN_BYTES 0x29
495#define NCI_PARAM_ID_ATR_REQ_CONFIG 0x2A
nxpandroidc7611652015-09-23 16:42:05 +0530496
nxpandroid8f6d0532017-07-12 18:25:30 +0530497#define NCI_PARAM_ID_LA_BIT_FRAME_SDD 0x30
nxpandroidc7611652015-09-23 16:42:05 +0530498#define NCI_PARAM_ID_LA_PLATFORM_CONFIG 0x31
nxpandroid8f6d0532017-07-12 18:25:30 +0530499#define NCI_PARAM_ID_LA_SEL_INFO 0x32
500#define NCI_PARAM_ID_LA_NFCID1 0x33
501#define NCI_PARAM_ID_LB_SENSB_INFO 0x38
502#define NCI_PARAM_ID_LB_NFCID0 0x39
503#define NCI_PARAM_ID_LB_APPDATA 0x3A
504#define NCI_PARAM_ID_LB_SFGI 0x3B
505#define NCI_PARAM_ID_LB_ADC_FO 0x3C
506#define NCI_PARAM_ID_LB_PROTOCOL NCI_PARAM_ID_LB_SENSB_INFO
nxpandroidc7611652015-09-23 16:42:05 +0530507
nxpandroid8f6d0532017-07-12 18:25:30 +0530508#define NCI_PARAM_ID_LF_T3T_ID1 0x40
509#define NCI_PARAM_ID_LF_T3T_ID2 0x41
510#define NCI_PARAM_ID_LF_T3T_ID3 0x42
511#define NCI_PARAM_ID_LF_T3T_ID4 0x43
512#define NCI_PARAM_ID_LF_T3T_ID5 0x44
513#define NCI_PARAM_ID_LF_T3T_ID6 0x45
514#define NCI_PARAM_ID_LF_T3T_ID7 0x46
515#define NCI_PARAM_ID_LF_T3T_ID8 0x47
516#define NCI_PARAM_ID_LF_T3T_ID9 0x48
517#define NCI_PARAM_ID_LF_T3T_ID10 0x49
518#define NCI_PARAM_ID_LF_T3T_ID11 0x4A
519#define NCI_PARAM_ID_LF_T3T_ID12 0x4B
520#define NCI_PARAM_ID_LF_T3T_ID13 0x4C
521#define NCI_PARAM_ID_LF_T3T_ID14 0x4D
522#define NCI_PARAM_ID_LF_T3T_ID15 0x4E
523#define NCI_PARAM_ID_LF_T3T_ID16 0x4F
524#define NCI_PARAM_ID_LF_PROTOCOL 0x50
525#define NCI_PARAM_ID_LF_T3T_PMM 0x51
526/* max num of LF_T3T_ID supported by NFCC (1 for now) */
527#define NCI_PARAM_ID_LF_T3T_MAX 0x52
528#define NCI_PARAM_ID_LF_T3T_FLAGS2 0x53
529#define NCI_PARAM_ID_LF_CON_BITR_F 0x54
nxf24591c1cbeab2018-02-21 17:32:26 +0530530#define NCI_PARAM_ID_LF_CON_ADV_FEAT 0x55
531/*LF_T3T name changed in NCI2.0*/
532#define NCI_PARAM_ID_LF_T3T_RD_ALLOWED 0x55
533
nxpandroid8f6d0532017-07-12 18:25:30 +0530534#define NCI_PARAM_ID_FWI 0x58
535#define NCI_PARAM_ID_LA_HIST_BY 0x59
536#define NCI_PARAM_ID_LB_H_INFO_RSP 0x5A
537#define NCI_PARAM_ID_LI_BIT_RATE 0x5B
nxpandroidc7611652015-09-23 16:42:05 +0530538
nxpandroid8f6d0532017-07-12 18:25:30 +0530539#define NCI_PARAM_ID_WT 0x60
540#define NCI_PARAM_ID_ATR_RES_GEN_BYTES 0x61
541#define NCI_PARAM_ID_ATR_RSP_CONFIG 0x62
nxpandroidc7611652015-09-23 16:42:05 +0530542
nxpandroid8f6d0532017-07-12 18:25:30 +0530543#define NCI_PARAM_ID_RF_FIELD_INFO 0x80
nxpandroid8f6d0532017-07-12 18:25:30 +0530544#define NCI_PARAM_ID_NFC_DEP_OP 0x82
nxpandroidc7611652015-09-23 16:42:05 +0530545
nxpandroidc7611652015-09-23 16:42:05 +0530546/* Type A Parameters */
nxpandroid8f6d0532017-07-12 18:25:30 +0530547#define NCI_PARAM_PLATFORM_T1T 0x0C
548#define NCI_PARAM_SEL_INFO_ISODEP 0x20
549#define NCI_PARAM_SEL_INFO_NFCDEP 0x40
nxpandroidc7611652015-09-23 16:42:05 +0530550/**********************************************
551 * NCI Parameter ID Lens
552 **********************************************/
nxpandroid8f6d0532017-07-12 18:25:30 +0530553#define NCI_PARAM_LEN_TOTAL_DURATION 2
nxpandroidc7611652015-09-23 16:42:05 +0530554
nxpandroidc0fd8b72017-07-12 21:09:02 +0530555#define NCI_PARAM_LEN_CON_DISCOVERY_PARAM 1
556
nxpandroid8f6d0532017-07-12 18:25:30 +0530557#define NCI_PARAM_LEN_PF_RC 1
nxpandroidcdd30442016-05-27 17:26:18 +0530558
nxpandroid8f6d0532017-07-12 18:25:30 +0530559#define NCI_PARAM_LEN_LA_BIT_FRAME_SDD 1
560#define NCI_PARAM_LEN_LA_PLATFORM_CONFIG 1
561#define NCI_PARAM_LEN_LA_SEL_INFO 1
nxpandroidc7611652015-09-23 16:42:05 +0530562
nxpandroid8f6d0532017-07-12 18:25:30 +0530563#define NCI_PARAM_LEN_LB_SENSB_INFO 1
564#define NCI_PARAM_LEN_LB_NFCID0 4
565#define NCI_PARAM_LEN_LB_APPDATA 4
566#define NCI_PARAM_LEN_LB_ADC_FO 1
nxpandroidc7611652015-09-23 16:42:05 +0530567
nxpandroid8f6d0532017-07-12 18:25:30 +0530568#define NCI_PARAM_LEN_LF_PROTOCOL 1
569#define NCI_PARAM_LEN_LF_T3T_FLAGS2 2
570#define NCI_PARAM_LEN_LF_T3T_PMM 8
571#define NCI_PARAM_LEN_LF_T3T_ID(X) (((X) == NCI_VERSION_2_0) ? (0x12) : (0x0A))
nxf24591c1cbeab2018-02-21 17:32:26 +0530572#define NCI_PARAM_LEN_LF_CON_ADV_FEAT 1
573
574#define NCI_PARAM_LEN_LF_T3T_RD_ALLOWED 1 // Listen F NCI2.0 Parameter
nxpandroidc7611652015-09-23 16:42:05 +0530575
nxpandroid8f6d0532017-07-12 18:25:30 +0530576#define NCI_PARAM_LEN_FWI 1
577#define NCI_PARAM_LEN_WT 1
nxpandroidc7611652015-09-23 16:42:05 +0530578/* GEN_BYTES - variable */
579
nxpandroid8f6d0532017-07-12 18:25:30 +0530580/* Listen protocol bits - NCI_PARAM_ID_LF_PROTOCOL and
581 * NCI_PARAM_ID_LB_SENSB_INFO */
582#define NCI_LISTEN_PROTOCOL_ISO_DEP 0x01
583#define NCI_LISTEN_PROTOCOL_NFC_DEP 0x02
nxpandroidc7611652015-09-23 16:42:05 +0530584
nxpandroidc7611652015-09-23 16:42:05 +0530585/* LF_T3T_FLAGS2 listen bits all-disabled definition */
nxpandroid8f6d0532017-07-12 18:25:30 +0530586#define NCI_LF_T3T_FLAGS2_ALL_DISABLED 0x0000
nxpandroidc7611652015-09-23 16:42:05 +0530587
nxf24591c1cbeab2018-02-21 17:32:26 +0530588/* The DH-NFCEE listen is considered as a enable NFCEE */
589#define NCI_LISTEN_DH_NFCEE_ENABLE_MASK 0x00
590/* The DH-NFCEE listen is considered as a disable NFCEE */
591#define NCI_LISTEN_DH_NFCEE_DISABLE_MASK 0x02
592/* The DH polling is considered as a disable NFCEE */
593#define NCI_POLLING_DH_DISABLE_MASK 0x00
594/* The DH polling is considered as a enable NFCEE */
595#define NCI_POLLING_DH_ENABLE_MASK 0x01
Suraj Uday Kotharkar6f7757b2018-05-10 15:58:29 +0530596/* SCBR support check with Core Init resp OCT1 byte */
597#define NCI_SCBR_MASK 0x10
nxpandroid8f6d0532017-07-12 18:25:30 +0530598
nxf24591c1cbeab2018-02-21 17:32:26 +0530599/* AID matching is allowed when the SELECT AID is longer */
600#define NCI_ROUTE_QUAL_LONG_SELECT 0x10
601/* AID matching is allowed when the SELECT AID is shorter */
602#define NCI_ROUTE_QUAL_SHORT_SELECT 0x20
603/* AID is blocked in unsupported power mode */
604#define NCI_ROUTE_QUAL_BLOCK_ROUTE 0x40
nxpandroidc7611652015-09-23 16:42:05 +0530605
606#ifndef NCI_GET_CMD_BUF
nxf24591c1cbeab2018-02-21 17:32:26 +0530607#if (HCI_USE_VARIABLE_SIZE_CMD_BUF == FALSE)
nxpandroidc7611652015-09-23 16:42:05 +0530608/* Allocate fixed-size buffer from HCI_CMD_POOL (default case) */
nxpandroid8f6d0532017-07-12 18:25:30 +0530609#define NCI_GET_CMD_BUF(paramlen) ((NFC_HDR*)GKI_getpoolbuf(NFC_NCI_POOL_ID))
nxpandroidc7611652015-09-23 16:42:05 +0530610#else
611/* Allocate smallest possible buffer (for platforms with limited RAM) */
nxpandroid8f6d0532017-07-12 18:25:30 +0530612#define NCI_GET_CMD_BUF(paramlen) \
613 ((NFC_HDR*)GKI_getbuf((uint16_t)(NFC_HDR_SIZE + NCI_MSG_HDR_SIZE + \
614 NCI_MSG_OFFSET_SIZE + (paramlen))))
nxpandroidc7611652015-09-23 16:42:05 +0530615#endif
nxpandroid8f6d0532017-07-12 18:25:30 +0530616#endif /* NCI_GET_CMD_BUF */
nxpandroidc7611652015-09-23 16:42:05 +0530617
nxpandroid8f6d0532017-07-12 18:25:30 +0530618#define NCI_MAX_AID_LEN 16
nxpandroidc7611652015-09-23 16:42:05 +0530619
nxpandroid8f6d0532017-07-12 18:25:30 +0530620typedef struct {
621 uint8_t type;
622 uint8_t frequency;
nxpandroidc7611652015-09-23 16:42:05 +0530623} tNCI_DISCOVER_PARAMS;
624
nxpandroid8f6d0532017-07-12 18:25:30 +0530625typedef struct {
626 uint8_t protocol;
627 uint8_t mode;
628 uint8_t intf_type;
nxpandroidc7611652015-09-23 16:42:05 +0530629} tNCI_DISCOVER_MAPS;
630
nxpandroid8f6d0532017-07-12 18:25:30 +0530631#define NCI_NFCID1_MAX_LEN 10
632#define NCI_T1T_HR_LEN 2
633typedef struct {
634 uint8_t sens_res[2]; /* SENS_RES Response (ATQA). Available after Technology
635 Detection */
636 uint8_t nfcid1_len; /* 4, 7 or 10 */
637 uint8_t nfcid1[NCI_NFCID1_MAX_LEN]; /* AKA NFCID1 */
638 uint8_t sel_rsp; /* SEL_RSP (SAK) Available after Collision Resolution */
639 uint8_t hr_len; /* 2, if T1T HR0/HR1 is reported */
640 uint8_t hr[NCI_T1T_HR_LEN]; /* T1T HR0 is in hr[0], HR1 is in hr[1] */
nxpandroidc7611652015-09-23 16:42:05 +0530641} tNCI_RF_PA_PARAMS;
642
nxpandroid8f6d0532017-07-12 18:25:30 +0530643#define NCI_MAX_SENSB_RES_LEN 12
644typedef struct {
645 uint8_t sensb_res_len; /* Length of SENSB_RES Response (Byte 2 - Byte 12 or
646 13) Available after Technology Detection */
647 uint8_t sensb_res[NCI_MAX_SENSB_RES_LEN]; /* SENSB_RES Response (ATQ) */
nxpandroidc7611652015-09-23 16:42:05 +0530648} tNCI_RF_PB_PARAMS;
649
nxpandroid8f6d0532017-07-12 18:25:30 +0530650#define NCI_MAX_SENSF_RES_LEN 18
nxpandroid8f6d0532017-07-12 18:25:30 +0530651#define NCI_NFCID2_LEN 8
652#define NCI_T3T_PMM_LEN 8
653#define NCI_SYSTEMCODE_LEN 2
654#define NCI_RF_F_UID_LEN NCI_NFCID2_LEN
655#define NCI_MRTI_CHECK_INDEX 13
656#define NCI_MRTI_UPDATE_INDEX 14
657typedef struct {
658 uint8_t bit_rate; /* NFC_BIT_RATE_212 or NFC_BIT_RATE_424 */
659 uint8_t sensf_res_len; /* Length of SENSF_RES Response (Byte 2 - Byte 17 or
660 19) Available after Technology Detection */
661 uint8_t sensf_res[NCI_MAX_SENSF_RES_LEN]; /* SENSB_RES Response */
nxpandroidc7611652015-09-23 16:42:05 +0530662} tNCI_RF_PF_PARAMS;
663
nxpandroid8f6d0532017-07-12 18:25:30 +0530664typedef struct {
665 uint8_t nfcid2[NCI_NFCID2_LEN]; /* NFCID2 generated by the Local NFCC for
666 NFC-DEP Protocol.Available for Frame
667 Interface */
nxpandroidc7611652015-09-23 16:42:05 +0530668} tNCI_RF_LF_PARAMS;
669
nxpandroidc7611652015-09-23 16:42:05 +0530670#ifndef NCI_MAX_ATS_LEN
nxpandroid8f6d0532017-07-12 18:25:30 +0530671#define NCI_MAX_ATS_LEN 60
nxpandroidc7611652015-09-23 16:42:05 +0530672#endif
673#ifndef NCI_MAX_HIS_BYTES_LEN
nxpandroid8f6d0532017-07-12 18:25:30 +0530674#define NCI_MAX_HIS_BYTES_LEN 50
nxpandroidc7611652015-09-23 16:42:05 +0530675#endif
676#ifndef NCI_MAX_GEN_BYTES_LEN
nxpandroid8f6d0532017-07-12 18:25:30 +0530677#define NCI_MAX_GEN_BYTES_LEN 48
nxpandroidc7611652015-09-23 16:42:05 +0530678#endif
679
nxpandroid8f6d0532017-07-12 18:25:30 +0530680#define NCI_ATS_T0_INDEX 0
681#define NCI_ATS_TC_MASK 0x40
682#define NCI_ATS_TB_MASK 0x20
683#define NCI_ATS_TA_MASK 0x10
nxpandroid8f6d0532017-07-12 18:25:30 +0530684typedef struct {
685 uint8_t ats_res_len; /* Length of ATS RES */
686 uint8_t ats_res[NCI_MAX_ATS_LEN]; /* ATS RES defined in [DIGPROT] */
nxpandroidc7611652015-09-23 16:42:05 +0530687} tNCI_INTF_PA_ISO_DEP;
688
nxpandroid8f6d0532017-07-12 18:25:30 +0530689typedef struct { uint8_t rats; /* RATS */ } tNCI_INTF_LA_ISO_DEP;
nxpandroidc7611652015-09-23 16:42:05 +0530690
nxpandroid8f6d0532017-07-12 18:25:30 +0530691#define NCI_P_GEN_BYTE_INDEX 15
692#define NCI_L_GEN_BYTE_INDEX 14
693#define NCI_L_NFC_DEP_TO_INDEX 13
694typedef struct {
695 uint8_t atr_res_len; /* Length of ATR_RES */
696 uint8_t atr_res[NCI_MAX_ATS_LEN]; /* ATR_RES (Byte 3 - Byte 17+n) as defined
697 in [DIGPROT] */
nxpandroidc7611652015-09-23 16:42:05 +0530698} tNCI_INTF_PA_NFC_DEP;
699
nxpandroid8f6d0532017-07-12 18:25:30 +0530700/* Note: keep tNCI_INTF_PA_NFC_DEP data member in the same order as
701 * tNCI_INTF_LA_NFC_DEP */
702typedef struct {
703 uint8_t atr_req_len; /* Length of ATR_REQ */
704 uint8_t atr_req[NCI_MAX_ATS_LEN]; /* ATR_REQ (Byte 3 - Byte 18+n) as defined
705 in [DIGPROT] */
nxpandroidc7611652015-09-23 16:42:05 +0530706} tNCI_INTF_LA_NFC_DEP;
707typedef tNCI_INTF_LA_NFC_DEP tNCI_INTF_LF_NFC_DEP;
708typedef tNCI_INTF_PA_NFC_DEP tNCI_INTF_PF_NFC_DEP;
709
nxpandroid8f6d0532017-07-12 18:25:30 +0530710#define NCI_MAX_ATTRIB_LEN (10 + NCI_MAX_GEN_BYTES_LEN)
nxpandroidc7611652015-09-23 16:42:05 +0530711
nxpandroid8f6d0532017-07-12 18:25:30 +0530712typedef struct {
713 uint8_t attrib_res_len; /* Length of ATTRIB RES */
714 uint8_t
715 attrib_res[NCI_MAX_ATTRIB_LEN]; /* ATTRIB RES as defined in [DIGPROT] */
nxpandroidc7611652015-09-23 16:42:05 +0530716} tNCI_INTF_PB_ISO_DEP;
717
nxpandroid8f6d0532017-07-12 18:25:30 +0530718typedef struct {
719 uint8_t attrib_req_len; /* Length of ATTRIB REQ */
720 uint8_t attrib_req[NCI_MAX_ATTRIB_LEN]; /* ATTRIB REQ (Byte 2 - Byte 10+k) as
721 defined in [DIGPROT] */
nxpandroidc7611652015-09-23 16:42:05 +0530722} tNCI_INTF_LB_ISO_DEP;
723
nxpandroid8f6d0532017-07-12 18:25:30 +0530724typedef struct {
nxf24591c1cbeab2018-02-21 17:32:26 +0530725 uint8_t atr_res_len; /* Length of ATR_RES */
726 uint8_t atr_res[NCI_MAX_ATS_LEN]; /* ATR_RES (Byte 3 - Byte 17+n) */
727 uint8_t max_payload_size; /* 64, 128, 192 or 254 */
728 uint8_t gen_bytes_len; /* len of general bytes */
729 uint8_t gen_bytes[NCI_MAX_GEN_BYTES_LEN]; /* general bytes */
730 uint8_t waiting_time; /* WT -> Response Waiting Time
731 RWT = (256 x 16/fC) x 2WT */
732} tNCI_RF_ACM_P_PARAMS;
nxpandroidc7611652015-09-23 16:42:05 +0530733
nxpandroid8f6d0532017-07-12 18:25:30 +0530734#endif /* NFC_NCI_DEFS_H */