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 */
33 struct rfid_15693_handle;
35 struct rfid_layer2_15693t {
39 int (*init)(struct iso15693_handle *handle);
40 int (*fini)(struct iso15693_handle *handle);
43 int (*transceive_sf)(struct iso14443a_handle *handle,
45 struct iso14443a_atqa *atqa);
46 int (*transceive_acf)(struct iso14443a_handle *handle,
47 struct iso14443a_anticol_cmd *acf,
48 unsigned int *bit_of_col);
50 int (*transceive)(struct iso15693_handle *handle,
51 const unsigned char *tx_buf,
53 unsigned char *rx_buf,
54 unsigned int *rx_len);
62 struct iso15693_handle {
64 unsigned int ask100:1,
68 enum rfid_15693_state {
71 ISO15693_STATE_ANTICOL_RUNNING,
75 RFID_OPT_15693_MOD_DEPTH = 0x00010001,
76 RFID_OPT_15693_VCD_CODING = 0x00010002,
77 RFID_OPT_15693_VICC_SUBC = 0x00010003,
78 RFID_OPT_15693_VICC_SPEED = 0x00010004,
81 enum rfid_15693_opt_mod_depth {
82 RFID_15693_MOD_10ASK = 0x01,
83 RFID_15693_MOD_100ASK = 0x02,
86 enum rfid_15693_opt_vcd_coding {
87 RFID_15693_VCD_CODING_1OUT256 = 0x01,
88 RFID_15693_VCD_CODING_1OUT4 = 0x02,
91 enum rfid_15693_opt_vicc_subc {
92 RFID_15693_VICC_SUBC_SINGLE = 0x01,
93 RFID_15693_VICC_SUBC_DUAL = 0x02,
96 enum rfid_15693_opt_vicc_speed {
97 RFID_15693_VICC_SPEED_SLOW = 0x01,
98 RFID_15693_VICC_SPEED_FAST = 0x02,
103 #define ISO15693_UID_LEN 8
104 #define ISO15693_CRC_LEN 2
106 /* ISO 15693-3, Ch. 7.2 Table 3 */
107 enum iso15693_request_flags {
108 RFID_15693_F_SUBC_TWO = 0x01,
109 RFID_15693_F_RATE_HIGH = 0x02,
110 RFID_15693_F_INV_TABLE_5 = 0x04,
111 RFID_15693_F_PROT_OEXT = 0x08,
114 /* ISO 15693-3, Ch. 7.2 Table 4 */
115 enum iso15693_request_flags_table4 {
116 RFID_15693_F4_SELECTED = 0x10, /* only VICC in 'select' state */
117 RFID_15693_F4_ADDRESS = 0x20, /* request is addressed */
118 RFID_15693_F4_CUSTOM = 0x40,
121 /* ISO 15693-3, Ch. 7.2 Table 5 */
122 enum iso15693_request_flags_table5 {
123 RFID_15693_F5_AFI_PRES = 0x10, /* AFI is present */
124 RFID_15693_F5_NSLOTS_1 = 0x20, /* only 1 slot (instead of 16) */
125 RFID_15693_F5_CUSTOM = 0x40,
128 /* ISO 15963-3, Ch. 7.2 Figure 4 */
129 struct iso15693_request {
133 } __attribute__ ((packed));
135 /* ISO 15963-3, Ch. 7.2 Figure 5 */
136 struct iso15693_response {
139 } __attribute__ ((packed));
141 /* ISO 15693, Ch. 7.3 Table 6 */
142 enum iso15693_response_flags {
143 RFID_15693_RF_ERROR = 0x01,
144 RFID_15693_RF_EXTENDED = 0x08,
147 /* ISO 15693, Ch. 7.3.2 Table 7 */
148 enum iso15693_response_errors {
149 RFID_15693_ERR_NOTSUPP = 0x01,
150 RFID_15693_ERR_INVALID = 0x02, /* command not recognized */
151 RFID_15693_ERR_UNKNOWN = 0x0f, /* unknown error */
152 RFID_15693_ERR_BLOCK_NA = 0x10, /* block not available */
153 RFID_15693_ERR_BLOCK_LOCKED = 0x11,
154 RFID_15693_ERR_BLOCK_LOCKED_CH = 0x12,
155 RFID_15693_ERR_BLOCK_NOTPROG = 0x13,
156 RFID_15693_ERR_BLOCK_NOTLOCK = 0x14,
157 /* 0xA0 .. 0xDF Custom Command error Codes */
160 /* ISO 15693, Ch. 7.4 */
161 enum iso15693_vicc_states {
162 RFID_15693_STATE_POWER_OFF,
163 RFID_15693_STATE_READY,
164 RFID_15693_STATE_QUIET,
165 RFID_15693_STATE_SELECTED,
168 /* ISO 15693, Ch. 9.1 Table 10*/
169 enum iso15693_commands {
170 /* Mandatory 0x01 .. 0x1f */
171 ISO15693_CMD_INVENTORY = 0x01,
172 ISO15693_CMD_STAY_QUIET = 0x02,
173 /* Optional 0x20 .. 0x9f */
174 ISO15693_CMD_READ_BLOCK_SINGLE = 0x20,
175 ISO15693_CMD_WRITE_BLOCK_SINGLE = 0x21,
176 ISO15693_CMD_LOCK_BLOCK = 0x22,
177 ISO15693_CMD_READ_BLOCK_MULTI = 0x23,
178 ISO15693_CMD_WRITE_BLOCK_MULTI = 0x24,
179 ISO15693_CMD_SELECT = 0x25,
180 ISO15693_CMD_RESET_TO_READY = 0x26,
181 ISO15693_CMD_WRITE_AFI = 0x27,
182 ISO15693_CMD_LOCK_AFI = 0x28,
183 ISO15693_CMD_WRITE_DSFID = 0x29,
184 ISO15693_CMD_LOCK_DSFID = 0x2a,
185 ISO15693_CMD_GET_SYSINFO = 0x2b,
186 ISO15693_CMD_GET_BLOCK_SECURITY = 0x2c,
187 /* Custom 0xa0 .. 0xdf */
188 ICODE_CMD_INVENTORY_READ = 0xa0,
189 ICODE_CMD_FAST_INVENTORY_READ = 0xa1,
190 ICODE_CMD_EAS_SET = 0xa2,
191 ICODE_CMD_EAS_RESET = 0xa3,
192 ICODE_CMD_EAS_LOCK = 0xa4,
193 ICODE_CMD_EAS_ALARM = 0xa5,
194 /* Proprietary 0xe0 .. 0xff */
197 struct iso15693_anticol_cmd {
198 /* iso15693-3 table5 flags*/
199 unsigned char flags; // SLOTS16 | SLOT1, AFI_PRESENT, OPTION_FLAG
200 unsigned char afi; // AFI 0 for any
201 unsigned char mask_len;
202 unsigned char mask_bits[ISO15693_UID_LEN];
203 unsigned char current_slot;
204 } __attribute__((packed));
206 #include <librfid/rfid_layer2.h>
207 extern const struct rfid_layer2 rfid_layer2_iso15693;
209 #endif /* __LIBRFID__ */
210 #endif /* _ISO15693_H */