364425c73b4adfee9626795143a507ff0c0e98b9
[librfid] / include / rfid / rfid_reader.h
1 #ifndef _RFID_READER_H
2 #define _RFID_READER_H
3
4 #include <rfid/rfid_asic.h>
5 #include <rfid/rfid_layer2_iso14443a.h>
6
7 struct rfid_reader_handle;
8
9 struct rfid_reader {
10         char *name;
11         unsigned int id;
12         int (*transcieve)(struct rfid_reader_handle *h,
13                           enum rfid_frametype frametype,
14                           const unsigned char *tx_buf, unsigned int tx_len,
15                           unsigned char *rx_buf, unsigned int *rx_len,
16                           u_int64_t timeout, unsigned int flags);
17         struct rfid_reader_handle * (*open)(void *data);
18         void (*close)(struct rfid_reader_handle *h);
19
20         struct rfid_14443a_reader {
21                 int (*init)(struct rfid_reader_handle *h);
22                 int (*transcieve_sf)(struct rfid_reader_handle *h,
23                                      unsigned char cmd,
24                                      struct iso14443a_atqa *atqa);
25                 int (*transcieve_acf)(struct rfid_reader_handle *h,
26                                       struct iso14443a_anticol_cmd *cmd,
27                                       unsigned int *bit_of_col);
28                 int (*set_speed)(struct rfid_reader_handle *h,
29                                  unsigned int speed);
30                 unsigned int speed;
31         } iso14443a;
32         struct rfid_14443b_reader {
33                 int (*init)(struct rfid_reader_handle *rh);
34                 unsigned int speed;
35         } iso14443b;
36         struct rfid_15693_reader {
37                 int (*init)(struct rfid_reader_handle *rh);
38         } iso15693;
39         struct rfid_mifare_classic_reader {
40                 int (*setkey)(struct rfid_reader_handle *h, unsigned char *key);
41                 int (*auth)(struct rfid_reader_handle *h, u_int8_t cmd,
42                             u_int32_t serno, u_int8_t block);
43         } mifare_classic;
44         struct rfid_reader *next;
45 };
46
47 enum rfid_reader_id {
48         RFID_READER_CM5121,
49         RFID_READER_PEGODA,
50 };
51
52 struct rfid_reader_handle {
53         struct rfid_asic_handle *ah;
54
55         union {
56
57         } priv;
58         struct rfid_reader *reader;
59 };
60
61
62 extern struct rfid_reader_handle *
63 rfid_reader_open(void *data, unsigned int id);
64
65 extern void rfid_reader_close(struct rfid_reader_handle *rh);
66 #endif