tags_defs.h revision f8a4ca325ef137a94869b34d36095ba7d08816a3
1/****************************************************************************** 2** 3** File: tags_defs.h 4** 5** Description: This file contains the Near Field Communication (NFC) 6** Tags related definitions from the specification. 7** 8** Copyright (c) 2009-2010 Broadcom Corp. All Rights Reserved. 9** Broadcom Bluetooth Core. Proprietary and confidential. 10** 11******************************************************************************/ 12 13#ifndef TAGS_DEFS_H 14#define TAGS_DEFS_H 15 16/* Manufacturer ID */ 17#define TAG_BRCM_MID 0x2E /* BROADCOM CORPORATION */ 18#define TAG_MIFARE_MID 0x04 /* MIFARE */ 19#define TAG_KOVIO_MID 0x37 /* KOVIO */ 20#define TAG_INFINEON_MID 0x05 /* Infineon Technologies */ 21 22/* TLV types present in Type1 and Type 2 Tags */ 23#define TAG_NULL_TLV 0 /* May be used for padding. SHALL ignore this */ 24#define TAG_LOCK_CTRL_TLV 1 /* Defines details of the lock bytes */ 25#define TAG_MEM_CTRL_TLV 2 /* Identifies reserved memory areas */ 26#define TAG_NDEF_TLV 3 /* Contains the NDEF message */ 27#define TAG_PROPRIETARY_TLV 0xFD /* Tag proprietary information */ 28#define TAG_TERMINATOR_TLV 0xFE /* Last TLV block in the data area */ 29#define TAG_BITS_PER_BYTE 0x08 /* Number of bits in every tag byte */ 30#define TAG_MAX_UID_LEN 0x0A /* Max UID Len of type 1 and type 2 tag */ 31 32#define TAG_LONG_NDEF_LEN_FIELD_BYTE0 0xFF /* Byte 0 Length field to indicate LNDEF */ 33#define TAG_DEFAULT_TLV_LEN 3 /* Tlv len for LOCK_CTRL/MEM TLV per spec */ 34 35/* Type 1 Tag related definitions */ 36 37#define T1T_STATIC_BLOCKS 0x0F /* block 0 to Block E */ 38#define T1T_BLOCK_SIZE 0x08 /* T1T Block size in bytes */ 39 40#define T1T_STATIC_SIZE T1T_STATIC_BLOCKS * T1T_BLOCK_SIZE /* Static Tag size */ 41 42#define T1T_SEGMENT_SIZE 0x80 /* Size of Type 1 Tag segment in bytes */ 43#define T1T_MAX_SEGMENTS 0x10 /* Maximum segment supported by Type 1 Tag */ 44#define T1T_BLOCKS_PER_SEGMENT 0x10 /* Number of blocks present in a segment */ 45#define T1T_OTP_LOCK_RES_BYTES 0x10 /* No.of default OTP,staticlocks,res bytes in tag */ 46 47#define T1T_STATIC_HR0 0x11 /* HRO value to indicate static Tag */ 48#define T1T_DYNAMIC_HR0 0x12 /* 0x1y, as long as (y!=1) */ 49#define T1T_NDEF_SUPPORTED 0x10 /* HR0 value is 0x1y, indicates NDEF supported */ 50#define T1T_HR1 0x00 /* should be ignored */ 51#define T1T_UID_BLOCK 0x00 /* UID block */ 52#define T1T_RES_BLOCK 0x0D /* Reserved block */ 53#define T1T_LOCK_BLOCK 0x0E /* Static lock block */ 54#define T1T_MID_OFFSET 0x06 /* Manufacturer ID offset */ 55#define T1T_STATIC_RES_OFFSET 0x68 /* Reserved bytes offset */ 56#define T1T_LOCK_0_OFFSET 0x70 /* Static lock offset */ 57#define T1T_LOCK_1_OFFSET 0x71 /* Static lock offset */ 58#define T1T_DYNAMIC_LOCK_OFFSET 0x78 /* Block F - typically used for dynamic locks */ 59#define T1T_DYNAMIC_LOCK_BYTES 0x08 60 61#define T1T_RES_BYTE_LEN 1 /* the len of reserved byte in T1T block 0 */ 62 63/* Capability Container definitions */ 64#define T1T_CC_BLOCK 1 /* Capability container block */ 65#define T1T_CC_LEN 4 /* the len of CC used in T1T tag */ 66/* CC offset */ 67#define T1T_CC_NMN_OFFSET 0x00 /* Offset for NDEF magic number in CC */ 68#define T1T_CC_VNO_OFFSET 0x01 /* Offset for Version number in CC */ 69#define T1T_CC_TMS_OFFSET 0x02 /* Offset for Tag memory size in CC */ 70#define T1T_CC_RWA_OFFSET 0x03 /* Offset for Read/Write access in CC */ 71#define T1T_CC_NMN_BYTE 0x08 /* NDEF Magic Number byte number */ 72#define T1T_CC_VNO_BYTE 0x09 /* Version Number byte number */ 73#define T1T_CC_TMS_BYTE 0x0A /* Tag Memory Size byte number */ 74#define T1T_CC_RWA_BYTE 0x0B /* Read Write Access byte number */ 75#define T1T_CC_NMN 0xE1 /* NDEF Magic Number */ 76#define T1T_CC_LEGACY_VNO 0x10 /* Supported Legacy Version */ 77#define T1T_CC_VNO 0x11 /* Version Number */ 78#define T1T_CC_TMS_STATIC 0x0E /* TMS static memory - (8 * (n+1)). */ 79#define T1T_CC_RWA_RW 0x00 /* RWA - Read/write allowed */ 80#define T1T_CC_RWA_RO 0x0F /* RWA - Read only */ 81 82#define T1T_TAG_NULL 0 /* May be used for padding. SHALL ignore this */ 83#define T1T_TAG_LOCK_CTRL 1 /* Defines details of the lock bytes */ 84#define T1T_TAG_MEM_CTRL 2 /* Identifies reserved memory areas */ 85#define T1T_TAG_NDEF 3 /* Contains the NDEF message */ 86#define T1T_TAG_PROPRIETARY 0xFD /* Tag proprietary information */ 87#define T1T_TAG_TERMINATOR 0xFE /* Last TLV block in the data area */ 88 89#define T1T_DEFAULT_TLV_LEN 3 /* Tlv len for LOCK_CTRL/MEM TLV per spec */ 90#define T1T_TLV_TYPE_LEN 1 /* Tlv type identifier len */ 91#define T1T_DEFAULT_TLV_LEN_FIELD_LEN 1 /* Length field size of lock/mem tlv */ 92 93#define T1T_HR_LEN 2 /* the len of HR used in Type 1 Tag */ 94#define T1T_CMD_UID_LEN 4 /* the len of UID used in Type 1 Tag Commands */ 95#define T1T_UID_LEN 7 /* the len of UID used in Type 1 Tag */ 96#define T1T_ADD_LEN 1 97 98#define T1T_SHORT_NDEF_LEN_FIELD_LEN 1 /* Length Field size of short NDEF Message */ 99#define T1T_LONG_NDEF_LEN_FIELD_LEN 3 /* Length Field size of Long NDEF Message */ 100#define T1T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF /* Byte 0 in Length field to indicate LNDEF*/ 101#define T1T_LONG_NDEF_MIN_LEN 0x00FF /* Min. len of NDEF to qualify as LNDEF */ 102 103/* Type 1 Tag Commands (7 bits) */ 104#define T1T_CMD_RID 0x78 /* read id */ 105#define T1T_CMD_RALL 0x00 /* read all bytes */ 106#define T1T_CMD_READ 0x01 /* read (1 byte) */ 107#define T1T_CMD_WRITE_E 0x53 /* write with erase (1 byte) */ 108#define T1T_CMD_WRITE_NE 0x1A /* write no erase (1 byte) */ 109/* dynamic memory only */ 110#define T1T_CMD_RSEG 0x10 /* read segment */ 111#define T1T_CMD_READ8 0x02 /* read (8 byte) */ 112#define T1T_CMD_WRITE_E8 0x54 /* write with erase (8 byte) */ 113#define T1T_CMD_WRITE_NE8 0x1B /* write no erase (8 byte) */ 114 115/* Lock */ 116#define T1T_NUM_STATIC_LOCK_BYTES 2 /* Number of static lock bytes in tag */ 117#define T1T_BYTES_LOCKED_BY_STATIC_LOCK_BIT 4 /* Bytes locked by one static lock bit */ 118 119 120/* Type 2 Tag related definitions */ 121#define T2T_STATIC_MEM_STR 0 122#define T2T_DYNAMIC_MEM_STR 1 123#define T2T_STATIC_SIZE 64 124#define T2T_STATIC_BLOCKS 16 /* block 0 to Block 15 */ 125#define T2T_BLOCK_SIZE 4 126#define T2T_HEADER_BLOCKS 4 127#define T2T_HEADER_SIZE 16 128#define T2T_SECTOR_SIZE 1024 129#define T2T_BLOCKS_PER_SECTOR 0x100 130 131#define T2T_UID_LEN 4 /* the len of UID used in T2T tag */ 132#define T2T_BLOCK0_UID_LEN 3 /* the len of UID in Block 0 of T2T tag */ 133#define T2T_BCC0_LEN 1 /* the len of BCC0 of T2T tag */ 134#define T2T_BLOCK1_UID_LEN 4 /* the len of UID in Block 1 of T2T tag */ 135#define T2T_BCC1_LEN 1 /* the len of BCC0 of T2T tag */ 136#define T2T_SNO_LEN 4 /* the len of Serial number used in T2T tag */ 137#define T2T_INTERNAL_BYTES_LEN 2 /* the len of internal used in T2T tag */ 138#define T2T_STATIC_LOCK_LEN 2 /* the len of static lock used in T2T tag */ 139/* Static Lock Bytes */ 140#define T2T_STATIC_LOCK0 0x0A /* Static Lock 0 offset */ 141#define T2T_STATIC_LOCK1 0x0B /* Static Lock 1 offset */ 142 143#define T2T_CC_LEN 4 /* the len of CC used in T2T tag */ 144 145/* Capability Container definitions */ 146#define T2T_CC_BLOCK 0x03 /* Capability container block */ 147#define T2T_CC0_NMN_BYTE 0x0C /* NDEF Magic Number byte number */ 148#define T2T_CC1_VNO_BYTE 0x0D /* Version Number byte number*/ 149#define T2T_CC2_TMS_BYTE 0x0E /* Tag Memory Size byte number */ 150#define T2T_CC3_RWA_BYTE 0x0F /* Read Write Access byte number */ 151#define T2T_DATA_MEM 0x10 /* Data Memory */ 152 153#define T2T_CC0_NMN 0xE1 /* NDEF Magic Number */ 154#define T2T_CC1_VNO 0x11 /* Version Number */ 155#define T2T_CC1_LEGACY_VNO 0x10 /* Legacy Version Number */ 156#define T2T_CC1_NEW_VNO 0x12 /* Another supported Version Number */ 157#define T2T_CC2_TMS_STATIC 0x06 /* TMS static memory - (4 * (n+1)). */ 158#define T2T_CC3_RWA_RW 0x00 /* RWA - Read/write allowed */ 159#define T2T_CC3_RWA_RO 0x0F /* RWA - Read only */ 160 161#define T2T_TMS_TAG_FACTOR 0x08 /* Factor to multiply to get tag data size from TMS */ 162 163/* Type 2 Tag Commands */ 164#define T2T_CMD_READ 0x30 /* read 4 blocks (16 bytes) */ 165#define T2T_CMD_WRITE 0xA2 /* write 1 block (4 bytes) */ 166#define T2T_CMD_SEC_SEL 0xC2 /* Sector select */ 167#define T2T_RSP_ACK 0xA 168#define T2T_RSP_NACK5 0x5 169#define T2T_RSP_NACK1 0x1 /* Nack can be either 1 */ 170 171#define T2T_FIRST_DATA_BLOCK 4 172#define T2T_READ_BLOCKS 4 173#define T2T_BLOCK_LEN 4 174#define T2T_READ_DATA_LEN (T2T_BLOCK_LEN * T2T_READ_BLOCKS) 175#define T2T_WRITE_DATA_LEN 4 176 177 178/* Type 2 TLV definitions */ 179#define T2T_TLV_TYPE_NULL 0 /* May be used for padding. SHALL ignore this */ 180#define T2T_TLV_TYPE_LOCK_CTRL 1 /* Defines details of the lock bytes */ 181#define T2T_TLV_TYPE_MEM_CTRL 2 /* Identifies reserved memory areas */ 182#define T2T_TLV_TYPE_NDEF 3 /* Contains the NDEF message */ 183#define T2T_TLV_TYPE_PROPRIETARY 0xFD /* Tag proprietary information */ 184#define T2T_TLV_TYPE_TERMINATOR 0xFE /* Last TLV block in the data area */ 185 186 187#define T2T_TLEN_LOCK_CTRL_TLV 3 /* Tag len for LOCK_CTRL TLV per spec */ 188#define T2T_TLEN_MEM_CTRL_TLV 3 /* Tag len for MEM_CTRL TLV per spec */ 189 190#define T2T_MAX_SECTOR 2 /* Maximum number of sectors supported */ 191 192#define T2T_TLV_TYPE_LEN 1 /* Tlv type identifier len */ 193 194#define T2T_DEFAULT_TLV_LEN 3 /* Tlv len for LOCK_CTRL/MEM TLV per spec */ 195#define T2T_SHORT_NDEF_LEN_FIELD_LEN 1 /* Length Field size of short NDEF Message */ 196#define T2T_LONG_NDEF_LEN_FIELD_LEN 3 /* Length Field size of Long NDEF Message */ 197#define T2T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF /* Byte 0 in Length field to indicate LNDEF*/ 198#define T2T_LONG_NDEF_MIN_LEN 0x00FF /* Min. len of NDEF to qualify as LNDEF */ 199 200/* Lock */ 201#define T2T_NUM_STATIC_LOCK_BYTES 2 /* Number of static lock bytes in tag */ 202#define T2T_BYTES_LOCKED_BY_STATIC_LOCK_BIT 4 /* Bytes locked by one static lock bit */ 203 204#define T2T_CC2_TMS_MULC 0x12 205/* 206** 207** Type 3 Tag Definitions 208** 209*/ 210 211#define T3T_SYSTEM_CODE_NDEF 0x12FC /* System Code for NDEF tags */ 212#define T3T_SYSTEM_CODE_FELICA_LITE 0x88B4 /* System Code for felica-lite tags */ 213#define T3T_MAX_SYSTEM_CODES 16 214 215/* Block descriptor, used to describe a block to check/update */ 216typedef struct 217{ 218 UINT16 service_code; /* Block service code. Set to T3T_SERVICE_CODE_NDEF (0x000B) for NDEF data */ 219 UINT16 block_number; /* Block number */ 220} tT3T_BLOCK_DESC; 221 222/* Poll RC (request code) definitions */ 223#define T3T_POLL_RC_NONE 0 /* No RD requested in SENSF_RES */ 224#define T3T_POLL_RC_SC 1 /* System code requested in SENSF_RES */ 225#define T3T_POLL_RC_COMM 2 /* Avanced protocol features requested in SENSF_RES */ 226typedef UINT8 tT3T_POLL_RC; 227 228/* Definitions for constructing t3t command messages */ 229 230/* NFC Forum / Felica commands */ 231#define T3T_MSG_OPC_CHECK_CMD 0x06 232#define T3T_MSG_OPC_CHECK_RSP 0x07 233#define T3T_MSG_OPC_UPDATE_CMD 0x08 234#define T3T_MSG_OPC_UPDATE_RSP 0x09 235 236/* Felica commands (not specified in NFC-Forum Type 3 tag specifications) */ 237#define T3T_MSG_OPC_POLL_CMD 0x00 238#define T3T_MSG_OPC_POLL_RSP 0x01 239#define T3T_MSG_OPC_REQ_SERVICE_CMD 0x02 240#define T3T_MSG_OPC_REQ_SERVICE_RSP 0x03 241#define T3T_MSG_OPC_REQ_RESPONSE_CMD 0x04 242#define T3T_MSG_OPC_REQ_RESPONSE_RSP 0x05 243#define T3T_MSG_OPC_REQ_SYSTEMCODE_CMD 0x0C 244#define T3T_MSG_OPC_REQ_SYSTEMCODE_RSP 0x0D 245 246#define T3T_MSG_NDEF_SC_RO 0x000B /* Service code: read-only NDEF */ 247#define T3T_MSG_NDEF_SC_RW 0x0009 /* Service code: read/write NDEF */ 248#define T3T_MSG_NDEF_VERSION 0x10 /* NDEF Mapping Version 1.0 */ 249#define T3T_MSG_NDEF_WRITEF_OFF 0x00 250#define T3T_MSG_NDEF_WRITEF_ON 0x0F 251#define T3T_MSG_NDEF_RWFLAG_RO 0x00 252#define T3T_MSG_NDEF_RWFLAG_RW 0x01 253#define T3T_MSG_NDEF_ATTR_INFO_SIZE 14 /* Size of NDEF attribute info block (minus checksum) */ 254 255#define T3T_MSG_OFFSET_IDM 1 /* offset of Manufacturer ID in UPDATE/CHECK messages */ 256#define T3T_MSG_OFFSET_NUM_SERVICES 9 /* offset of Number of Services parameter in UPDATE/CHECK messages */ 257#define T3T_MSG_OFFSET_SERVICE_CODE_LIST 10 /* offset of Service Code List parameter in UPDATE/CHECK messages */ 258#define T3T_MSG_MASK_TWO_BYTE_BLOCK_DESC_FORMAT 0x80 /* len flag for Block List Element */ 259#define T3T_MSG_SERVICE_LIST_MASK 0x0F /* service code list mask */ 260#define T3T_MSG_SERVICE_LIST_MAX 16 261 262#define T3T_MSG_NUM_SERVICES_UPDATE_MAX 12 /* Max Number of Services per UPDATE command */ 263#define T3T_MSG_NUM_SERVICES_CHECK_MAX 15 /* Max Number of Services per CHECK command */ 264#define T3T_MSG_NUM_BLOCKS_UPDATE_MAX 13 /* Max Number of Blocks per UPDATE command */ 265#define T3T_MSG_NUM_BLOCKS_CHECK_MAX 15 /* Max Number of Blocks per CHECK command */ 266 267#define T3T_MSG_BLOCKSIZE 16 /* Data block size for UPDATE and CHECK commands */ 268 269/* Common header definitions for T3t commands */ 270#define T3T_MSG_CMD_COMMON_HDR_LEN 11 /* Common header: SoD + cmdcode + NFCID2 + num_services */ 271 272/* Common header definition for T3t responses */ 273#define T3T_MSG_RSP_COMMON_HDR_LEN 11 /* Common header: rspcode + NFCID2 + StatusFlag1 + StatusFlag2 */ 274#define T3T_MSG_RSP_CHECK_HDR_LEN (T3T_MSG_RSP_COMMON_HDR_LEN + 1) /* Common header + NumBlocks */ 275#define T3T_MSG_RSP_OFFSET_RSPCODE 0 /* Offset for Response code */ 276#define T3T_MSG_RSP_OFFSET_IDM 1 /* Offset for Manufacturer ID */ 277#define T3T_MSG_RSP_OFFSET_STATUS1 9 /* Offset for Status Flag1 */ 278#define T3T_MSG_RSP_OFFSET_NUMBLOCKS 11 /* Offset for NumberOfBlocks (in CHECK response) */ 279#define T3T_MSG_RSP_OFFSET_CHECK_DATA 12 /* Offset for Block Data (in CHECK response) */ 280#define T3T_MSG_RSP_OFFSET_POLL_PMM 9 /* Offset for PMm (in POLL response) */ 281#define T3T_MSG_RSP_OFFSET_POLL_RD 17 /* Offset for RD (in POLL response) */ 282#define T3T_MSG_RSP_OFFSET_NUMSYS 9 /* Offset for Number of Systems */ 283 284#define T3T_MSG_RSP_STATUS_OK 0x00 285#define T3T_MSG_RSP_STATUS_ERROR 0x01 286 287#define T3T_MSG_RSP_STATUS2_ERROR_MEMORY 0x70 288#define T3T_MSG_RSP_STATUS2_ERROR_EXCESSIVE_WRITES 0x71 289#define T3T_MSG_RSP_STATUS2_ERROR_PROCESSING 0xFF 290 291#define T3T_NFC_F_MAX_PAYLOAD_LEN 0xFE /* Maximum payload lenght for NFC-F messages (including SoD) */ 292 293/* Felica Lite defintions */ 294#define T3T_MSG_FELICALITE_BLOCK_ID_MC 0x88 /* Block ID for MC (memory configuration) */ 295#define T3T_MSG_FELICALITE_MC_OFFSET_SYS_OP 0x03 /* Memory Configuration Block offset: SYS_OP (System Option) */ 296 297 298 299/* 300** 301** Type 4 Tag Definitions 302** 303*/ 304#define T4T_CMD_MIN_HDR_SIZE 4 /* CLA, INS, P1, P2 */ 305#define T4T_CMD_MAX_HDR_SIZE 5 /* CLA, INS, P1, P2, Lc */ 306 307#define T4T_VERSION_2_0 0x20 /* version 2.0 */ 308#define T4T_VERSION_1_0 0x10 /* version 1.0 */ 309#define T4T_MY_VERSION T4T_VERSION_2_0 310#define T4T_GET_MAJOR_VERSION(x) ((x) >> 4) 311#define T4T_GET_MINOR_VERSION(x) ((x) & 0x0F ) 312 313#define T4T_CMD_CLASS 0x00 314#define T4T_CMD_INS_SELECT 0xA4 315#define T4T_CMD_INS_READ_BINARY 0xB0 316#define T4T_CMD_INS_UPDATE_BINARY 0xD6 317#define T4T_CMD_P1_SELECT_BY_NAME 0x04 318#define T4T_CMD_P1_SELECT_BY_FILE_ID 0x00 319#define T4T_CMD_P2_FIRST_OR_ONLY_00H 0x00 320#define T4T_CMD_P2_FIRST_OR_ONLY_0CH 0x0C 321 322#define T4T_MAX_LENGTH_LE 0xFF /* Max number of bytes to be read from file in ReadBinary Command */ 323#define T4T_MAX_LENGTH_LC 0xFF /* Max number of bytes written to NDEF file in UpdateBinary Command */ 324 325#define T4T_RSP_STATUS_WORDS_SIZE 0x02 326 327#define T4T_RSP_CMD_CMPLTED 0x9000 328#define T4T_RSP_NOT_FOUND 0x6A82 329#define T4T_RSP_WRONG_PARAMS 0x6B00 330#define T4T_RSP_CLASS_NOT_SUPPORTED 0x6E00 331#define T4T_RSP_WRONG_LENGTH 0x6700 332#define T4T_RSP_INSTR_NOT_SUPPORTED 0x6D00 333#define T4T_RSP_CMD_NOT_ALLOWED 0x6986 334 335#define T4T_V10_NDEF_TAG_AID_LEN 0x07 /* V1.0 Type 4 Tag Applicaiton ID length */ 336#define T4T_V20_NDEF_TAG_AID_LEN 0x07 /* V2.0 Type 4 Tag Applicaiton ID length */ 337 338#define T4T_MIN_MLE 0x000F /* Min of Max R-APDU data size */ 339 340#define T4T_FILE_ID_SIZE 0x02 341#define T4T_CC_FILE_ID 0xE103 342#define T4T_CC_FILE_MIN_LEN 0x000F 343 344#define T4T_VERSION_OFFSET_IN_CC 0x02 345#define T4T_FC_TLV_OFFSET_IN_CC 0x07 346 347#define T4T_NDEF_FILE_CONTROL_TYPE 0x04 /* NDEF File Control Type */ 348#define T4T_PROP_FILE_CONTROL_TYPE 0x05 /* Proprietary File Control Type */ 349 350#define T4T_FILE_CONTROL_TLV_SIZE 0x08 /* size of T(1),L(1),V(6) for file control */ 351#define T4T_FILE_CONTROL_LENGTH 0x06 /* size of V(6) for file control */ 352 353#define T4T_FC_READ_ACCESS 0x00 /* read access granted without any security */ 354#define T4T_FC_WRITE_ACCESS 0x00 /* write access granted without any security */ 355#define T4T_FC_NO_WRITE_ACCESS 0xFF /* no write access granted at all (read-only) */ 356 357#define T4T_FILE_LENGTH_SIZE 0x02 358 359/* 360** 361** ISO 15693 Tag Definitions 362** 363*/ 364 365/* Request flags 1 to 4 definition */ 366#define I93_FLAG_SUB_CARRIER_MASK 0x01 /* Sub_carrier_flag */ 367#define I93_FLAG_SUB_CARRIER_SINGLE 0x00 /* A single sub-carrier frequency shall be used by VICC */ 368#define I93_FLAG_SUB_CARRIER_DOUBLE 0x01 /* Two sub-carriers shall be used by VICC */ 369 370#define I93_FLAG_DATA_RATE_MASK 0x02 /* Data_rate_flag */ 371#define I93_FLAG_DATA_RATE_LOW 0x00 /* Low data rate shall be used */ 372#define I93_FLAG_DATA_RATE_HIGH 0x02 /* High data rate shall be used */ 373 374#define I93_FLAG_INVENTORY_MASK 0x04 /* Inventory_flag */ 375#define I93_FLAG_INVENTORY_UNSET 0x00 /* Flags 5 to 8 meaning is according to table 4 */ 376#define I93_FLAG_INVENTORY_SET 0x04 /* Flags 5 to 8 meaning is according to table 5 */ 377 378#define I93_FLAG_PROT_EXT_MASK 0x08 /* Protocol_Extension_flag */ 379#define I93_FLAG_PROT_EXT_NO 0x00 /* No protocol format extension */ 380#define I93_FLAG_PROT_EXT_YES 0x08 /* Protocol format is extended. Reserved for future use */ 381 382/* Request flags 5 to 6 definition when inventory flag is not set */ 383#define I93_FLAG_SELECT_MASK 0x10 /* Select_flag */ 384#define I93_FLAG_SELECT_UNSET 0x00 /* Request shall be executed by any VICC according to the setting of Address_flag */ 385#define I93_FLAG_SELECT_SET 0x10 /* Request shall be executed only by VICC in selected state */ 386 /* The Address_flag shall be set to 0 and the UID field shall bot be included in the request */ 387 388#define I93_FLAG_ADDRESS_MASK 0x20 /* Address_flag */ 389#define I93_FLAG_ADDRESS_UNSET 0x00 /* Request is not addressed. UID field is not included. It shall be executed by any VICC */ 390#define I93_FLAG_ADDRESS_SET 0x20 /* Request is addressed. UID field is included. It shall be executed only by VICC */ 391 /* whose UID matches the UID specified in the request */ 392 393/* Request flags 5 to 6 definition when inventory flag is set */ 394#define I93_FLAG_AFI_MASK 0x10 /* AFI_flag */ 395#define I93_FLAG_AFI_NOT_PRESENT 0x00 /* AFI field is not present */ 396#define I93_FLAG_AFI_PRESENT 0x10 /* AFI field is present */ 397 398#define I93_FLAG_SLOT_MASK 0x20 /* Nb_slots_flag */ 399#define I93_FLAG_SLOT_16 0x00 /* 16 slots */ 400#define I93_FLAG_SLOT_ONE 0x20 /* 1 slot */ 401 402/* Request flags 6 to 8 definition when inventory flag is set or not set */ 403 404#define I93_FLAG_OPTION_MASK 0x40 /* Option_flag */ 405#define I93_FLAG_OPTION_UNSET 0x00 /* Meaning is defined by the command description. */ 406 /* It shall be set to 0 if not otherwise defined by command */ 407#define I93_FLAG_OPTION_SET 0x40 /* Meaning is defined by the command description. */ 408 409/* Response flags */ 410#define I93_FLAG_ERROR_MASK 0x01 /* Error_flag */ 411#define I93_FLAG_ERORR_NOT_DETECTED 0x00 /* No error */ 412#define I93_FLAG_ERROR_DETECTED 0x01 /* Error detected, Error code is in the "Error" field */ 413 414/* Response error code */ 415#define I93_ERROR_CODE_NOT_SUPPORTED 0x01 /* The command is not supported, i.e. the request code is not recognized */ 416#define I93_ERROR_CODE_NOT_RECOGNIZED 0x02 /* The command is not recognized, for example: a format error occured */ 417#define I93_ERROR_CODE_OPTION_NOT_SUPPORTED 0x03 /* The command option is not supported */ 418#define I93_ERROR_CODE_NO_INFO 0x0F /* Error with no information given or a specific error code is not supported */ 419#define I93_ERROR_CODE_BLOCK_NOT_AVAILABLE 0x10 /* The specific block is not available (doesn't exist) */ 420#define I93_ERROR_CODE_BLOCK_ALREADY_LOCKED 0x11 /* The specific block is already locked and thus cannot be locked again */ 421#define I93_ERROR_CODE_BLOCK_LOCKED 0x12 /* The specific block is locked and its content cannot be changed */ 422#define I93_ERROR_CODE_BLOCK_FAIL_TO_WRITE 0x13 /* The specific block is was not successfully programmed */ 423#define I93_ERROR_CODE_BLOCK_FAIL_TO_LOCK 0x14 /* The specific block is was not successfully locked */ 424 425#define I93_UID_BYTE_LEN 8 /* UID length in bytes */ 426#define I93_DFS_UNSUPPORTED 0x00 /* Data Storage Format is not supported */ 427#define I93_BLOCK_UNLOCKED 0x00 /* Block is not locked */ 428#define I93_BLOCK_LOCKED 0x01 /* Block is locked */ 429 430/* ISO 15693 Mandatory commands */ 431#define I93_CMD_INVENTORY 0x01 /* Inventory */ 432#define I93_CMD_STAY_QUIET 0x02 /* Stay Quiet */ 433 434/* ISO 15693 Optional commands */ 435#define I93_CMD_READ_SINGLE_BLOCK 0x20 /* Read single block */ 436#define I93_CMD_WRITE_SINGLE_BLOCK 0x21 /* Write single block */ 437#define I93_CMD_LOCK_BLOCK 0x22 /* Lock block */ 438#define I93_CMD_READ_MULTI_BLOCK 0x23 /* Read multiple blocks */ 439#define I93_CMD_WRITE_MULTI_BLOCK 0x24 /* Write multiple blocks */ 440#define I93_CMD_SELECT 0x25 /* Select */ 441#define I93_CMD_RESET_TO_READY 0x26 /* Reset to ready */ 442#define I93_CMD_WRITE_AFI 0x27 /* Wreite AFI */ 443#define I93_CMD_LOCK_AFI 0x28 /* Lock AFI */ 444#define I93_CMD_WRITE_DSFID 0x29 /* Write DSFID */ 445#define I93_CMD_LOCK_DSFID 0x2A /* Lock DSFID */ 446#define I93_CMD_GET_SYS_INFO 0x2B /* Get system information */ 447#define I93_CMD_GET_MULTI_BLK_SEC 0x2C /* Get multiple block security status */ 448 449/* Information flags definition */ 450#define I93_INFO_FLAG_DSFID 0x01 /* DSFID is supported and DSFID field is present */ 451#define I93_INFO_FLAG_AFI 0x02 /* AFI is supported and AFI field is present */ 452#define I93_INFO_FLAG_MEM_SIZE 0x04 /* VICC memory size field is present */ 453#define I93_INFO_FLAG_IC_REF 0x08 /* IC reference field is present */ 454 455#define I93_MAX_BLOCK_LENGH 32 /* Max block size in bytes */ 456#define I93_MAX_NUM_BLOCK 256 /* Max number of blocks */ 457 458/* ICODE Capability Container(CC) definition */ 459#define I93_ICODE_CC_MAGIC_NUMER 0xE1 /* magic number in CC[0] */ 460#define I93_ICODE_CC_MAJOR_VER_MASK 0xC0 /* major version in CC[1] */ 461#define I93_ICODE_CC_MINOR_VER_MASK 0x30 /* minor version in CC[1] */ 462#define I93_ICODE_CC_READ_ACCESS_MASK 0x0C /* read access condition in CC[1] */ 463#define I93_ICODE_CC_READ_ACCESS_GRANTED 0x00 /* read access granted without security */ 464#define I93_ICODE_CC_WRITE_ACCESS_MASK 0x03 /* write access condition in CC[1] */ 465#define I93_ICODE_CC_WRITE_ACCESS_GRANTED 0x00 /* write access granted without security */ 466#define I93_ICODE_CC_READ_ONLY 0x03 /* write access not granted at all */ 467#define I93_ICODE_CC_MBREAD_MASK 0x01 /* read multi block supported in CC[3] */ 468#define I93_ICODE_CC_IPREAD_MASK 0x02 /* inventory page read supported in CC[3] */ 469 470/* ICODE TLV type */ 471#define I93_ICODE_TLV_TYPE_NULL 0x00 /* NULL TLV */ 472#define I93_ICODE_TLV_TYPE_NDEF 0x03 /* NDEF message TLV */ 473#define I93_ICODE_TLV_TYPE_PROP 0xFD /* Proprietary TLV */ 474#define I93_ICODE_TLV_TYPE_TERM 0xFE /* Terminator TLV */ 475 476/* UID Coding (UID Bit 64-57), First byte of ISO 15693 UID */ 477#define I93_UID_FIRST_BYTE 0xE0 478 479/* UID Coding (UID Bit 56-49), IC manufacturer code */ 480#define I93_UID_IC_MFG_CODE_NXP 0x04 481#define I93_UID_IC_MFG_CODE_TI 0x07 482 483/* NXP, UID Coding of ICODE type (UID Bit 48-41) */ 484#define I93_UID_ICODE_SLI 0x01 /* ICODE SLI, SLIX */ 485#define I93_UID_ICODE_SLI_S 0x02 /* ICODE SLI-S, SLIX-S */ 486#define I93_UID_ICODE_SLI_L 0x03 /* ICODE SLI-L, SLIX-L */ 487 488/* TI, UID Coding of product version (UID Bit 48-42) */ 489#define I93_UID_TAG_IT_HF_I_PRODUCT_ID_MASK 0xFE /* upper 7 bits */ 490#define I93_UID_TAG_IT_HF_I_PLUS_INLAY 0x00 /* Tag-it HF-I Plus Inlay */ 491#define I93_UID_TAG_IT_HF_I_PLUS_CHIP 0x80 /* Tag-it HF-I Plus Chip */ 492#define I93_UID_TAG_IT_HF_I_STD_CHIP_INLAY 0xC0 /* Tag-it HF-I Standard Chip/Inlyas */ 493#define I93_UID_TAG_IT_HF_I_PRO_CHIP_INLAY 0xC4 /* Tag-it HF-I Pro Chip/Inlyas */ 494 495#define I93_TAG_IT_HF_I_STD_CHIP_INLAY_NUM_TOTAL_BLK 11 496#define I93_TAG_IT_HF_I_PRO_CHIP_INLAY_NUM_TOTAL_BLK 12 497 498#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_BLK_SIZE 4 499#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_NUM_USER_BLK 8 500#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_AFI_LOCATION 40 /* LSB in Block 0x0A */ 501 502#endif /* TAGS_DEFS_H */ 503