aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-06-04 19:03:51 -0400
committerbnewbold <bnewbold@robocracy.org>2010-06-04 19:03:51 -0400
commit220eaa0272a96275a46f81bb347124e3a4daa6f8 (patch)
treeb2fdaba9f99038001a028edf9ee1d3814d395a90 /libmaple
parent88d4b095e4590ab9bbafcf76e134d168f66c41b1 (diff)
downloadlibrambutan-220eaa0272a96275a46f81bb347124e3a4daa6f8.tar.gz
librambutan-220eaa0272a96275a46f81bb347124e3a4daa6f8.zip
NEEDS REVIEW: fix for first usb write bug
aj wrote this and had comments saying fix this wouldn't work, but it seems to...
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/usb/usb.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c
index b7d2d93..0474cad 100644
--- a/libmaple/usb/usb.c
+++ b/libmaple/usb/usb.c
@@ -379,6 +379,11 @@ void usbWaitReset(void) {
will block at every 64 byte packet
*/
int16 usbSendBytes(uint8* sendBuf, uint16 len) {
+
+ if (reset_state == NDTR_NRTS) {
+ return -1; /* indicates to caller to stop trying, were not connected */
+ }
+
/* Block for any pending writes */
while (countTx)
;
@@ -388,9 +393,6 @@ int16 usbSendBytes(uint8* sendBuf, uint16 len) {
/* } */
/* }/\* wait for pipe to be clear *\/ */
- if (reset_state == NDTR_NRTS) {
- return -1; /* indicates to caller to stop trying, were not connected */
- }
/* ideally we should wait here, but it gets stuck
for some reason. countTx wont decrement when