* improve scanning support:
[librfid] / include / librfid / rfid_asic_rc632.h
1 #ifndef _RFID_ASIC_RC632_H
2 #define _RFID_ASIC_RC632_H
3
4 struct rfid_asic_transport_handle;
5
6 #include <librfid/rfid.h>
7 #include <librfid/rfid_asic.h>
8
9 struct rfid_asic_rc632_transport {
10         struct {
11                 int (*reg_write)(struct rfid_asic_transport_handle *rath,
12                                  u_int8_t reg,
13                                  u_int8_t value);
14                 int (*reg_read)(struct rfid_asic_transport_handle *rath,
15                                 u_int8_t reg,
16                                 u_int8_t *value);
17                 int (*fifo_write)(struct rfid_asic_transport_handle *rath,
18                                   u_int8_t len,
19                                   const u_int8_t *buf,
20                                   u_int8_t flags);
21                 int (*fifo_read)(struct rfid_asic_transport_handle *rath,
22                                  u_int8_t len,
23                                  u_int8_t *buf);
24         } fn;
25 };
26
27 struct rfid_asic_handle;
28
29 struct iso14443a_atqa;
30 struct iso14443a_anticol_cmd;
31
32 struct rfid_asic_rc632 {
33         struct {
34                 int (*power_up)(struct rfid_asic_handle *h);
35                 int (*power_down)(struct rfid_asic_handle *h);
36                 int (*rf_power)(struct rfid_asic_handle *h, int on);
37                 int (*transceive)(struct rfid_asic_handle *h,
38                                   enum rfid_frametype,
39                                   const u_int8_t *tx_buf,
40                                   unsigned int tx_len,
41                                   u_int8_t *rx_buf,
42                                   unsigned int *rx_len,
43                                   u_int64_t timeout,
44                                   unsigned int flags);
45                 struct {
46                         int (*init)(struct rfid_asic_handle *h);
47                         int (*transceive_sf)(struct rfid_asic_handle *h,
48                                              u_int8_t cmd,
49                                              struct iso14443a_atqa *atqa);
50                         int (*transceive_acf)(struct rfid_asic_handle *h,
51                                               struct iso14443a_anticol_cmd *cmd,
52                                               unsigned int *bit_of_col);
53                         int (*set_speed)(struct rfid_asic_handle *h,
54                                          unsigned int tx,
55                                          unsigned int speed);
56                 } iso14443a;
57                 struct {
58                         int (*init)(struct rfid_asic_handle *h);
59                 } iso14443b;
60                 struct {
61                         int (*init)(struct rfid_asic_handle *h);
62                 } iso15693;
63                 struct {
64                         int (*setkey)(struct rfid_asic_handle *h,
65                                       const unsigned char *key);
66                         int (*auth)(struct rfid_asic_handle *h, u_int8_t cmd, 
67                                     u_int32_t serno, u_int8_t block);
68                 } mifare_classic;
69         } fn;
70 };
71
72 struct rc632_transport_handle {
73 };
74
75 /* A handle to a specific RC632 chip */
76 struct rfid_asic_rc632_handle {
77         struct rc632_transport_handle th;
78 };
79
80 struct rfid_asic_rc632_impl_proto {
81         u_int8_t mod_conductance;
82         u_int8_t cw_conductance;
83         u_int8_t bitphase;
84         u_int8_t threshold;
85 };
86
87 struct rfid_asic_rc632_impl {
88         u_int32_t mru;          /* maximum receive unit (PICC->PCD) */
89         u_int32_t mtu;          /* maximum transmit unit (PCD->PICC) */
90         //struct rfid_asic_rc632_impl_proto proto[NUM_RFID_PROTOCOLS];
91 };
92
93 extern struct rfid_asic_handle * rc632_open(struct rfid_asic_transport_handle *th);
94 extern void rc632_close(struct rfid_asic_handle *h);
95
96 #endif