aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-10-21 19:48:49 +0000
committerGitHub <[email protected]>2022-10-21 19:48:49 +0000
commit73d06dd67b3ee6f61fb05c9cad9a43b6d388bc36 (patch)
treeb0b49dcd07f9c164e329c44999b608e6877a1560
parentbf0ad38640bd683401489ea68926aebd25272858 (diff)
parent866a42f3aeb196e2b0f854a52683ee07cffc4ccd (diff)
Merge #1021
1021: rp usb: wait for accept() completion r=Dirbaio a=mkj This fixes failures when `defmt` feature isn't enabled (timing related). Co-authored-by: Matt Johnston <[email protected]>
-rw-r--r--embassy-rp/src/usb.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/embassy-rp/src/usb.rs b/embassy-rp/src/usb.rs
index 0a904aab3..7a83dcb4a 100644
--- a/embassy-rp/src/usb.rs
+++ b/embassy-rp/src/usb.rs
@@ -811,8 +811,8 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> {
811 async move { 811 async move {
812 trace!("control: accept"); 812 trace!("control: accept");
813 813
814 let bufcontrol = T::dpram().ep_in_buffer_control(0);
814 unsafe { 815 unsafe {
815 let bufcontrol = T::dpram().ep_in_buffer_control(0);
816 bufcontrol.write(|w| { 816 bufcontrol.write(|w| {
817 w.set_length(0, 0); 817 w.set_length(0, 0);
818 w.set_pid(0, true); 818 w.set_pid(0, true);
@@ -826,6 +826,18 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> {
826 w.set_available(0, true); 826 w.set_available(0, true);
827 }); 827 });
828 } 828 }
829
830 // wait for completion before returning, needed so
831 // set_address() doesn't happen early.
832 poll_fn(|cx| {
833 EP_IN_WAKERS[0].register(cx.waker());
834 if unsafe { bufcontrol.read().available(0) } {
835 Poll::Pending
836 } else {
837 Poll::Ready(())
838 }
839 })
840 .await;
829 } 841 }
830 } 842 }
831 843