X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=src%2Fftdi.h;h=ff72d05853c52ea1db6aaf95c97f913ea0a22f54;hp=1040e2e76b98e551487c980ea8a03286b6b55fc1;hb=7cc9950ec21b5cdba8b80ed18dbf686e5024aee1;hpb=9bec2387b04ac85385ff019fa1a4cf7bbe9491cf diff --git a/src/ftdi.h b/src/ftdi.h index 1040e2e..ff72d05 100644 --- a/src/ftdi.h +++ b/src/ftdi.h @@ -20,7 +20,7 @@ #include /// FTDI chip type -enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2 }; +enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2, TYPE_R=3 }; /// 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,7 +35,9 @@ enum ftdi_mpsse_mode { BITMODE_MPSSE = 0x02, BITMODE_SYNCBB = 0x04, BITMODE_MCU = 0x08, - BITMODE_OPTO = 0x10 + // CPU-style fifo mode gets set via EEPROM + BITMODE_OPTO = 0x10, + BITMODE_CBUS = 0x20 }; /// Port interface for FT2232C @@ -111,8 +113,12 @@ enum ftdi_interface { #define SIO_RTS_CTS_HS (0x1 << 8) +/* marker for unused usb urb structures + (taken from libusb) */ +#define FTDI_URB_USERCONTEXT_COOKIE ((void *)0x1) + /** - Main context structure for all libftdi functions. + \brief Main context structure for all libftdi functions. Do not access directly if possible. */ @@ -158,10 +164,15 @@ struct ftdi_context { /// String representation of last error char *error_str; + + /// Buffer needed for async communication + char *async_usb_buffer; + /// Number of URB-structures we can buffer + unsigned int async_usb_buffer_size; }; /** - Single linked list of usb devices created by ftdi_usb_find_all() + \brief list of usb devices created by ftdi_usb_find_all() */ struct ftdi_device_list { /// pointer to next entry @@ -171,7 +182,7 @@ struct ftdi_device_list { }; /** - FTDI eeprom structure + \brief FTDI eeprom structure */ struct ftdi_eeprom { /// vendor id @@ -223,6 +234,10 @@ extern "C" { int ftdi_usb_find_all(struct ftdi_context *ftdi, struct ftdi_device_list **devlist, int vendor, int product); void ftdi_list_free(struct ftdi_device_list **devlist); + int ftdi_usb_get_strings(struct ftdi_context *ftdi, struct usb_device *dev, + char * manufacturer, int mnf_len, + char * description, int desc_len, + char * serial, int serial_len); 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, @@ -245,6 +260,9 @@ extern "C" { int ftdi_write_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize); int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize); + int ftdi_write_data_async(struct ftdi_context *ftdi, unsigned char *buf, int size); + void ftdi_async_complete(struct ftdi_context *ftdi, int wait_for_more); + int ftdi_enable_bitbang(struct ftdi_context *ftdi, unsigned char bitmask); int ftdi_disable_bitbang(struct ftdi_context *ftdi); int ftdi_set_bitmode(struct ftdi_context *ftdi, unsigned char bitmask, unsigned char mode); @@ -260,6 +278,7 @@ extern "C" { // "eeprom" needs to be valid 128 byte eeprom (generated by the eeprom generator) // the checksum of the eeprom is valided int ftdi_read_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom); + int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid); int ftdi_write_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom); int ftdi_erase_eeprom(struct ftdi_context *ftdi);