4 #include <librfid/rfid_asic.h>
5 #include <librfid/rfid_layer2_iso14443a.h>
6 #include <librfid/rfid_layer2_iso15693.h>
8 struct rfid_reader_handle;
10 /* 0...0xffff = global options, 0x10000...0x1ffff = private options */
11 #define RFID_OPT_RDR_PRIV 0x00010000
12 enum rfid_reader_opt {
13 RFID_OPT_RDR_FW_VERSION = 0x0001,
14 RFID_OPT_RDR_RF_KILL = 0x0002,
21 unsigned int l2_supported;
22 unsigned int proto_supported;
24 int (*reset)(struct rfid_reader_handle *h);
27 struct rfid_reader_handle * (*open)(void *data);
29 /* Initialize the reader for a given layer 2 */
30 int (*init)(struct rfid_reader_handle *h, enum rfid_layer2_id);
32 /* completely close the reader */
33 void (*close)(struct rfid_reader_handle *h);
36 int (*getopt)(struct rfid_reader_handle *rh, int optname,
37 void *optval, unsigned int *optlen);
39 int (*setopt)(struct rfid_reader_handle *rh, int optname,
40 const void *optval, unsigned int optlen);
42 /* transceive one frame */
43 int (*transceive)(struct rfid_reader_handle *h,
44 enum rfid_frametype frametype,
45 const unsigned char *tx_buf, unsigned int tx_len,
46 unsigned char *rx_buf, unsigned int *rx_len,
47 u_int64_t timeout, unsigned int flags);
49 struct rfid_14443a_reader {
50 int (*transceive_sf)(struct rfid_reader_handle *h,
52 struct iso14443a_atqa *atqa);
53 int (*transceive_acf)(struct rfid_reader_handle *h,
54 struct iso14443a_anticol_cmd *cmd,
55 unsigned int *bit_of_col);
56 int (*set_speed)(struct rfid_reader_handle *h,
61 struct rfid_14443b_reader {
64 struct rfid_15693_reader {
65 int (*transceive_ac)(struct rfid_reader_handle *h,
66 const struct iso15693_anticol_cmd *acf,
68 struct iso15693_anticol_resp *resp,
69 unsigned int *rx_len, char *bit_of_col);
71 struct rfid_mifare_classic_reader {
72 int (*setkey)(struct rfid_reader_handle *h, const unsigned char *key);
73 int (*auth)(struct rfid_reader_handle *h, u_int8_t cmd,
74 u_int32_t serno, u_int8_t block);
85 struct rfid_reader_handle {
86 struct rfid_asic_handle *ah;
91 const struct rfid_reader *reader;
94 extern struct rfid_reader_handle *
95 rfid_reader_open(void *data, unsigned int id);
97 extern void rfid_reader_close(struct rfid_reader_handle *rh);
99 extern int rfid_reader_getopt(struct rfid_reader_handle *rh, int optname,
100 void *optval, unsigned int *optlen);
101 extern int rfid_reader_setopt(struct rfid_reader_handle *rh, int optname,
102 const void *optval, unsigned int optlen);