-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathifd_smartreader_types.h
107 lines (96 loc) · 3.55 KB
/
ifd_smartreader_types.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// FTDI defines
#ifndef __SMARTREADER_TYPES_H__
#define __SMARTREADER_TYPES_H__
/* Definitions for flow control */
#define SIO_RESET 0 /* Reset the port */
#define SIO_MODEM_CTRL 1 /* Set the modem control register */
#define SIO_SET_FLOW_CTRL 2 /* Set flow control register */
#define SIO_SET_BAUD_RATE 3 /* Set baud rate */
#define SIO_SET_DATA 4 /* Set the data characteristics of the port */
#define FTDI_DEVICE_OUT_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT)
#define FTDI_DEVICE_IN_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN)
/* Requests */
#define SIO_RESET_REQUEST SIO_RESET
#define SIO_SET_BAUDRATE_REQUEST SIO_SET_BAUD_RATE
#define SIO_SET_DATA_REQUEST SIO_SET_DATA
#define SIO_SET_FLOW_CTRL_REQUEST SIO_SET_FLOW_CTRL
#define SIO_SET_MODEM_CTRL_REQUEST SIO_MODEM_CTRL
#define SIO_POLL_MODEM_STATUS_REQUEST 0x05
#define SIO_SET_EVENT_CHAR_REQUEST 0x06
#define SIO_SET_ERROR_CHAR_REQUEST 0x07
#define SIO_SET_LATENCY_TIMER_REQUEST 0x09
#define SIO_GET_LATENCY_TIMER_REQUEST 0x0A
#define SIO_SET_BITMODE_REQUEST 0x0B
#define SIO_READ_PINS_REQUEST 0x0C
#define SIO_READ_EEPROM_REQUEST 0x90
#define SIO_WRITE_EEPROM_REQUEST 0x91
#define SIO_ERASE_EEPROM_REQUEST 0x92
#define CLK_BITS 0x8e
#define CLK_BYTES 0x8f
#define CLK_WAIT_HIGH 0x94
#define CLK_WAIT_LOW 0x95
#define EN_ADAPTIVE 0x96
#define DIS_ADAPTIVE 0x97
#define CLK_BYTES_OR_HIGH 0x9c
#define CLK_BYTES_OR_LOW 0x0d
#define SIO_RESET_SIO 0
#define SIO_RESET_PURGE_RX 1
#define SIO_RESET_PURGE_TX 2
#define SIO_DISABLE_FLOW_CTRL 0x0
#define SIO_RTS_CTS_HS (0x1 << 8)
#define SIO_DTR_DSR_HS (0x2 << 8)
#define SIO_XON_XOFF_HS (0x4 << 8)
#define SIO_SET_DTR_MASK 0x1
#define SIO_SET_DTR_HIGH ( 1 | ( SIO_SET_DTR_MASK << 8))
#define SIO_SET_DTR_LOW ( 0 | ( SIO_SET_DTR_MASK << 8))
#define SIO_SET_RTS_MASK 0x2
#define SIO_SET_RTS_HIGH ( 2 | ( SIO_SET_RTS_MASK << 8 ))
#define SIO_SET_RTS_LOW ( 0 | ( SIO_SET_RTS_MASK << 8 ))
#define SIO_RTS_CTS_HS (0x1 << 8)
/** FTDI chip type */
enum smartreader_chip_type { TYPE_AM = 0, TYPE_BM = 1, TYPE_2232C = 2, TYPE_R = 3, TYPE_2232H = 4, TYPE_4232H = 5, TYPE_232H = 6 };
/** Parity mode for smartreader_set_line_property() */
enum smartreader_parity_type { NONE = 0, ODD = 1, EVEN = 2, MARK = 3, SPACE = 4 };
/** Number of stop bits for smartreader_set_line_property() */
enum smartreader_stopbits_type { STOP_BIT_1 = 0, STOP_BIT_15 = 1, STOP_BIT_2 = 2 };
/** Number of bits for smartreader_set_line_property() */
enum smartreader_bits_type { BITS_7 = 7, BITS_8 = 8 };
/** Break type for smartreader_set_line_property2() */
enum smartreader_break_type { BREAK_OFF = 0, BREAK_ON = 1 };
/** Port interface for chips with multiple interfaces */
enum smartreader_rdrtypename
{
SR = 0,
Infinity = 1,
SRv2 = 2,
TripleP1 = 3,
TripleP2 = 4,
TripleP3 = 5
};
enum smartreader_interface
{
INTERFACE_ANY = 0,
INTERFACE_A = 1,
INTERFACE_B = 2,
INTERFACE_C = 3,
INTERFACE_D = 4
};
struct s_reader_types
{
uint16_t rdrtypename;
uint8_t in_ep;
uint8_t out_ep;
int32_t index;
int32_t interface;
};
const struct s_reader_types reader_types[] =
{
{ SR, 0x01, 0x82, INTERFACE_A, 0}, // type 0
{ Infinity, 0x01, 0x81, INTERFACE_A, 0}, // type 1
{ SRv2, 0x02, 0x81, INTERFACE_A, 0}, // type 2
{ TripleP1, 0x02, 0x81, INTERFACE_A, 0}, // type 3
{ TripleP2, 0x04, 0x83, INTERFACE_B, 1}, // type 4
{ TripleP3, 0x06, 0x85, INTERFACE_C, 2} // type 5
};
#endif // __SMARTREADER_TYPES_H__
// end of FTDI defines