xref: /freebsd/share/man/man4/uftdi.4 (revision 01c73a3bb3bc62b0268eeece8dba1de36c6da60c)
131f48889SJosef Karthauser.\" $NetBSD: uftdi.4,v 1.5 2002/02/07 03:15:08 ross Exp $
231f48889SJosef Karthauser.\"
331f48889SJosef Karthauser.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
431f48889SJosef Karthauser.\" All rights reserved.
531f48889SJosef Karthauser.\"
631f48889SJosef Karthauser.\" This code is derived from software contributed to The NetBSD Foundation
731f48889SJosef Karthauser.\" by Lennart Augustsson.
831f48889SJosef Karthauser.\"
931f48889SJosef Karthauser.\" Redistribution and use in source and binary forms, with or without
1031f48889SJosef Karthauser.\" modification, are permitted provided that the following conditions
1131f48889SJosef Karthauser.\" are met:
1231f48889SJosef Karthauser.\" 1. Redistributions of source code must retain the above copyright
1331f48889SJosef Karthauser.\"    notice, this list of conditions and the following disclaimer.
1431f48889SJosef Karthauser.\" 2. Redistributions in binary form must reproduce the above copyright
1531f48889SJosef Karthauser.\"    notice, this list of conditions and the following disclaimer in the
1631f48889SJosef Karthauser.\"    documentation and/or other materials provided with the distribution.
1731f48889SJosef Karthauser.\"
1831f48889SJosef Karthauser.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1931f48889SJosef Karthauser.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2031f48889SJosef Karthauser.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2131f48889SJosef Karthauser.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2231f48889SJosef Karthauser.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2331f48889SJosef Karthauser.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2431f48889SJosef Karthauser.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2531f48889SJosef Karthauser.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2631f48889SJosef Karthauser.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2731f48889SJosef Karthauser.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2831f48889SJosef Karthauser.\" POSSIBILITY OF SUCH DAMAGE.
2931f48889SJosef Karthauser.\"
3031f48889SJosef Karthauser.\" $FreeBSD$
3131f48889SJosef Karthauser.\"
32ea25ea8cSIan Lepore.Dd March 31, 2014
3331f48889SJosef Karthauser.Dt UFTDI 4
3431f48889SJosef Karthauser.Os
3531f48889SJosef Karthauser.Sh NAME
3631f48889SJosef Karthauser.Nm uftdi
37ea25ea8cSIan Lepore.Nd USB support for serial adapters based on the FTDI family of USB
38ea25ea8cSIan Leporeserial adapter chips.
3931f48889SJosef Karthauser.Sh SYNOPSIS
400a771a3bSChristian BruefferTo compile this driver into the kernel,
410a771a3bSChristian Bruefferplace the following lines in your
420a771a3bSChristian Bruefferkernel configuration file:
430a771a3bSChristian Brueffer.Bd -ragged -offset indent
4499fc5899SMartin Wilke.Cd "device usb"
4599fc5899SMartin Wilke.Cd "device ucom"
46fc1a4ecfSWarner Losh.Cd "device uftdi"
470a771a3bSChristian Brueffer.Ed
480a771a3bSChristian Brueffer.Pp
490a771a3bSChristian BruefferAlternatively, to load the driver as a
500a771a3bSChristian Brueffermodule at boot time, place the following line in
510a771a3bSChristian Brueffer.Xr loader.conf 5 :
520a771a3bSChristian Brueffer.Bd -literal -offset indent
530a771a3bSChristian Bruefferuftdi_load="YES"
540a771a3bSChristian Brueffer.Ed
5531f48889SJosef Karthauser.Sh DESCRIPTION
5631f48889SJosef KarthauserThe
5731f48889SJosef Karthauser.Nm
58ea25ea8cSIan Leporedriver provides support for various serial adapters based on the
59ea25ea8cSIan Leporefollowing FTDI chips:
60ea25ea8cSIan Lepore.Pp
61ea25ea8cSIan Lepore.Bl -bullet -compact
62ea25ea8cSIan Lepore.It
63ea25ea8cSIan LeporeFT8U100AX
64ea25ea8cSIan Lepore.It
65ea25ea8cSIan LeporeFT8U232AM
66ea25ea8cSIan Lepore.It
67ea25ea8cSIan LeporeFT8U232BM
68ea25ea8cSIan Lepore.It
69ea25ea8cSIan LeporeFT232R
70ea25ea8cSIan Lepore.It
71ea25ea8cSIan LeporeFT2232C
72ea25ea8cSIan Lepore.It
73ea25ea8cSIan LeporeFT2232D
74ea25ea8cSIan Lepore.It
75ea25ea8cSIan LeporeFT2232H
76ea25ea8cSIan Lepore.It
77ea25ea8cSIan LeporeFT4232H
78ea25ea8cSIan Lepore.It
79ea25ea8cSIan LeporeFT230X
80ea25ea8cSIan Lepore.El
8131f48889SJosef Karthauser.Pp
8231f48889SJosef KarthauserThe device is accessed through the
8331f48889SJosef Karthauser.Xr ucom 4
8431f48889SJosef Karthauserdriver which makes it behave like a
8531f48889SJosef Karthauser.Xr tty 4 .
86a9d84a2bSIan Lepore.Pp
87a9d84a2bSIan LeporeMany of the supported chips provide additional functionality
88a9d84a2bSIan Leporesuch as bitbang mode and the MPSSE engine for serial bus emulation.
89a9d84a2bSIan LeporeThe
90a9d84a2bSIan Lepore.Nm
91a9d84a2bSIan Leporedriver provides access to that functionality with the following
92a9d84a2bSIan Lepore.Xr ioctl 2
93a9d84a2bSIan Leporecalls, defined in
94a9d84a2bSIan Lepore.In dev/usb/uftdiio.h :
95a9d84a2bSIan Lepore.Bl -tag -width indent
96a9d84a2bSIan Lepore.It Dv UFTDIIOC_RESET_IO Pq Vt int
97a9d84a2bSIan LeporeReset the channel to its default configuration, flush RX and TX FIFOs.
98a9d84a2bSIan Lepore.It Dv UFTDIIOC_RESET_RX Pq Vt int
99a9d84a2bSIan LeporeFlush the RX FIFO.
100a9d84a2bSIan Lepore.It Dv UFTDIIOC_RESET_TX Pq Vt int
101a9d84a2bSIan LeporeFlush the TX FIFO.
102a9d84a2bSIan Lepore.It Dv UFTDIIOC_SET_BITMODE Pq Vt "struct uftdi_bitmode"
103a9d84a2bSIan LeporePut the channel into the operating mode specified in
104a9d84a2bSIan Lepore.Va mode ,
105a9d84a2bSIan Leporeand set the pins indicated by ones in
106a9d84a2bSIan Lepore.Va iomask
107a9d84a2bSIan Leporeto output mode.
108a9d84a2bSIan LeporeThe
109a9d84a2bSIan Lepore.Va mode
110a9d84a2bSIan Leporemust be one of the
111a9d84a2bSIan Lepore.Va uftdi_bitmodes
112a9d84a2bSIan Leporevalues.
113a9d84a2bSIan Lepore.Bd -literal
114a9d84a2bSIan Leporeenum uftdi_bitmodes
115a9d84a2bSIan Lepore{
116a9d84a2bSIan Lepore	UFTDI_BITMODE_ASYNC = 0,
117a9d84a2bSIan Lepore	UFTDI_BITMODE_MPSSE = 1,
118a9d84a2bSIan Lepore	UFTDI_BITMODE_SYNC = 2,
119a9d84a2bSIan Lepore	UFTDI_BITMODE_CPU_EMUL = 3,
120a9d84a2bSIan Lepore	UFTDI_BITMODE_FAST_SERIAL = 4,
121a9d84a2bSIan Lepore	UFTDI_BITMODE_CBUS = 5,
122a9d84a2bSIan Lepore	UFTDI_BITMODE_NONE = 0xff,
123a9d84a2bSIan Lepore};
124a9d84a2bSIan Lepore
125a9d84a2bSIan Leporestruct uftdi_bitmode
126a9d84a2bSIan Lepore{
127a9d84a2bSIan Lepore	uint8_t mode;
128a9d84a2bSIan Lepore	uint8_t iomask;
129a9d84a2bSIan Lepore};
130a9d84a2bSIan Lepore.Ed
131a9d84a2bSIan Lepore.Pp
132a9d84a2bSIan LeporeManuals and application notes published by FTDI describe these
133a9d84a2bSIan Leporemodes in detail.
134a9d84a2bSIan LeporeTo use most of these modes, you first put the channel into
135a9d84a2bSIan Leporethe desired mode, then you
136a9d84a2bSIan Lepore.Xr read 2
137a9d84a2bSIan Leporeand
138a9d84a2bSIan Lepore.Xr write 2
139a9d84a2bSIan Leporedata which either reflects pin state or is interpreted
140a9d84a2bSIan Leporeas MPSSE commands and parameters, depending on the mode.
141a9d84a2bSIan Lepore.It Dv UFTDIIOC_GET_BITMODE Pq Vt "struct uftdi_bitmode"
142a9d84a2bSIan LeporeReturn the state of the bitbang pins at the time of the call in the
143a9d84a2bSIan Lepore.Va iomask
144a9d84a2bSIan Leporemember.
145a9d84a2bSIan LeporeThe
146a9d84a2bSIan Lepore.Va mode
147a9d84a2bSIan Leporemember is unused.
148a9d84a2bSIan Lepore.It Dv UFTDIIOC_SET_ERROR_CHAR Pq Vt int
149a9d84a2bSIan LeporeSet the character which is inserted into the buffer to mark
150a9d84a2bSIan Leporethe point of an error such as FIFO overflow.
151a9d84a2bSIan Lepore.It Dv UFTDIIOC_SET_EVENT_CHAR Pq Vt int
152a9d84a2bSIan LeporeSet the character which causes a partial FIFO full of data
153a9d84a2bSIan Leporeto be returned immediately even if the FIFO is not full.
154a9d84a2bSIan Lepore.It Dv UFTDIIOC_SET_LATENCY Pq Vt int
155a9d84a2bSIan LeporeSet the amount of time to wait for a full FIFO,
156a9d84a2bSIan Leporein milliseconds.
157a9d84a2bSIan LeporeIf more than this much time elapses without receiving a new
158a9d84a2bSIan Leporecharacter, any characters in the FIFO are returned.
159a9d84a2bSIan Lepore.It Dv UFTDIIOC_GET_LATENCY Pq Vt int
160a9d84a2bSIan LeporeGet the current value of the latency timer.
161a9d84a2bSIan Lepore.It Dv UFTDIIOC_GET_HWREV Pq Vt int
162a9d84a2bSIan LeporeGet the hardware revision number.
163a9d84a2bSIan LeporeThis is the
164a9d84a2bSIan Lepore.Va bcdDevice
165a9d84a2bSIan Leporevalue from the
166a9d84a2bSIan Lepore.Va usb_device_descriptor .
167*01c73a3bSGlen Barber.El
168fe72d7b1SSimon L. B. Nielsen.Sh HARDWARE
169fe72d7b1SSimon L. B. NielsenThe
170fe72d7b1SSimon L. B. Nielsen.Nm
171fe72d7b1SSimon L. B. Nielsendriver supports the following adapters:
172fe72d7b1SSimon L. B. Nielsen.Pp
173fe72d7b1SSimon L. B. Nielsen.Bl -bullet -compact
174fe72d7b1SSimon L. B. Nielsen.It
1753aa6430fSLukas ErtlB&B Electronics USB->RS422/485 adapter
1763aa6430fSLukas Ertl.It
17729881a83SMarc FonvieilleElexol USB MOD1 and USB MOD3
178f53b14baSMarc Fonvieille.It
179fe72d7b1SSimon L. B. NielsenHP USB-Serial adapter shipped with some HP laptops
180fe72d7b1SSimon L. B. Nielsen.It
181fe72d7b1SSimon L. B. NielsenInland UAS111
182fe72d7b1SSimon L. B. Nielsen.It
183fe72d7b1SSimon L. B. NielsenQVS USC-1000
18499f1557aSTakanori Watanabe.It
18599f1557aSTakanori WatanabeBuffalo PC-OP-RS / Kurouto-shikou KURO-RS universal remote
1867bc5465eSPoul-Henning Kamp.It
1877bc5465eSPoul-Henning KampPrologix GPIB-USB Controller
188fe72d7b1SSimon L. B. Nielsen.El
18931f48889SJosef Karthauser.Sh SEE ALSO
19031f48889SJosef Karthauser.Xr tty 4 ,
19131f48889SJosef Karthauser.Xr ucom 4 ,
19231f48889SJosef Karthauser.Xr usb 4
19331f48889SJosef Karthauser.Sh HISTORY
19431f48889SJosef KarthauserThe
19531f48889SJosef Karthauser.Nm
19631f48889SJosef Karthauserdriver
19731f48889SJosef Karthauserappeared in
198a10ab609SDavid E. O'Brien.Fx 4.8
199a10ab609SDavid E. O'Brienfrom
20031f48889SJosef Karthauser.Nx 1.5 .
201