aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/usb/usb_callbacks.c
diff options
context:
space:
mode:
authorAJM <poslathian@poslathian.(none)>2010-12-13 22:03:14 -0500
committerAJM <poslathian@poslathian.(none)>2010-12-13 22:03:14 -0500
commit873356a31fae8cf4e8b6a5ab609125a5a501d1c4 (patch)
tree7747300a71f5597ef048128c47ec267a59e9e04b /libmaple/usb/usb_callbacks.c
parentb67d281d85bd59a9738a9a43c4db1027f81d9208 (diff)
downloadlibrambutan-873356a31fae8cf4e8b6a5ab609125a5a501d1c4.tar.gz
librambutan-873356a31fae8cf4e8b6a5ab609125a5a501d1c4.zip
candidate bugfix for serialusb receive bug
changed USB driver to nak whenever it cant fill an entire endpoint (64B) worth of new data. The old scheme was to set receive valid as long as as the endpoint buffer wasnt full, the new scheme is to nak until it is completely empty.
Diffstat (limited to 'libmaple/usb/usb_callbacks.c')
-rw-r--r--libmaple/usb/usb_callbacks.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libmaple/usb/usb_callbacks.c b/libmaple/usb/usb_callbacks.c
index 4cdaf73..c30d650 100644
--- a/libmaple/usb/usb_callbacks.c
+++ b/libmaple/usb/usb_callbacks.c
@@ -132,8 +132,12 @@ void vcomDataRxCb(void) {
}
maxNewBytes -= newBytes;
- SetEPRxCount(VCOM_RX_ENDP,maxNewBytes);
- SetEPRxValid(VCOM_RX_ENDP);
+
+ if (maxNewBytes > VCOM_RX_EPSIZE) {
+ SetEPRxCount(VCOM_RX_ENDP,0);
+ SetEPRxStatus(VCOM_RX_ENDP,EP_RX_NAK); /* nak until we clear the buffer */
+ }
+
}
void vcomManagementCb(void) {