- added support for the oocd-link (http://www.joernonline.de/dw/doku.php?id=en:projec...
[openocd.git] / src / jtag / ft2232.c
index e681b3e5ad843d6294ea95ffeb7a7b2403d20e65..67167c78b167c9adb51b299081c5a10822f7e363 100644 (file)
@@ -108,6 +108,7 @@ ft2232_layout_t ft2232_layouts[] =
        {"usbjtag", usbjtag_init, usbjtag_reset, NULL},
        {"jtagkey", jtagkey_init, jtagkey_reset, NULL},
        {"jtagkey_prototype_v1", jtagkey_init, jtagkey_reset, NULL},
+       {"oocdlink", jtagkey_init, jtagkey_reset, NULL},
        {"signalyzer", usbjtag_init, usbjtag_reset, NULL},
        {"evb_lm3s811", usbjtag_init, usbjtag_reset, NULL},
        {"olimex-jtag", olimex_jtag_init, olimex_jtag_reset, olimex_jtag_blink},
@@ -189,15 +190,19 @@ int ft2232_read(u8* buf, int size, u32* bytes_read)
 #if BUILD_FT2232_FTD2XX == 1
        DWORD dw_bytes_read;
        FT_STATUS status;
-       if ((status = FT_Read(ftdih, buf, size, &dw_bytes_read)) != FT_OK)
+       int timeout = 5;
+       *bytes_read = 0;
+
+       while ((*bytes_read < size) && timeout--)
        {
-               *bytes_read = dw_bytes_read; 
-               ERROR("FT_Read returned: %i", status);
-               return ERROR_JTAG_DEVICE_ERROR;
+               if ((status = FT_Read(ftdih, buf, size, &dw_bytes_read)) != FT_OK)
+               {
+                       *bytes_read = 0; 
+                       ERROR("FT_Read returned: %i", status);
+                       return ERROR_JTAG_DEVICE_ERROR;
+               }
+               *bytes_read += dw_bytes_read; 
        }
-       *bytes_read = dw_bytes_read; 
-       return ERROR_OK;        
-
 #elif BUILD_FT2232_LIBFTDI == 1
        int retval;
        int timeout = 100;
@@ -213,8 +218,15 @@ int ft2232_read(u8* buf, int size, u32* bytes_read)
                }
                *bytes_read += retval;
        }
-       return ERROR_OK;        
 #endif
+
+       if (*bytes_read < size)
+       {
+               ERROR("couldn't read the requested number of bytes from FT2232 device (%i < %i)", *bytes_read, size);
+               return ERROR_JTAG_DEVICE_ERROR;
+       }
+       
+       return ERROR_OK;
 }
 
 int ft2232_speed(int speed)
@@ -1249,7 +1261,8 @@ int jtagkey_init(void)
                nSRST = 0x02;
                nSRSTnOE = 0x08;
        }
-       else if (strcmp(layout->name, "jtagkey_prototype_v1") == 0)
+       else if ((strcmp(layout->name, "jtagkey_prototype_v1") == 0) ||
+               (strcmp(layout->name, "oocdlink") == 0))
        {
                nTRST = 0x02;
                nTRSTnOE = 0x1;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)