summaryrefslogtreecommitdiffstats
path: root/share/man/man4/uftdi.4
blob: 1045169b7a2dd198152cbaa677f6034adbbae8cd (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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
.\" $NetBSD: uftdi.4,v 1.5 2002/02/07 03:15:08 ross Exp $
.\"
.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Lennart Augustsson.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd March 31, 2014
.Dt UFTDI 4
.Os
.Sh NAME
.Nm uftdi
.Nd USB support for serial adapters based on the FTDI family of USB
serial adapter chips.
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following lines in your
kernel configuration file:
.Bd -ragged -offset indent
.Cd "device usb"
.Cd "device ucom"
.Cd "device uftdi"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
uftdi_load="YES"
.Ed
.Sh DESCRIPTION
The
.Nm
driver provides support for various serial adapters based on the
following FTDI chips:
.Pp
.Bl -bullet -compact
.It
FT8U100AX
.It
FT8U232AM
.It
FT8U232BM
.It
FT232R
.It
FT2232C
.It
FT2232D
.It
FT2232H
.It
FT4232H
.It
FT230X
.El
.Pp
The device is accessed through the
.Xr ucom 4
driver which makes it behave like a
.Xr tty 4 .
.Pp
Many of the supported chips provide additional functionality
such as bitbang mode and the MPSSE engine for serial bus emulation.
The
.Nm
driver provides access to that functionality with the following
.Xr ioctl 2
calls, defined in
.In dev/usb/uftdiio.h :
.Bl -tag -width indent
.It Dv UFTDIIOC_RESET_IO Pq Vt int
Reset the channel to its default configuration, flush RX and TX FIFOs.
.It Dv UFTDIIOC_RESET_RX Pq Vt int
Flush the RX FIFO.
.It Dv UFTDIIOC_RESET_TX Pq Vt int
Flush the TX FIFO.
.It Dv UFTDIIOC_SET_BITMODE Pq Vt "struct uftdi_bitmode"
Put the channel into the operating mode specified in
.Va mode ,
and set the pins indicated by ones in
.Va iomask
to output mode.
The
.Va mode
must be one of the
.Va uftdi_bitmodes
values.
.Bd -literal
enum uftdi_bitmodes
{
	UFTDI_BITMODE_ASYNC = 0,
	UFTDI_BITMODE_MPSSE = 1,
	UFTDI_BITMODE_SYNC = 2,
	UFTDI_BITMODE_CPU_EMUL = 3,
	UFTDI_BITMODE_FAST_SERIAL = 4,
	UFTDI_BITMODE_CBUS = 5,
	UFTDI_BITMODE_NONE = 0xff,
};

struct uftdi_bitmode
{
	uint8_t mode;
	uint8_t iomask;
};
.Ed
.Pp
Manuals and application notes published by FTDI describe these
modes in detail.
To use most of these modes, you first put the channel into
the desired mode, then you
.Xr read 2
and
.Xr write 2
data which either reflects pin state or is interpreted
as MPSSE commands and parameters, depending on the mode.
.It Dv UFTDIIOC_GET_BITMODE Pq Vt "struct uftdi_bitmode"
Return the state of the bitbang pins at the time of the call in the
.Va iomask
member.
The
.Va mode
member is unused.
.It Dv UFTDIIOC_SET_ERROR_CHAR Pq Vt int
Set the character which is inserted into the buffer to mark
the point of an error such as FIFO overflow.
.It Dv UFTDIIOC_SET_EVENT_CHAR Pq Vt int
Set the character which causes a partial FIFO full of data
to be returned immediately even if the FIFO is not full.
.It Dv UFTDIIOC_SET_LATENCY Pq Vt int
Set the amount of time to wait for a full FIFO,
in milliseconds.
If more than this much time elapses without receiving a new
character, any characters in the FIFO are returned.
.It Dv UFTDIIOC_GET_LATENCY Pq Vt int
Get the current value of the latency timer.
.It Dv UFTDIIOC_GET_HWREV Pq Vt int
Get the hardware revision number.
This is the
.Va bcdDevice
value from the
.Va usb_device_descriptor .
.El
.Sh HARDWARE
The
.Nm
driver supports the following adapters:
.Pp
.Bl -bullet -compact
.It
B&B Electronics USB->RS422/485 adapter
.It
Elexol USB MOD1 and USB MOD3
.It
HP USB-Serial adapter shipped with some HP laptops
.It
Inland UAS111
.It
QVS USC-1000
.It
Buffalo PC-OP-RS / Kurouto-shikou KURO-RS universal remote
.It
Prologix GPIB-USB Controller
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,
.Xr usb 4
.Sh HISTORY
The
.Nm
driver
appeared in
.Fx 4.8
from
.Nx 1.5 .
OpenPOWER on IntegriCloud