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