1 |
5f148f59
|
(no author)
|
#ifndef _OPENPCD_PROTO_H
|
2 |
|
|
#define _OPENPCD_PROTO_H
|
3 |
8a863d16
|
(no author)
|
|
4 |
917b88ae
|
(no author)
|
/* This header file describes the USB protocol of the OpenPCD RFID reader */
|
5 |
|
|
|
6 |
caf50003
|
(no author)
|
#include <sys/types.h>
|
7 |
8a863d16
|
(no author)
|
|
8 |
41333333
|
(no author)
|
struct openpcd_hdr {
|
9 |
373c172a
|
Harald Welte
|
uint8_t cmd; /* command. high nibble: class,
|
10 |
514b0f72
|
laforge
|
* low nibble: cmd */
|
11 |
373c172a
|
Harald Welte
|
uint8_t flags;
|
12 |
|
|
uint8_t reg; /* register */
|
13 |
|
|
uint8_t val; /* value (in case of write *) */
|
14 |
|
|
uint8_t data[0];
|
15 |
41333333
|
(no author)
|
} __attribute__ ((packed));
|
16 |
|
|
|
17 |
514b0f72
|
laforge
|
#define OPCD_REV_LEN 16
|
18 |
|
|
struct openpcd_compile_version {
|
19 |
|
|
char svnrev[OPCD_REV_LEN];
|
20 |
|
|
char by[OPCD_REV_LEN];
|
21 |
|
|
char date[OPCD_REV_LEN];
|
22 |
|
|
} __attribute__ ((packed));
|
23 |
|
|
|
24 |
|
|
#define OPENPCD_FLAG_RESPOND 0x01 /* Response requested */
|
25 |
|
|
#define OPENPCD_FLAG_ERROR 0x80 /* An error occurred */
|
26 |
50092771
|
(no author)
|
|
27 |
81416e6a
|
(no author)
|
enum openpcd_cmd_class {
|
28 |
514b0f72
|
laforge
|
OPENPCD_CMD_CLS_GENERIC = 0x0,
|
29 |
50092771
|
(no author)
|
/* PCD (reader) side */
|
30 |
81416e6a
|
(no author)
|
OPENPCD_CMD_CLS_RC632 = 0x1,
|
31 |
514b0f72
|
laforge
|
//OPENPCD_CMD_CLS_LED = 0x2,
|
32 |
81416e6a
|
(no author)
|
OPENPCD_CMD_CLS_SSC = 0x3,
|
33 |
|
|
OPENPCD_CMD_CLS_PWM = 0x4,
|
34 |
8a29be07
|
(no author)
|
OPENPCD_CMD_CLS_ADC = 0x5,
|
35 |
28eb4a57
|
laforge
|
OPENPCD_CMD_CLS_LIBRFID = 0x6,
|
36 |
6f440df0
|
meri
|
OPENPCD_CMD_CLS_PRESENCE = 0x7,
|
37 |
50b1aff6
|
Harald Welte
|
/* SIM SCAN */
|
38 |
|
|
OPENPCD_CMD_CLS_SIM = 0x8,
|
39 |
50092771
|
(no author)
|
/* PICC (transponder) side */
|
40 |
8a29be07
|
(no author)
|
OPENPCD_CMD_CLS_PICC = 0xe,
|
41 |
50092771
|
(no author)
|
|
42 |
|
|
OPENPCD_CMD_CLS_USBTEST = 0xf,
|
43 |
81416e6a
|
(no author)
|
};
|
44 |
|
|
|
45 |
50092771
|
(no author)
|
#define OPENPCD_REG_MAX 0x3f
|
46 |
f987bf9a
|
(no author)
|
|
47 |
81416e6a
|
(no author)
|
#define OPENPCD_CMD_CLS(x) (x >> 4)
|
48 |
|
|
#define OPENPCD_CMD(x) (x & 0xf)
|
49 |
|
|
|
50 |
|
|
#define OPENPCD_CLS2CMD(x) (x << 4)
|
51 |
|
|
|
52 |
f1cae2aa
|
laforge
|
/* Generic */
|
53 |
514b0f72
|
laforge
|
#define OPENPCD_CMD_GET_VERSION (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
|
54 |
|
|
#define OPENPCD_CMD_SET_LED (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
|
55 |
f1cae2aa
|
laforge
|
#define OPENPCD_CMD_GET_SERIAL (0x3|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
|
56 |
bc0c0684
|
meri
|
#define OPENPCD_CMD_GET_API_VERSION (0x4|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
|
57 |
|
|
#define OPENPCD_CMD_GET_ENVIRONMENT (0x5|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
|
58 |
|
|
#define OPENPCD_CMD_SET_ENVIRONMENT (0x6|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
|
59 |
|
|
#define OPENPCD_CMD_RESET (0x7|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
|
60 |
514b0f72
|
laforge
|
|
61 |
81416e6a
|
(no author)
|
/* CMD_CLS_RC632 */
|
62 |
|
|
#define OPENPCD_CMD_WRITE_REG (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
63 |
|
|
#define OPENPCD_CMD_WRITE_FIFO (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
64 |
|
|
#define OPENPCD_CMD_WRITE_VFIFO (0x3|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
65 |
|
|
#define OPENPCD_CMD_REG_BITS_CLEAR (0x4|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
66 |
|
|
#define OPENPCD_CMD_REG_BITS_SET (0x5|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
67 |
|
|
#define OPENPCD_CMD_READ_REG (0x6|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
68 |
|
|
#define OPENPCD_CMD_READ_FIFO (0x7|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
69 |
|
|
#define OPENPCD_CMD_READ_VFIFO (0x8|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
70 |
|
|
#define OPENPCD_CMD_DUMP_REGS (0x9|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
71 |
|
|
#define OPENPCD_CMD_IRQ (0xa|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
72 |
6a189e61
|
laforge
|
#define OPENPCD_CMD_WRITE_REG_SET (0xb|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
|
73 |
81416e6a
|
(no author)
|
|
74 |
|
|
/* CMD_CLS_SSC */
|
75 |
|
|
#define OPENPCD_CMD_SSC_READ (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_SSC))
|
76 |
|
|
#define OPENPCD_CMD_SSC_WRITE (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_SSC))
|
77 |
|
|
|
78 |
|
|
/* CMD_CLS_PWM */
|
79 |
|
|
#define OPENPCD_CMD_PWM_ENABLE (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM))
|
80 |
|
|
#define OPENPCD_CMD_PWM_DUTY_SET (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM))
|
81 |
|
|
#define OPENPCD_CMD_PWM_DUTY_GET (0x3|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM))
|
82 |
|
|
#define OPENPCD_CMD_PWM_FREQ_SET (0x4|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM))
|
83 |
|
|
#define OPENPCD_CMD_PWM_FREQ_GET (0x5|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM))
|
84 |
e48e9896
|
(no author)
|
|
85 |
50092771
|
(no author)
|
/* CMD_CLS_PICC */
|
86 |
|
|
#define OPENPCD_CMD_PICC_REG_WRITE (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PICC))
|
87 |
|
|
#define OPENPCD_CMD_PICC_REG_READ (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PICC))
|
88 |
|
|
|
89 |
8a29be07
|
(no author)
|
/* CMD_CLS_ADC */
|
90 |
a46943b3
|
(no author)
|
#define OPENPCD_CMD_ADC_READ (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_ADC))
|
91 |
8a29be07
|
(no author)
|
|
92 |
28eb4a57
|
laforge
|
/* CMD_CLS_LIBRFID */
|
93 |
|
|
#define OPENPCD_CMD_LRFID_DETECT_IRQ (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_LIBRFID))
|
94 |
|
|
|
95 |
6f440df0
|
meri
|
/* CMD_CLS_LIBRFID */
|
96 |
|
|
#define OPENPCD_CMD_PRESENCE_UID_GET (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PRESENCE))
|
97 |
|
|
|
98 |
50092771
|
(no author)
|
/* CMD_CLS_USBTEST */
|
99 |
|
|
#define OPENPCD_CMD_USBTEST_IN (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_USBTEST))
|
100 |
|
|
#define OPENPCD_CMD_USBTEST_OUT (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_USBTEST))
|
101 |
|
|
|
102 |
22239346
|
(no author)
|
/* FIXME */
|
103 |
|
|
#define OPENPCD_CMD_PIO_IRQ (0x3|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_USBTEST))
|
104 |
|
|
|
105 |
50092771
|
(no author)
|
|
106 |
a914cae2
|
laforge
|
#define OPENPCD_VENDOR_ID 0x16c0
|
107 |
50b1aff6
|
Harald Welte
|
#define SIMTRACE_PRODUCT_ID 0x0762
|
108 |
a914cae2
|
laforge
|
#define OPENPCD_PRODUCT_ID 0x076b
|
109 |
|
|
#define OPENPICC_PRODUCT_ID 0x076c
|
110 |
6556e87c
|
(no author)
|
#define OPENPCD_OUT_EP 0x01
|
111 |
|
|
#define OPENPCD_IN_EP 0x82
|
112 |
|
|
#define OPENPCD_IRQ_EP 0x83
|
113 |
|
|
|
114 |
8a863d16
|
(no author)
|
#endif
|