add support for new OpenPCD design
[librfid] / include / librfid / rfid_reader_openpcd.h
1 #ifndef _OPENPCD_PROTO_H
2 #define _OPENPCD_PROTO_H
3
4 /* This header file describes the USB protocol of the OpenPCD RFID reader */
5
6 #include <sys/types.h>
7
8 struct openpcd_hdr {
9         u_int8_t cmd;           /* command */
10         u_int8_t flags;
11         u_int8_t reg;           /* register */
12         u_int8_t val;           /* value (in case of write *) */
13         u_int16_t len;
14         u_int16_t res;
15         u_int8_t data[0];
16 } __attribute__((packed));
17
18 #define OPENPCD_REG_MAX                 0x3f
19
20 #define OPENPCD_CMD_WRITE_REG           0x01
21 #define OPENPCD_CMD_WRITE_FIFO          0x02
22 #define OPENPCD_CMD_WRITE_VFIFO         0x03
23 #define OPENPCD_CMD_REG_BITS_CLEAR      0x04
24 #define OPENPCD_CMD_REG_BITS_SET        0x05
25
26 #define OPENPCD_CMD_READ_REG            0x11
27 #define OPENPCD_CMD_READ_FIFO           0x12
28 #define OPENPCD_CMD_READ_VFIFO          0x13
29
30 #define OPENPCD_CMD_SET_LED             0x21
31
32 #define OPENPCD_CMD_IRQ                 0x40    /* IRQ reported by RC632 */
33
34 #define OPENPCD_VENDOR_ID       0x2342
35 #define OPENPCD_PRODUCT_ID      0x0001
36 #define OPENPCD_OUT_EP          0x01
37 #define OPENPCD_IN_EP           0x82
38 #define OPENPCD_IRQ_EP          0x83
39
40 extern struct rfid_reader rfid_reader_openpcd;
41
42 #endif