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 . 86*a9d84a2bSIan Lepore.Pp 87*a9d84a2bSIan LeporeMany of the supported chips provide additional functionality 88*a9d84a2bSIan Leporesuch as bitbang mode and the MPSSE engine for serial bus emulation. 89*a9d84a2bSIan LeporeThe 90*a9d84a2bSIan Lepore.Nm 91*a9d84a2bSIan Leporedriver provides access to that functionality with the following 92*a9d84a2bSIan Lepore.Xr ioctl 2 93*a9d84a2bSIan Leporecalls, defined in 94*a9d84a2bSIan Lepore.In dev/usb/uftdiio.h : 95*a9d84a2bSIan Lepore.Bl -tag -width indent 96*a9d84a2bSIan Lepore.It Dv UFTDIIOC_RESET_IO Pq Vt int 97*a9d84a2bSIan LeporeReset the channel to its default configuration, flush RX and TX FIFOs. 98*a9d84a2bSIan Lepore.It Dv UFTDIIOC_RESET_RX Pq Vt int 99*a9d84a2bSIan LeporeFlush the RX FIFO. 100*a9d84a2bSIan Lepore.It Dv UFTDIIOC_RESET_TX Pq Vt int 101*a9d84a2bSIan LeporeFlush the TX FIFO. 102*a9d84a2bSIan Lepore.It Dv UFTDIIOC_SET_BITMODE Pq Vt "struct uftdi_bitmode" 103*a9d84a2bSIan LeporePut the channel into the operating mode specified in 104*a9d84a2bSIan Lepore.Va mode , 105*a9d84a2bSIan Leporeand set the pins indicated by ones in 106*a9d84a2bSIan Lepore.Va iomask 107*a9d84a2bSIan Leporeto output mode. 108*a9d84a2bSIan LeporeThe 109*a9d84a2bSIan Lepore.Va mode 110*a9d84a2bSIan Leporemust be one of the 111*a9d84a2bSIan Lepore.Va uftdi_bitmodes 112*a9d84a2bSIan Leporevalues. 113*a9d84a2bSIan Lepore.Bd -literal 114*a9d84a2bSIan Leporeenum uftdi_bitmodes 115*a9d84a2bSIan Lepore{ 116*a9d84a2bSIan Lepore UFTDI_BITMODE_ASYNC = 0, 117*a9d84a2bSIan Lepore UFTDI_BITMODE_MPSSE = 1, 118*a9d84a2bSIan Lepore UFTDI_BITMODE_SYNC = 2, 119*a9d84a2bSIan Lepore UFTDI_BITMODE_CPU_EMUL = 3, 120*a9d84a2bSIan Lepore UFTDI_BITMODE_FAST_SERIAL = 4, 121*a9d84a2bSIan Lepore UFTDI_BITMODE_CBUS = 5, 122*a9d84a2bSIan Lepore UFTDI_BITMODE_NONE = 0xff, 123*a9d84a2bSIan Lepore}; 124*a9d84a2bSIan Lepore 125*a9d84a2bSIan Leporestruct uftdi_bitmode 126*a9d84a2bSIan Lepore{ 127*a9d84a2bSIan Lepore uint8_t mode; 128*a9d84a2bSIan Lepore uint8_t iomask; 129*a9d84a2bSIan Lepore}; 130*a9d84a2bSIan Lepore.Ed 131*a9d84a2bSIan Lepore.Pp 132*a9d84a2bSIan LeporeManuals and application notes published by FTDI describe these 133*a9d84a2bSIan Leporemodes in detail. 134*a9d84a2bSIan LeporeTo use most of these modes, you first put the channel into 135*a9d84a2bSIan Leporethe desired mode, then you 136*a9d84a2bSIan Lepore.Xr read 2 137*a9d84a2bSIan Leporeand 138*a9d84a2bSIan Lepore.Xr write 2 139*a9d84a2bSIan Leporedata which either reflects pin state or is interpreted 140*a9d84a2bSIan Leporeas MPSSE commands and parameters, depending on the mode. 141*a9d84a2bSIan Lepore.It Dv UFTDIIOC_GET_BITMODE Pq Vt "struct uftdi_bitmode" 142*a9d84a2bSIan LeporeReturn the state of the bitbang pins at the time of the call in the 143*a9d84a2bSIan Lepore.Va iomask 144*a9d84a2bSIan Leporemember. 145*a9d84a2bSIan LeporeThe 146*a9d84a2bSIan Lepore.Va mode 147*a9d84a2bSIan Leporemember is unused. 148*a9d84a2bSIan Lepore.It Dv UFTDIIOC_SET_ERROR_CHAR Pq Vt int 149*a9d84a2bSIan LeporeSet the character which is inserted into the buffer to mark 150*a9d84a2bSIan Leporethe point of an error such as FIFO overflow. 151*a9d84a2bSIan Lepore.It Dv UFTDIIOC_SET_EVENT_CHAR Pq Vt int 152*a9d84a2bSIan LeporeSet the character which causes a partial FIFO full of data 153*a9d84a2bSIan Leporeto be returned immediately even if the FIFO is not full. 154*a9d84a2bSIan Lepore.It Dv UFTDIIOC_SET_LATENCY Pq Vt int 155*a9d84a2bSIan LeporeSet the amount of time to wait for a full FIFO, 156*a9d84a2bSIan Leporein milliseconds. 157*a9d84a2bSIan LeporeIf more than this much time elapses without receiving a new 158*a9d84a2bSIan Leporecharacter, any characters in the FIFO are returned. 159*a9d84a2bSIan Lepore.It Dv UFTDIIOC_GET_LATENCY Pq Vt int 160*a9d84a2bSIan LeporeGet the current value of the latency timer. 161*a9d84a2bSIan Lepore.It Dv UFTDIIOC_GET_HWREV Pq Vt int 162*a9d84a2bSIan LeporeGet the hardware revision number. 163*a9d84a2bSIan LeporeThis is the 164*a9d84a2bSIan Lepore.Va bcdDevice 165*a9d84a2bSIan Leporevalue from the 166*a9d84a2bSIan Lepore.Va usb_device_descriptor . 167fe72d7b1SSimon L. B. Nielsen.Sh HARDWARE 168fe72d7b1SSimon L. B. NielsenThe 169fe72d7b1SSimon L. B. Nielsen.Nm 170fe72d7b1SSimon L. B. Nielsendriver supports the following adapters: 171fe72d7b1SSimon L. B. Nielsen.Pp 172fe72d7b1SSimon L. B. Nielsen.Bl -bullet -compact 173fe72d7b1SSimon L. B. Nielsen.It 1743aa6430fSLukas ErtlB&B Electronics USB->RS422/485 adapter 1753aa6430fSLukas Ertl.It 17629881a83SMarc FonvieilleElexol USB MOD1 and USB MOD3 177f53b14baSMarc Fonvieille.It 178fe72d7b1SSimon L. B. NielsenHP USB-Serial adapter shipped with some HP laptops 179fe72d7b1SSimon L. B. Nielsen.It 180fe72d7b1SSimon L. B. NielsenInland UAS111 181fe72d7b1SSimon L. B. Nielsen.It 182fe72d7b1SSimon L. B. NielsenQVS USC-1000 18399f1557aSTakanori Watanabe.It 18499f1557aSTakanori WatanabeBuffalo PC-OP-RS / Kurouto-shikou KURO-RS universal remote 1857bc5465eSPoul-Henning Kamp.It 1867bc5465eSPoul-Henning KampPrologix GPIB-USB Controller 187fe72d7b1SSimon L. B. Nielsen.El 18831f48889SJosef Karthauser.Sh SEE ALSO 18931f48889SJosef Karthauser.Xr tty 4 , 19031f48889SJosef Karthauser.Xr ucom 4 , 19131f48889SJosef Karthauser.Xr usb 4 19231f48889SJosef Karthauser.Sh HISTORY 19331f48889SJosef KarthauserThe 19431f48889SJosef Karthauser.Nm 19531f48889SJosef Karthauserdriver 19631f48889SJosef Karthauserappeared in 197a10ab609SDavid E. O'Brien.Fx 4.8 198a10ab609SDavid E. O'Brienfrom 19931f48889SJosef Karthauser.Nx 1.5 . 200