Skip to content

Commit e0836d6

Browse files
committed
usb: Plumb in SOF handling for the Synopsys DWC2
1 parent 4483bfa commit e0836d6

File tree

1 file changed

+16
-1
lines changed
  • embassy-usb-synopsys-otg/src

1 file changed

+16
-1
lines changed

embassy-usb-synopsys-otg/src/lib.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,20 @@ pub unsafe fn on_interrupt<const MAX_EP_COUNT: usize>(r: Otg, state: &State<MAX_
3030
trace!("irq");
3131

3232
let ints = r.gintsts().read();
33-
if ints.wkupint() || ints.usbsusp() || ints.usbrst() || ints.enumdne() || ints.otgint() || ints.srqint() {
33+
if ints.wkupint()
34+
|| ints.usbsusp()
35+
|| ints.usbrst()
36+
|| ints.enumdne()
37+
|| ints.otgint()
38+
|| ints.srqint()
39+
|| ints.sof()
40+
{
3441
// Mask interrupts and notify `Bus` to process them
3542
r.gintmsk().write(|w| {
3643
w.set_iepint(true);
3744
w.set_oepint(true);
3845
w.set_rxflvlm(true);
46+
w.set_sofm(true);
3947
});
4048
state.bus_waker.wake();
4149
}
@@ -868,6 +876,13 @@ impl<'d, const MAX_EP_COUNT: usize> embassy_usb_driver::Bus for Bus<'d, MAX_EP_C
868876
return Poll::Ready(Event::Resume);
869877
}
870878

879+
if ints.sof() {
880+
trace!("sof");
881+
regs.gintsts().write(|w| w.set_sof(true)); // clear
882+
self.restore_irqs();
883+
return Poll::Ready(Event::SOF);
884+
}
885+
871886
Poll::Pending
872887
})
873888
.await

0 commit comments

Comments
 (0)