rw_api.h revision a24be4f06674b2707b57904deaa0dff5a95823bd
11320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci/******************************************************************************
21320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
31320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  Copyright (C) 2009-2014 Broadcom Corporation
41320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
51320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  Licensed under the Apache License, Version 2.0 (the "License");
61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  you may not use this file except in compliance with the License.
71320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  You may obtain a copy of the License at:
81320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
91320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  http://www.apache.org/licenses/LICENSE-2.0
101320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  Unless required by applicable law or agreed to in writing, software
121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  distributed under the License is distributed on an "AS IS" BASIS,
131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  See the License for the specific language governing permissions and
151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  limitations under the License.
161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci ******************************************************************************/
181320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci/******************************************************************************
211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  This file contains the Near Field Communication (NFC) Reader/Writer mode
231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *  related API function external definitions.
241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci ******************************************************************************/
261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#ifndef RW_API_H
281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define RW_API_H
291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "tags_defs.h"
301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define RW_T1T_BLD_ADD(a, k, y)   a = ((k & 0xF) << 3) | (y&0x7);
321320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define RW_T1T_BLD_ADDS(a, s)     a = ((s & 0xF) << 4);
331320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define RW_T1T_FIRST_EVT    0x20
351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define RW_T2T_FIRST_EVT    0x40
361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define RW_T3T_FIRST_EVT    0x60
371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define RW_T4T_FIRST_EVT    0x80
381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define RW_I93_FIRST_EVT    0xA0
391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccienum
411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci{
421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    /* Note: the order of these events can not be changed */
431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    /* Type 1 tag events for tRW_CBACK */
441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_RID_EVT = RW_T1T_FIRST_EVT,          /* Read ID command completd              */
451320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_RALL_CPLT_EVT,                       /* Read All command completed            */
461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_READ_CPLT_EVT,                       /* Read byte completed                   */
471320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_WRITE_E_CPLT_EVT,                    /* Write byte after erase completed      */
481320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_WRITE_NE_CPLT_EVT,                   /* Write byte with no erase completed    */
491320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_RSEG_CPLT_EVT,                       /* Read segment completed                */
501320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_READ8_CPLT_EVT,                      /* Read block completed                  */
511320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_WRITE_E8_CPLT_EVT,                   /* Write block after erase completed     */
521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_WRITE_NE8_CPLT_EVT,                  /* Write block with no erase completed   */
531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_TLV_DETECT_EVT,                      /* Lock/Mem/Prop tlv detection complete  */
541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_NDEF_DETECT_EVT,                     /* NDEF detection complete               */
551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_NDEF_READ_EVT,                       /* NDEF read completed                   */
561320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_NDEF_WRITE_EVT,                      /* NDEF write complete                   */
571320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_SET_TAG_RO_EVT,                      /* Tag is set as read only               */
581320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_RAW_FRAME_EVT,                       /* Response of raw frame sent            */
591320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_PRESENCE_CHECK_EVT,                  /* Response to RW_T1tPresenceCheck       */
601320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_FORMAT_CPLT_EVT,                     /* Tag Formated                          */
611320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_INTF_ERROR_EVT,                      /* RF Interface error event              */
621320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T1T_MAX_EVT,
631320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
641320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    /* Type 2 tag events */
651320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_READ_CPLT_EVT = RW_T2T_FIRST_EVT,    /* Read completed                        */
661320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_WRITE_CPLT_EVT,                      /* Write completed                       */
671320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_SELECT_CPLT_EVT,                     /* Sector select completed               */
681320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_NDEF_DETECT_EVT,                     /* NDEF detection complete               */
691320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_TLV_DETECT_EVT,                      /* Lock/Mem/Prop tlv detection complete  */
701320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_NDEF_READ_EVT,                       /* NDEF read completed                   */
711320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_NDEF_WRITE_EVT,                      /* NDEF write complete                   */
721320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_SET_TAG_RO_EVT,                      /* Tag is set as read only               */
731320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_RAW_FRAME_EVT,                       /* Response of raw frame sent            */
741320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_PRESENCE_CHECK_EVT,                  /* Response to RW_T2tPresenceCheck       */
751320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_FORMAT_CPLT_EVT,                     /* Tag Formated                          */
761320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_INTF_ERROR_EVT,                      /* RF Interface error event              */
771320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T2T_MAX_EVT,
781320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
791320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    /* Type 3 tag events for tRW_CBACK */
801320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_CHECK_CPLT_EVT = RW_T3T_FIRST_EVT,   /* Read completed                           */
811320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_UPDATE_CPLT_EVT,                     /* Write completed                          */
821320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_CHECK_EVT,                           /* Segment of data received from type 3 tag */
831320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_RAW_FRAME_EVT,                       /* SendRawFrame response                    */
841320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_NDEF_DETECT_EVT,                     /* NDEF detection complete                  */
851320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_PRESENCE_CHECK_EVT,                  /* Response to RW_T3tPresenceCheck          */
861320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_POLL_EVT,                            /* Response to RW_T3tPoll                   */
871320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_GET_SYSTEM_CODES_EVT,                /* Response to RW_T3tGetSystemCodes         */
881320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_FORMAT_CPLT_EVT,                     /* Tag Formated (Felica-Lite only)          */
891320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_SET_READ_ONLY_CPLT_EVT,              /* Tag is set as Read only                  */
901320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_INTF_ERROR_EVT,                      /* RF Interface error event                 */
911320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T3T_MAX_EVT,
921320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
931320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    /* Type 4 tag events for tRW_CBACK */
941320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T4T_NDEF_DETECT_EVT = RW_T4T_FIRST_EVT,  /* Result of NDEF detection procedure       */
951320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                                                /* Mandatory NDEF file is selected          */
961320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    RW_T4T_NDEF_READ_EVT,                       /* Segment of data received from type 4 tag */
971320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    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_MAX_EVT,
106
107    /* ISO 15693 tag events for tRW_CBACK */
108    RW_I93_NDEF_DETECT_EVT = RW_I93_FIRST_EVT,  /* Result of NDEF detection procedure */
109    RW_I93_NDEF_READ_EVT,                       /* Segment of data received from tag  */
110    RW_I93_NDEF_READ_CPLT_EVT,                  /* Read operation completed           */
111    RW_I93_NDEF_READ_FAIL_EVT,                  /* Read operation failed              */
112    RW_I93_NDEF_UPDATE_CPLT_EVT,                /* Update operation completed         */
113    RW_I93_NDEF_UPDATE_FAIL_EVT,                /* Update operation failed            */
114    RW_I93_FORMAT_CPLT_EVT,                     /* Format procedure complete          */
115    RW_I93_SET_TAG_RO_EVT,                      /* Set read-only procedure complete   */
116    RW_I93_INVENTORY_EVT,                       /* Response of Inventory              */
117    RW_I93_DATA_EVT,                            /* Response of Read, Get Multi Security */
118    RW_I93_SYS_INFO_EVT,                        /* Response of System Information     */
119    RW_I93_CMD_CMPL_EVT,                        /* Command complete                   */
120    RW_I93_PRESENCE_CHECK_EVT,                  /* Response to RW_I93PresenceCheck    */
121    RW_I93_RAW_FRAME_EVT,                       /* Response of raw frame sent         */
122    RW_I93_INTF_ERROR_EVT,                      /* RF Interface error event           */
123    RW_I93_MAX_EVT
124};
125
126#define RW_RAW_FRAME_EVT     0xFF
127
128typedef UINT8 tRW_EVENT;
129
130#define RW_NDEF_FL_READ_ONLY                    0x01    /* Tag is read only              */
131#define RW_NDEF_FL_FORMATED                     0x02    /* Tag formated for NDEF         */
132#define RW_NDEF_FL_SUPPORTED                    0x04    /* NDEF supported by the tag     */
133#define RW_NDEF_FL_UNKNOWN                      0x08    /* Unable to find if tag is ndef capable/formated/read only */
134#define RW_NDEF_FL_FORMATABLE                   0x10    /* Tag supports format operation */
135#define RW_NDEF_FL_SOFT_LOCKABLE                0x20    /* Tag can be soft locked */
136#define RW_NDEF_FL_HARD_LOCKABLE                0x40    /* Tag can be hard locked */
137#define RW_NDEF_FL_OTP                          0x80    /* Tag is one time programmable */
138
139typedef UINT8 tRW_NDEF_FLAG;
140
141/* options for RW_T4tPresenceCheck  */
142#define RW_T4T_CHK_READ_BINARY_CH0      0
143#define RW_T4T_CHK_READ_BINARY_CH1      1
144#define RW_T4T_CHK_READ_BINARY_CH2      2
145#define RW_T4T_CHK_READ_BINARY_CH3      3
146#define RW_T4T_CHK_EMPTY_I_BLOCK        4
147
148typedef struct
149{
150    tNFC_STATUS     status;
151    UINT8           hr[T1T_HR_LEN];
152    UINT8           uid[T1T_CMD_UID_LEN];
153} tRW_T1T_RID_EVT;
154
155typedef struct
156{
157    tNFC_STATUS     status;
158    UINT16          msg_len;            /* Length of the NDEF message */
159} tRW_T2T_DETECT;
160
161typedef struct
162{
163    tNFC_STATUS     status;             /* Status of the POLL request */
164    UINT8           rc;                 /* RC (request code) used in the POLL request */
165    UINT8           response_num;       /* Number of SENSF_RES responses */
166    UINT8           response_bufsize;   /* Size of SENSF_RES responses */
167    UINT8           *response_buf;      /* Buffer of responses (length + SENSF_RES) see $8.1.2.2 of NCI specs */
168} tRW_T3T_POLL;
169
170typedef struct
171{
172    tNFC_STATUS     status;             /* Status of the Get System Codes request */
173    UINT8           num_system_codes;   /* Number of system codes */
174    UINT16          *p_system_codes;    /* Table of system codes */
175} tRW_T3T_SYSTEM_CODES;
176
177typedef struct
178{
179    tNFC_STATUS     status;             /* status of NDEF detection */
180    tNFC_PROTOCOL   protocol;           /* protocol used to detect NDEF */
181    UINT32          max_size;           /* max number of bytes available for NDEF data */
182    UINT32          cur_size;           /* current size of stored NDEF data (in bytes) */
183    tRW_NDEF_FLAG   flags;              /* Flags to indicate NDEF capability,formated,formatable and read only */
184} tRW_DETECT_NDEF_DATA;
185
186typedef struct
187{
188    tNFC_STATUS     status;             /* status of NDEF detection */
189    tNFC_PROTOCOL   protocol;           /* protocol used to detect TLV */
190    UINT8           num_bytes;          /* number of reserved/lock bytes based on the type of tlv */
191} tRW_DETECT_TLV_DATA;
192
193typedef struct
194{
195    tNFC_STATUS     status;
196    BT_HDR         *p_data;
197} tRW_READ_DATA;
198
199typedef struct
200{
201    tNFC_STATUS     status;
202    UINT8           sw1;
203    UINT8           sw2;
204} tRW_T4T_SW;
205
206typedef struct                              /* RW_I93_INVENTORY_EVT        */
207{
208    tNFC_STATUS     status;                 /* status of Inventory command */
209    UINT8           dsfid;                  /* DSFID                       */
210    UINT8           uid[I93_UID_BYTE_LEN];  /* UID[0]:MSB, ... UID[7]:LSB  */
211} tRW_I93_INVENTORY;
212
213typedef struct                              /* RW_I93_DATA_EVT               */
214{
215    tNFC_STATUS     status;                 /* status of Read/Get security status command */
216    UINT8           command;                /* sent command                  */
217    BT_HDR         *p_data;                 /* block data of security status */
218} tRW_I93_DATA;
219
220typedef struct                              /* RW_I93_SYS_INFO_EVT             */
221{
222    tNFC_STATUS     status;                 /* status of Get Sys Info command  */
223    UINT8           info_flags;             /* information flags               */
224    UINT8           uid[I93_UID_BYTE_LEN];  /* UID[0]:MSB, ... UID[7]:LSB      */
225    UINT8           dsfid;                  /* DSFID if I93_INFO_FLAG_DSFID    */
226    UINT8           afi;                    /* AFI if I93_INFO_FLAG_AFI        */
227    UINT16          num_block;              /* number of blocks if I93_INFO_FLAG_MEM_SIZE   */
228    UINT8           block_size;             /* block size in byte if I93_INFO_FLAG_MEM_SIZE */
229    UINT8           IC_reference;           /* IC Reference if I93_INFO_FLAG_IC_REF         */
230} tRW_I93_SYS_INFO;
231
232typedef struct                              /* RW_I93_CMD_CMPL_EVT             */
233{
234    tNFC_STATUS     status;                 /* status of sent command          */
235    UINT8           command;                /* sent command                    */
236    UINT8           error_code;             /* error code; I93_ERROR_CODE_XXX  */
237} tRW_I93_CMD_CMPL;
238
239typedef struct
240{
241    tNFC_STATUS     status;
242    BT_HDR         *p_data;
243} tRW_RAW_FRAME;
244
245typedef union
246{
247    tNFC_STATUS             status;
248    tRW_T3T_POLL            t3t_poll;   /* Response to t3t poll command          */
249    tRW_T3T_SYSTEM_CODES    t3t_sc;     /* Received system codes from t3 tag     */
250    tRW_DETECT_TLV_DATA     tlv;        /* The information of detected TLV data  */
251    tRW_DETECT_NDEF_DATA    ndef;       /* The information of detected NDEF data */
252    tRW_READ_DATA           data;       /* The received data from a tag          */
253    tRW_RAW_FRAME           raw_frame;  /* Response of raw frame sent            */
254    tRW_T4T_SW              t4t_sw;     /* Received status words from a tag      */
255    tRW_I93_INVENTORY       i93_inventory;  /* ISO 15693 Inventory response      */
256    tRW_I93_DATA            i93_data;       /* ISO 15693 Data response           */
257    tRW_I93_SYS_INFO        i93_sys_info;   /* ISO 15693 System Information      */
258    tRW_I93_CMD_CMPL        i93_cmd_cmpl;   /* ISO 15693 Command complete        */
259} tRW_DATA;
260
261
262typedef void (tRW_CBACK) (tRW_EVENT event, tRW_DATA *p_data);
263
264/*******************************************************************************
265**
266** Function         RW_T1tRid
267**
268** Description      This function send a RID command for Reader/Writer mode.
269**
270** Returns          tNFC_STATUS
271**
272*******************************************************************************/
273NFC_API extern tNFC_STATUS RW_T1tRid (void);
274
275/*******************************************************************************
276**
277** Function         RW_T1tReadAll
278**
279** Description      This function send a RALL command for Reader/Writer mode.
280**
281** Returns          tNFC_STATUS
282**
283*******************************************************************************/
284NFC_API extern tNFC_STATUS RW_T1tReadAll (void);
285
286/*******************************************************************************
287**
288** Function         RW_T1tRead
289**
290** Description      This function send a READ command for Reader/Writer mode.
291**
292** Returns          tNFC_STATUS
293**
294*******************************************************************************/
295NFC_API extern tNFC_STATUS RW_T1tRead (UINT8 block, UINT8 byte);
296
297/*******************************************************************************
298**
299** Function         RW_T1tWriteErase
300**
301** Description      This function send a WRITE-E command for Reader/Writer mode.
302**
303** Returns          tNFC_STATUS
304**
305*******************************************************************************/
306NFC_API extern tNFC_STATUS RW_T1tWriteErase (UINT8 block, UINT8 byte, UINT8 new_byte);
307
308/*******************************************************************************
309**
310** Function         RW_T1tWriteNoErase
311**
312** Description      This function send a WRITE-NE command for Reader/Writer mode.
313**
314** Returns          tNFC_STATUS
315**
316*******************************************************************************/
317NFC_API extern tNFC_STATUS RW_T1tWriteNoErase (UINT8 block, UINT8 byte, UINT8 new_byte);
318
319/*******************************************************************************
320**
321** Function         RW_T1tReadSeg
322**
323** Description      This function send a RSEG command for Reader/Writer mode.
324**
325** Returns          tNFC_STATUS
326**
327*******************************************************************************/
328NFC_API extern tNFC_STATUS RW_T1tReadSeg (UINT8 segment);
329
330/*******************************************************************************
331**
332** Function         RW_T1tRead8
333**
334** Description      This function send a READ8 command for Reader/Writer mode.
335**
336** Returns          tNFC_STATUS
337**
338*******************************************************************************/
339NFC_API extern tNFC_STATUS RW_T1tRead8 (UINT8 block);
340
341/*******************************************************************************
342**
343** Function         RW_T1tWriteErase8
344**
345** Description      This function send a WRITE-E8 command for Reader/Writer mode.
346**
347** Returns          tNFC_STATUS
348**
349*******************************************************************************/
350NFC_API extern tNFC_STATUS RW_T1tWriteErase8 (UINT8 block, UINT8 *p_new_dat);
351
352/*******************************************************************************
353**
354** Function         RW_T1tWriteNoErase8
355**
356** Description      This function send a WRITE-NE8 command for Reader/Writer mode.
357**
358** Returns          tNFC_STATUS
359**
360*******************************************************************************/
361NFC_API extern tNFC_STATUS RW_T1tWriteNoErase8 (UINT8 block, UINT8 *p_new_dat);
362
363/*******************************************************************************
364**
365** Function         RW_T1tLocateTlv
366**
367** Description      This function is called to find the start of the given TLV
368**
369** Parameters:      void
370**
371** Returns          NCI_STATUS_OK, if detection was started. Otherwise, error status.
372**
373*******************************************************************************/
374NFC_API extern tNFC_STATUS RW_T1tLocateTlv (UINT8 tlv_type);
375
376/*******************************************************************************
377**
378** Function         RW_T1tDetectNDef
379**
380** Description      This function can be called to detect if there is an NDEF
381**                  message on the tag.
382**
383** Parameters:      void
384**
385** Returns          NCI_STATUS_OK, if detection was started. Otherwise, error status.
386**
387*******************************************************************************/
388NFC_API extern tNFC_STATUS RW_T1tDetectNDef (void);
389
390/*******************************************************************************
391**
392** Function         RW_T1tReadNDef
393**
394** Description      This function can be called to read the NDEF message on the tag.
395**
396** Parameters:      p_buffer:   The buffer into which to read the NDEF message
397**                  buf_len:    The length of the buffer
398**
399** Returns          NCI_STATUS_OK, if read was started. Otherwise, error status.
400**
401*******************************************************************************/
402NFC_API extern tNFC_STATUS RW_T1tReadNDef (UINT8 *p_buffer, UINT16 buf_len);
403
404/*******************************************************************************
405**
406** Function         RW_T1tWriteNDef
407**
408** Description      This function can be called to write an NDEF message to the tag.
409**
410** Parameters:      msg_len:    The length of the buffer
411**                  p_msg:      The NDEF message to write
412**
413** Returns          NCI_STATUS_OK, if write was started. Otherwise, error status.
414**
415*******************************************************************************/
416NFC_API extern tNFC_STATUS RW_T1tWriteNDef (UINT16 msg_len, UINT8 *p_msg);
417
418/*******************************************************************************
419**
420** Function         RW_T1tSetTagReadOnly
421**
422** Description      This function can be called to set the tag in to read only
423**                  state
424**
425** Parameters:      b_hard_lock: To hard lock or just soft lock the tag
426**
427** Returns          NCI_STATUS_OK, if set readonly operation started.
428**                                 Otherwise, error status.
429**
430*******************************************************************************/
431NFC_API extern tNFC_STATUS RW_T1tSetTagReadOnly (BOOLEAN b_hard_lock);
432
433/*****************************************************************************
434**
435** Function         RW_T1tPresenceCheck
436**
437** Description
438**      Check if the tag is still in the field.
439**
440**      The RW_T1T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
441**      or non-presence.
442**
443** Returns
444**      NFC_STATUS_OK, if raw data frame sent
445**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
446**      NFC_STATUS_FAILED: other error
447**
448*****************************************************************************/
449NFC_API extern tNFC_STATUS RW_T1tPresenceCheck (void);
450
451/*****************************************************************************
452**
453** Function         RW_T1tFormatNDef
454**
455** Description
456**      Format Tag content
457**
458** Returns
459**      NFC_STATUS_OK, Command sent to format Tag
460**      NFC_STATUS_REJECTED: Invalid HR0 and cannot format the tag
461**      NFC_STATUS_FAILED: other error
462**
463*****************************************************************************/
464tNFC_STATUS RW_T1tFormatNDef (void);
465
466/*******************************************************************************
467**
468** Function         RW_T2tLocateTlv
469**
470** Description      This function is called to find the start of the given TLV
471**
472** Returns          Pointer to the TLV, if successful. Otherwise, NULL.
473**
474*******************************************************************************/
475NFC_API extern tNFC_STATUS RW_T2tLocateTlv(UINT8 tlv_type);
476
477/*******************************************************************************
478**
479** Function         RW_T2tRead
480**
481** Description      This function issues the Type 2 Tag READ command. When the
482**                  operation is complete the callback function will be called
483**                  with a RW_T2T_READ_EVT.
484**
485** Returns          tNFC_STATUS
486**
487*******************************************************************************/
488NFC_API extern tNFC_STATUS RW_T2tRead (UINT16 block);
489
490/*******************************************************************************
491**
492** Function         RW_T2tWrite
493**
494** Description      This function issues the Type 2 Tag WRITE command. When the
495**                  operation is complete the callback function will be called
496**                  with a RW_T2T_WRITE_EVT.
497**
498**                  p_write_data points to the array of 4 bytes to be written
499**
500** Returns          tNFC_STATUS
501**
502*******************************************************************************/
503NFC_API extern tNFC_STATUS RW_T2tWrite (UINT16 block, UINT8 *p_write_data);
504
505/*******************************************************************************
506**
507** Function         RW_T2tSectorSelect
508**
509** Description      This function issues the Type 2 Tag SECTOR-SELECT command
510**                  packet 1. If a NACK is received as the response, the callback
511**                  function will be called with a RW_T2T_SECTOR_SELECT_EVT. If
512**                  an ACK is received as the response, the command packet 2 with
513**                  the given sector number is sent to the peer device. When the
514**                  response for packet 2 is received, the callback function will
515**                  be called with a RW_T2T_SECTOR_SELECT_EVT.
516**
517**                  A sector is 256 contiguous blocks (1024 bytes).
518**
519** Returns          tNFC_STATUS
520**
521*******************************************************************************/
522NFC_API extern tNFC_STATUS RW_T2tSectorSelect (UINT8 sector);
523
524/*******************************************************************************
525**
526** Function         RW_T2tDetectNDef
527**
528** Description      This function will find NDEF message if any in the Tag
529**
530** Returns          tNFC_STATUS
531**
532*******************************************************************************/
533NFC_API extern tNFC_STATUS RW_T2tDetectNDef (BOOLEAN skip_dyn_locks);
534
535/*******************************************************************************
536**
537** Function         RW_T2tReadNDef
538**
539** Description      This function can be called to read the NDEF message on the tag.
540**
541** Parameters:      p_buffer:   The buffer into which to read the NDEF message
542**                  buf_len:    The length of the buffer
543**
544** Returns          NCI_STATUS_OK, if read was started. Otherwise, error status.
545**
546*******************************************************************************/
547NFC_API extern tNFC_STATUS RW_T2tReadNDef (UINT8 *p_buffer, UINT16 buf_len);
548
549/*******************************************************************************
550**
551** Function         RW_T2tWriteNDef
552**
553** Description      This function can be called to write an NDEF message to the tag.
554**
555** Parameters:      msg_len:    The length of the buffer
556**                  p_msg:      The NDEF message to write
557**
558** Returns          NCI_STATUS_OK, if write was started. Otherwise, error status.
559**
560*******************************************************************************/
561NFC_API extern tNFC_STATUS RW_T2tWriteNDef (UINT16 msg_len, UINT8 *p_msg );
562
563/*******************************************************************************
564**
565** Function         RW_T2tSetTagReadOnly
566**
567** Description      This function can be called to set the tag in to read only
568**                  state
569**
570** Parameters:      b_hard_lock:   To indicate hard lock the tag or not
571**
572** Returns          NCI_STATUS_OK, if set readonly operation started.
573**                                 Otherwise, error status.
574**
575*******************************************************************************/
576NFC_API extern tNFC_STATUS RW_T2tSetTagReadOnly (BOOLEAN b_hard_lock);
577
578/*****************************************************************************
579**
580** Function         RW_T2tPresenceCheck
581**
582** Description
583**      Check if the tag is still in the field.
584**
585**      The RW_T2T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
586**      or non-presence.
587**
588** Returns
589**      NFC_STATUS_OK, if raw data frame sent
590**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
591**      NFC_STATUS_FAILED: other error
592**
593*****************************************************************************/
594NFC_API extern tNFC_STATUS RW_T2tPresenceCheck (void);
595
596/*****************************************************************************
597**
598** Function         RW_T2tFormatNDef
599**
600** Description
601**      Format Tag content
602**
603** Returns
604**      NFC_STATUS_OK, Command sent to format Tag
605**      NFC_STATUS_FAILED: otherwise
606**
607*****************************************************************************/
608tNFC_STATUS RW_T2tFormatNDef (void);
609
610/*****************************************************************************
611**
612** Function         RW_T3tDetectNDef
613**
614** Description
615**      This function is used to perform NDEF detection on a Type 3 tag, and
616**      retrieve the tag's NDEF attribute information (block 0).
617**
618**      Before using this API, the application must call RW_SelectTagType to
619**      indicate that a Type 3 tag has been activated, and to provide the
620**      tag's Manufacture ID (IDm) .
621**
622** Returns
623**      NFC_STATUS_OK: ndef detection procedure started
624**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
625**      NFC_STATUS_FAILED: other error
626**
627*****************************************************************************/
628NFC_API extern tNFC_STATUS RW_T3tDetectNDef (void);
629
630/*****************************************************************************
631**
632** Function         RW_T3tFormatNDef
633**
634** Description
635**      Format a type-3 tag for NDEF.
636**
637**      Only Felica-Lite tags are supported by this API. The
638**      RW_T3T_FORMAT_CPLT_EVT is used to notify the status of the operation.
639**
640** Returns
641**      NFC_STATUS_OK: ndef detection procedure started
642**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
643**      NFC_STATUS_FAILED: other error
644**
645*****************************************************************************/
646NFC_API extern tNFC_STATUS RW_T3tFormatNDef (void);
647
648/*****************************************************************************
649**
650** Function         RW_T3tSetReadOnly
651**
652** Description
653**      Set a type-3 tag to Read Only
654**
655**      Only Felica-Lite tags are supported by this API.
656**      RW_T3tDetectNDef() must be called before using this
657**      The RW_T3T_SET_READ_ONLY_CPLT_EVT event will be returned.
658**
659** Returns
660**      NFC_STATUS_OK if success
661**      NFC_STATUS_FAILED if T3T is busy or other error
662**
663*****************************************************************************/
664NFC_API extern tNFC_STATUS RW_T3tSetReadOnly (BOOLEAN b_hard_lock);
665
666/*****************************************************************************
667**
668** Function         RW_T3tCheckNDef
669**
670** Description
671**      Retrieve NDEF contents from a Type3 tag.
672**
673**      The RW_T3T_CHECK_EVT event is used to notify the application for each
674**      segment of NDEF data received. The RW_T3T_CHECK_CPLT_EVT event is used to
675**      notify the application all segments have been received.
676**
677**      Before using this API, the RW_T3tDetectNDef function must be called to
678**      verify that the tag contains NDEF data, and to retrieve the NDEF
679**      attributes.
680**
681**      Internally, this command will be separated into multiple Tag 3 Check
682**      commands (if necessary) - depending on the tag's Nbr (max number of
683**      blocks per read) attribute.
684**
685** Returns
686**      NFC_STATUS_OK: check command started
687**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
688**      NFC_STATUS_FAILED: other error
689**
690*****************************************************************************/
691NFC_API extern tNFC_STATUS RW_T3tCheckNDef (void);
692
693/*****************************************************************************
694**
695** Function         RW_T3tUpdateNDef
696**
697** Description
698**      Write NDEF contents to a Type3 tag.
699**
700**      The RW_T3T_UPDATE_CPLT_EVT callback event will be used to notify the
701**      application of the response.
702**
703**      Before using this API, the RW_T3tDetectNDef function must be called to
704**      verify that the tag contains NDEF data, and to retrieve the NDEF
705**      attributes.
706**
707**      Internally, this command will be separated into multiple Tag 3 Update
708**      commands (if necessary) - depending on the tag's Nbw (max number of
709**      blocks per write) attribute.
710**
711** Returns
712**      NFC_STATUS_OK: check command started
713**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
714**      NFC_STATUS_REFUSED: tag is read-only
715**      NFC_STATUS_BUFFER_FULL: len exceeds tag's maximum size
716**      NFC_STATUS_FAILED: other error
717**
718*****************************************************************************/
719NFC_API extern tNFC_STATUS RW_T3tUpdateNDef (UINT32 len, UINT8 *p_data);
720
721/*****************************************************************************
722**
723** Function         RW_T3tCheck
724**
725** Description
726**      Read (non-NDEF) contents from a Type3 tag.
727**
728**      The RW_READ_EVT event is used to notify the application for each
729**      segment of NDEF data received. The RW_READ_CPLT_EVT event is used to
730**      notify the application all segments have been received.
731**
732**      Before using this API, the application must call RW_SelectTagType to
733**      indicate that a Type 3 tag has been activated, and to provide the
734**      tag's Manufacture ID (IDm) .
735**
736** Returns
737**      NFC_STATUS_OK: check command started
738**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
739**      NFC_STATUS_FAILED: other error
740**
741*****************************************************************************/
742NFC_API extern tNFC_STATUS RW_T3tCheck (UINT8 num_blocks, tT3T_BLOCK_DESC *t3t_blocks);
743
744/*****************************************************************************
745**
746** Function         RW_T3tUpdate
747**
748** Description
749**      Write (non-NDEF) contents to a Type3 tag.
750**
751**      The RW_WRITE_CPLT_EVT event is used to notify the application all
752**      segments have been received.
753**
754**      Before using this API, the application must call RW_SelectTagType to
755**      indicate that a Type 3 tag has been activated, and to provide the tag's
756**      Manufacture ID (IDm) .
757**
758** Returns
759**      NFC_STATUS_OK: check command started
760**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
761**      NFC_STATUS_FAILED: other error
762**
763*****************************************************************************/
764NFC_API extern tNFC_STATUS RW_T3tUpdate (UINT8 num_blocks, tT3T_BLOCK_DESC *t3t_blocks, UINT8 *p_data);
765
766/*****************************************************************************
767**
768** Function         RW_T3tSendRawFrame
769**
770** Description
771**      This function is called to send a raw data frame to the peer device.
772**      When type 3 tag receives response from peer, the callback function
773**      will be called with a RW_T3T_RAW_FRAME_EVT [Table 6].
774**
775**      Before using this API, the application must call RW_SelectTagType to
776**      indicate that a Type 3 tag has been activated.
777**
778**      The raw frame should be a properly formatted Type 3 tag message.
779**
780** Returns
781**      NFC_STATUS_OK, if raw data frame sent
782**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
783**      NFC_STATUS_FAILED: other error
784**
785*****************************************************************************/
786NFC_API extern tNFC_STATUS RW_T3tSendRawFrame (UINT16 len, UINT8 *p_data);
787
788/*****************************************************************************
789**
790** Function         RW_T3tPoll
791**
792** Description
793**      Send POLL command
794**
795** Returns
796**      NFC_STATUS_OK, if raw data frame sent
797**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
798**      NFC_STATUS_FAILED: other error
799**
800*****************************************************************************/
801NFC_API extern tNFC_STATUS RW_T3tPoll (UINT16 system_code, tT3T_POLL_RC rc, UINT8 tsn);
802
803/*****************************************************************************
804**
805** Function         RW_T3tPresenceCheck
806**
807** Description
808**      Check if the tag is still in the field.
809**
810**      The RW_T3T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
811**      or non-presence.
812**
813** Returns
814**      NFC_STATUS_OK, if raw data frame sent
815**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
816**      NFC_STATUS_FAILED: other error
817**
818*****************************************************************************/
819NFC_API extern tNFC_STATUS RW_T3tPresenceCheck (void);
820
821/*****************************************************************************
822**
823** Function         RW_T3tGetSystemCodes
824**
825** Description
826**      Get systems codes supported by the activated tag:
827**              Poll for wildcard (FFFF):
828**                  - If felica-lite code then poll for ndef (12fc)
829**                  - Otherwise send RequestSystmCode command to get
830**                    system codes.
831**
832**      Before using this API, the application must call RW_SelectTagType to
833**      indicate that a Type 3 tag has been activated.
834**
835** Returns
836**      NFC_STATUS_OK, if raw data frame sent
837**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
838**      NFC_STATUS_FAILED: other error
839**
840*****************************************************************************/
841NFC_API extern tNFC_STATUS RW_T3tGetSystemCodes (void);
842
843/*******************************************************************************
844**
845** Function         RW_T4tDetectNDef
846**
847** Description      This function performs NDEF detection procedure
848**
849**                  RW_T4T_NDEF_DETECT_EVT will be returned
850**
851** Returns          NFC_STATUS_OK if success
852**                  NFC_STATUS_FAILED if T4T is busy or other error
853**
854*******************************************************************************/
855NFC_API extern tNFC_STATUS RW_T4tDetectNDef (void);
856
857/*******************************************************************************
858**
859** Function         RW_T4tReadNDef
860**
861** Description      This function performs NDEF read procedure
862**                  Note: RW_T4tDetectNDef() must be called before using this
863**
864**                  The following event will be returned
865**                      RW_T4T_NDEF_READ_EVT for each segmented NDEF message
866**                      RW_T4T_NDEF_READ_CPLT_EVT for the last segment or complete NDEF
867**                      RW_T4T_NDEF_READ_FAIL_EVT for failure
868**
869** Returns          NFC_STATUS_OK if success
870**                  NFC_STATUS_FAILED if T4T is busy or other error
871**
872*******************************************************************************/
873NFC_API extern tNFC_STATUS RW_T4tReadNDef (void);
874
875/*******************************************************************************
876**
877** Function         RW_T4tUpdateNDef
878**
879** Description      This function performs NDEF update procedure
880**                  Note: RW_T4tDetectNDef() must be called before using this
881**                        Updating data must not be removed until returning event
882**
883**                  The following event will be returned
884**                      RW_T4T_NDEF_UPDATE_CPLT_EVT for complete
885**                      RW_T4T_NDEF_UPDATE_FAIL_EVT for failure
886**
887** Returns          NFC_STATUS_OK if success
888**                  NFC_STATUS_FAILED if T4T is busy or other error
889**
890*******************************************************************************/
891NFC_API extern tNFC_STATUS RW_T4tUpdateNDef (UINT16 length, UINT8 *p_data);
892
893/*****************************************************************************
894**
895** Function         RW_T4tPresenceCheck
896**
897** Description
898**      Check if the tag is still in the field.
899**
900**      The RW_T4T_PRESENCE_CHECK_EVT w/ status is used to indicate presence
901**      or non-presence.
902**      option is RW_T4T_CHK_EMPTY_I_BLOCK, use empty I block for presence check.
903**
904** Returns
905**      NFC_STATUS_OK, if raw data frame sent
906**      NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
907**      NFC_STATUS_FAILED: other error
908**
909*****************************************************************************/
910NFC_API extern tNFC_STATUS RW_T4tPresenceCheck (UINT8 option);
911
912/*****************************************************************************
913**
914** Function         RW_T4tSetNDefReadOnly
915**
916** Description      This function performs NDEF read-only procedure
917**                  Note: RW_T4tDetectNDef() must be called before using this
918**
919**                  The RW_T4T_SET_TO_RO_EVT event will be returned.
920**
921** Returns          NFC_STATUS_OK if success
922**                  NFC_STATUS_FAILED if T4T is busy or other error
923**
924*****************************************************************************/
925NFC_API extern tNFC_STATUS RW_T4tSetNDefReadOnly (void);
926
927/*******************************************************************************
928**
929** Function         RW_I93Inventory
930**
931** Description      This function send Inventory command with/without AFI
932**                  If UID is provided then set UID[0]:MSB, ... UID[7]:LSB
933**
934**                  RW_I93_RESPONSE_EVT will be returned
935**
936** Returns          NFC_STATUS_OK if success
937**                  NFC_STATUS_NO_BUFFERS if out of buffer
938**                  NFC_STATUS_FAILED if T4T is busy or other error
939**
940*******************************************************************************/
941NFC_API extern tNFC_STATUS RW_I93Inventory (BOOLEAN including_afi, UINT8 afi, UINT8 *p_uid);
942
943/*******************************************************************************
944**
945** Function         RW_I93StayQuiet
946**
947** Description      This function send Inventory command
948**
949**                  RW_I93_CMD_CMPL_EVT will be returned
950**
951** Returns          NFC_STATUS_OK if success
952**                  NFC_STATUS_NO_BUFFERS if out of buffer
953**                  NFC_STATUS_BUSY if busy
954**                  NFC_STATUS_FAILED if other error
955**
956*******************************************************************************/
957NFC_API extern tNFC_STATUS RW_I93StayQuiet (void);
958
959/*******************************************************************************
960**
961** Function         RW_I93ReadSingleBlock
962**
963** Description      This function send Read Single Block command
964**
965**                  RW_I93_RESPONSE_EVT will be returned
966**
967** Returns          NFC_STATUS_OK if success
968**                  NFC_STATUS_NO_BUFFERS if out of buffer
969**                  NFC_STATUS_BUSY if busy
970**                  NFC_STATUS_FAILED if other error
971**
972*******************************************************************************/
973NFC_API extern tNFC_STATUS RW_I93ReadSingleBlock (UINT16 block_number);
974
975/*******************************************************************************
976**
977** Function         RW_I93WriteSingleBlock
978**
979** Description      This function send Write Single Block command
980**                  Application must get block size first by calling RW_I93GetSysInfo().
981**
982**                  RW_I93_CMD_CMPL_EVT will be returned
983**
984** Returns          NFC_STATUS_OK if success
985**                  NFC_STATUS_NO_BUFFERS if out of buffer
986**                  NFC_STATUS_BUSY if busy
987**                  NFC_STATUS_FAILED if other error
988**
989*******************************************************************************/
990NFC_API extern tNFC_STATUS RW_I93WriteSingleBlock (UINT16 block_number,
991                                                   UINT8  *p_data);
992
993/*******************************************************************************
994**
995** Function         RW_I93LockBlock
996**
997** Description      This function send Lock Block command
998**
999**                  RW_I93_CMD_CMPL_EVT will be returned
1000**
1001** Returns          NFC_STATUS_OK if success
1002**                  NFC_STATUS_NO_BUFFERS if out of buffer
1003**                  NFC_STATUS_BUSY if busy
1004**                  NFC_STATUS_FAILED if other error
1005**
1006*******************************************************************************/
1007NFC_API extern tNFC_STATUS RW_I93LockBlock (UINT8 block_number);
1008
1009/*******************************************************************************
1010**
1011** Function         RW_I93ReadMultipleBlocks
1012**
1013** Description      This function send Read Multiple Blocks command
1014**
1015**                  RW_I93_RESPONSE_EVT will be returned
1016**
1017** Returns          NFC_STATUS_OK if success
1018**                  NFC_STATUS_NO_BUFFERS if out of buffer
1019**                  NFC_STATUS_BUSY if busy
1020**                  NFC_STATUS_FAILED if other error
1021**
1022*******************************************************************************/
1023NFC_API extern tNFC_STATUS RW_I93ReadMultipleBlocks (UINT16 first_block_number,
1024                                                     UINT16 number_blocks);
1025
1026/*******************************************************************************
1027**
1028** Function         RW_I93WriteMultipleBlocks
1029**
1030** Description      This function send Write Multiple Blocks command
1031**
1032**                  RW_I93_CMD_CMPL_EVT will be returned
1033**
1034** Returns          NFC_STATUS_OK if success
1035**                  NFC_STATUS_NO_BUFFERS if out of buffer
1036**                  NFC_STATUS_BUSY if busy
1037**                  NFC_STATUS_FAILED if other error
1038**
1039*******************************************************************************/
1040NFC_API extern tNFC_STATUS RW_I93WriteMultipleBlocks (UINT8  first_block_number,
1041                                                      UINT16 number_blocks,
1042                                                      UINT8 *p_data);
1043
1044/*******************************************************************************
1045**
1046** Function         RW_I93Select
1047**
1048** Description      This function send Select command
1049**
1050**                  UID[0]: 0xE0, MSB
1051**                  UID[1]: IC Mfg Code
1052**                  ...
1053**                  UID[7]: LSB
1054**
1055**                  RW_I93_CMD_CMPL_EVT will be returned
1056**
1057** Returns          NFC_STATUS_OK if success
1058**                  NFC_STATUS_NO_BUFFERS if out of buffer
1059**                  NFC_STATUS_BUSY if busy
1060**                  NFC_STATUS_FAILED if other error
1061**
1062*******************************************************************************/
1063NFC_API extern tNFC_STATUS RW_I93Select (UINT8 *p_uid);
1064
1065/*******************************************************************************
1066**
1067** Function         RW_I93ResetToReady
1068**
1069** Description      This function send Reset To Ready command
1070**
1071**                  RW_I93_CMD_CMPL_EVT will be returned
1072**
1073** Returns          NFC_STATUS_OK if success
1074**                  NFC_STATUS_NO_BUFFERS if out of buffer
1075**                  NFC_STATUS_BUSY if busy
1076**                  NFC_STATUS_FAILED if other error
1077**
1078*******************************************************************************/
1079NFC_API extern tNFC_STATUS RW_I93ResetToReady (void);
1080
1081/*******************************************************************************
1082**
1083** Function         RW_I93WriteAFI
1084**
1085** Description      This function send Write AFI command
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*******************************************************************************/
1095NFC_API extern tNFC_STATUS RW_I93WriteAFI (UINT8 afi);
1096
1097/*******************************************************************************
1098**
1099** Function         RW_I93LockAFI
1100**
1101** Description      This function send Lock AFI 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*******************************************************************************/
1111NFC_API extern tNFC_STATUS RW_I93LockAFI (void);
1112
1113/*******************************************************************************
1114**
1115** Function         RW_I93WriteDSFID
1116**
1117** Description      This function send Write DSFID 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*******************************************************************************/
1127NFC_API extern tNFC_STATUS RW_I93WriteDSFID (UINT8 dsfid);
1128
1129/*******************************************************************************
1130**
1131** Function         RW_I93LockDSFID
1132**
1133** Description      This function send Lock DSFID 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*******************************************************************************/
1143NFC_API extern tNFC_STATUS RW_I93LockDSFID (void);
1144
1145/*******************************************************************************
1146**
1147** Function         RW_I93GetSysInfo
1148**
1149** Description      This function send Get System Information command
1150**                  If UID is provided then set UID[0]:MSB, ... UID[7]:LSB
1151**
1152**                  RW_I93_RESPONSE_EVT will be returned
1153**
1154** Returns          NFC_STATUS_OK if success
1155**                  NFC_STATUS_NO_BUFFERS if out of buffer
1156**                  NFC_STATUS_BUSY if busy
1157**                  NFC_STATUS_FAILED if other error
1158**
1159*******************************************************************************/
1160NFC_API extern tNFC_STATUS RW_I93GetSysInfo (UINT8 *p_uid);
1161
1162/*******************************************************************************
1163**
1164** Function         RW_I93GetMultiBlockSecurityStatus
1165**
1166** Description      This function send Get Multiple Block Security Status command
1167**
1168**                  RW_I93_RESPONSE_EVT will be returned
1169**
1170** Returns          NFC_STATUS_OK if success
1171**                  NFC_STATUS_NO_BUFFERS if out of buffer
1172**                  NFC_STATUS_BUSY if busy
1173**                  NFC_STATUS_FAILED if other error
1174**
1175*******************************************************************************/
1176NFC_API extern tNFC_STATUS RW_I93GetMultiBlockSecurityStatus (UINT16 first_block_number,
1177                                                              UINT16 number_blocks);
1178
1179/*******************************************************************************
1180**
1181** Function         RW_I93DetectNDef
1182**
1183** Description      This function performs NDEF detection procedure
1184**
1185**                  RW_I93_NDEF_DETECT_EVT will be returned
1186**
1187** Returns          NFC_STATUS_OK if success
1188**                  NFC_STATUS_FAILED if busy or other error
1189**
1190*******************************************************************************/
1191NFC_API extern tNFC_STATUS RW_I93DetectNDef (void);
1192
1193/*******************************************************************************
1194**
1195** Function         RW_I93ReadNDef
1196**
1197** Description      This function performs NDEF read procedure
1198**                  Note: RW_I93DetectNDef() must be called before using this
1199**
1200**                  The following event will be returned
1201**                      RW_I93_NDEF_READ_EVT for each segmented NDEF message
1202**                      RW_I93_NDEF_READ_CPLT_EVT for the last segment or complete NDEF
1203**                      RW_I93_NDEF_READ_FAIL_EVT for failure
1204**
1205** Returns          NFC_STATUS_OK if success
1206**                  NFC_STATUS_FAILED if I93 is busy or other error
1207**
1208*******************************************************************************/
1209NFC_API extern tNFC_STATUS RW_I93ReadNDef (void);
1210
1211/*******************************************************************************
1212**
1213** Function         RW_I93UpdateNDef
1214**
1215** Description      This function performs NDEF update procedure
1216**                  Note: RW_I93DetectNDef() must be called before using this
1217**                        Updating data must not be removed until returning event
1218**
1219**                  The following event will be returned
1220**                      RW_I93_NDEF_UPDATE_CPLT_EVT for complete
1221**                      RW_I93_NDEF_UPDATE_FAIL_EVT for failure
1222**
1223** Returns          NFC_STATUS_OK if success
1224**                  NFC_STATUS_FAILED if I93 is busy or other error
1225**
1226*******************************************************************************/
1227NFC_API extern tNFC_STATUS RW_I93UpdateNDef (UINT16 length, UINT8 *p_data);
1228
1229/*******************************************************************************
1230**
1231** Function         RW_I93FormatNDef
1232**
1233** Description      This function performs formatting procedure
1234**
1235**                  RW_I93_FORMAT_CPLT_EVT will be returned
1236**
1237** Returns          NFC_STATUS_OK if success
1238**                  NFC_STATUS_FAILED if busy or other error
1239**
1240*******************************************************************************/
1241NFC_API extern tNFC_STATUS RW_I93FormatNDef (void);
1242
1243/*******************************************************************************
1244**
1245** Function         RW_I93SetTagReadOnly
1246**
1247** Description      This function performs NDEF read-only procedure
1248**                  Note: RW_I93DetectNDef() must be called before using this
1249**                        Updating data must not be removed until returning event
1250**
1251**                  The RW_I93_SET_TAG_RO_EVT event will be returned.
1252**
1253** Returns          NFC_STATUS_OK if success
1254**                  NFC_STATUS_FAILED if I93 is busy or other error
1255**
1256*******************************************************************************/
1257NFC_API extern tNFC_STATUS RW_I93SetTagReadOnly (void);
1258
1259/*****************************************************************************
1260**
1261** Function         RW_I93PresenceCheck
1262**
1263** Description      Check if the tag is still in the field.
1264**
1265**                  The RW_I93_PRESENCE_CHECK_EVT w/ status is used to indicate
1266**                  presence or non-presence.
1267**
1268** Returns          NFC_STATUS_OK, if raw data frame sent
1269**                  NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this operation
1270**                  NFC_STATUS_FAILED: other error
1271**
1272*****************************************************************************/
1273NFC_API extern tNFC_STATUS RW_I93PresenceCheck (void);
1274
1275/*******************************************************************************
1276**
1277** Function         RW_SendRawFrame
1278**
1279** Description      This function sends a raw frame to the peer device.
1280**
1281** Returns          tNFC_STATUS
1282**
1283*******************************************************************************/
1284NFC_API extern tNFC_STATUS RW_SendRawFrame (UINT8 *p_raw_data, UINT16 data_len);
1285
1286/*******************************************************************************
1287**
1288** Function         RW_SetActivatedTagType
1289**
1290** Description      This function sets tag type for Reader/Writer mode.
1291**
1292** Returns          tNFC_STATUS
1293**
1294*******************************************************************************/
1295NFC_API extern tNFC_STATUS RW_SetActivatedTagType (tNFC_ACTIVATE_DEVT *p_activate_params, tRW_CBACK *p_cback);
1296
1297/*******************************************************************************
1298**
1299** Function         RW_SetTraceLevel
1300**
1301** Description      This function sets the trace level for Reader/Writer mode.
1302**                  If called with a value of 0xFF,
1303**                  it simply returns the current trace level.
1304**
1305** Returns          The new or current trace level
1306**
1307*******************************************************************************/
1308NFC_API extern UINT8 RW_SetTraceLevel (UINT8 new_level);
1309
1310#endif /* RW_API_H */
1311