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