UFTDI(4) | Device Drivers Manual | UFTDI(4) |
uftdi
— USB
support for serial adapters based on the FTDI family of USB serial adapter
chips.
To compile this driver into the kernel, place the following lines in your kernel configuration file:
device usb
device ucom
device uftdi
Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5):
uftdi_load="YES"
The uftdi
driver provides support for
various serial adapters based on the following FTDI chips:
The device is accessed through the ucom(4) driver which makes it behave like a tty(4).
Many of the supported chips provide additional functionality such
as bitbang mode and the MPSSE engine for serial bus emulation. The
uftdi
driver provides access to that functionality
with the following ioctl(2) calls, defined in
<dev/usb/uftdiio.h>
:
UFTDIIOC_RESET_IO
(int)UFTDIIOC_RESET_RX
(int)UFTDIIOC_RESET_TX
(int)UFTDIIOC_SET_BITMODE
(struct uftdi_bitmode)UFTDI_BITMODE_NONE
returns the channel to standard UART mode.
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; };
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 read(2) and write(2) data which either reflects pin state or is interpreted as MPSSE commands and parameters, depending on the mode.
UFTDIIOC_GET_BITMODE
(struct uftdi_bitmode)UFTDI_BITMODE_NONE
(UART) mode.UFTDIIOC_SET_ERROR_CHAR
(int)UFTDIIOC_SET_EVENT_CHAR
(int)UFTDIIOC_SET_LATENCY
(int)UFTDIIOC_GET_LATENCY
(int)UFTDIIOC_GET_HWREV
(int)UFTDIIOC_READ_EEPROM
(struct uftdi_eeio)struct uftdi_eeio { uint16_t offset; uint16_t length; uint16_t data[64]; };
The FT232R chip has an internal eeprom. An external serial eeprom is optional on other FTDI chips. The eeprom may contain 64, 128, or 256 words, depending on the part used. Multiple calls may be needed to read or write the larger parts. When no eeprom is present, all words in the returned data are 0xffff. An erased eeprom also reads as all 0xffff.
UFTDIIOC_WRITE_EEPROM
(struct uftdi_eeio)UFTDIIOC_READ_EEPROM
.
The FTDI chip does a blind write to the eeprom, and it will appear to succeed even when no eeprom is present. To ensure a good write you must read back and verify the data. It is not necessary to erase before writing. Any position within the eeprom can be overwritten at any time.
UFTDIIOC_ERASE_EEPROM
(int)UFTDI_CONFIRM_ERASE
as the argument to this
ioctl.The uftdi
driver supports the following
adapters:
The uftdi
driver appeared in
FreeBSD 4.8 from NetBSD
1.5.
April 26, 2017 | Debian |