Add ftdi_eeprom_free() to free allocated memory in eeprom
[libftdi] / src / ftdi.h
index 179d3ca..aaa7744 100644 (file)
@@ -278,6 +278,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 +352,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 +384,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);