1 /******************************************************************************
2  *
3  *  Copyright (C) 2009-2014 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
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
28 #include "nfc_api.h"
29 #include "tags_defs.h"
30 
31 #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);
33 
34 #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
39 
40 enum {
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,
62 
63   /* 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,
77 
78   /* 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,
91 
92   /* 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,
107 
108   /* 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
126 };
127 
128 #define RW_RAW_FRAME_EVT 0xFF
129 
130 typedef uint8_t tRW_EVENT;
131 
132 /* 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
148 
149 typedef uint8_t tRW_NDEF_FLAG;
150 
151 /* options for RW_T4tPresenceCheck  */
152 #define RW_T4T_CHK_EMPTY_I_BLOCK 1
153 #define RW_T4T_CHK_ISO_DEP_NAK_PRES_CHK 5
154 
155 typedef struct {
156   tNFC_STATUS status;
157   uint16_t msg_len; /* Length of the NDEF message */
158 } tRW_T2T_DETECT;
159 
160 typedef 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 */
167 } tRW_T3T_POLL;
168 
169 typedef 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 */
173 } tRW_T3T_SYSTEM_CODES;
174 
175 typedef 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 */
183 } tRW_DETECT_NDEF_DATA;
184 
185 typedef 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 */
190 } tRW_DETECT_TLV_DATA;
191 
192 typedef struct {
193   tNFC_STATUS status;
194   NFC_HDR* p_data;
195 } tRW_READ_DATA;
196 
197 typedef struct {
198   tNFC_STATUS status;
199   uint8_t sw1;
200   uint8_t sw2;
201 } tRW_T4T_SW;
202 
203 typedef struct /* RW_I93_INVENTORY_EVT        */
204 {
205   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  */
208 } tRW_I93_INVENTORY;
209 
210 typedef struct /* RW_I93_DATA_EVT               */
211 {
212   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 */
215 } tRW_I93_DATA;
216 
217 typedef struct /* RW_I93_SYS_INFO_EVT             */
218 {
219   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         */
227 } tRW_I93_SYS_INFO;
228 
229 typedef struct /* RW_I93_CMD_CMPL_EVT             */
230 {
231   tNFC_STATUS status; /* status of sent command          */
232   uint8_t command;    /* sent command                    */
233   uint8_t error_code; /* error code; I93_ERROR_CODE_XXX  */
234 } tRW_I93_CMD_CMPL;
235 
236 typedef struct {
237   tNFC_STATUS status;
238   NFC_HDR* p_data;
239 } tRW_RAW_FRAME;
240 
241 typedef 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        */
254 } tRW_DATA;
255 
256 typedef void(tRW_CBACK)(tRW_EVENT event, tRW_DATA* p_data);
257 
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 *******************************************************************************/
267 extern tNFC_STATUS RW_T1tRid(void);
268 
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 *******************************************************************************/
278 extern tNFC_STATUS RW_T1tReadAll(void);
279 
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 *******************************************************************************/
289 extern tNFC_STATUS RW_T1tRead(uint8_t block, uint8_t byte);
290 
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 *******************************************************************************/
300 extern tNFC_STATUS RW_T1tWriteErase(uint8_t block, uint8_t byte,
301                                     uint8_t new_byte);
302 
303 /*******************************************************************************
304 **
305 ** Function         RW_T1tWriteNoErase
306 **
307 ** Description      This function send a WRITE-NE command for Reader/Writer
308 **                  mode.
309 **
310 ** Returns          tNFC_STATUS
311 **
312 *******************************************************************************/
313 extern tNFC_STATUS RW_T1tWriteNoErase(uint8_t block, uint8_t byte,
314                                       uint8_t new_byte);
315 
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 *******************************************************************************/
325 extern tNFC_STATUS RW_T1tReadSeg(uint8_t segment);
326 
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 *******************************************************************************/
336 extern tNFC_STATUS RW_T1tRead8(uint8_t block);
337 
338 /*******************************************************************************
339 **
340 ** Function         RW_T1tWriteErase8
341 **
342 ** Description      This function send a WRITE-E8 command for Reader/Writer
343 **                  mode.
344 **
345 ** Returns          tNFC_STATUS
346 **
347 *******************************************************************************/
348 extern tNFC_STATUS RW_T1tWriteErase8(uint8_t block, uint8_t* p_new_dat);
349 
350 /*******************************************************************************
351 **
352 ** Function         RW_T1tWriteNoErase8
353 **
354 ** Description      This function send a WRITE-NE8 command for Reader/Writer
355 **                  mode.
356 **
357 ** Returns          tNFC_STATUS
358 **
359 *******************************************************************************/
360 extern tNFC_STATUS RW_T1tWriteNoErase8(uint8_t block, uint8_t* p_new_dat);
361 
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 **
370 ** Returns          NCI_STATUS_OK, if detection was started. Otherwise, error
371 **                  status.
372 **
373 *******************************************************************************/
374 extern tNFC_STATUS RW_T1tLocateTlv(uint8_t 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
386 **                  status.
387 **
388 *******************************************************************************/
389 extern tNFC_STATUS RW_T1tDetectNDef(void);
390 
391 /*******************************************************************************
392 **
393 ** Function         RW_T1tReadNDef
394 **
395 ** Description      This function can be called to read the NDEF message on the
396 **                  tag.
397 **
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 *******************************************************************************/
404 extern tNFC_STATUS RW_T1tReadNDef(uint8_t* p_buffer, uint16_t buf_len);
405 
406 /*******************************************************************************
407 **
408 ** Function         RW_T1tWriteNDef
409 **
410 ** Description      This function can be called to write an NDEF message to the
411 **                  tag.
412 **
413 ** Parameters:      msg_len:    The length of the buffer
414 **                  p_msg:      The NDEF message to write
415 **
416 ** Returns          NCI_STATUS_OK, if write was started. Otherwise, error
417 **                  status.
418 **
419 *******************************************************************************/
420 extern tNFC_STATUS RW_T1tWriteNDef(uint16_t msg_len, uint8_t* p_msg);
421 
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 *******************************************************************************/
435 extern tNFC_STATUS RW_T1tSetTagReadOnly(bool b_hard_lock);
436 
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 *****************************************************************************/
453 extern tNFC_STATUS RW_T1tPresenceCheck(void);
454 
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 *****************************************************************************/
468 tNFC_STATUS RW_T1tFormatNDef(void);
469 
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 *******************************************************************************/
479 extern tNFC_STATUS RW_T2tLocateTlv(uint8_t tlv_type);
480 
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 *******************************************************************************/
492 extern tNFC_STATUS RW_T2tRead(uint16_t block);
493 
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 *******************************************************************************/
507 extern tNFC_STATUS RW_T2tWrite(uint16_t block, uint8_t* p_write_data);
508 
509 /*******************************************************************************
510 **
511 ** Function         RW_T2tSectorSelect
512 **
513 ** Description      This function issues the Type 2 Tag SECTOR-SELECT command
514 **                  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.
521 **
522 **                  A sector is 256 contiguous blocks (1024 bytes).
523 **
524 ** Returns          tNFC_STATUS
525 **
526 *******************************************************************************/
527 extern tNFC_STATUS RW_T2tSectorSelect(uint8_t sector);
528 
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 *******************************************************************************/
538 extern tNFC_STATUS RW_T2tDetectNDef(bool skip_dyn_locks);
539 
540 /*******************************************************************************
541 **
542 ** Function         RW_T2tReadNDef
543 **
544 ** Description      This function can be called to read the NDEF message on the
545 **                  tag.
546 **
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 *******************************************************************************/
553 extern tNFC_STATUS RW_T2tReadNDef(uint8_t* p_buffer, uint16_t buf_len);
554 
555 /*******************************************************************************
556 **
557 ** Function         RW_T2tWriteNDef
558 **
559 ** Description      This function can be called to write an NDEF message to the
560 **                  tag.
561 **
562 ** Parameters:      msg_len:    The length of the buffer
563 **                  p_msg:      The NDEF message to write
564 **
565 ** Returns          NCI_STATUS_OK, if write was started. Otherwise, error
566 **                  status.
567 **
568 *******************************************************************************/
569 extern tNFC_STATUS RW_T2tWriteNDef(uint16_t msg_len, uint8_t* p_msg);
570 
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 *******************************************************************************/
584 extern tNFC_STATUS RW_T2tSetTagReadOnly(bool b_hard_lock);
585 
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 *****************************************************************************/
602 extern tNFC_STATUS RW_T2tPresenceCheck(void);
603 
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 *****************************************************************************/
616 tNFC_STATUS RW_T2tFormatNDef(void);
617 
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 *****************************************************************************/
636 extern tNFC_STATUS RW_T3tDetectNDef(void);
637 
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 *****************************************************************************/
654 extern tNFC_STATUS RW_T3tFormatNDef(void);
655 
656 /*****************************************************************************
657 **
658 ** 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 *****************************************************************************/
672 extern tNFC_STATUS RW_T3tSetReadOnly(bool b_hard_lock);
673 
674 /*****************************************************************************
675 **
676 ** 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
682 **      segment of NDEF data received. The RW_T3T_CHECK_CPLT_EVT event is used
683 **      to notify the application all segments have been received.
684 **
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 *****************************************************************************/
699 extern tNFC_STATUS RW_T3tCheckNDef(void);
700 
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 *****************************************************************************/
727 extern tNFC_STATUS RW_T3tUpdateNDef(uint32_t len, uint8_t* p_data);
728 
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 *****************************************************************************/
750 extern tNFC_STATUS RW_T3tCheck(uint8_t num_blocks, tT3T_BLOCK_DESC* t3t_blocks);
751 
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 *****************************************************************************/
772 extern tNFC_STATUS RW_T3tUpdate(uint8_t num_blocks, tT3T_BLOCK_DESC* t3t_blocks,
773                                 uint8_t* p_data);
774 
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 *****************************************************************************/
795 extern tNFC_STATUS RW_T3tSendRawFrame(uint16_t len, uint8_t* p_data);
796 
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 *****************************************************************************/
810 extern tNFC_STATUS RW_T3tPoll(uint16_t system_code, tT3T_POLL_RC rc,
811                               uint8_t tsn);
812 
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 *****************************************************************************/
829 extern tNFC_STATUS RW_T3tPresenceCheck(void);
830 
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 *****************************************************************************/
851 extern tNFC_STATUS RW_T3tGetSystemCodes(void);
852 
853 /*****************************************************************************
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 *****************************************************************************/
867 extern tNFC_STATUS RW_T4tFormatNDef(void);
868 
869 /*******************************************************************************
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 *******************************************************************************/
881 extern tNFC_STATUS RW_T4tDetectNDef(void);
882 
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
892 **                      RW_T4T_NDEF_READ_CPLT_EVT for the last segment or
893 **                      complete NDEF
894 **                      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 *******************************************************************************/
900 extern tNFC_STATUS RW_T4tReadNDef(void);
901 
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
908 **                        Updating data must not be removed until returning
909 **                        event
910 **
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 *******************************************************************************/
919 extern tNFC_STATUS RW_T4tUpdateNDef(uint16_t length, uint8_t* p_data);
920 
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.
930 **
931 **      option is RW_T4T_CHK_EMPTY_I_BLOCK, use empty I block for presence
932 **      check.
933 **
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 *****************************************************************************/
940 extern tNFC_STATUS RW_T4tPresenceCheck(uint8_t option);
941 
942 /*****************************************************************************
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 *****************************************************************************/
955 extern tNFC_STATUS RW_T4tSetNDefReadOnly(void);
956 
957 /*******************************************************************************
958 **
959 ** Function         RW_I93Inventory
960 **
961 ** Description      This function send Inventory command with/without AFI
962 **                  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 *******************************************************************************/
971 extern tNFC_STATUS RW_I93Inventory(bool including_afi, uint8_t afi,
972                                    uint8_t* p_uid);
973 
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 *******************************************************************************/
988 extern tNFC_STATUS RW_I93StayQuiet(void);
989 
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 *******************************************************************************/
1004 extern tNFC_STATUS RW_I93ReadSingleBlock(uint16_t block_number);
1005 
1006 /*******************************************************************************
1007 **
1008 ** Function         RW_I93WriteSingleBlock
1009 **
1010 ** Description      This function send Write Single Block command
1011 **                  Application must get block size first by calling
1012 **                  RW_I93GetSysInfo().
1013 **
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 *******************************************************************************/
1022 extern tNFC_STATUS RW_I93WriteSingleBlock(uint16_t block_number,
1023                                           uint8_t* p_data);
1024 
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 *******************************************************************************/
1039 extern tNFC_STATUS RW_I93LockBlock(uint8_t block_number);
1040 
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 *******************************************************************************/
1055 extern tNFC_STATUS RW_I93ReadMultipleBlocks(uint16_t first_block_number,
1056                                             uint16_t number_blocks);
1057 
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 *******************************************************************************/
1072 extern tNFC_STATUS RW_I93WriteMultipleBlocks(uint16_t first_block_number,
1073                                              uint16_t number_blocks,
1074                                              uint8_t* p_data);
1075 
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 *******************************************************************************/
1095 extern tNFC_STATUS RW_I93Select(uint8_t* p_uid);
1096 
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 *******************************************************************************/
1111 extern tNFC_STATUS RW_I93ResetToReady(void);
1112 
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 *******************************************************************************/
1127 extern tNFC_STATUS RW_I93WriteAFI(uint8_t afi);
1128 
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 *******************************************************************************/
1143 extern tNFC_STATUS RW_I93LockAFI(void);
1144 
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 *******************************************************************************/
1159 extern tNFC_STATUS RW_I93WriteDSFID(uint8_t dsfid);
1160 
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 *******************************************************************************/
1175 extern tNFC_STATUS RW_I93LockDSFID(void);
1176 
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 *******************************************************************************/
1192 extern tNFC_STATUS RW_I93GetSysInfo(uint8_t* p_uid);
1193 
1194 /*******************************************************************************
1195 **
1196 ** Function         RW_I93GetMultiBlockSecurityStatus
1197 **
1198 ** Description      This function send Get Multiple Block Security Status
1199 **                  command
1200 **
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 *******************************************************************************/
1209 extern tNFC_STATUS RW_I93GetMultiBlockSecurityStatus(
1210     uint16_t first_block_number, uint16_t number_blocks);
1211 
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 *******************************************************************************/
1224 extern tNFC_STATUS RW_I93DetectNDef(void);
1225 
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
1235 **                      RW_I93_NDEF_READ_CPLT_EVT for the last segment or
1236 **                      complete NDEF
1237 **                      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 *******************************************************************************/
1243 extern tNFC_STATUS RW_I93ReadNDef(void);
1244 
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
1251 **                        Updating data must not be removed until returning
1252 **                        event
1253 **
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 *******************************************************************************/
1262 extern tNFC_STATUS RW_I93UpdateNDef(uint16_t length, uint8_t* p_data);
1263 
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 *******************************************************************************/
1276 extern tNFC_STATUS RW_I93FormatNDef(void);
1277 
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
1284 **                        Updating data must not be removed until returning
1285 **                        event
1286 **
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 *******************************************************************************/
1293 extern tNFC_STATUS RW_I93SetTagReadOnly(void);
1294 
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
1305 **                  NFC_STATUS_NO_BUFFERS: unable to allocate a buffer for this
1306 **                  operation
1307 **                  NFC_STATUS_FAILED: other error
1308 **
1309 *****************************************************************************/
1310 extern tNFC_STATUS RW_I93PresenceCheck(void);
1311 
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 *******************************************************************************/
1321 extern tNFC_STATUS RW_SendRawFrame(uint8_t* p_raw_data, uint16_t data_len);
1322 
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 *******************************************************************************/
1332 extern tNFC_STATUS RW_SetActivatedTagType(tNFC_ACTIVATE_DEVT* p_activate_params,
1333                                           tRW_CBACK* p_cback);
1334 #endif /* RW_API_H */
1335