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