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 March 31, 2014 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 38serial adapter chips. 39.Sh SYNOPSIS 40To compile this driver into the kernel, 41place the following lines in your 42kernel configuration file: 43.Bd -ragged -offset indent 44.Cd "device usb" 45.Cd "device ucom" 46.Cd "device uftdi" 47.Ed 48.Pp 49Alternatively, to load the driver as a 50module at boot time, place the following line in 51.Xr loader.conf 5 : 52.Bd -literal -offset indent 53uftdi_load="YES" 54.Ed 55.Sh DESCRIPTION 56The 57.Nm 58driver provides support for various serial adapters based on the 59following FTDI chips: 60.Pp 61.Bl -bullet -compact 62.It 63FT8U100AX 64.It 65FT8U232AM 66.It 67FT8U232BM 68.It 69FT232R 70.It 71FT2232C 72.It 73FT2232D 74.It 75FT2232H 76.It 77FT4232H 78.It 79FT230X 80.El 81.Pp 82The device is accessed through the 83.Xr ucom 4 84driver which makes it behave like a 85.Xr tty 4 . 86.Pp 87Many of the supported chips provide additional functionality 88such as bitbang mode and the MPSSE engine for serial bus emulation. 89The 90.Nm 91driver provides access to that functionality with the following 92.Xr ioctl 2 93calls, defined in 94.In dev/usb/uftdiio.h : 95.Bl -tag -width indent 96.It Dv UFTDIIOC_RESET_IO Pq Vt int 97Reset the channel to its default configuration, flush RX and TX FIFOs. 98.It Dv UFTDIIOC_RESET_RX Pq Vt int 99Flush the RX FIFO. 100.It Dv UFTDIIOC_RESET_TX Pq Vt int 101Flush the TX FIFO. 102.It Dv UFTDIIOC_SET_BITMODE Pq Vt "struct uftdi_bitmode" 103Put the channel into the operating mode specified in 104.Va mode , 105and set the pins indicated by ones in 106.Va iomask 107to output mode. 108The 109.Va mode 110must be one of the 111.Va uftdi_bitmodes 112values. 113.Bd -literal 114enum uftdi_bitmodes 115{ 116 UFTDI_BITMODE_ASYNC = 0, 117 UFTDI_BITMODE_MPSSE = 1, 118 UFTDI_BITMODE_SYNC = 2, 119 UFTDI_BITMODE_CPU_EMUL = 3, 120 UFTDI_BITMODE_FAST_SERIAL = 4, 121 UFTDI_BITMODE_CBUS = 5, 122 UFTDI_BITMODE_NONE = 0xff, 123}; 124 125struct uftdi_bitmode 126{ 127 uint8_t mode; 128 uint8_t iomask; 129}; 130.Ed 131.Pp 132Manuals and application notes published by FTDI describe these 133modes in detail. 134To use most of these modes, you first put the channel into 135the desired mode, then you 136.Xr read 2 137and 138.Xr write 2 139data which either reflects pin state or is interpreted 140as MPSSE commands and parameters, depending on the mode. 141.It Dv UFTDIIOC_GET_BITMODE Pq Vt "struct uftdi_bitmode" 142Return the state of the bitbang pins at the time of the call in the 143.Va iomask 144member. 145The 146.Va mode 147member is unused. 148.It Dv UFTDIIOC_SET_ERROR_CHAR Pq Vt int 149Set the character which is inserted into the buffer to mark 150the point of an error such as FIFO overflow. 151.It Dv UFTDIIOC_SET_EVENT_CHAR Pq Vt int 152Set the character which causes a partial FIFO full of data 153to be returned immediately even if the FIFO is not full. 154.It Dv UFTDIIOC_SET_LATENCY Pq Vt int 155Set the amount of time to wait for a full FIFO, 156in milliseconds. 157If more than this much time elapses without receiving a new 158character, any characters in the FIFO are returned. 159.It Dv UFTDIIOC_GET_LATENCY Pq Vt int 160Get the current value of the latency timer. 161.It Dv UFTDIIOC_GET_HWREV Pq Vt int 162Get the hardware revision number. 163This is the 164.Va bcdDevice 165value from the 166.Va usb_device_descriptor . 167.El 168.Sh HARDWARE 169The 170.Nm 171driver supports the following adapters: 172.Pp 173.Bl -bullet -compact 174.It 175B&B Electronics USB->RS422/485 adapter 176.It 177Elexol USB MOD1 and USB MOD3 178.It 179HP USB-Serial adapter shipped with some HP laptops 180.It 181Inland UAS111 182.It 183QVS USC-1000 184.It 185Buffalo PC-OP-RS / Kurouto-shikou KURO-RS universal remote 186.It 187Prologix GPIB-USB Controller 188.El 189.Sh SEE ALSO 190.Xr tty 4 , 191.Xr ucom 4 , 192.Xr usb 4 193.Sh HISTORY 194The 195.Nm 196driver 197appeared in 198.Fx 4.8 199from 200.Nx 1.5 . 201