1 #ifndef _RFID_ISO15693_H
2 #define _RFID_ISO15693_H
7 * ISO15693 tag manufacturer codes as found at
8 * http://rfid-handbook.de/forum/read.php?5,437,580#msg-580
11 * 02h = ST Microelectronics
13 * 04h = Philips/NXP I.CODE
14 * 05h = Siemens/Infineon
16 * 07h = Texas Instruments TagIt
17 * 08h = Fujitsu Limited
18 * 09h = Mashushita Electric Industrial
22 * 0Dh = Mishubishi Electric
23 * 0Eh = Samsung Electronics
24 * 0Fh = Hyundai Electronics
25 * 10h = LG Semiconductors
26 * 16h = EMarin Microelectronic
30 /* protocol definitions */
32 struct iso15693_handle {
34 unsigned int vcd_ask100:1,
40 u_int8_t afi; /* appplication family identifier */
41 u_int8_t dsfid; /* data storage format identifier */
44 enum rfid_15693_state {
47 ISO15693_STATE_ANTICOL_RUNNING,
51 RFID_OPT_15693_MOD_DEPTH = 0x00010001,
52 RFID_OPT_15693_VCD_CODING = 0x00010002,
53 RFID_OPT_15693_VICC_SUBC = 0x00010003,
54 RFID_OPT_15693_VICC_SPEED = 0x00010004,
55 RFID_OPT_15693_VCD_SLOTS = 0x00010005,
56 RFID_OPT_15693_USE_AFI = 0x00010006,
57 RFID_OPT_15693_AFI = 0x00010007,
58 RFID_OPT_15693_DSFID = 0x00010008,
61 enum rfid_15693_opt_mod_depth {
62 RFID_15693_MOD_10ASK = 0x01,
63 RFID_15693_MOD_100ASK = 0x02,
66 enum rfid_15693_opt_vcd_coding {
67 RFID_15693_VCD_CODING_1OUT256 = 0x01,
68 RFID_15693_VCD_CODING_1OUT4 = 0x02,
71 enum rfid_15693_opt_vicc_subc {
72 RFID_15693_VICC_SUBC_SINGLE = 0x01,
73 RFID_15693_VICC_SUBC_DUAL = 0x02,
76 enum rfid_15693_opt_vicc_speed {
77 RFID_15693_VICC_SPEED_SLOW = 0x01,
78 RFID_15693_VICC_SPEED_FAST = 0x02,
83 #define ISO15693_UID_LEN 8
84 #define ISO15693_CRC_LEN 2
86 /* ISO 15693-3, Ch. 7.2 Table 3 */
87 enum iso15693_request_flags {
88 RFID_15693_F_SUBC_TWO = 0x01,
89 RFID_15693_F_RATE_HIGH = 0x02,
90 RFID_15693_F_INV_TABLE_5 = 0x04,
91 RFID_15693_F_PROT_OEXT = 0x08,
94 /* ISO 15693-3, Ch. 7.2 Table 4 */
95 enum iso15693_request_flags_table4 {
96 RFID_15693_F4_SELECTED = 0x10, /* only VICC in 'select' state */
97 RFID_15693_F4_ADDRESS = 0x20, /* request is addressed */
98 RFID_15693_F4_CUSTOM = 0x40,
101 /* ISO 15693-3, Ch. 7.2 Table 5 */
102 enum iso15693_request_flags_table5 {
103 RFID_15693_F5_AFI_PRES = 0x10, /* AFI is present */
104 RFID_15693_F5_NSLOTS_1 = 0x20, /* only 1 slot (instead of 16) */
105 RFID_15693_F5_CUSTOM = 0x40,
108 /* ISO 15963-3, Ch. 7.2 Figure 4 */
109 struct iso15693_request {
113 } __attribute__ ((packed));
115 /* ISO 15963-3, Ch. 7.2 Figure 5 */
116 struct iso15693_response {
119 } __attribute__ ((packed));
121 /* ISO 15693, Ch. 7.3 Table 6 */
122 enum iso15693_response_flags {
123 RFID_15693_RF_ERROR = 0x01,
124 RFID_15693_RF_EXTENDED = 0x08,
127 /* ISO 15693, Ch. 7.3.2 Table 7 */
128 enum iso15693_response_errors {
129 RFID_15693_ERR_NOTSUPP = 0x01,
130 RFID_15693_ERR_INVALID = 0x02, /* command not recognized */
131 RFID_15693_ERR_UNKNOWN = 0x0f, /* unknown error */
132 RFID_15693_ERR_BLOCK_NA = 0x10, /* block not available */
133 RFID_15693_ERR_BLOCK_LOCKED = 0x11,
134 RFID_15693_ERR_BLOCK_LOCKED_CH = 0x12,
135 RFID_15693_ERR_BLOCK_NOTPROG = 0x13,
136 RFID_15693_ERR_BLOCK_NOTLOCK = 0x14,
137 /* 0xA0 .. 0xDF Custom Command error Codes */
140 /* ISO 15693, Ch. 7.4 */
141 enum iso15693_vicc_states {
142 RFID_15693_STATE_POWER_OFF,
143 RFID_15693_STATE_READY,
144 RFID_15693_STATE_QUIET,
145 RFID_15693_STATE_SELECTED,
148 /* ISO 15693, Ch. 9.1 Table 10*/
149 enum iso15693_commands {
150 /* Mandatory 0x01 .. 0x1f */
151 ISO15693_CMD_INVENTORY = 0x01,
152 ISO15693_CMD_STAY_QUIET = 0x02,
153 /* Optional 0x20 .. 0x9f */
154 ISO15693_CMD_READ_BLOCK_SINGLE = 0x20,
155 ISO15693_CMD_WRITE_BLOCK_SINGLE = 0x21,
156 ISO15693_CMD_LOCK_BLOCK = 0x22,
157 ISO15693_CMD_READ_BLOCK_MULTI = 0x23,
158 ISO15693_CMD_WRITE_BLOCK_MULTI = 0x24,
159 ISO15693_CMD_SELECT = 0x25,
160 ISO15693_CMD_RESET_TO_READY = 0x26,
161 ISO15693_CMD_WRITE_AFI = 0x27,
162 ISO15693_CMD_LOCK_AFI = 0x28,
163 ISO15693_CMD_WRITE_DSFID = 0x29,
164 ISO15693_CMD_LOCK_DSFID = 0x2a,
165 ISO15693_CMD_GET_SYSINFO = 0x2b,
166 ISO15693_CMD_GET_BLOCK_SECURITY = 0x2c,
167 /* Custom 0xa0 .. 0xdf */
168 ICODE_CMD_INVENTORY_READ = 0xa0,
169 ICODE_CMD_FAST_INVENTORY_READ = 0xa1,
170 ICODE_CMD_EAS_SET = 0xa2,
171 ICODE_CMD_EAS_RESET = 0xa3,
172 ICODE_CMD_EAS_LOCK = 0xa4,
173 ICODE_CMD_EAS_ALARM = 0xa5,
174 /* Proprietary 0xe0 .. 0xff */
177 struct iso15693_anticol_cmd {
178 struct iso15693_request req;
179 unsigned char mask_len;
180 unsigned char mask_bits[ISO15693_UID_LEN];
181 unsigned char current_slot;
182 } __attribute__((packed));
184 struct iso15693_anticol_cmd_afi {
185 struct iso15693_request req;
187 unsigned char mask_len;
188 unsigned char mask_bits[ISO15693_UID_LEN];
189 } __attribute__((packed));
191 /* Figure 11, Chapter 9.2.1 */
192 struct iso15693_anticol_resp {
193 struct iso15693_response resp;
195 u_int8_t uuid[ISO15693_UID_LEN];
196 } __attribute__((packed));
199 #define ISO15693_T_SLOW 0
200 #define ISO15693_T_FAST 1
209 /* in microseconds as per Chapter 8.4 table 8 */
210 extern const unsigned int iso15693_timing[2][5];
212 #include <librfid/rfid_layer2.h>
213 extern const struct rfid_layer2 rfid_layer2_iso15693;
215 #endif /* __LIBRFID__ */
216 #endif /* _ISO15693_H */