X-Git-Url: http://developer.intra2net.com/git/?a=blobdiff_plain;f=src%2Fftdi.h;h=324d07be52031946a161ef01ddbf9954fee51278;hb=02212d8e84cccd393a95612d4c4a5ec495fa3e2e;hp=179d3ca3076e329418c203ef6a958038f8ebf706;hpb=866a6dbba29fe197207a3d2ea579fcab9778ea8c;p=libftdi diff --git a/src/ftdi.h b/src/ftdi.h index 179d3ca..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,6 +354,8 @@ 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); @@ -359,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);