1 #ifndef _RFID_ISO14443A_H
2 #define _RFID_ISO14443A_H
5 RFID_OPT_14443A_SPEED_RX = 0x00010001,
6 RFID_OPT_14443A_SPEED_TX = 0x00010002,
7 RFID_OPT_14443A_ATQA = 0x00010003,
8 RFID_OPT_14443A_WUPA = 0x00010004,
11 enum rfid_14443_opt_speed {
12 RFID_14443A_SPEED_106K = 0x01,
13 RFID_14443A_SPEED_212K = 0x02,
14 RFID_14443A_SPEED_424K = 0x04,
15 RFID_14443A_SPEED_848K = 0x08,
20 #include <sys/types.h>
22 /* protocol definitions */
24 /* ISO 14443-3, Chapter 6.3.1 */
25 enum iso14443a_sf_cmd {
26 ISO14443A_SF_CMD_REQA = 0x26,
27 ISO14443A_SF_CMD_WUPA = 0x52,
28 ISO14443A_SF_CMD_OPT_TIMESLOT = 0x35, /* Annex C */
29 /* 40 to 4f and 78 to 7f: proprietary */
32 struct iso14443a_atqa {
33 u_int8_t bf_anticol:5,
36 u_int8_t proprietary:4,
38 } __attribute__((packed));
40 #define ISO14443A_HLTA 0x5000
42 /* ISO 14443-3, Chapter 6.3.2 */
43 struct iso14443a_anticol_cmd {
44 unsigned char sel_code;
46 unsigned char uid_bits[5];
47 } __attribute__((packed));
49 enum iso14443a_anticol_sel_code {
50 ISO14443A_AC_SEL_CODE_CL1 = 0x93,
51 ISO14443A_AC_SEL_CODE_CL2 = 0x95,
52 ISO14443A_AC_SEL_CODE_CL3 = 0x97,
55 #define ISO14443A_BITOFCOL_NONE 0xffffffff
57 struct iso14443a_handle {
60 unsigned int tcl_capable;
61 struct iso14443a_atqa atqa;
64 enum iso14443a_level {
71 enum iso14443a_state {
72 ISO14443A_STATE_ERROR,
74 ISO14443A_STATE_REQA_SENT,
75 ISO14443A_STATE_ATQA_RCVD,
76 ISO14443A_STATE_NO_BITFRAME_ANTICOL,
77 ISO14443A_STATE_ANTICOL_RUNNING,
78 ISO14443A_STATE_SELECTED,
81 /* Section 6.1.2 values in usec, rounded up to next usec */
82 #define ISO14443A_FDT_ANTICOL_LAST1 92 /* 1236 / fc = 91.15 usec */
83 #define ISO14443A_FDT_ANTICOL_LAST0 87 /* 1172 / fc = 86.43 usec */
85 #define ISO14443_CARRIER_FREQ 13560000
86 #define ISO14443A_FDT_OTHER_LAST1(n) (((n*128+84)*1000000)/ISO14443_CARRIER_FREQ)
89 #include <librfid/rfid_layer2.h>
90 extern const struct rfid_layer2 rfid_layer2_iso14443a;
92 #endif /* __LIBRFID__ */
95 #endif /* _ISO14443A_H */