]> git.zerfleddert.de Git - usb-driver/commitdiff
ignore no-ops
authormichael <michael>
Sun, 29 Apr 2007 14:40:03 +0000 (14:40 +0000)
committermichael <michael>
Sun, 29 Apr 2007 14:40:03 +0000 (14:40 +0000)
jtagkey.c

index 42669591ecfd76a9a06098e34380367ce4df8aa6..9891f4b70302d77a43283db5dbbcf16de3c2454d 100644 (file)
--- a/jtagkey.c
+++ b/jtagkey.c
@@ -98,14 +98,14 @@ int jtagkey_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
        unsigned long port;
        unsigned char val;
        static unsigned char last_data = 0;
        unsigned long port;
        unsigned char val;
        static unsigned char last_data = 0;
+       static unsigned char last_write = 0x00;
        static unsigned char writebuf[USBBUFSIZE], *writepos = writebuf;
        static unsigned char readbuf[USBBUFSIZE], *readpos;
        static unsigned char writebuf[USBBUFSIZE], *writepos = writebuf;
        static unsigned char readbuf[USBBUFSIZE], *readpos;
-       unsigned char data;
-       static unsigned char last_write = 0x00;
+       unsigned char data, prev_data;
 
 
-       /* Count writes */
+       /* Count reads */
        for (i = 0; i < num; i++)
        for (i = 0; i < num; i++)
-               if (tr[i].cmdTrans == 10)
+               if (tr[i].cmdTrans == PP_READ)
                        nread++;
 
        /* Write combining */
                        nread++;
 
        /* Write combining */
@@ -117,7 +117,7 @@ int jtagkey_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
                i = 0;
                while (i < writepos-writebuf) {
                        i += ftdi_read_data(&ftdic, readbuf, sizeof(readbuf));
                i = 0;
                while (i < writepos-writebuf) {
                        i += ftdi_read_data(&ftdic, readbuf, sizeof(readbuf));
-               };
+               }
                DPRINTF("read %d/%d bytes\n", i, writepos-writebuf);
                writepos = writebuf;
        }
                DPRINTF("read %d/%d bytes\n", i, writepos-writebuf);
                writepos = writebuf;
        }
@@ -137,6 +137,7 @@ int jtagkey_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
 
                /* Pad writebuf for read-commands in stream */
                *writepos = last_data;
 
                /* Pad writebuf for read-commands in stream */
                *writepos = last_data;
+               prev_data = last_data;
 
                if (port == ppbase + PP_DATA) {
                        DPRINTF("data port\n");
 
                if (port == ppbase + PP_DATA) {
                        DPRINTF("data port\n");
@@ -191,7 +192,9 @@ int jtagkey_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
                                        break;
                        }
                }
                                        break;
                        }
                }
-               writepos++;
+
+               if (nread || (*writepos != prev_data))
+                       writepos++;
        }
 
        if (nread)
        }
 
        if (nread)
Impressum, Datenschutz