Skip to content

Commit eec6c45

Browse files
dgoodladCryowatt
authored andcommitted
Minor changes to hopefully make ISO IN eps work
1 parent 3cc3d4f commit eec6c45

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/bus.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ impl<USB: UsbPeripheral> usb_device::bus::UsbBus for UsbBus<USB> {
498498
write_reg!(otg_global, regs.global(), GINTMSK,
499499
USBRST: 1, ENUMDNEM: 1,
500500
USBSUSPM: 1, WUIM: 1,
501-
IEPINT: 1, RXFLVLM: 1
501+
IEPINT: 1, RXFLVLM: 1,
502+
SOFM: 1
502503
);
503504

504505
// clear pending interrupts

src/endpoint.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ impl EndpointIn {
139139
}
140140
}
141141

142+
#[cfg(feature = "fs")]
143+
write_reg!(endpoint_in, ep, DIEPTSIZ, PKTCNT: 1, XFRSIZ: buf.len() as u32);
144+
#[cfg(feature = "hs")]
145+
write_reg!(endpoint_in, ep, DIEPTSIZ, MCNT: 1, PKTCNT: 1, XFRSIZ: buf.len() as u32);
146+
147+
modify_reg!(endpoint_in, ep, DIEPCTL, CNAK: 1, EPENA: 1);
148+
142149
match self.descriptor.ep_type {
143150
// Isochronous endpoints must set the correct even/odd frame bit to
144151
// correspond with the next frame's number.
@@ -150,19 +157,12 @@ impl EndpointIn {
150157
modify_reg!(endpoint_in, ep, DIEPCTL, SD0PID_SEVNFRM: 1);
151158
} else {
152159
// Previous frame number is even, so upcoming frame is odd
153-
modify_reg!(endpoint_in, ep, DIEPCTL, SODDFRM_SD1PID: 1);
160+
modify_reg!(endpoint_in, ep, DIEPCTL, SODDFRM: 1);
154161
}
155162
},
156163
_ => {}
157164
}
158165

159-
#[cfg(feature = "fs")]
160-
write_reg!(endpoint_in, ep, DIEPTSIZ, PKTCNT: 1, XFRSIZ: buf.len() as u32);
161-
#[cfg(feature = "hs")]
162-
write_reg!(endpoint_in, ep, DIEPTSIZ, MCNT: 1, PKTCNT: 1, XFRSIZ: buf.len() as u32);
163-
164-
modify_reg!(endpoint_in, ep, DIEPCTL, CNAK: 1, EPENA: 1);
165-
166166
fifo_write(self.usb, self.index(), buf);
167167

168168
Ok(())

0 commit comments

Comments
 (0)