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