aboutsummaryrefslogtreecommitdiffstats
path: root/usbh/src/pipe.rs
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2019-08-01 21:38:07 -0400
committerBrian Cully <bjc@kublai.com>2019-08-01 21:38:07 -0400
commitde3e8606c3bc199dfe417d3737c37fc898dc0442 (patch)
treec8676a25685eaef3f6e2ec998158697f21d2430f /usbh/src/pipe.rs
parent0771a8d2466fb418b566846cfd165480760fd9ce (diff)
downloadsamd21-demo-de3e8606c3bc199dfe417d3737c37fc898dc0442.tar.gz
samd21-demo-de3e8606c3bc199dfe417d3737c37fc898dc0442.zip
Short-circuit out of NAK on interrupt pipes.
Don't bother retrying. NAK on an interrupt endpoint means there's no data.
Diffstat (limited to 'usbh/src/pipe.rs')
-rw-r--r--usbh/src/pipe.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/usbh/src/pipe.rs b/usbh/src/pipe.rs
index abdba2a..80ebe11 100644
--- a/usbh/src/pipe.rs
+++ b/usbh/src/pipe.rs
@@ -321,9 +321,9 @@ impl Pipe<'_, '_> {
ep.out_toggle,
);
if self.regs.status.read().dtgl().bit_is_set() {
- self.dtgl_clear();
- } else {
self.dtgl_set();
+ } else {
+ self.dtgl_clear();
}
if token == PToken::In {
ep.in_toggle = self.regs.status.read().dtgl().bit_is_set()
@@ -377,6 +377,13 @@ impl Pipe<'_, '_> {
last_err = e;
match last_err {
PipeErr::DataToggle => self.dtgl(ep, token),
+
+ // Flow error on interrupt pipes means we got
+ // a NAK, which in this context means there's
+ // no data. cf ยง32.8.7.5 of SAM D21 data
+ // sheet.
+ PipeErr::Flow if ep.transfer_type == TransferType::Interrupt => break,
+
PipeErr::Stall => break,
_ => {
naks += 1;