]> cvs.zerfleddert.de Git - usb-driver/commitdiff
make sure that there is valid data if the last command in a transfer is
authormichael <michael>
Sun, 29 Apr 2007 21:50:09 +0000 (21:50 +0000)
committermichael <michael>
Sun, 29 Apr 2007 21:50:09 +0000 (21:50 +0000)
a read

jtagkey.c

index 249e9d963377150551387f65d52df14e87ef0cba..7707ae042d1112a574d13f21aea8ebb79424e952 100644 (file)
--- a/jtagkey.c
+++ b/jtagkey.c
@@ -79,6 +79,7 @@ static int jtagkey_set_bbmode(unsigned char mode) {
 
        if (bitbang_mode != mode) {
                DPRINTF("switching bitbang-mode!\n");
+
                /* Wait for the latency-timer to kick in */
                usleep(2);
                if ((ret = ftdi_set_bitmode(&ftdic, JTAGKEY_TCK|JTAGKEY_TDI|JTAGKEY_TMS|JTAGKEY_OEn, mode))  != 0) {
@@ -236,6 +237,10 @@ int jtagkey_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
        if (nread)
        {
                DPRINTF("writing %d bytes\n", writepos-writebuf);
+
+               *writepos = last_data;
+               writepos++;
+
                jtagkey_set_bbmode(BITMODE_SYNCBB);
                ftdi_write_data(&ftdic, writebuf, writepos-writebuf);
 
@@ -276,6 +281,7 @@ int jtagkey_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
                        switch(tr[i].cmdTrans) {
                                case PP_READ:
                                        data = *readpos;
+
 #ifdef DEBUG
                                        DPRINTF("READ: 0x%x\n", data);
                                        jtagkey_state(data);
Impressum, Datenschutz