diff options
Diffstat (limited to 'sys/dev/usb/uftdiio.h')
-rw-r--r-- | sys/dev/usb/uftdiio.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/sys/dev/usb/uftdiio.h b/sys/dev/usb/uftdiio.h index 0db2f38..b624483 100644 --- a/sys/dev/usb/uftdiio.h +++ b/sys/dev/usb/uftdiio.h @@ -43,7 +43,7 @@ enum uftdi_bitmodes UFTDI_BITMODE_CPU_EMUL = 3, UFTDI_BITMODE_FAST_SERIAL = 4, UFTDI_BITMODE_CBUS = 5, - UFTDI_BITMODE_NONE = 0xff, + UFTDI_BITMODE_NONE = 0xff, /* aka UART mode. */ }; /* @@ -52,8 +52,9 @@ enum uftdi_bitmodes * iomask = Mask of bits enabled for bitbang output. * * For UFTDIIOC_GET_BITMODE: - * mode = Unused. - * iomask = Returned snapshot of bitbang pin states at time of call. + * mode = Mode most recently set using UFTDIIOC_SET_BITMODE. + * iomask = Returned snapshot of DBUS0..DBUS7 pin states at time of call. + * Pin states can be read in any mode, not just bitbang modes. */ struct uftdi_bitmode { @@ -61,6 +62,26 @@ struct uftdi_bitmode uint8_t iomask; }; +/* + * For UFTDIIOC_READ_EEPROM, UFTDIIOC_WRITE_EEPROM: + * + * IO is done in 16-bit words at the chip level; offset and length are in bytes, + * but must each be evenly divisible by two. + * + * It is not necessary to erase before writing. For the FT232R device (only) + * you must set the latency timer to 0x77 before doing a series of eeprom writes + * (and restore it to the prior value when done). + */ +struct uftdi_eeio +{ + uint16_t offset; + uint16_t length; + uint16_t data[64]; +}; + +/* Pass this value to confirm that eeprom erase request is not accidental. */ +#define UFTDI_CONFIRM_ERASE 0x26139108 + #define UFTDIIOC_RESET_IO _IO('c', 0) /* Reset config, flush fifos.*/ #define UFTDIIOC_RESET_RX _IO('c', 1) /* Flush input fifo. */ #define UFTDIIOC_RESET_TX _IO('c', 2) /* Flush output fifo. */ @@ -71,5 +92,8 @@ struct uftdi_bitmode #define UFTDIIOC_SET_LATENCY _IOW('c', 7, int) /* 1-255 ms */ #define UFTDIIOC_GET_LATENCY _IOR('c', 8, int) #define UFTDIIOC_GET_HWREV _IOR('c', 9, int) +#define UFTDIIOC_READ_EEPROM _IOWR('c', 10, struct uftdi_eeio) +#define UFTDIIOC_WRITE_EEPROM _IOW('c', 11, struct uftdi_eeio) +#define UFTDIIOC_ERASE_EEPROM _IOW('c', 12, int) #endif |