]> hackdaworld.org Git - rfid/librfid.git/blob - include/librfid/rfid_reader.h
more constants fro the cmds
[rfid/librfid.git] / 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         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 tx,
30                                  unsigned int speed);
31                 unsigned int speed;
32         } iso14443a;
33         struct rfid_14443b_reader {
34                 int (*init)(struct rfid_reader_handle *rh);
35                 unsigned int speed;
36         } iso14443b;
37         struct rfid_15693_reader {
38                 int (*init)(struct rfid_reader_handle *rh);
39         } iso15693;
40         struct rfid_mifare_classic_reader {
41                 int (*setkey)(struct rfid_reader_handle *h, unsigned char *key);
42                 int (*auth)(struct rfid_reader_handle *h, u_int8_t cmd,
43                             u_int32_t serno, u_int8_t block);
44         } mifare_classic;
45         struct rfid_reader *next;
46 };
47
48 enum rfid_reader_id {
49         RFID_READER_CM5121,
50         RFID_READER_X501,
51         RFID_READER_PEGODA,
52 };
53
54 struct rfid_reader_handle {
55         struct rfid_asic_handle *ah;
56
57         union {
58
59         } priv;
60         struct rfid_reader *reader;
61 };
62
63
64 extern struct rfid_reader_handle *
65 rfid_reader_open(void *data, unsigned int id);
66
67 extern void rfid_reader_close(struct rfid_reader_handle *rh);
68 #endif