summaryrefslogtreecommitdiff
path: root/openpcd/firmware/include/openpcd.h
blob: 9af311e408d5fee00dc2db619afb6543880ea9f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef _OPENPCD_PROTO_H
#define _OPENPCD_PROTO_H

/* This header file describes the USB protocol of the OpenPCD RFID reader */

#include <sys/types.h>

struct openpcd_hdr {
	u_int8_t cmd;		/* command */
	u_int8_t flags;
	u_int8_t reg;		/* register */
	u_int8_t val;		/* value (in case of write *) */
	u_int16_t len;
	u_int16_t res;
	u_int8_t data[0];
} __attribute__ ((packed));

#define OPENPCD_CMD_WRITE_REG		0x01
#define OPENPCD_CMD_WRITE_FIFO		0x02
#define OPENPCD_CMD_WRITE_VFIFO		0x03
#define OPENPCD_CMD_REG_BITS_CLEAR	0x04
#define OPENPCD_CMD_REG_BITS_SET	0x05

#define OPENPCD_CMD_READ_REG		0x11
#define OPENPCD_CMD_READ_FIFO		0x12
#define OPENPCD_CMD_READ_VFIFO		0x13
#define OPENPCD_CMD_DUMP_REGS		0x14

#define OPENPCD_CMD_SET_LED		0x21

#define OPENPCD_CMD_IRQ			0x40	/* IRQ reported by RC632 */

#define OPENPCD_VENDOR_ID	0x2342
#define OPENPCD_PRODUCT_ID	0x0001
#define OPENPCD_OUT_EP		0x01
#define OPENPCD_IN_EP		0x82
#define OPENPCD_IRQ_EP		0x83

#endif
personal git repositories of Harald Welte. Your mileage may vary