diff options
author | John Rigby <john.rigby@linaro.org> | 2012-08-01 15:50:55 -0600 |
---|---|---|
committer | John Rigby <john.rigby@linaro.org> | 2012-08-01 15:58:30 -0600 |
commit | 870a05851d23d3a697f37596569beb09663cc8e1 (patch) | |
tree | 9a77be0a57e681e9c4410a76ac2306d721d46f7b | |
parent | 27d77171a1b9f0caa60bd8aa310381bacaadf054 (diff) |
to work around what seems to be a musb fifo overrun
on some panda versions
Signed-off-by: John Rigby <john.rigby@linaro.org>
-rw-r--r-- | usbboot.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -36,6 +36,15 @@ #include "usb.h" +void throttled_usb_write(void *usb, void *data, int sz) +{ + while (sz > 0) { + usb_write(usb, data, 64); + data += 64; + sz -= 64; + } +} + int usb_boot(usb_handle * usb, void *data1, unsigned sz1, void *data2, unsigned sz2) { @@ -99,7 +108,7 @@ int usb_boot(usb_handle * usb, } sleep(1); fprintf(stderr, "transferring %d bytes of data\n", sz2); - usb_write(usb, data2, sz2); + throttled_usb_write(usb, data2, sz2); fprintf(stderr, "write finished, waiting for \"OKAY\"\n"); usb_read(usb, response, sizeof(response)); if (strncmp("OKAY", response, 4) == 0) { |