blob: edf7e83063693ce04e677a0a82b53049ac3c6f0b [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) Reader/Writer mode
22 * related API function external definitions.
23 *
24 ******************************************************************************/
25
26#ifndef RW_API_H
27#define RW_API_H
Ruchi Kandoi9343bf42017-10-13 12:56:30 -070028#include "nfc_api.h"
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080029#include "tags_defs.h"
30
Chih-Hung Hsieh7ac6a7c2017-08-01 14:26:16 -070031#define RW_T1T_BLD_ADD(a, k, y) (a) = (((k) & 0xF) << 3) | ((y) & 0x7);
32#define RW_T1T_BLD_ADDS(a, s) (a) = (((s) & 0xF) << 4);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080033
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -080034#define RW_T1T_FIRST_EVT 0x20
35#define RW_T2T_FIRST_EVT 0x40
36#define RW_T3T_FIRST_EVT 0x60
37#define RW_T4T_FIRST_EVT 0x80
38#define RW_I93_FIRST_EVT 0xA0
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080039
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -080040enum {
41 /* Note: the order of these events can not be changed */
42 /* Type 1 tag events for tRW_CBACK */
43 RW_T1T_RID_EVT = RW_T1T_FIRST_EVT, /* Read ID command completd */
44 RW_T1T_RALL_CPLT_EVT, /* Read All command completed */
45 RW_T1T_READ_CPLT_EVT, /* Read byte completed */
46 RW_T1T_WRITE_E_CPLT_EVT, /* Write byte after erase completed */
47 RW_T1T_WRITE_NE_CPLT_EVT, /* Write byte with no erase completed */
48 RW_T1T_RSEG_CPLT_EVT, /* Read segment completed */
49 RW_T1T_READ8_CPLT_EVT, /* Read block completed */
50 RW_T1T_WRITE_E8_CPLT_EVT, /* Write block after erase completed */
51 RW_T1T_WRITE_NE8_CPLT_EVT, /* Write block with no erase completed */
52 RW_T1T_TLV_DETECT_EVT, /* Lock/Mem/Prop tlv detection complete */
53 RW_T1T_NDEF_DETECT_EVT, /* NDEF detection complete */
54 RW_T1T_NDEF_READ_EVT, /* NDEF read completed */
55 RW_T1T_NDEF_WRITE_EVT, /* NDEF write complete */
56 RW_T1T_SET_TAG_RO_EVT, /* Tag is set as read only */
57 RW_T1T_RAW_FRAME_EVT, /* Response of raw frame sent */
58 RW_T1T_PRESENCE_CHECK_EVT, /* Response to RW_T1tPresenceCheck */
59 RW_T1T_FORMAT_CPLT_EVT, /* Tag Formated */
60 RW_T1T_INTF_ERROR_EVT, /* RF Interface error event */
61 RW_T1T_MAX_EVT,
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080062
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -080063 /* Type 2 tag events */
64 RW_T2T_READ_CPLT_EVT = RW_T2T_FIRST_EVT, /* Read completed */
65 RW_T2T_WRITE_CPLT_EVT, /* Write completed */
66 RW_T2T_SELECT_CPLT_EVT, /* Sector select completed */
67 RW_T2T_NDEF_DETECT_EVT, /* NDEF detection complete */
68 RW_T2T_TLV_DETECT_EVT, /* Lock/Mem/Prop tlv detection complete */
69 RW_T2T_NDEF_READ_EVT, /* NDEF read completed */
70 RW_T2T_NDEF_WRITE_EVT, /* NDEF write complete */
71 RW_T2T_SET_TAG_RO_EVT, /* Tag is set as read only */
72 RW_T2T_RAW_FRAME_EVT, /* Response of raw frame sent */
73 RW_T2T_PRESENCE_CHECK_EVT, /* Response to RW_T2tPresenceCheck */
74 RW_T2T_FORMAT_CPLT_EVT, /* Tag Formated */
75 RW_T2T_INTF_ERROR_EVT, /* RF Interface error event */
76 RW_T2T_MAX_EVT,
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080077
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -080078 /* Type 3 tag events for tRW_CBACK */
79 RW_T3T_CHECK_CPLT_EVT = RW_T3T_FIRST_EVT, /* Read completed */
80 RW_T3T_UPDATE_CPLT_EVT, /* Write completed */
81 RW_T3T_CHECK_EVT, /* Segment of data received from type 3 tag */
82 RW_T3T_RAW_FRAME_EVT, /* SendRawFrame response */
83 RW_T3T_NDEF_DETECT_EVT, /* NDEF detection complete */
84 RW_T3T_PRESENCE_CHECK_EVT, /* Response to RW_T3tPresenceCheck */
85 RW_T3T_POLL_EVT, /* Response to RW_T3tPoll */
86 RW_T3T_GET_SYSTEM_CODES_EVT, /* Response to RW_T3tGetSystemCodes */
87 RW_T3T_FORMAT_CPLT_EVT, /* Tag Formated (Felica-Lite only) */
88 RW_T3T_SET_READ_ONLY_CPLT_EVT, /* Tag is set as Read only */
89 RW_T3T_INTF_ERROR_EVT, /* RF Interface error event */
90 RW_T3T_MAX_EVT,
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080091
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -080092 /* Type 4 tag events for tRW_CBACK */
93 RW_T4T_NDEF_DETECT_EVT =
94 RW_T4T_FIRST_EVT, /* Result of NDEF detection procedure */
95 /* Mandatory NDEF file is selected */
96 RW_T4T_NDEF_READ_EVT, /* Segment of data received from type 4 tag */
97 RW_T4T_NDEF_READ_CPLT_EVT, /* Read operation completed */
98 RW_T4T_NDEF_READ_FAIL_EVT, /* Read operation failed */
99 RW_T4T_NDEF_UPDATE_CPLT_EVT, /* Update operation completed */
100 RW_T4T_NDEF_UPDATE_FAIL_EVT, /* Update operation failed */
101 RW_T4T_SET_TO_RO_EVT, /* Tag is set as read only */
102 RW_T4T_PRESENCE_CHECK_EVT, /* Response to RW_T4tPresenceCheck */
103 RW_T4T_RAW_FRAME_EVT, /* Response of raw frame sent */
104 RW_T4T_INTF_ERROR_EVT, /* RF Interface error event */
105 RW_T4T_NDEF_FORMAT_CPLT_EVT, /* Format operation completed */
106 RW_T4T_MAX_EVT,
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800107
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800108 /* ISO 15693 tag events for tRW_CBACK */
109 RW_I93_NDEF_DETECT_EVT =
110 RW_I93_FIRST_EVT, /* Result of NDEF detection procedure */
111 RW_I93_NDEF_READ_EVT, /* Segment of data received from tag */
112 RW_I93_NDEF_READ_CPLT_EVT, /* Read operation completed */
113 RW_I93_NDEF_READ_FAIL_EVT, /* Read operation failed */
114 RW_I93_NDEF_UPDATE_CPLT_EVT, /* Update operation completed */
115 RW_I93_NDEF_UPDATE_FAIL_EVT, /* Update operation failed */
116 RW_I93_FORMAT_CPLT_EVT, /* Format procedure complete */
117 RW_I93_SET_TAG_RO_EVT, /* Set read-only procedure complete */
118 RW_I93_INVENTORY_EVT, /* Response of Inventory */
119 RW_I93_DATA_EVT, /* Response of Read, Get Multi Security */
120 RW_I93_SYS_INFO_EVT, /* Response of System Information */
121 RW_I93_CMD_CMPL_EVT, /* Command complete */
122 RW_I93_PRESENCE_CHECK_EVT, /* Response to RW_I93PresenceCheck */
123 RW_I93_RAW_FRAME_EVT, /* Response of raw frame sent */
124 RW_I93_INTF_ERROR_EVT, /* RF Interface error event */
125 RW_I93_MAX_EVT
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800126};
127
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800128#define RW_RAW_FRAME_EVT 0xFF
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800129
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800130typedef uint8_t tRW_EVENT;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800131
Ruchi Kandoi46e6e282017-01-30 14:26:10 -0800132/* Tag is read only */
133#define RW_NDEF_FL_READ_ONLY 0x01
134/* Tag formated for NDEF */
135#define RW_NDEF_FL_FORMATED 0x02
136/* NDEF supported by the tag */
137#define RW_NDEF_FL_SUPPORTED 0x04
138/* Unable to find if tag is ndef capable/formated/read only */
139#define RW_NDEF_FL_UNKNOWN 0x08
140/* Tag supports format operation */
141#define RW_NDEF_FL_FORMATABLE 0x10
142/* Tag can be soft locked */
143#define RW_NDEF_FL_SOFT_LOCKABLE 0x20
144/* Tag can be hard locked */
145#define RW_NDEF_FL_HARD_LOCKABLE 0x40
146/* Tag is one time programmable */
147#define RW_NDEF_FL_OTP 0x80
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800148
Ruchi Kandoi512ee632017-01-03 13:59:10 -0800149typedef uint8_t tRW_NDEF_FLAG;
Martijn Coenen5c65c3a2013-03-27 13:23:36 -0700150
Evan Chua24be4f2013-11-13 15:30:16 -0500151/* options for RW_T4tPresenceCheck */
Ruchi Kandoi3da3fba2018-02-28 17:26:14 -0800152#define RW_T4T_CHK_EMPTY_I_BLOCK 1
Love Khannad09d4bf2017-04-06 14:31:48 +0530153#define RW_T4T_CHK_ISO_DEP_NAK_PRES_CHK 5
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800154
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800155typedef struct {
156 tNFC_STATUS status;
157 uint16_t msg_len; /* Length of the NDEF message */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800158} tRW_T2T_DETECT;
159
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800160typedef struct {
161 tNFC_STATUS status; /* Status of the POLL request */
162 uint8_t rc; /* RC (request code) used in the POLL request */
163 uint8_t response_num; /* Number of SENSF_RES responses */
164 uint8_t response_bufsize; /* Size of SENSF_RES responses */
165 uint8_t* response_buf; /* Buffer of responses (length + SENSF_RES) see
166 $8.1.2.2 of NCI specs */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800167} tRW_T3T_POLL;
168
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800169typedef struct {
170 tNFC_STATUS status; /* Status of the Get System Codes request */
171 uint8_t num_system_codes; /* Number of system codes */
172 uint16_t* p_system_codes; /* Table of system codes */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800173} tRW_T3T_SYSTEM_CODES;
174
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800175typedef struct {
176 tNFC_STATUS status; /* status of NDEF detection */
177 tNFC_PROTOCOL protocol; /* protocol used to detect NDEF */
178 uint32_t max_size; /* max number of bytes available for NDEF data */
179 uint32_t cur_size; /* current size of stored NDEF data (in bytes) */
180 tRW_NDEF_FLAG
181 flags; /* Flags to indicate NDEF capability,formated,formatable and read
182 only */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800183} tRW_DETECT_NDEF_DATA;
184
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800185typedef struct {
186 tNFC_STATUS status; /* status of NDEF detection */
187 tNFC_PROTOCOL protocol; /* protocol used to detect TLV */
188 uint8_t
189 num_bytes; /* number of reserved/lock bytes based on the type of tlv */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800190} tRW_DETECT_TLV_DATA;
191
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800192typedef struct {
193 tNFC_STATUS status;
194 NFC_HDR* p_data;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800195} tRW_READ_DATA;
196
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800197typedef struct {
198 tNFC_STATUS status;
199 uint8_t sw1;
200 uint8_t sw2;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800201} tRW_T4T_SW;
202
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800203typedef struct /* RW_I93_INVENTORY_EVT */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800204{
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800205 tNFC_STATUS status; /* status of Inventory command */
206 uint8_t dsfid; /* DSFID */
207 uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800208} tRW_I93_INVENTORY;
209
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800210typedef struct /* RW_I93_DATA_EVT */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800211{
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800212 tNFC_STATUS status; /* status of Read/Get security status command */
213 uint8_t command; /* sent command */
214 NFC_HDR* p_data; /* block data of security status */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800215} tRW_I93_DATA;
216
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800217typedef struct /* RW_I93_SYS_INFO_EVT */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800218{
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800219 tNFC_STATUS status; /* status of Get Sys Info command */
220 uint8_t info_flags; /* information flags */
221 uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB */
222 uint8_t dsfid; /* DSFID if I93_INFO_FLAG_DSFID */
223 uint8_t afi; /* AFI if I93_INFO_FLAG_AFI */
224 uint16_t num_block; /* number of blocks if I93_INFO_FLAG_MEM_SIZE */
225 uint8_t block_size; /* block size in byte if I93_INFO_FLAG_MEM_SIZE */
226 uint8_t IC_reference; /* IC Reference if I93_INFO_FLAG_IC_REF */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800227} tRW_I93_SYS_INFO;
228
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800229typedef struct /* RW_I93_CMD_CMPL_EVT */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800230{
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800231 tNFC_STATUS status; /* status of sent command */
232 uint8_t command; /* sent command */
233 uint8_t error_code; /* error code; I93_ERROR_CODE_XXX */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800234} tRW_I93_CMD_CMPL;
235
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800236typedef struct {
237 tNFC_STATUS status;
238 NFC_HDR* p_data;
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800239} tRW_RAW_FRAME;
240
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800241typedef union {
242 tNFC_STATUS status;
243 tRW_T3T_POLL t3t_poll; /* Response to t3t poll command */
244 tRW_T3T_SYSTEM_CODES t3t_sc; /* Received system codes from t3 tag */
245 tRW_DETECT_TLV_DATA tlv; /* The information of detected TLV data */
246 tRW_DETECT_NDEF_DATA ndef; /* The information of detected NDEF data */
247 tRW_READ_DATA data; /* The received data from a tag */
248 tRW_RAW_FRAME raw_frame; /* Response of raw frame sent */
249 tRW_T4T_SW t4t_sw; /* Received status words from a tag */
250 tRW_I93_INVENTORY i93_inventory; /* ISO 15693 Inventory response */
251 tRW_I93_DATA i93_data; /* ISO 15693 Data response */
252 tRW_I93_SYS_INFO i93_sys_info; /* ISO 15693 System Information */
253 tRW_I93_CMD_CMPL i93_cmd_cmpl; /* ISO 15693 Command complete */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800254} tRW_DATA;
255
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800256typedef void(tRW_CBACK)(tRW_EVENT event, tRW_DATA* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800257
258/*******************************************************************************
259**
260** Function RW_T1tRid
261**
262** Description This function send a RID command for Reader/Writer mode.
263**
264** Returns tNFC_STATUS
265**
266*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800267extern tNFC_STATUS RW_T1tRid(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800268
269/*******************************************************************************
270**
271** Function RW_T1tReadAll
272**
273** Description This function send a RALL command for Reader/Writer mode.
274**
275** Returns tNFC_STATUS
276**
277*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800278extern tNFC_STATUS RW_T1tReadAll(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800279
280/*******************************************************************************
281**
282** Function RW_T1tRead
283**
284** Description This function send a READ command for Reader/Writer mode.
285**
286** Returns tNFC_STATUS
287**
288*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800289extern tNFC_STATUS RW_T1tRead(uint8_t block, uint8_t byte);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800290
291/*******************************************************************************
292**
293** Function RW_T1tWriteErase
294**
295** Description This function send a WRITE-E command for Reader/Writer mode.
296**
297** Returns tNFC_STATUS
298**
299*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800300extern tNFC_STATUS RW_T1tWriteErase(uint8_t block, uint8_t byte,
301 uint8_t new_byte);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800302
303/*******************************************************************************
304**
305** Function RW_T1tWriteNoErase
306**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800307** Description This function send a WRITE-NE command for Reader/Writer
308** mode.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800309**
310** Returns tNFC_STATUS
311**
312*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800313extern tNFC_STATUS RW_T1tWriteNoErase(uint8_t block, uint8_t byte,
314 uint8_t new_byte);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800315
316/*******************************************************************************
317**
318** Function RW_T1tReadSeg
319**
320** Description This function send a RSEG command for Reader/Writer mode.
321**
322** Returns tNFC_STATUS
323**
324*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800325extern tNFC_STATUS RW_T1tReadSeg(uint8_t segment);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800326
327/*******************************************************************************
328**
329** Function RW_T1tRead8
330**
331** Description This function send a READ8 command for Reader/Writer mode.
332**
333** Returns tNFC_STATUS
334**
335*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800336extern tNFC_STATUS RW_T1tRead8(uint8_t block);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800337
338/*******************************************************************************
339**
340** Function RW_T1tWriteErase8
341**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800342** Description This function send a WRITE-E8 command for Reader/Writer
343** mode.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800344**
345** Returns tNFC_STATUS
346**
347*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800348extern tNFC_STATUS RW_T1tWriteErase8(uint8_t block, uint8_t* p_new_dat);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800349
350/*******************************************************************************
351**
352** Function RW_T1tWriteNoErase8
353**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800354** Description This function send a WRITE-NE8 command for Reader/Writer
355** mode.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800356**
357** Returns tNFC_STATUS
358**
359*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800360extern tNFC_STATUS RW_T1tWriteNoErase8(uint8_t block, uint8_t* p_new_dat);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800361
362/*******************************************************************************
363**
364** Function RW_T1tLocateTlv
365**
366** Description This function is called to find the start of the given TLV
367**
368** Parameters: void
369**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800370** Returns NCI_STATUS_OK, if detection was started. Otherwise, error
371** status.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800372**
373*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800374extern tNFC_STATUS RW_T1tLocateTlv(uint8_t tlv_type);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800375
376/*******************************************************************************
377**
Evan Chuc95c79c2013-04-12 17:38:09 -0400378** Function RW_T1tDetectNDef
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800379**
380** Description This function can be called to detect if there is an NDEF
381** message on the tag.
382**
383** Parameters: void
384**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800385** Returns NCI_STATUS_OK, if detection was started. Otherwise, error
386** status.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800387**
388*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800389extern tNFC_STATUS RW_T1tDetectNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800390
391/*******************************************************************************
392**
393** Function RW_T1tReadNDef
394**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800395** Description This function can be called to read the NDEF message on the
396** tag.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800397**
398** Parameters: p_buffer: The buffer into which to read the NDEF message
399** buf_len: The length of the buffer
400**
401** Returns NCI_STATUS_OK, if read was started. Otherwise, error status.
402**
403*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800404extern tNFC_STATUS RW_T1tReadNDef(uint8_t* p_buffer, uint16_t buf_len);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800405
406/*******************************************************************************
407**
408** Function RW_T1tWriteNDef
409**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800410** Description This function can be called to write an NDEF message to the
411** tag.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800412**
413** Parameters: msg_len: The length of the buffer
414** p_msg: The NDEF message to write
415**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800416** Returns NCI_STATUS_OK, if write was started. Otherwise, error
417** status.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800418**
419*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800420extern tNFC_STATUS RW_T1tWriteNDef(uint16_t msg_len, uint8_t* p_msg);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800421
422/*******************************************************************************
423**
424** Function RW_T1tSetTagReadOnly
425**
426** Description This function can be called to set the tag in to read only
427** state
428**
429** Parameters: b_hard_lock: To hard lock or just soft lock the tag
430**
431** Returns NCI_STATUS_OK, if set readonly operation started.
432** Otherwise, error status.
433**
434*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800435extern tNFC_STATUS RW_T1tSetTagReadOnly(bool b_hard_lock);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800436
437/*****************************************************************************
438**
439** Function RW_T1tPresenceCheck
440**
441** Description
442** Check if the tag is still in the field.
443**
444** The RW_T1T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
445** or non-presence.
446**
447** Returns
448** NFC_STATUS_OK, if raw data frame sent
449** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
450** NFC_STATUS_FAILED: other error
451**
452*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800453extern tNFC_STATUS RW_T1tPresenceCheck(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800454
455/*****************************************************************************
456**
457** Function RW_T1tFormatNDef
458**
459** Description
460** Format Tag content
461**
462** Returns
463** NFC_STATUS_OK, Command sent to format Tag
464** NFC_STATUS_REJECTED: Invalid HR0 and cannot format the tag
465** NFC_STATUS_FAILED: other error
466**
467*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800468tNFC_STATUS RW_T1tFormatNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800469
470/*******************************************************************************
471**
472** Function RW_T2tLocateTlv
473**
474** Description This function is called to find the start of the given TLV
475**
476** Returns Pointer to the TLV, if successful. Otherwise, NULL.
477**
478*******************************************************************************/
Ruchi Kandoi4182dab2017-01-10 13:25:53 -0800479extern tNFC_STATUS RW_T2tLocateTlv(uint8_t tlv_type);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800480
481/*******************************************************************************
482**
483** Function RW_T2tRead
484**
485** Description This function issues the Type 2 Tag READ command. When the
486** operation is complete the callback function will be called
487** with a RW_T2T_READ_EVT.
488**
489** Returns tNFC_STATUS
490**
491*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800492extern tNFC_STATUS RW_T2tRead(uint16_t block);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800493
494/*******************************************************************************
495**
496** Function RW_T2tWrite
497**
498** Description This function issues the Type 2 Tag WRITE command. When the
499** operation is complete the callback function will be called
500** with a RW_T2T_WRITE_EVT.
501**
502** p_write_data points to the array of 4 bytes to be written
503**
504** Returns tNFC_STATUS
505**
506*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800507extern tNFC_STATUS RW_T2tWrite(uint16_t block, uint8_t* p_write_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800508
509/*******************************************************************************
510**
511** Function RW_T2tSectorSelect
512**
513** Description This function issues the Type 2 Tag SECTOR-SELECT command
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800514** packet 1. If a NACK is received as the response, the
515** callback function will be called with a
516** RW_T2T_SECTOR_SELECT_EVT. If an ACK is received as the
517** response, the command packet 2 with the given sector number
518** is sent to the peer device. When the response for packet 2
519** is received, the callback function will be called with a
520** RW_T2T_SECTOR_SELECT_EVT.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800521**
522** A sector is 256 contiguous blocks (1024 bytes).
523**
524** Returns tNFC_STATUS
525**
526*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800527extern tNFC_STATUS RW_T2tSectorSelect(uint8_t sector);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800528
529/*******************************************************************************
530**
531** Function RW_T2tDetectNDef
532**
533** Description This function will find NDEF message if any in the Tag
534**
535** Returns tNFC_STATUS
536**
537*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800538extern tNFC_STATUS RW_T2tDetectNDef(bool skip_dyn_locks);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800539
540/*******************************************************************************
541**
542** Function RW_T2tReadNDef
543**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800544** Description This function can be called to read the NDEF message on the
545** tag.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800546**
547** Parameters: p_buffer: The buffer into which to read the NDEF message
548** buf_len: The length of the buffer
549**
550** Returns NCI_STATUS_OK, if read was started. Otherwise, error status.
551**
552*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800553extern tNFC_STATUS RW_T2tReadNDef(uint8_t* p_buffer, uint16_t buf_len);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800554
555/*******************************************************************************
556**
557** Function RW_T2tWriteNDef
558**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800559** Description This function can be called to write an NDEF message to the
560** tag.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800561**
562** Parameters: msg_len: The length of the buffer
563** p_msg: The NDEF message to write
564**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800565** Returns NCI_STATUS_OK, if write was started. Otherwise, error
566** status.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800567**
568*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800569extern tNFC_STATUS RW_T2tWriteNDef(uint16_t msg_len, uint8_t* p_msg);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800570
571/*******************************************************************************
572**
573** Function RW_T2tSetTagReadOnly
574**
575** Description This function can be called to set the tag in to read only
576** state
577**
578** Parameters: b_hard_lock: To indicate hard lock the tag or not
579**
580** Returns NCI_STATUS_OK, if set readonly operation started.
581** Otherwise, error status.
582**
583*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800584extern tNFC_STATUS RW_T2tSetTagReadOnly(bool b_hard_lock);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800585
586/*****************************************************************************
587**
588** Function RW_T2tPresenceCheck
589**
590** Description
591** Check if the tag is still in the field.
592**
593** The RW_T2T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
594** or non-presence.
595**
596** Returns
597** NFC_STATUS_OK, if raw data frame sent
598** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
599** NFC_STATUS_FAILED: other error
600**
601*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800602extern tNFC_STATUS RW_T2tPresenceCheck(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800603
604/*****************************************************************************
605**
606** Function RW_T2tFormatNDef
607**
608** Description
609** Format Tag content
610**
611** Returns
612** NFC_STATUS_OK, Command sent to format Tag
613** NFC_STATUS_FAILED: otherwise
614**
615*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800616tNFC_STATUS RW_T2tFormatNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800617
618/*****************************************************************************
619**
620** Function RW_T3tDetectNDef
621**
622** Description
623** This function is used to perform NDEF detection on a Type 3 tag, and
624** retrieve the tag's NDEF attribute information (block 0).
625**
626** Before using this API, the application must call RW_SelectTagType to
627** indicate that a Type 3 tag has been activated, and to provide the
628** tag's Manufacture ID (IDm) .
629**
630** Returns
631** NFC_STATUS_OK: ndef detection procedure started
632** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
633** NFC_STATUS_FAILED: other error
634**
635*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800636extern tNFC_STATUS RW_T3tDetectNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800637
638/*****************************************************************************
639**
640** Function RW_T3tFormatNDef
641**
642** Description
643** Format a type-3 tag for NDEF.
644**
645** Only Felica-Lite tags are supported by this API. The
646** RW_T3T_FORMAT_CPLT_EVT is used to notify the status of the operation.
647**
648** Returns
649** NFC_STATUS_OK: ndef detection procedure started
650** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
651** NFC_STATUS_FAILED: other error
652**
653*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800654extern tNFC_STATUS RW_T3tFormatNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800655
656/*****************************************************************************
657**
Martijn Coenen5c65c3a2013-03-27 13:23:36 -0700658** Function RW_T3tSetReadOnly
659**
660** Description
661** Set a type-3 tag to Read Only
662**
663** Only Felica-Lite tags are supported by this API.
664** RW_T3tDetectNDef() must be called before using this
665** The RW_T3T_SET_READ_ONLY_CPLT_EVT event will be returned.
666**
667** Returns
668** NFC_STATUS_OK if success
669** NFC_STATUS_FAILED if T3T is busy or other error
670**
671*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800672extern tNFC_STATUS RW_T3tSetReadOnly(bool b_hard_lock);
Martijn Coenen5c65c3a2013-03-27 13:23:36 -0700673
674/*****************************************************************************
675**
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800676** Function RW_T3tCheckNDef
677**
678** Description
679** Retrieve NDEF contents from a Type3 tag.
680**
681** The RW_T3T_CHECK_EVT event is used to notify the application for each
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800682** segment of NDEF data received. The RW_T3T_CHECK_CPLT_EVT event is used
683** to notify the application all segments have been received.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800684**
685** Before using this API, the RW_T3tDetectNDef function must be called to
686** verify that the tag contains NDEF data, and to retrieve the NDEF
687** attributes.
688**
689** Internally, this command will be separated into multiple Tag 3 Check
690** commands (if necessary) - depending on the tag's Nbr (max number of
691** blocks per read) attribute.
692**
693** Returns
694** NFC_STATUS_OK: check command started
695** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
696** NFC_STATUS_FAILED: other error
697**
698*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800699extern tNFC_STATUS RW_T3tCheckNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800700
701/*****************************************************************************
702**
703** Function RW_T3tUpdateNDef
704**
705** Description
706** Write NDEF contents to a Type3 tag.
707**
708** The RW_T3T_UPDATE_CPLT_EVT callback event will be used to notify the
709** application of the response.
710**
711** Before using this API, the RW_T3tDetectNDef function must be called to
712** verify that the tag contains NDEF data, and to retrieve the NDEF
713** attributes.
714**
715** Internally, this command will be separated into multiple Tag 3 Update
716** commands (if necessary) - depending on the tag's Nbw (max number of
717** blocks per write) attribute.
718**
719** Returns
720** NFC_STATUS_OK: check command started
721** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
722** NFC_STATUS_REFUSED: tag is read-only
723** NFC_STATUS_BUFFER_FULL: len exceeds tag's maximum size
724** NFC_STATUS_FAILED: other error
725**
726*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800727extern tNFC_STATUS RW_T3tUpdateNDef(uint32_t len, uint8_t* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800728
729/*****************************************************************************
730**
731** Function RW_T3tCheck
732**
733** Description
734** Read (non-NDEF) contents from a Type3 tag.
735**
736** The RW_READ_EVT event is used to notify the application for each
737** segment of NDEF data received. The RW_READ_CPLT_EVT event is used to
738** notify the application all segments have been received.
739**
740** Before using this API, the application must call RW_SelectTagType to
741** indicate that a Type 3 tag has been activated, and to provide the
742** tag's Manufacture ID (IDm) .
743**
744** Returns
745** NFC_STATUS_OK: check command started
746** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
747** NFC_STATUS_FAILED: other error
748**
749*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800750extern tNFC_STATUS RW_T3tCheck(uint8_t num_blocks, tT3T_BLOCK_DESC* t3t_blocks);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800751
752/*****************************************************************************
753**
754** Function RW_T3tUpdate
755**
756** Description
757** Write (non-NDEF) contents to a Type3 tag.
758**
759** The RW_WRITE_CPLT_EVT event is used to notify the application all
760** segments have been received.
761**
762** Before using this API, the application must call RW_SelectTagType to
763** indicate that a Type 3 tag has been activated, and to provide the tag's
764** Manufacture ID (IDm) .
765**
766** Returns
767** NFC_STATUS_OK: check command started
768** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
769** NFC_STATUS_FAILED: other error
770**
771*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800772extern tNFC_STATUS RW_T3tUpdate(uint8_t num_blocks, tT3T_BLOCK_DESC* t3t_blocks,
773 uint8_t* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800774
775/*****************************************************************************
776**
777** Function RW_T3tSendRawFrame
778**
779** Description
780** This function is called to send a raw data frame to the peer device.
781** When type 3 tag receives response from peer, the callback function
782** will be called with a RW_T3T_RAW_FRAME_EVT [Table 6].
783**
784** Before using this API, the application must call RW_SelectTagType to
785** indicate that a Type 3 tag has been activated.
786**
787** The raw frame should be a properly formatted Type 3 tag message.
788**
789** Returns
790** NFC_STATUS_OK, if raw data frame sent
791** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
792** NFC_STATUS_FAILED: other error
793**
794*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800795extern tNFC_STATUS RW_T3tSendRawFrame(uint16_t len, uint8_t* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800796
797/*****************************************************************************
798**
799** Function RW_T3tPoll
800**
801** Description
802** Send POLL command
803**
804** Returns
805** NFC_STATUS_OK, if raw data frame sent
806** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
807** NFC_STATUS_FAILED: other error
808**
809*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800810extern tNFC_STATUS RW_T3tPoll(uint16_t system_code, tT3T_POLL_RC rc,
811 uint8_t tsn);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800812
813/*****************************************************************************
814**
815** Function RW_T3tPresenceCheck
816**
817** Description
818** Check if the tag is still in the field.
819**
820** The RW_T3T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
821** or non-presence.
822**
823** Returns
824** NFC_STATUS_OK, if raw data frame sent
825** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
826** NFC_STATUS_FAILED: other error
827**
828*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800829extern tNFC_STATUS RW_T3tPresenceCheck(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800830
831/*****************************************************************************
832**
833** Function RW_T3tGetSystemCodes
834**
835** Description
836** Get systems codes supported by the activated tag:
837** Poll for wildcard (FFFF):
838** - If felica-lite code then poll for ndef (12fc)
839** - Otherwise send RequestSystmCode command to get
840** system codes.
841**
842** Before using this API, the application must call RW_SelectTagType to
843** indicate that a Type 3 tag has been activated.
844**
845** Returns
846** NFC_STATUS_OK, if raw data frame sent
847** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
848** NFC_STATUS_FAILED: other error
849**
850*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800851extern tNFC_STATUS RW_T3tGetSystemCodes(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800852
Jizhou Liao94f37742015-06-03 12:31:03 -0700853/*****************************************************************************
854**
855** Function RW_T4tFormatNDef
856**
857** Description
858** Format a type-4 tag for NDEF.
859**
860** Only Desifire tags are supported by this API. The
861** RW_T4T_FORMAT_CPLT_EVT is used to notify the status of the operation.
862**
863** Returns
864** NFC_STATUS_OK: if success
865** NFC_STATUS_FAILED: other error
866*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800867extern tNFC_STATUS RW_T4tFormatNDef(void);
Jizhou Liao94f37742015-06-03 12:31:03 -0700868
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800869/*******************************************************************************
870**
871** Function RW_T4tDetectNDef
872**
873** Description This function performs NDEF detection procedure
874**
875** RW_T4T_NDEF_DETECT_EVT will be returned
876**
877** Returns NFC_STATUS_OK if success
878** NFC_STATUS_FAILED if T4T is busy or other error
879**
880*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800881extern tNFC_STATUS RW_T4tDetectNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800882
883/*******************************************************************************
884**
885** Function RW_T4tReadNDef
886**
887** Description This function performs NDEF read procedure
888** Note: RW_T4tDetectNDef() must be called before using this
889**
890** The following event will be returned
891** RW_T4T_NDEF_READ_EVT for each segmented NDEF message
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800892** RW_T4T_NDEF_READ_CPLT_EVT for the last segment or
893** complete NDEF
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800894** RW_T4T_NDEF_READ_FAIL_EVT for failure
895**
896** Returns NFC_STATUS_OK if success
897** NFC_STATUS_FAILED if T4T is busy or other error
898**
899*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800900extern tNFC_STATUS RW_T4tReadNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800901
902/*******************************************************************************
903**
904** Function RW_T4tUpdateNDef
905**
906** Description This function performs NDEF update procedure
907** Note: RW_T4tDetectNDef() must be called before using this
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800908** Updating data must not be removed until returning
909** event
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800910**
911** The following event will be returned
912** RW_T4T_NDEF_UPDATE_CPLT_EVT for complete
913** RW_T4T_NDEF_UPDATE_FAIL_EVT for failure
914**
915** Returns NFC_STATUS_OK if success
916** NFC_STATUS_FAILED if T4T is busy or other error
917**
918*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800919extern tNFC_STATUS RW_T4tUpdateNDef(uint16_t length, uint8_t* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800920
921/*****************************************************************************
922**
923** Function RW_T4tPresenceCheck
924**
925** Description
926** Check if the tag is still in the field.
927**
928** The RW_T4T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
929** or non-presence.
Ruchi Kandoi552f2b72017-01-28 16:22:55 -0800930**
931** option is RW_T4T_CHK_EMPTY_I_BLOCK, use empty I block for presence
932** check.
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800933**
934** Returns
935** NFC_STATUS_OK, if raw data frame sent
936** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
937** NFC_STATUS_FAILED: other error
938**
939*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800940extern tNFC_STATUS RW_T4tPresenceCheck(uint8_t option);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800941
Martijn Coenen5c65c3a2013-03-27 13:23:36 -0700942/*****************************************************************************
943**
944** Function RW_T4tSetNDefReadOnly
945**
946** Description This function performs NDEF read-only procedure
947** Note: RW_T4tDetectNDef() must be called before using this
948**
949** The RW_T4T_SET_TO_RO_EVT event will be returned.
950**
951** Returns NFC_STATUS_OK if success
952** NFC_STATUS_FAILED if T4T is busy or other error
953**
954*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800955extern tNFC_STATUS RW_T4tSetNDefReadOnly(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800956
957/*******************************************************************************
958**
959** Function RW_I93Inventory
960**
Martijn Coenen5c65c3a2013-03-27 13:23:36 -0700961** Description This function send Inventory command with/without AFI
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800962** If UID is provided then set UID[0]:MSB, ... UID[7]:LSB
963**
964** RW_I93_RESPONSE_EVT will be returned
965**
966** Returns NFC_STATUS_OK if success
967** NFC_STATUS_NO_BUFFERS if out of buffer
968** NFC_STATUS_FAILED if T4T is busy or other error
969**
970*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800971extern tNFC_STATUS RW_I93Inventory(bool including_afi, uint8_t afi,
972 uint8_t* p_uid);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800973
974/*******************************************************************************
975**
976** Function RW_I93StayQuiet
977**
978** Description This function send Inventory command
979**
980** RW_I93_CMD_CMPL_EVT will be returned
981**
982** Returns NFC_STATUS_OK if success
983** NFC_STATUS_NO_BUFFERS if out of buffer
984** NFC_STATUS_BUSY if busy
985** NFC_STATUS_FAILED if other error
986**
987*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -0800988extern tNFC_STATUS RW_I93StayQuiet(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800989
990/*******************************************************************************
991**
992** Function RW_I93ReadSingleBlock
993**
994** Description This function send Read Single Block command
995**
996** RW_I93_RESPONSE_EVT will be returned
997**
998** Returns NFC_STATUS_OK if success
999** NFC_STATUS_NO_BUFFERS if out of buffer
1000** NFC_STATUS_BUSY if busy
1001** NFC_STATUS_FAILED if other error
1002**
1003*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001004extern tNFC_STATUS RW_I93ReadSingleBlock(uint16_t block_number);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001005
1006/*******************************************************************************
1007**
1008** Function RW_I93WriteSingleBlock
1009**
1010** Description This function send Write Single Block command
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001011** Application must get block size first by calling
1012** RW_I93GetSysInfo().
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001013**
1014** RW_I93_CMD_CMPL_EVT will be returned
1015**
1016** Returns NFC_STATUS_OK if success
1017** NFC_STATUS_NO_BUFFERS if out of buffer
1018** NFC_STATUS_BUSY if busy
1019** NFC_STATUS_FAILED if other error
1020**
1021*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001022extern tNFC_STATUS RW_I93WriteSingleBlock(uint16_t block_number,
1023 uint8_t* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001024
1025/*******************************************************************************
1026**
1027** Function RW_I93LockBlock
1028**
1029** Description This function send Lock Block command
1030**
1031** RW_I93_CMD_CMPL_EVT will be returned
1032**
1033** Returns NFC_STATUS_OK if success
1034** NFC_STATUS_NO_BUFFERS if out of buffer
1035** NFC_STATUS_BUSY if busy
1036** NFC_STATUS_FAILED if other error
1037**
1038*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001039extern tNFC_STATUS RW_I93LockBlock(uint8_t block_number);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001040
1041/*******************************************************************************
1042**
1043** Function RW_I93ReadMultipleBlocks
1044**
1045** Description This function send Read Multiple Blocks command
1046**
1047** RW_I93_RESPONSE_EVT will be returned
1048**
1049** Returns NFC_STATUS_OK if success
1050** NFC_STATUS_NO_BUFFERS if out of buffer
1051** NFC_STATUS_BUSY if busy
1052** NFC_STATUS_FAILED if other error
1053**
1054*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001055extern tNFC_STATUS RW_I93ReadMultipleBlocks(uint16_t first_block_number,
1056 uint16_t number_blocks);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001057
1058/*******************************************************************************
1059**
1060** Function RW_I93WriteMultipleBlocks
1061**
1062** Description This function send Write Multiple Blocks command
1063**
1064** RW_I93_CMD_CMPL_EVT will be returned
1065**
1066** Returns NFC_STATUS_OK if success
1067** NFC_STATUS_NO_BUFFERS if out of buffer
1068** NFC_STATUS_BUSY if busy
1069** NFC_STATUS_FAILED if other error
1070**
1071*******************************************************************************/
Raphael Collado867d5c32017-03-27 12:49:40 +02001072extern tNFC_STATUS RW_I93WriteMultipleBlocks(uint16_t first_block_number,
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001073 uint16_t number_blocks,
1074 uint8_t* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001075
1076/*******************************************************************************
1077**
1078** Function RW_I93Select
1079**
1080** Description This function send Select command
1081**
1082** UID[0]: 0xE0, MSB
1083** UID[1]: IC Mfg Code
1084** ...
1085** UID[7]: LSB
1086**
1087** RW_I93_CMD_CMPL_EVT will be returned
1088**
1089** Returns NFC_STATUS_OK if success
1090** NFC_STATUS_NO_BUFFERS if out of buffer
1091** NFC_STATUS_BUSY if busy
1092** NFC_STATUS_FAILED if other error
1093**
1094*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001095extern tNFC_STATUS RW_I93Select(uint8_t* p_uid);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001096
1097/*******************************************************************************
1098**
1099** Function RW_I93ResetToReady
1100**
1101** Description This function send Reset To Ready command
1102**
1103** RW_I93_CMD_CMPL_EVT will be returned
1104**
1105** Returns NFC_STATUS_OK if success
1106** NFC_STATUS_NO_BUFFERS if out of buffer
1107** NFC_STATUS_BUSY if busy
1108** NFC_STATUS_FAILED if other error
1109**
1110*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001111extern tNFC_STATUS RW_I93ResetToReady(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001112
1113/*******************************************************************************
1114**
1115** Function RW_I93WriteAFI
1116**
1117** Description This function send Write AFI command
1118**
1119** RW_I93_CMD_CMPL_EVT will be returned
1120**
1121** Returns NFC_STATUS_OK if success
1122** NFC_STATUS_NO_BUFFERS if out of buffer
1123** NFC_STATUS_BUSY if busy
1124** NFC_STATUS_FAILED if other error
1125**
1126*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001127extern tNFC_STATUS RW_I93WriteAFI(uint8_t afi);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001128
1129/*******************************************************************************
1130**
1131** Function RW_I93LockAFI
1132**
1133** Description This function send Lock AFI command
1134**
1135** RW_I93_CMD_CMPL_EVT will be returned
1136**
1137** Returns NFC_STATUS_OK if success
1138** NFC_STATUS_NO_BUFFERS if out of buffer
1139** NFC_STATUS_BUSY if busy
1140** NFC_STATUS_FAILED if other error
1141**
1142*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001143extern tNFC_STATUS RW_I93LockAFI(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001144
1145/*******************************************************************************
1146**
1147** Function RW_I93WriteDSFID
1148**
1149** Description This function send Write DSFID command
1150**
1151** RW_I93_CMD_CMPL_EVT will be returned
1152**
1153** Returns NFC_STATUS_OK if success
1154** NFC_STATUS_NO_BUFFERS if out of buffer
1155** NFC_STATUS_BUSY if busy
1156** NFC_STATUS_FAILED if other error
1157**
1158*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001159extern tNFC_STATUS RW_I93WriteDSFID(uint8_t dsfid);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001160
1161/*******************************************************************************
1162**
1163** Function RW_I93LockDSFID
1164**
1165** Description This function send Lock DSFID command
1166**
1167** RW_I93_CMD_CMPL_EVT will be returned
1168**
1169** Returns NFC_STATUS_OK if success
1170** NFC_STATUS_NO_BUFFERS if out of buffer
1171** NFC_STATUS_BUSY if busy
1172** NFC_STATUS_FAILED if other error
1173**
1174*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001175extern tNFC_STATUS RW_I93LockDSFID(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001176
1177/*******************************************************************************
1178**
1179** Function RW_I93GetSysInfo
1180**
1181** Description This function send Get System Information command
1182** If UID is provided then set UID[0]:MSB, ... UID[7]:LSB
1183**
1184** RW_I93_RESPONSE_EVT will be returned
1185**
1186** Returns NFC_STATUS_OK if success
1187** NFC_STATUS_NO_BUFFERS if out of buffer
1188** NFC_STATUS_BUSY if busy
1189** NFC_STATUS_FAILED if other error
1190**
1191*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001192extern tNFC_STATUS RW_I93GetSysInfo(uint8_t* p_uid);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001193
1194/*******************************************************************************
1195**
1196** Function RW_I93GetMultiBlockSecurityStatus
1197**
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001198** Description This function send Get Multiple Block Security Status
1199** command
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001200**
1201** RW_I93_RESPONSE_EVT will be returned
1202**
1203** Returns NFC_STATUS_OK if success
1204** NFC_STATUS_NO_BUFFERS if out of buffer
1205** NFC_STATUS_BUSY if busy
1206** NFC_STATUS_FAILED if other error
1207**
1208*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001209extern tNFC_STATUS RW_I93GetMultiBlockSecurityStatus(
1210 uint16_t first_block_number, uint16_t number_blocks);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001211
1212/*******************************************************************************
1213**
1214** Function RW_I93DetectNDef
1215**
1216** Description This function performs NDEF detection procedure
1217**
1218** RW_I93_NDEF_DETECT_EVT will be returned
1219**
1220** Returns NFC_STATUS_OK if success
1221** NFC_STATUS_FAILED if busy or other error
1222**
1223*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001224extern tNFC_STATUS RW_I93DetectNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001225
1226/*******************************************************************************
1227**
1228** Function RW_I93ReadNDef
1229**
1230** Description This function performs NDEF read procedure
1231** Note: RW_I93DetectNDef() must be called before using this
1232**
1233** The following event will be returned
1234** RW_I93_NDEF_READ_EVT for each segmented NDEF message
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001235** RW_I93_NDEF_READ_CPLT_EVT for the last segment or
1236** complete NDEF
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001237** RW_I93_NDEF_READ_FAIL_EVT for failure
1238**
1239** Returns NFC_STATUS_OK if success
1240** NFC_STATUS_FAILED if I93 is busy or other error
1241**
1242*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001243extern tNFC_STATUS RW_I93ReadNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001244
1245/*******************************************************************************
1246**
1247** Function RW_I93UpdateNDef
1248**
1249** Description This function performs NDEF update procedure
1250** Note: RW_I93DetectNDef() must be called before using this
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001251** Updating data must not be removed until returning
1252** event
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001253**
1254** The following event will be returned
1255** RW_I93_NDEF_UPDATE_CPLT_EVT for complete
1256** RW_I93_NDEF_UPDATE_FAIL_EVT for failure
1257**
1258** Returns NFC_STATUS_OK if success
1259** NFC_STATUS_FAILED if I93 is busy or other error
1260**
1261*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001262extern tNFC_STATUS RW_I93UpdateNDef(uint16_t length, uint8_t* p_data);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001263
1264/*******************************************************************************
1265**
1266** Function RW_I93FormatNDef
1267**
1268** Description This function performs formatting procedure
1269**
1270** RW_I93_FORMAT_CPLT_EVT will be returned
1271**
1272** Returns NFC_STATUS_OK if success
1273** NFC_STATUS_FAILED if busy or other error
1274**
1275*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001276extern tNFC_STATUS RW_I93FormatNDef(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001277
1278/*******************************************************************************
1279**
1280** Function RW_I93SetTagReadOnly
1281**
1282** Description This function performs NDEF read-only procedure
1283** Note: RW_I93DetectNDef() must be called before using this
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001284** Updating data must not be removed until returning
1285** event
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001286**
1287** The RW_I93_SET_TAG_RO_EVT event will be returned.
1288**
1289** Returns NFC_STATUS_OK if success
1290** NFC_STATUS_FAILED if I93 is busy or other error
1291**
1292*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001293extern tNFC_STATUS RW_I93SetTagReadOnly(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001294
1295/*****************************************************************************
1296**
1297** Function RW_I93PresenceCheck
1298**
1299** Description Check if the tag is still in the field.
1300**
1301** The RW_I93_PRESENCE_CHECK_EVT w/ status is used to indicate
1302** presence or non-presence.
1303**
1304** Returns NFC_STATUS_OK, if raw data frame sent
Ruchi Kandoi552f2b72017-01-28 16:22:55 -08001305** NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this
1306** operation
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001307** NFC_STATUS_FAILED: other error
1308**
1309*****************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001310extern tNFC_STATUS RW_I93PresenceCheck(void);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001311
1312/*******************************************************************************
1313**
1314** Function RW_SendRawFrame
1315**
1316** Description This function sends a raw frame to the peer device.
1317**
1318** Returns tNFC_STATUS
1319**
1320*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001321extern tNFC_STATUS RW_SendRawFrame(uint8_t* p_raw_data, uint16_t data_len);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001322
1323/*******************************************************************************
1324**
1325** Function RW_SetActivatedTagType
1326**
1327** Description This function sets tag type for Reader/Writer mode.
1328**
1329** Returns tNFC_STATUS
1330**
1331*******************************************************************************/
Ruchi Kandoi6fca02d2017-01-30 14:28:16 -08001332extern tNFC_STATUS RW_SetActivatedTagType(tNFC_ACTIVATE_DEVT* p_activate_params,
1333 tRW_CBACK* p_cback);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001334#endif /* RW_API_H */