]> git.zerfleddert.de Git - usb-driver/commitdiff
some more performance improvements
authormichael <michael>
Sun, 29 Apr 2007 18:48:10 +0000 (18:48 +0000)
committermichael <michael>
Sun, 29 Apr 2007 18:48:10 +0000 (18:48 +0000)
jtagkey.c

index bf1cded0ee4978272c5019f5064c8ed70424ec7e..04cfb4c018350b30456eda5a5cbe4ffeb813bc6c 100644 (file)
--- a/jtagkey.c
+++ b/jtagkey.c
@@ -208,10 +208,35 @@ int jtagkey_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
        {
                DPRINTF("writing %d bytes\n", writepos-writebuf);
                for (i=0; i<writepos-writebuf; i++) {
+#if 1
+                       int combine = i;
+                       
+                       do {
+                               if (combine > 0 &&
+                                       tr[combine-1].cmdTrans == PP_READ) {
+                                       break;
+                               } else {
+                                       combine++;
+                               }
+                       } while (combine < writepos-writebuf);
+
+                       DPRINTF("combined writes before read: %d\n", combine);
+
+                       if ((combine-i)-1 > 0) {
+                               ftdi_write_data(&ftdic, writebuf+i, (combine-i)-1);
+                               i = combine-1;
+                       }
+#endif
+
                        ftdi_write_data(&ftdic, writebuf+i, 1);
 
                        if (i > 0 && tr[i].cmdTrans == PP_WRITE && tr[i-1].cmdTrans == PP_READ)
                                ftdi_read_pins(&ftdic, readbuf+i);
+
+                       if (i == (writepos-writebuf)-1 && tr[i].cmdTrans == PP_READ) {
+                               ftdi_write_data(&ftdic, writebuf+i, 1);
+                               ftdi_read_pins(&ftdic, readbuf+i+1);
+                       }
                }
 
 #ifdef DEBUG
Impressum, Datenschutz