X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=src%2Fftdi.h;h=b518f969f10dc68343e54c5dbc4e49419fcdcfd9;hp=46032e719f7e8002324e7978cc5fca9475171395;hb=418aaa72029f42b4054336067d5874e79992a426;hpb=22d12cda4aed8d25fb79588a7261ca489db5ecd7 diff --git a/src/ftdi.h b/src/ftdi.h index 46032e7..b518f96 100644 --- a/src/ftdi.h +++ b/src/ftdi.h @@ -22,7 +22,7 @@ #define FTDI_DEFAULT_EEPROM_SIZE 128 /** FTDI chip type */ -enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2, TYPE_R=3 }; +enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2, TYPE_R=3, TYPE_2232H=4, TYPE_4232H=5 }; /** Parity mode for ftdi_set_line_property() */ enum ftdi_parity_type { NONE=0, ODD=1, EVEN=2, MARK=3, SPACE=4 }; /** Number of stop bits for ftdi_set_line_property() */ @@ -35,22 +35,25 @@ enum ftdi_break_type { BREAK_OFF=0, BREAK_ON=1 }; /** MPSSE bitbang modes */ enum ftdi_mpsse_mode { - BITMODE_RESET = 0x00, - BITMODE_BITBANG= 0x01, - BITMODE_MPSSE = 0x02, - BITMODE_SYNCBB = 0x04, - BITMODE_MCU = 0x08, - /* CPU-style fifo mode gets set via EEPROM */ - BITMODE_OPTO = 0x10, - BITMODE_CBUS = 0x20 + BITMODE_RESET = 0x00, /**< switch off bitbang mode, back to regular serial/FIFO */ + BITMODE_BITBANG= 0x01, /**< classical asynchronous bitbang mode, introduced with B-type chips */ + BITMODE_MPSSE = 0x02, /**< MPSSE mode, available on 2232x chips */ + BITMODE_SYNCBB = 0x04, /**< synchronous bitbang mode, available on 2232x and R-type chips */ + BITMODE_MCU = 0x08, /**< MCU Host Bus Emulation mode, available on 2232x chips */ + /* CPU-style fifo mode gets set via EEPROM */ + BITMODE_OPTO = 0x10, /**< Fast Opto-Isolated Serial Interface Mode, available on 2232x chips */ + BITMODE_CBUS = 0x20, /**< Bitbang on CBUS pins of R-type chips, configure in EEPROM before */ + BITMODE_SYNCFF = 0x40, /**< Single Channel Synchronous FIFO mode, available on 2232H chips */ }; -/** Port interface for FT2232C */ +/** Port interface for chips with multiple interfaces */ enum ftdi_interface { INTERFACE_ANY = 0, INTERFACE_A = 1, - INTERFACE_B = 2 + INTERFACE_B = 2, + INTERFACE_C = 3, + INTERFACE_D = 4 }; /* Shifting commands IN MPSSE Mode*/ @@ -177,6 +180,8 @@ struct ftdi_context unsigned int readbuffer_chunksize; /** write buffer chunk size */ unsigned int writebuffer_chunksize; + /** maximum packet size. Needed for filtering modem status bytes every n packets. */ + unsigned int max_packet_size; /* FTDI FT2232C requirecments */ /** FT2232C interface number: 0 or 1 */ @@ -265,7 +270,7 @@ extern "C" #endif int ftdi_init(struct ftdi_context *ftdi); - struct ftdi_context *ftdi_new(); + struct ftdi_context *ftdi_new(void); int ftdi_set_interface(struct ftdi_context *ftdi, enum ftdi_interface interface); void ftdi_deinit(struct ftdi_context *ftdi); @@ -284,7 +289,10 @@ extern "C" int ftdi_usb_open(struct ftdi_context *ftdi, int vendor, int product); int ftdi_usb_open_desc(struct ftdi_context *ftdi, int vendor, int product, const char* description, const char* serial); + int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, int vendor, int product, + const char* description, const char* serial, unsigned int index); int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct usb_device *dev); + int ftdi_usb_open_string(struct ftdi_context *ftdi, const char* description); int ftdi_usb_close(struct ftdi_context *ftdi); int ftdi_usb_reset(struct ftdi_context *ftdi); @@ -345,6 +353,9 @@ extern "C" int ftdi_write_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom); int ftdi_erase_eeprom(struct ftdi_context *ftdi); + int ftdi_read_eeprom_location (struct ftdi_context *ftdi, int eeprom_addr, unsigned short *eeprom_val); + int ftdi_write_eeprom_location(struct ftdi_context *ftdi, int eeprom_addr, unsigned short eeprom_val); + char *ftdi_get_error_string(struct ftdi_context *ftdi); #ifdef __cplusplus