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