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