1 #ifndef _RFID_ISO15693_H
2 #define _RFID_ISO15693_H
13 /* protocol definitions */
16 struct rfid_15693_handle;
18 struct rfid_layer2_15693t {
22 int (*init)(struct iso15693_handle *handle);
23 int (*fini)(struct iso15693_handle *handle);
26 int (*transceive_sf)(struct iso14443a_handle *handle,
28 struct iso14443a_atqa *atqa);
29 int (*transceive_acf)(struct iso14443a_handle *handle,
30 struct iso14443a_anticol_cmd *acf,
31 unsigned int *bit_of_col);
33 int (*transceive)(struct iso15693_handle *handle,
34 const unsigned char *tx_buf,
36 unsigned char *rx_buf,
37 unsigned int *rx_len);
45 struct iso15693_handle {
47 unsigned int ask100:1,
51 enum rfid_15693_state {
57 RFID_OPT_15693_MOD_DEPTH = 0x00010001,
58 RFID_OPT_15693_VCD_CODING = 0x00010002,
59 RFID_OPT_15693_VICC_SUBC = 0x00010003,
60 RFID_OPT_15693_VICC_SPEED = 0x00010004,
63 enum rfid_15693_opt_mod_depth {
64 RFID_15693_MOD_10ASK = 0x01,
65 RFID_15693_MOD_100ASK = 0x02,
68 enum rfid_15693_opt_vcd_coding {
69 RFID_15693_VCD_CODING_1OUT256 = 0x01,
70 RFID_15693_VCD_CODING_1OUT4 = 0x02,
73 enum rfid_15693_opt_vicc_subc {
74 RFID_15693_VICC_SUBC_SINGLE = 0x01,
75 RFID_15693_VICC_SUBC_DUAL = 0x02,
78 enum rfid_15693_opt_vicc_speed {
79 RFID_15693_VICC_SPEED_SLOW = 0x01,
80 RFID_15693_VICC_SPEED_FAST = 0x02,
85 #define ISO15693_UID_LEN 8
86 #define ISO15693_CRC_LEN 2
88 /* ISO 15693-3, Ch. 7.2 Table 3*/
89 enum iso15693_request_flags {
90 RFID_15693_F_SUBC_TWO = 0x01,
91 RFID_15693_F_RATE_HIGH = 0x02,
92 RFID_15693_F_INV_TABLE_5 = 0x04,
93 RFID_15693_F_PROT_OEXT = 0x08,
96 /* ISO 15693-3, Ch. 7.2 Table 4 */
97 enum iso15693_request_flags_table4 {
98 RFID_15693_F4_SELECTED = 0x10, /* only VICC in 'select' state */
99 RFID_15693_F4_ADDRESS = 0x20, /* request is addressed */
100 RFID_15693_F4_CUSTOM = 0x40,
103 /* ISO 15693-3, Ch. 7.2 Table 5 */
104 enum iso15693_request_flags_table5 {
105 RFID_15693_F5_AFI_PRES = 0x10, /* AFI is present */
106 RFID_15693_F5_NSLOTS_1 = 0x20, /* only 1 slot (instead of 16) */
107 RFID_15693_F5_CUSTOM = 0x40,
110 /* ISO 15963-3, Ch. 7.2 Figure 4 */
111 struct iso15693_request {
115 } __attribute__ ((packed));
117 /* ISO 15693, Ch. 7.3 Table 6 */
118 enum iso15693_response_flags {
119 RFID_15693_RF_ERROR = 0x01,
120 RFID_15693_RF_EXTENDED = 0x08,
123 /* ISO 15693, Ch. 7.3.2 Table 7 */
124 enum iso15693_response_errors {
125 RFID_15693_ERR_NOTSUPP = 0x01,
126 RFID_15693_ERR_INVALID = 0x02, /* command not recognized */
127 RFID_15693_ERR_UNKNOWN = 0x0f, /* unknown error */
128 RFID_15693_ERR_BLOCK_NA = 0x10, /* block not available */
129 RFID_15693_ERR_BLOCK_LOCKED = 0x11,
130 RFID_15693_ERR_BLOCK_LOCKED_CH = 0x12,
131 RFID_15693_ERR_BLOCK_NOTPROG = 0x13,
132 RFID_15693_ERR_BLOCK_NOTLOCK = 0x14,
135 /* ISO 15693, Ch. 7.4 */
136 enum iso15693_vicc_states {
137 RFID_15693_STATE_POWER_OFF,
138 RFID_15693_STATE_READY,
139 RFID_15693_STATE_QUIET,
140 RFID_15693_STATE_SELECTED,
143 /* ISO 15693, Ch. 9.1 Table 10*/
144 enum iso15693_commands {
145 /* Mandatory 0x01 .. 0x1f */
146 ISO15693_CMD_INVENTORY = 0x01,
147 ISO15693_CMD_STAY_QUIET = 0x02,
148 /* Optional 0x20 .. 0x9f */
149 ISO15693_CMD_READ_BLOCK_SINGLE = 0x20,
150 ISO15693_CMD_WRITE_BLOCK_SINGLE = 0x21,
151 ISO15693_CMD_LOCK_BLOCK = 0x22,
152 ISO15693_CMD_READ_BLOCK_MULTI = 0x23,
153 ISO15693_CMD_WRITE_BLOCK_MULTI = 0x24,
154 ISO15693_CMD_SELECT = 0x25,
155 ISO15693_CMD_RESET_TO_READY = 0x26,
156 ISO15693_CMD_WRITE_AFI = 0x27,
157 ISO15693_CMD_LOCK_AFI = 0x28,
158 ISO15693_CMD_WRITE_DSFID = 0x29,
159 ISO15693_CMD_LOCK_DSFID = 0x2a,
160 ISO15693_CMD_GET_SYSINFO = 0x2b,
161 ISO15693_CMD_GET_BLOCK_SECURITY = 0x2c,
162 /* Custom 0xa0 .. 0xdf */
163 ICODE_CMD_INVENTORY_READ = 0xa0,
164 ICODE_CMD_FAST_INVENTORY_READ = 0xa1,
165 ICODE_CMD_EAS_SET = 0xa2,
166 ICODE_CMD_EAS_RESET = 0xa3,
167 ICODE_CMD_EAS_LOCK = 0xa4,
168 ICODE_CMD_EAS_ALARM = 0xa5,
169 /* Proprietary 0xe0 .. 0xff */
173 #include <librfid/rfid_layer2.h>
174 extern const struct rfid_layer2 rfid_layer2_iso15693;
176 #endif /* __LIBRFID__ */
177 #endif /* _ISO15693_H */