fix more compiler warnings, based on a patch by Rainer Keller
[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 (*get_api_version)(
16             struct rfid_reader_handle *h,
17             u_int8_t *version);
18
19         int (*get_environment)(
20             struct rfid_reader_handle *rh,
21             unsigned char num_bytes,
22             unsigned char *buf);
23
24         int (*set_environment)(
25             struct rfid_reader_handle *rh,
26             unsigned char num_bytes,
27             const unsigned char *buf);
28
29         int (*reset)(struct rfid_reader_handle *h);
30
31         int (*transceive)(struct rfid_reader_handle *h,
32                           enum rfid_frametype frametype,
33                           const unsigned char *tx_buf, unsigned int tx_len,
34                           unsigned char *rx_buf, unsigned int *rx_len,
35                           u_int64_t timeout, unsigned int flags);
36         struct rfid_reader_handle * (*open)(void *data);
37         void (*close)(struct rfid_reader_handle *h);
38
39         struct rfid_14443a_reader {
40                 int (*init)(struct rfid_reader_handle *h);
41                 int (*transceive_sf)(struct rfid_reader_handle *h,
42                                      unsigned char cmd,
43                                      struct iso14443a_atqa *atqa);
44                 int (*transceive_acf)(struct rfid_reader_handle *h,
45                                       struct iso14443a_anticol_cmd *cmd,
46                                       unsigned int *bit_of_col);
47                 int (*set_speed)(struct rfid_reader_handle *h,
48                                  unsigned int tx,
49                                  unsigned int speed);
50                 unsigned int speed;
51         } iso14443a;
52         struct rfid_14443b_reader {
53                 int (*init)(struct rfid_reader_handle *rh);
54                 unsigned int speed;
55         } iso14443b;
56         struct rfid_15693_reader {
57                 int (*init)(struct rfid_reader_handle *rh);
58         } iso15693;
59         struct rfid_mifare_classic_reader {
60                 int (*setkey)(struct rfid_reader_handle *h, const unsigned char *key);
61                 int (*auth)(struct rfid_reader_handle *h, u_int8_t cmd,
62                             u_int32_t serno, u_int8_t block);
63         } mifare_classic;
64 };
65
66 enum rfid_reader_id {
67         RFID_READER_CM5121,
68         RFID_READER_PEGODA,
69         RFID_READER_OPENPCD,
70         RFID_READER_SPIDEV,
71 };
72
73 struct rfid_reader_handle {
74         struct rfid_asic_handle *ah;
75
76         union {
77
78         } priv;
79         const struct rfid_reader *reader;
80 };
81
82 extern struct rfid_reader_handle *
83 rfid_reader_open(void *data, unsigned int id);
84
85 extern void rfid_reader_close(struct rfid_reader_handle *rh);
86 #endif