aboutsummaryrefslogtreecommitdiff
path: root/src/platforms/stm32
diff options
context:
space:
mode:
authorGareth McMullin2013-03-08 15:18:12 -0800
committerGareth McMullin2013-03-08 15:18:12 -0800
commit7b10270007413ae2c99f19b8b863d8bfdda92cb8 (patch)
treef215a5b028c9f24f291a13e8040b3a6b8d884003 /src/platforms/stm32
parent530ee15153b05f97a38dd549d5813c91f936fc96 (diff)
parente8f9d52d2f236028c8f91ed36d3df91ab93b05f2 (diff)
Merge pull request #16 from zyp/master
Fix for broken USB flow control.
Diffstat (limited to 'src/platforms/stm32')
-rw-r--r--src/platforms/stm32/gdb_if.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/platforms/stm32/gdb_if.c b/src/platforms/stm32/gdb_if.c
index 030205a..3ea7d14 100644
--- a/src/platforms/stm32/gdb_if.c
+++ b/src/platforms/stm32/gdb_if.c
@@ -54,8 +54,12 @@ void gdb_if_putchar(unsigned char c, int flush)
void gdb_usb_out_cb(usbd_device *dev, uint8_t ep)
{
(void)ep;
+ usbd_ep_nak_set(dev, CDCACM_GDB_ENDPOINT, 1);
count_new = usbd_ep_read_packet(dev, CDCACM_GDB_ENDPOINT,
double_buffer_out, CDCACM_PACKET_SIZE);
+ if(!count_new) {
+ usbd_ep_nak_set(dev, CDCACM_GDB_ENDPOINT, 0);
+ }
}
unsigned char gdb_if_getchar(void)
@@ -72,6 +76,7 @@ unsigned char gdb_if_getchar(void)
count_out = count_new;
count_new = 0;
out_ptr = 0;
+ usbd_ep_nak_set(usbdev, CDCACM_GDB_ENDPOINT, 0);
}
}
@@ -93,6 +98,7 @@ unsigned char gdb_if_getchar_to(int timeout)
count_out = count_new;
count_new = 0;
out_ptr = 0;
+ usbd_ep_nak_set(usbdev, CDCACM_GDB_ENDPOINT, 0);
}
} while(timeout_counter && !(out_ptr < count_out));