]> CyberLeo.Net >> Repos - FreeBSD/releng/10.3.git/blob - share/man/man4/uftdi.4
- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
[FreeBSD/releng/10.3.git] / share / man / man4 / uftdi.4
1 .\" $NetBSD: uftdi.4,v 1.5 2002/02/07 03:15:08 ross Exp $
2 .\"
3 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Lennart Augustsson.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd August 6, 2015
33 .Dt UFTDI 4
34 .Os
35 .Sh NAME
36 .Nm uftdi
37 .Nd USB support for serial adapters based on the FTDI family of USB
38 serial adapter chips.
39 .Sh SYNOPSIS
40 To compile this driver into the kernel,
41 place the following lines in your
42 kernel configuration file:
43 .Bd -ragged -offset indent
44 .Cd "device usb"
45 .Cd "device ucom"
46 .Cd "device uftdi"
47 .Ed
48 .Pp
49 Alternatively, to load the driver as a
50 module at boot time, place the following line in
51 .Xr loader.conf 5 :
52 .Bd -literal -offset indent
53 uftdi_load="YES"
54 .Ed
55 .Sh DESCRIPTION
56 The
57 .Nm
58 driver provides support for various serial adapters based on the
59 following FTDI chips:
60 .Pp
61 .Bl -bullet -compact
62 .It
63 FT8U100AX
64 .It
65 FT8U232AM
66 .It
67 FT8U232BM
68 .It
69 FT232R
70 .It
71 FT2232C
72 .It
73 FT2232D
74 .It
75 FT2232H
76 .It
77 FT4232H
78 .It
79 FT230X
80 .El
81 .Pp
82 The device is accessed through the
83 .Xr ucom 4
84 driver which makes it behave like a
85 .Xr tty 4 .
86 .Pp
87 Many of the supported chips provide additional functionality
88 such as bitbang mode and the MPSSE engine for serial bus emulation.
89 The
90 .Nm
91 driver provides access to that functionality with the following
92 .Xr ioctl 2
93 calls, defined in
94 .In dev/usb/uftdiio.h :
95 .Bl -tag -width indent
96 .It Dv UFTDIIOC_RESET_IO Pq Vt int
97 Reset the channel to its default configuration, flush RX and TX FIFOs.
98 .It Dv UFTDIIOC_RESET_RX Pq Vt int
99 Flush the RX FIFO.
100 .It Dv UFTDIIOC_RESET_TX Pq Vt int
101 Flush the TX FIFO.
102 .It Dv UFTDIIOC_SET_BITMODE Pq Vt "struct uftdi_bitmode"
103 Put the channel into the operating mode specified in
104 .Va mode ,
105 and set the pins indicated by ones in
106 .Va iomask
107 to output mode.
108 The
109 .Va mode
110 must be one of the
111 .Va uftdi_bitmodes
112 values.
113 Setting
114 .Va mode
115 to
116 .Dv UFTDI_BITMODE_NONE
117 returns the channel to standard UART mode.
118 .Bd -literal
119 enum uftdi_bitmodes
120 {
121         UFTDI_BITMODE_ASYNC = 0,
122         UFTDI_BITMODE_MPSSE = 1,
123         UFTDI_BITMODE_SYNC = 2,
124         UFTDI_BITMODE_CPU_EMUL = 3,
125         UFTDI_BITMODE_FAST_SERIAL = 4,
126         UFTDI_BITMODE_CBUS = 5,
127         UFTDI_BITMODE_NONE = 0xff,
128 };
129
130 struct uftdi_bitmode
131 {
132         uint8_t mode;
133         uint8_t iomask;
134 };
135 .Ed
136 .Pp
137 Manuals and application notes published by FTDI describe these
138 modes in detail.
139 To use most of these modes, you first put the channel into
140 the desired mode, then you
141 .Xr read 2
142 and
143 .Xr write 2
144 data which either reflects pin state or is interpreted
145 as MPSSE commands and parameters, depending on the mode.
146 .It Dv UFTDIIOC_GET_BITMODE Pq Vt "struct uftdi_bitmode"
147 Return the current bitbang mode in the
148 .Va mode
149 member, and the state of the DBUS0..DBUS7 pins at the time
150 of the call in the
151 .Va iomask
152 member.
153 The pin state can be read while the chip is in any mode, including
154 .Dv UFTDI_BITMODE_NONE
155 (UART) mode.
156 .It Dv UFTDIIOC_SET_ERROR_CHAR Pq Vt int
157 Set the character which is inserted into the buffer to mark
158 the point of an error such as FIFO overflow.
159 .It Dv UFTDIIOC_SET_EVENT_CHAR Pq Vt int
160 Set the character which causes a partial FIFO full of data
161 to be returned immediately even if the FIFO is not full.
162 .It Dv UFTDIIOC_SET_LATENCY Pq Vt int
163 Set the amount of time to wait for a full FIFO,
164 in milliseconds.
165 If more than this much time elapses without receiving a new
166 character, any characters in the FIFO are returned.
167 .It Dv UFTDIIOC_GET_LATENCY Pq Vt int
168 Get the current value of the latency timer.
169 .It Dv UFTDIIOC_GET_HWREV Pq Vt int
170 Get the hardware revision number.
171 This is the
172 .Va bcdDevice
173 value from the
174 .Va usb_device_descriptor .
175 .It Dv UFTDIIOC_READ_EEPROM Pq Vt "struct uftdi_eeio"
176 Read one or more words from the configuration eeprom.
177 The FTDI chip performs eeprom I/O in 16-bit words.
178 Set
179 .Va offset
180 and
181 .Va length
182 to values evenly divisible by two before the call, and the
183 .Va data
184 array will contain the requested values from eeprom after the call.
185 .Bd -literal
186 struct uftdi_eeio
187 {
188         uint16_t offset;
189         uint16_t length;
190         uint16_t data[64];
191 };
192 .Ed
193 .Pp
194 The FT232R chip has an internal eeprom.
195 An external serial eeprom is optional on other FTDI chips.
196 The eeprom may contain 64, 128, or 256 words, 
197 depending on the part used.
198 Multiple calls may be needed to read or write the larger parts.
199 When no eeprom is present, all words in the returned data are 0xffff.
200 An erased eeprom also reads as all 0xffff.
201 .It Dv UFTDIIOC_WRITE_EEPROM Pq Vt "struct uftdi_eeio"
202 Write one or more words to the configuration eeprom.
203 The
204 .Va uftdi_eeio
205 values are as described for
206 .Dv UFTDIIOC_READ_EEPROM .
207 .Pp
208 The FTDI chip does a blind write to the eeprom, and it will appear
209 to succeed even when no eeprom is present.
210 To ensure a good write you must read back and verify the data.
211 It is
212 .Em not
213 necessary to erase before writing.
214 Any position within the eeprom can be overwritten at any time.
215 .It Dv UFTDIIOC_ERASE_EEPROM Pq Vt int
216 Erase the entire eeprom.
217 This is useful primarily for test and debugging, as there is no
218 need to erase before writing.
219 To help prevent accidental erasure caused by calling the wrong
220 ioctl, you must pass the special value
221 .Dv UFTDI_CONFIRM_ERASE
222 as the argument to this ioctl.
223 .El
224 .Sh HARDWARE
225 The
226 .Nm
227 driver supports the following adapters:
228 .Pp
229 .Bl -bullet -compact
230 .It
231 B&B Electronics USB->RS422/485 adapter
232 .It
233 Elexol USB MOD1 and USB MOD3
234 .It
235 HP USB-Serial adapter shipped with some HP laptops
236 .It
237 Inland UAS111
238 .It
239 QVS USC-1000
240 .It
241 Buffalo PC-OP-RS / Kurouto-shikou KURO-RS universal remote
242 .It
243 Prologix GPIB-USB Controller
244 .El
245 .Sh SEE ALSO
246 .Xr tty 4 ,
247 .Xr ucom 4 ,
248 .Xr usb 4
249 .Sh HISTORY
250 The
251 .Nm
252 driver
253 appeared in
254 .Fx 4.8
255 from
256 .Nx 1.5 .