• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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) Tags related
22  *  definitions from the specification.
23  *
24  ******************************************************************************/
25 
26 #ifndef TAGS_DEFS_H
27 #define TAGS_DEFS_H
28 
29 /* Manufacturer ID */
30 /* BROADCOM CORPORATION                           */
31 #define TAG_BRCM_MID 0x2E
32 /* MIFARE                                         */
33 #define TAG_MIFARE_MID 0x04
34 /* KOVIO                                          */
35 #define TAG_KOVIO_MID 0x37
36 /* Infineon Technologies                          */
37 #define TAG_INFINEON_MID 0x05
38 
39 /* TLV types present in Type1 and Type 2 Tags */
40 /* May be used for padding. SHALL ignore this     */
41 #define TAG_NULL_TLV 0
42 /* Defines details of the lock bytes              */
43 #define TAG_LOCK_CTRL_TLV 1
44 /* Identifies reserved memory areas               */
45 #define TAG_MEM_CTRL_TLV 2
46 /* Contains the NDEF message                      */
47 #define TAG_NDEF_TLV 3
48 /* Tag proprietary information                    */
49 #define TAG_PROPRIETARY_TLV 0xFD
50 /* Last TLV block in the data area                */
51 #define TAG_TERMINATOR_TLV 0xFE
52 /* Number of bits in every tag byte               */
53 #define TAG_BITS_PER_BYTE 0x08
54 /* Max UID Len of type 1 and type 2 tag           */
55 #define TAG_MAX_UID_LEN 0x0A
56 
57 /* Byte 0 Length field to indicate LNDEF  */
58 #define TAG_LONG_NDEF_LEN_FIELD_BYTE0 0xFF
59 /* Tlv len for LOCK_CTRL/MEM TLV per spec */
60 #define TAG_DEFAULT_TLV_LEN 3
61 
62 /* Type 1 Tag related definitions */
63 
64 /* block 0 to Block E                             */
65 #define T1T_STATIC_BLOCKS 0x0F
66 /* T1T Block size in bytes                        */
67 #define T1T_BLOCK_SIZE 0x08
68 
69 #define T1T_STATIC_SIZE \
70   T1T_STATIC_BLOCKS* T1T_BLOCK_SIZE /* Static Tag size   */
71 
72 /* Size of Type 1 Tag segment in bytes            */
73 #define T1T_SEGMENT_SIZE 0x80
74 /* Maximum segment supported by Type 1 Tag        */
75 #define T1T_MAX_SEGMENTS 0x10
76 /* Number of blocks present in a segment          */
77 #define T1T_BLOCKS_PER_SEGMENT 0x10
78 /* No.of default OTP,staticlocks,res bytes in tag */
79 #define T1T_OTP_LOCK_RES_BYTES 0x10
80 
81 /* HRO value to indicate static Tag               */
82 #define T1T_STATIC_HR0 0x11
83 /* 0x1y, as long as (y!=1)                        */
84 /* HR0 value is 0x1y, indicates NDEF supported    */
85 #define T1T_NDEF_SUPPORTED 0x10
86 /* UID block                                      */
87 #define T1T_UID_BLOCK 0x00
88 /* Reserved block                                 */
89 #define T1T_RES_BLOCK 0x0D
90 /* Static lock block                              */
91 #define T1T_LOCK_BLOCK 0x0E
92 /* Static lock offset                             */
93 #define T1T_LOCK_0_OFFSET 0x70
94 /* Block F - typically used for dynamic locks     */
95 #define T1T_DYNAMIC_LOCK_BYTES 0x08
96 
97 /* the len of reserved byte in T1T block 0        */
98 #define T1T_RES_BYTE_LEN 1
99 
100 /* Capability Container definitions */
101 /* Capability container block                     */
102 #define T1T_CC_BLOCK 1
103 /* the len of CC used in T1T tag                  */
104 #define T1T_CC_LEN 4
105 /* CC offset */
106 /* Offset for NDEF magic number in CC             */
107 #define T1T_CC_NMN_OFFSET 0x00
108 /* Offset for Read/Write access in CC             */
109 #define T1T_CC_RWA_OFFSET 0x03
110 /* NDEF Magic Number byte number                  */
111 #define T1T_CC_NMN_BYTE 0x08
112 /* Version Number byte number                     */
113 #define T1T_CC_VNO_BYTE 0x09
114 /* Tag Memory Size byte number                    */
115 #define T1T_CC_TMS_BYTE 0x0A
116 /* Read Write Access byte number                  */
117 #define T1T_CC_RWA_BYTE 0x0B
118 /* NDEF Magic Number                              */
119 #define T1T_CC_NMN 0xE1
120 /* Supported Legacy Version                       */
121 #define T1T_CC_LEGACY_VNO 0x10
122 /* Version Number                                 */
123 #define T1T_CC_VNO 0x11
124 /* RWA - Read/write allowed                       */
125 #define T1T_CC_RWA_RW 0x00
126 /* RWA - Read only                                */
127 #define T1T_CC_RWA_RO 0x0F
128 
129 /* Tlv len for LOCK_CTRL/MEM TLV per spec         */
130 #define T1T_DEFAULT_TLV_LEN 3
131 /* Tlv type identifier len                        */
132 #define T1T_TLV_TYPE_LEN 1
133 /* Length field size of  lock/mem tlv     */
134 #define T1T_DEFAULT_TLV_LEN_FIELD_LEN 1
135 
136 /* the len of HR used in Type 1 Tag               */
137 #define T1T_HR_LEN 2
138 /* the len of UID used in Type 1 Tag Commands     */
139 #define T1T_CMD_UID_LEN 4
140 /* the len of UID used in Type 1 Tag              */
141 #define T1T_UID_LEN 7
142 #define T1T_ADD_LEN 1
143 
144 /* Length Field size of short NDEF Message    */
145 #define T1T_SHORT_NDEF_LEN_FIELD_LEN 1
146 /* Length Field size of Long NDEF Message     */
147 #define T1T_LONG_NDEF_LEN_FIELD_LEN 3
148 /* Byte 0 in Length field to indicate LNDEF*/
149 #define T1T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF
150 /* Min. len of NDEF to qualify as LNDEF  */
151 
152 /* Type 1 Tag Commands (7 bits) */
153 /* read id                                      */
154 #define T1T_CMD_RID 0x78
155 /* read all bytes                               */
156 #define T1T_CMD_RALL 0x00
157 /* read (1 byte)                                */
158 #define T1T_CMD_READ 0x01
159 /* write with erase (1 byte)                    */
160 #define T1T_CMD_WRITE_E 0x53
161 /* write no erase (1 byte)                      */
162 #define T1T_CMD_WRITE_NE 0x1A
163 /* dynamic memory only */
164 /* read segment                                 */
165 #define T1T_CMD_RSEG 0x10
166 /* read (8 byte)                                */
167 #define T1T_CMD_READ8 0x02
168 /* write with erase (8 byte)                    */
169 #define T1T_CMD_WRITE_E8 0x54
170 /* write no erase (8 byte)                      */
171 #define T1T_CMD_WRITE_NE8 0x1B
172 
173 /* Lock */
174 /* Number of static lock bytes in tag   */
175 #define T1T_NUM_STATIC_LOCK_BYTES 2
176 /* Bytes locked by one static lock bit  */
177 
178 /* Type 2 Tag related definitions */
179 #define T2T_STATIC_SIZE 64
180 #define T2T_BLOCK_SIZE 4
181 #define T2T_HEADER_SIZE 16
182 #define T2T_SECTOR_SIZE 1024
183 #define T2T_BLOCKS_PER_SECTOR 0x100
184 
185 #define T2T_UID_LEN 4        /* the len of UID used in T2T tag */
186 /* the len of Serial number used in T2T tag */
187 #define T2T_INTERNAL_BYTES_LEN 2 /* the len of internal used in T2T tag */
188 /* Static Lock Bytes */
189 #define T2T_STATIC_LOCK0 0x0A /* Static Lock 0 offset */
190 #define T2T_STATIC_LOCK1 0x0B /* Static Lock 1 offset */
191 
192 /* Capability Container definitions */
193 #define T2T_CC_BLOCK 0x03     /* Capability container block */
194 #define T2T_CC0_NMN_BYTE 0x0C /* NDEF Magic Number byte number */
195 #define T2T_CC1_VNO_BYTE 0x0D /* Version Number byte number*/
196 #define T2T_CC2_TMS_BYTE 0x0E /* Tag Memory Size byte number */
197 #define T2T_CC3_RWA_BYTE 0x0F /* Read Write Access byte number */
198 
199 #define T2T_CC0_NMN 0xE1        /* NDEF Magic Number */
200 #define T2T_CC1_VNO 0x11        /* Version Number */
201 #define T2T_CC1_LEGACY_VNO 0x10 /* Legacy Version Number */
202 #define T2T_CC1_NEW_VNO 0x12    /* Another supported Version Number */
203 #define T2T_CC2_TMS_STATIC 0x06 /* TMS static memory - (4 * (n+1)). */
204 #define T2T_CC3_RWA_RW 0x00     /* RWA - Read/write allowed */
205 #define T2T_CC3_RWA_RO 0x0F     /* RWA - Read only */
206 
207 /* Factor to multiply to get tag data size from TMS */
208 #define T2T_TMS_TAG_FACTOR 0x08
209 /* Bytes locked per lock bit of default locks */
210 #define T2T_DEFAULT_LOCK_BLPB 0x08
211 
212 /* Type 2 Tag Commands  */
213 #define T2T_CMD_READ 0x30    /* read  4 blocks (16 bytes) */
214 #define T2T_CMD_WRITE 0xA2   /* write 1 block  (4 bytes)  */
215 #define T2T_CMD_SEC_SEL 0xC2 /* Sector select             */
216 #define T2T_RSP_ACK 0xA
217 
218 #define T2T_STATUS_OK_1_BIT 0x11
219 #define T2T_STATUS_OK_7_BIT 0x17
220 
221 #define T2T_FIRST_DATA_BLOCK 4
222 #define T2T_READ_BLOCKS 4
223 #define T2T_BLOCK_LEN 4
224 #define T2T_READ_DATA_LEN (T2T_BLOCK_LEN * T2T_READ_BLOCKS)
225 #define T2T_WRITE_DATA_LEN 4
226 
227 /* Type 2 TLV definitions */
228 /* May be used for padding. SHALL ignore this */
229 #define T2T_TLV_TYPE_LOCK_CTRL 1      /* Defines details of the lock bytes */
230 
231 /* Tag len for LOCK_CTRL TLV per spec */
232 #define T2T_TLEN_LOCK_CTRL_TLV 3
233 
234 /* Maximum number of sectors supported */
235 #if (APPL_DTA_MODE == TRUE)
236 #define T2T_MAX_SECTOR 3
237 #else
238 #define T2T_MAX_SECTOR 2
239 #endif
240 /* Tlv type identifier len                */
241 #define T2T_TLV_TYPE_LEN 1
242 
243 /* Length Field size of short NDEF Message    */
244 #define T2T_SHORT_NDEF_LEN_FIELD_LEN 1
245 /* Length Field size of Long NDEF Message     */
246 #define T2T_LONG_NDEF_LEN_FIELD_LEN 3
247 /* Byte 0 in Length field to indicate LNDEF*/
248 #define T2T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF
249 /* Min. len of NDEF to qualify as LNDEF  */
250 #define T2T_LONG_NDEF_MIN_LEN 0x00FF
251 
252 /* Lock */
253 /* Number of static lock bytes in tag   */
254 #define T2T_NUM_STATIC_LOCK_BYTES 2
255 
256 /*
257 **
258 **  Type 3 Tag Definitions
259 **
260 */
261 
262 #define T3T_SYSTEM_CODE_NDEF 0x12FC /* System Code for NDEF tags */
263 /* System Code for felica-lite tags */
264 #define T3T_SYSTEM_CODE_FELICA_LITE 0x88B4
265 #define T3T_MAX_SYSTEM_CODES 16
266 /* Maximum number of blocks for NDEF message for Felica Lite tags */
267 #define T3T_FELICALITE_NMAXB 13
268 
269 /* Block descriptor, used to describe a block to check/update */
270 typedef struct {
271   uint16_t service_code; /* Block service code. Set to T3T_SERVICE_CODE_NDEF
272                             (0x000B) for NDEF data */
273   uint16_t block_number; /* Block number */
274 } tT3T_BLOCK_DESC;
275 
276 /* Poll RC (request code) definitions */
277 #define T3T_POLL_RC_SC 1   /* System code requested in SENSF_RES */
278 typedef uint8_t tT3T_POLL_RC;
279 
280 /* Definitions for constructing t3t command messages */
281 
282 /* NFC Forum / Felica commands */
283 #define T3T_MSG_OPC_CHECK_CMD 0x06
284 #define T3T_MSG_OPC_CHECK_RSP 0x07
285 #define T3T_MSG_OPC_UPDATE_CMD 0x08
286 #define T3T_MSG_OPC_UPDATE_RSP 0x09
287 
288 /* Felica commands (not specified in NFC-Forum Type 3 tag specifications) */
289 #define T3T_MSG_OPC_POLL_CMD 0x00
290 #define T3T_MSG_OPC_POLL_RSP 0x01
291 #define T3T_MSG_OPC_REQ_SERVICE_CMD 0x02
292 #define T3T_MSG_OPC_REQ_RESPONSE_CMD 0x04
293 #define T3T_MSG_OPC_REQ_RESPONSE_RSP 0x05
294 #define T3T_MSG_OPC_REQ_SYSTEMCODE_CMD 0x0C
295 #define T3T_MSG_OPC_REQ_SYSTEMCODE_RSP 0x0D
296 
297 /* Service code: read-only NDEF */
298 #define T3T_MSG_NDEF_SC_RO 0x000B
299 /* Service code: read/write NDEF */
300 #define T3T_MSG_NDEF_SC_RW 0x0009
301 #define T3T_MSG_NDEF_VERSION 0x10 /* NDEF Mapping Version 1.0 */
302 #define T3T_MSG_NDEF_WRITEF_OFF 0x00
303 #define T3T_MSG_NDEF_WRITEF_ON 0x0F
304 #define T3T_MSG_NDEF_RWFLAG_RO 0x00
305 #define T3T_MSG_NDEF_RWFLAG_RW 0x01
306 /* Size of NDEF attribute info block (minus checksum) */
307 #define T3T_MSG_NDEF_ATTR_INFO_SIZE 14
308 
309 /* len flag for Block List Element */
310 #define T3T_MSG_MASK_TWO_BYTE_BLOCK_DESC_FORMAT 0x80
311 /* service code list mask */
312 #define T3T_MSG_SERVICE_LIST_MASK 0x0F
313 #define T3T_MSG_SERVICE_LIST_MAX 16
314 
315 /* Max Number of Blocks per UPDATE command */
316 #define T3T_MSG_NUM_BLOCKS_UPDATE_MAX 13
317 /* Max Number of Blocks per CHECK command */
318 #define T3T_MSG_NUM_BLOCKS_CHECK_MAX 15
319 
320 /* Data block size for UPDATE and CHECK commands */
321 #define T3T_MSG_BLOCKSIZE 16
322 
323 /* Common header definitions for T3t commands */
324 /* Common header: SoD + cmdcode + NFCID2 + num_services */
325 #define T3T_MSG_CMD_COMMON_HDR_LEN 11
326 
327 /* Common header definition for T3t responses */
328 /* Common header: rspcode + NFCID2 + StatusFlag1 + StatusFlag2  */
329 #define T3T_MSG_RSP_COMMON_HDR_LEN 11
330 /* Offset for Response code */
331 #define T3T_MSG_RSP_OFFSET_RSPCODE 0
332 /* Offset for Manufacturer ID */
333 #define T3T_MSG_RSP_OFFSET_IDM 1
334 /* Offset for Status Flag1 */
335 #define T3T_MSG_RSP_OFFSET_STATUS1 9
336 /* Offset for NumberOfBlocks (in CHECK response) */
337 #define T3T_MSG_RSP_OFFSET_NUMBLOCKS 11
338 /* Offset for Block Data (in CHECK response) */
339 #define T3T_MSG_RSP_OFFSET_CHECK_DATA 12
340 
341 #define T3T_MSG_RSP_STATUS_OK 0x00
342 #define T3T_MSG_RSP_STATUS_ERROR 0x01
343 
344 #define T3T_MSG_RSP_STATUS2_ERROR_MEMORY 0x70
345 #define T3T_MSG_RSP_STATUS2_ERROR_PROCESSING 0xFF
346 
347 
348 /* Felica Lite defintions */
349 /* Block ID for MC (memory configuration)                       */
350 #define T3T_MSG_FELICALITE_BLOCK_ID_MC 0x88
351 
352 /* Memory Configuration Block offset: MC_SP (Memory Configuration for scratch
353  * pad)   */
354 #define T3T_MSG_FELICALITE_MC_OFFSET_MC_SP 0x00
355 /* Memory Configuration Block offset: SYS_OP (System Option) */
356 #define T3T_MSG_FELICALITE_MC_OFFSET_SYS_OP 0x03
357 /* Memory Configuration Block offset: RF_PRM (Memory Configuration for RF
358  * Parameter) */
359 #define T3T_MSG_FELICALITE_MC_OFFSET_RF_PRM 0x04
360 
361 /*
362 **
363 **  Type 4 Tag Definitions
364 **
365 */
366 #define T4T_CMD_MIN_HDR_SIZE 4 /* CLA, INS, P1, P2 */
367 #define T4T_CMD_MAX_HDR_SIZE 5 /* CLA, INS, P1, P2, Lc */
368 
369 /* CLA, INS, P1, P2, Data ODO */
370 #define T4T_CMD_MIN_EXT_HDR_SIZE 9
371 /* CLA, INS, P1, P2, Lc, Data ODO, Le
372  * with Lc and Le coded using Extended Field Coding */
373 #define T4T_CMD_MAX_EXT_HDR_SIZE 15
374 
375 #define T4T_VERSION_3_0 0x30 /* version 3.0 */
376 #define T4T_VERSION_2_0 0x20 /* version 2.0 */
377 #define T4T_VERSION_1_0 0x10 /* version 1.0 */
378 #define T4T_MY_VERSION T4T_VERSION_3_0
379 #define T4T_GET_MAJOR_VERSION(x) ((x) >> 4)
380 
381 #define T4T_CMD_CLASS 0x00
382 #define T4T_CMD_INS_SELECT 0xA4
383 #define T4T_CMD_INS_READ_BINARY 0xB0
384 #define T4T_CMD_INS_UPDATE_BINARY 0xD6
385 #define T4T_CMD_INS_READ_BINARY_ODO 0xB1
386 #define T4T_CMD_INS_UPDATE_BINARY_ODO 0xD7
387 #define T4T_CMD_DES_CLASS 0x90
388 #define T4T_CMD_INS_GET_HW_VERSION 0x60
389 #define T4T_CMD_CREATE_AID 0xCA
390 #define T4T_CMD_SELECT_APP 0x5A
391 #define T4T_CMD_CREATE_DATAFILE 0xCD
392 #define T4T_CMD_DES_WRITE 0x3D
393 #define T4T_CMD_P1_SELECT_BY_NAME 0x04
394 #define T4T_CMD_P1_SELECT_BY_FILE_ID 0x00
395 #define T4T_CMD_P2_FIRST_OR_ONLY_00H 0x00
396 #define T4T_CMD_P2_FIRST_OR_ONLY_0CH 0x0C
397 
398 /* Max number of bytes to be read from file in ReadBinary Command */
399 #define T4T_MAX_LENGTH_LE 0xFF
400 /* Max number of bytes written to NDEF file in UpdateBinary Command */
401 #define T4T_MAX_LENGTH_LC 0xFF
402 
403 #define T4T_RSP_STATUS_WORDS_SIZE 0x02
404 
405 #define T4T_RSP_CMD_CMPLTED 0x9000
406 #define T4T_RSP_NOT_FOUND 0x6A82
407 #define T4T_RSP_WRONG_PARAMS 0x6B00
408 #define T4T_RSP_CLASS_NOT_SUPPORTED 0x6E00
409 #define T4T_RSP_WRONG_LENGTH 0x6700
410 #define T4T_RSP_INSTR_NOT_SUPPORTED 0x6D00
411 #define T4T_RSP_CMD_NOT_ALLOWED 0x6986
412 
413 /* V1.0 Type 4 Tag Applicaiton ID length */
414 #define T4T_V10_NDEF_TAG_AID_LEN 0x07
415 /* V2.0 Type 4 Tag Applicaiton ID length */
416 #define T4T_V20_NDEF_TAG_AID_LEN 0x07
417 
418 /* Min of Max R-APDU data size */
419 #define T4T_MIN_MLE 0x000F
420 
421 #define T4T_FILE_ID_SIZE 0x02
422 #define T4T_CC_FILE_ID 0xE103
423 #define T4T_CC_FILE_MIN_LEN 0x000F
424 
425 #define T4T_VERSION_OFFSET_IN_CC 0x02
426 #define T4T_FC_TLV_OFFSET_IN_CC 0x07
427 /* size of T(1),L(1),V(8) for extended NDEF file control */
428 #define T4T_ENDEF_FC_V_FIELD_OFFSET 0x09
429 /* Offset of Write access byte from type field in CC */
430 #define T4T_FC_WRITE_ACCESS_OFFSET_IN_TLV 0x07
431 
432 #define T4T_NDEF_FILE_CONTROL_TYPE 0x04 /* NDEF File Control Type */
433 
434 /* size of T(1),L(1),V(6) for file control */
435 #define T4T_FILE_CONTROL_TLV_SIZE 0x08
436 /* size of V(6) for file control */
437 #define T4T_FILE_CONTROL_LENGTH 0x06
438 
439 #define T4T_ENDEF_FILE_CONTROL_TYPE 0x06 /* Extended NDEF File Control Type */
440 /* size of T(1),L(1),V(8) for extended NDEF file control */
441 #define T4T_ENDEF_FILE_CONTROL_TLV_SIZE 0x0A
442 /* size of V(8) for extended NDEF file control */
443 #define T4T_ENDEF_FILE_CONTROL_LENGTH 0x08
444 
445 /* read access granted without any security */
446 #define T4T_FC_READ_ACCESS 0x00
447 /* no read access granted at all */
448 #define T4T_FC_NO_READ_ACCESS 0xFF
449 /* proprietary read access range start */
450 #define T4T_FC_READ_ACCESS_PROP_START 0x80
451 /* write access granted without any security */
452 #define T4T_FC_WRITE_ACCESS 0x00
453 /* proprietary write access range start */
454 #define T4T_FC_WRITE_ACCESS_PROP_START 0x80
455 /* no write access granted at all (read-only) */
456 #define T4T_FC_NO_WRITE_ACCESS 0xFF
457 
458 #define T4T_FILE_LENGTH_SIZE 0x02
459 #define T4T_EFILE_LENGTH_SIZE 0x04
460 #define T4T_ADDI_FRAME_RESP 0xAFU
461 #define T4T_DES_GET_VERSION_LEN 0x09
462 #define T4T_SIZE_IDENTIFIER_2K 0x16U
463 #define T4T_SIZE_IDENTIFIER_4K 0x18U
464 #define T4T_SIZE_IDENTIFIER_8K 0x1AU
465 #define T4T_DESEV1_MAJOR_VERSION 0x01U
466 #define T4T_TYPE_DESFIRE_EV1 0x01U
467 #define T4T_DESEV0_MAJOR_VERSION 0x00U
468 #define T4T_DESEV0_MINOR_VERSION 0x06U
469 #define T4T_DES_EV1_NFC_APP_ID 0x010000
470 #define T4T_DES_EV0_NFC_APP_ID 0x10EEEE
471 
472 /*  Mifare Classic Tag Definitions */
473 #define MFC_UID_LEN 4
474 
475 /*
476 **
477 **  ISO 15693 Tag Definitions
478 **
479 */
480 
481 #define I93_VERSION_1_x 0x40 /* major mapping version 1.x */
482 
483 /* A single sub-carrier frequency shall be used by VICC */
484 #define I93_FLAG_SUB_CARRIER_SINGLE 0x00
485 
486 /* High data rate shall be used */
487 #define I93_FLAG_DATA_RATE_HIGH 0x02
488 
489 /* Flags 5 to 8 meaning is according to table 5 */
490 #define I93_FLAG_INVENTORY_SET 0x04
491 
492 /* No protocol format extension                         */
493 #define I93_FLAG_PROT_EXT_NO 0x00
494 /* Protocol format is extended. Reserved for future use */
495 #define I93_FLAG_PROT_EXT_YES 0x08
496 
497 /* Request is addressed with AMS (Address Mode Selector). UID field is included.
498  * It shall be executed only by VICC */
499 #define I93_FLAG_ADDRESS_SET 0x20
500 /* whose UID matches the UID specified in the request */
501 /* Request is addressed with SMS (Select Mode Selector). UID field is included
502  * or not.  It shall be executed by the unique VICC to be in SELECTED state */
503 #define I93_FLAG_SELECT_SET 0x10
504 
505 /* AFI field is present     */
506 #define I93_FLAG_AFI_PRESENT 0x10
507 
508 #define I93_FLAG_SLOT_ONE 0x20  /* 1 slot   */
509 
510 /* It shall be set to 0 if not otherwise defined by command */
511 /* Meaning is defined by the command description. */
512 #define I93_FLAG_OPTION_SET 0x40
513 
514 /* Error detected, Error code is in the "Error" field */
515 #define I93_FLAG_ERROR_DETECTED 0x01
516 
517 /* Response error code */
518 /* The command option is not supported                                   */
519 #define I93_ERROR_CODE_OPTION_NOT_SUPPORTED 0x03
520 /* The specific block is was not successfully programmed                 */
521 #define I93_ERROR_CODE_BLOCK_FAIL_TO_WRITE 0x13
522 /* The specific block is was not successfully locked                     */
523 
524 /* UID length in bytes                  */
525 #define I93_UID_BYTE_LEN 8
526 /* Data Storage Format is not supported */
527 #define I93_DFS_UNSUPPORTED 0x00
528 /* Block is locked                      */
529 #define I93_BLOCK_LOCKED 0x01
530 
531 /* ISO 15693 Mandatory commands */
532 #define I93_CMD_INVENTORY 0x01  /* Inventory  */
533 #define I93_CMD_STAY_QUIET 0x02 /* Stay Quiet */
534 
535 /* ISO 15693 Optional commands */
536 #define I93_CMD_READ_SINGLE_BLOCK 0x20  /* Read single block     */
537 #define I93_CMD_EXT_READ_SINGLE_BLOCK 0x30 /* Extended Read single block */
538 #define I93_CMD_WRITE_SINGLE_BLOCK 0x21 /* Write single block    */
539 #define I93_CMD_EXT_WRITE_SINGLE_BLOCK 0x31 /* Extended Write single block */
540 #define I93_CMD_LOCK_BLOCK 0x22         /* Lock block            */
541 #define I93_CMD_EXT_LOCK_BLOCK 0x32     /* Extended Lock block            */
542 #define I93_CMD_READ_MULTI_BLOCK 0x23   /* Read multiple blocks  */
543 #define I93_CMD_EXT_READ_MULTI_BLOCK 0x33 /* Extended Read multiple blocks  */
544 #define I93_CMD_WRITE_MULTI_BLOCK 0x24  /* Write multiple blocks */
545 #define I93_CMD_EXT_WRITE_MULTI_BLOCK 0x34 /* Write multiple blocks */
546 #define I93_CMD_SELECT 0x25             /* Select                */
547 #define I93_CMD_RESET_TO_READY 0x26     /* Reset to ready        */
548 #define I93_CMD_WRITE_AFI 0x27          /* Wreite AFI            */
549 #define I93_CMD_LOCK_AFI 0x28           /* Lock AFI              */
550 #define I93_CMD_WRITE_DSFID 0x29        /* Write DSFID           */
551 #define I93_CMD_LOCK_DSFID 0x2A         /* Lock DSFID            */
552 /* Get system information             */
553 #define I93_CMD_GET_SYS_INFO 0x2B
554 /* Get extended system information    */
555 #define I93_CMD_EXT_GET_SYS_INFO 0x3B
556 /* Get multiple block security status */
557 #define I93_CMD_GET_MULTI_BLK_SEC 0x2C
558 /* Get extended multiple block security status */
559 #define I93_CMD_EXT_GET_MULTI_BLK_SEC 0x3C
560 #define I93_CMD_SET_ADDR_MODE 0x3D /* Set address mode            */
561 
562 /* Information flags definition */
563 /* DSFID is supported and DSFID field is present */
564 #define I93_INFO_FLAG_DSFID 0x01
565 /* DSFID info length */
566 #define I93_INFO_DSFID_LEN 0x01
567 /* AFI is supported and AFI field is present     */
568 #define I93_INFO_FLAG_AFI 0x02
569 /* AFI info length */
570 #define I93_INFO_AFI_LEN 0x01
571 /* VICC memory size field is present             */
572 #define I93_INFO_FLAG_MEM_SIZE 0x04
573 /* block size info length */
574 #define I93_INFO_BLOCK_SIZE_LEN 0x01
575 /* 8bit num of blocks info length */
576 #define I93_INFO_8BIT_NUM_BLOCK_LEN 0x01
577 /* 16bit num of blocks info length */
578 #define I93_INFO_16BIT_NUM_BLOCK_LEN 0x02
579 /* IC reference field is present                 */
580 #define I93_INFO_FLAG_IC_REF 0x08
581 /* IC ref info length */
582 #define I93_INFO_IC_REF_LEN 0x01
583 /* Memory coded in 2 bytes address               */
584 #define I93_INFO_FLAG_MOI 0x10
585 
586 /* Max block size in bytes */
587 #define I93_MAX_BLOCK_LENGH 32
588 
589 /* Block lengths */
590 #define I93_BLEN_4BYTES 0x04
591 #define I93_BLEN_8BYTES 0x08
592 #define I93_BLEN_16BYTES 0x10
593 #define I93_BLEN_32BYTES 0x20
594 /* ICODE Capability Container(CC) definition */
595 #define I93_ICODE_CC_MAGIC_NUMER_E1 0xE1 /* magic number in CC[0]  */
596 #define I93_ICODE_CC_MAGIC_NUMER_E2 0xE2 /* magic number in CC[0]  */
597 /* read access condition in CC[1]        */
598 #define I93_ICODE_CC_READ_ACCESS_MASK 0x0C
599 /* read access granted without security  */
600 #define I93_ICODE_CC_READ_ACCESS_GRANTED 0x00
601 /* write access condition in CC[1]       */
602 #define I93_ICODE_CC_WRITE_ACCESS_MASK 0x03
603 /* write access granted without security */
604 #define I93_ICODE_CC_WRITE_ACCESS_GRANTED 0x00
605 /* write access not granted at all       */
606 #define I93_ICODE_CC_READ_ONLY 0x03
607 /* read multi block supported in CC[3]   */
608 #define I93_ICODE_CC_MBREAD_MASK 0x01
609 /* inventory page read supported in CC[3] */
610 #define I93_ICODE_CC_IPREAD_MASK 0x02
611 /* More than 2040 bytes are supported in CC[3] */
612 #define I93_STM_CC_OVERFLOW_MASK 0x04
613 #define I93_ONS_CC_OVERFLOW_MASK 0x04
614 /* Special Frame are supported in CC[3] */
615 #define I93_ICODE_CC_SPECIAL_FRAME_MASK 0x10
616 
617 /* ICODE TLV type */
618 #define I93_ICODE_TLV_TYPE_NULL 0x00 /* NULL TLV         */
619 #define I93_ICODE_TLV_TYPE_NDEF 0x03 /* NDEF message TLV */
620 #define I93_ICODE_TLV_TYPE_PROP 0xFD /* Proprietary TLV  */
621 #define I93_ICODE_TLV_TYPE_TERM 0xFE /* Terminator TLV   */
622 
623 /* UID Coding (UID Bit 64-57), First byte of ISO 15693 UID */
624 #define I93_UID_FIRST_BYTE 0xE0
625 
626 /* UID Coding (UID Bit 56-49), IC manufacturer code */
627 #define I93_UID_IC_MFG_CODE_STM 0x02
628 #define I93_UID_IC_MFG_CODE_NXP 0x04
629 #define I93_UID_IC_MFG_CODE_TI 0x07
630 #define I93_UID_IC_MFG_CODE_ONS 0x67
631 
632 /* NXP, UID Coding of ICODE type (UID Bit 48-41) */
633 /* ICODE SLI, SLIX     */
634 #define I93_UID_ICODE_SLI 0x01
635 /* ICODE SLI-S, SLIX-S */
636 #define I93_UID_ICODE_SLI_S 0x02
637 /* ICODE SLI-L, SLIX-L */
638 #define I93_UID_ICODE_SLI_L 0x03
639 
640 /* IC Reference for ICODE SLI-L */
641 #define I93_IC_REF_ICODE_SLI_L 0x03
642 /* read multi block supported check bit */
643 #define I93_ICODE_IC_REF_MBREAD_MASK 0x02
644 
645 /* TI, UID Coding of product version (UID Bit 48-42) */
646 /* upper 7 bits                     */
647 #define I93_UID_TAG_IT_HF_I_PRODUCT_ID_MASK 0xFE
648 /* Tag-it HF-I Plus Inlay           */
649 #define I93_UID_TAG_IT_HF_I_PLUS_INLAY 0x00
650 /* Tag-it HF-I Plus Chip            */
651 #define I93_UID_TAG_IT_HF_I_PLUS_CHIP 0x80
652 /* Tag-it HF-I Standard Chip/Inlyas */
653 #define I93_UID_TAG_IT_HF_I_STD_CHIP_INLAY 0xC0
654 /* Tag-it HF-I Pro Chip/Inlyas      */
655 #define I93_UID_TAG_IT_HF_I_PRO_CHIP_INLAY 0xC4
656 
657 #define I93_TAG_IT_HF_I_STD_CHIP_INLAY_NUM_TOTAL_BLK 11
658 #define I93_TAG_IT_HF_I_PRO_CHIP_INLAY_NUM_TOTAL_BLK 12
659 
660 #define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_BLK_SIZE 4
661 #define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_NUM_USER_BLK 8
662 /* LSB in Block 0x0A */
663 #define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_AFI_LOCATION 40
664 
665 /* STM, product version (IC manufacturer code) */
666 /* IC Reference mask for STM */
667 #define I93_IC_REF_STM_MASK 0xFC
668 /* IC Reference for LRI1K:      010000xx(b), blockSize: 4, numberBlocks: 0x20 */
669 #define I93_IC_REF_STM_LRI1K 0x40
670 /* IC Reference for LRI2K:      001000xx(b), blockSize: 4, numberBlocks: 0x40 */
671 #define I93_IC_REF_STM_LRI2K 0x20
672 /* IC Reference for LRIS2K:     001010xx(b), blockSize: 4, numberBlocks: 0x40 */
673 #define I93_IC_REF_STM_LRIS2K 0x28
674 /* IC Reference for LRIS64K:    010001xx(b), blockSize: 4, numberBlocks: 0x800
675  */
676 #define I93_IC_REF_STM_LRIS64K 0x44
677 /* IC Reference for M24LR64-R:  001011xx(b), blockSize: 4, numberBlocks: 0x800
678  */
679 #define I93_IC_REF_STM_M24LR64_R 0x2C
680 /* IC Reference for M24LR04E-R: 01011010(b), blockSize: 4, numberBlocks: 0x80 */
681 #define I93_IC_REF_STM_M24LR04E_R 0x5A
682 /* IC Reference for M24LR16E-R: 01001110(b), blockSize: 4, numberBlocks: 0x200
683  */
684 #define I93_IC_REF_STM_M24LR16E_R 0x4E
685 /* IC Reference for M24LR16D-W: 01001101(b), blockSize: 4, numberBlocks: 0x200
686  */
687 #define I93_IC_REF_STM_M24LR16D_W 0x4D
688 /* IC Reference for M24LR64D-W: 01011110(b), blockSize: 4, numberBlocks: 0x800
689  */
690 #define I93_IC_REF_STM_M24LR64E_R 0x5E
691 /* IC Reference for ST25DV04K: 00100100(b), blockSize: 4, numberBlocks: 0x80
692  */
693 #define I93_IC_REF_STM_ST25DV04K 0x24
694 /* IC Reference for ST25DVHIK: 00100110(b), blockSize: 4, numberBlocks: 0x800
695  * or 0x200
696  */
697 #define I93_IC_REF_STM_ST25DVHIK 0x26
698 
699 /* ONS, product version (IC manufacturer code) */
700 /* IC Reference for N36RW02:  00011010(b), blockSize: 4, numberBlocks: 0x40 */
701 #define I93_IC_REF_ONS_N36RW02  0x1A
702 /* IC Reference for N24RF04:  00101010(b), blockSize: 4, numberBlocks: 0x80 */
703 #define I93_IC_REF_ONS_N24RF04  0x2A
704 /* IC Reference for N24RF04E: 00101110(b), blockSize: 4, numberBlocks: 0x80 */
705 #define I93_IC_REF_ONS_N24RF04E 0x2E
706 /* IC Reference for N24RF16:  01001010(b), blockSize: 4, numberBlocks: 0x200 */
707 #define I93_IC_REF_ONS_N24RF16  0x4A
708 /* IC Reference for N24RF16E: 01001110(b), blockSize: 4, numberBlocks: 0x200 */
709 #define I93_IC_REF_ONS_N24RF16E 0x4E
710 /* IC Reference for N24RF64:  01101010(b), blockSize: 4, numberBlocks: 0x800 */
711 #define I93_IC_REF_ONS_N24RF64  0x6A
712 /* IC Reference for N24RF64E: 01101110(b), blockSize: 4, numberBlocks: 0x800 */
713 #define I93_IC_REF_ONS_N24RF64E 0x6E
714 
715 #define I93_STM_BLOCKS_PER_SECTOR 32
716 #define I93_STM_MAX_BLOCKS_PER_READ 32
717 
718 #define I93_ONS_BLOCKS_PER_SECTOR 32
719 #define I93_ONS_MAX_BLOCKS_PER_READ 32
720 
721 #endif /* TAGS_DEFS_H */