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