X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=src%2Fftdi.h;h=324d07be52031946a161ef01ddbf9954fee51278;hp=e57fe94507ae2011830966b3c46025dc6d1177b2;hb=c2ed8c4e338d1c907b79340c34da30aaf1b15dbd;hpb=579b006f4873fa72c73d372660d158061497bcc9 diff --git a/src/ftdi.h b/src/ftdi.h index e57fe94..324d07b 100644 --- a/src/ftdi.h +++ b/src/ftdi.h @@ -175,6 +175,8 @@ struct ftdi_transfer_control struct ftdi_context { /* USB specific */ + /** libusb's context */ + struct libusb_context *usb_ctx; /** libusb's usb_dev_handle */ struct libusb_device_handle *usb_dev; /** usb read timeout */ @@ -278,6 +280,29 @@ struct ftdi_eeprom int size; }; +/** + \brief Progress Info for streaming read +*/ +struct size_and_time +{ + uint64_t totalBytes; + struct timeval time; +}; + +typedef struct +{ + struct size_and_time first; + struct size_and_time prev; + struct size_and_time current; + double totalTime; + double totalRate; + double currentRate; +} FTDIProgressInfo; + +typedef int (FTDIStreamCallback)(uint8_t *buffer, int length, + FTDIProgressInfo *progress, void *userdata); + + #ifdef __cplusplus extern "C" { @@ -329,9 +354,14 @@ 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_readstream(struct ftdi_context *ftdi, FTDIStreamCallback *callback, + void *userdata, int packetsPerTransfer, int numTransfers); 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); + struct ftdi_transfer_control *ftdi_read_data_submit(struct ftdi_context *ftdi, unsigned char *buf, int size); + int ftdi_transfer_data_done(struct ftdi_transfer_control *tc); + int DEPRECATED(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); @@ -356,6 +386,7 @@ extern "C" /* init and build eeprom from ftdi_eeprom structure */ void ftdi_eeprom_initdefaults(struct ftdi_eeprom *eeprom); + void ftdi_eeprom_free(struct ftdi_eeprom *eeprom); int ftdi_eeprom_build(struct ftdi_eeprom *eeprom, unsigned char *output); int ftdi_eeprom_decode(struct ftdi_eeprom *eeprom, unsigned char *output, int size);