aboutsummaryrefslogtreecommitdiff
path: root/embassy-usb-synopsys-otg/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-usb-synopsys-otg/src/lib.rs')
-rw-r--r--embassy-usb-synopsys-otg/src/lib.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/embassy-usb-synopsys-otg/src/lib.rs b/embassy-usb-synopsys-otg/src/lib.rs
index 5fb82db42..b145f4aa8 100644
--- a/embassy-usb-synopsys-otg/src/lib.rs
+++ b/embassy-usb-synopsys-otg/src/lib.rs
@@ -1071,6 +1071,21 @@ impl<'d> embassy_usb_driver::EndpointOut for Endpoint<'d, Out> {
1071 w.set_pktcnt(1); 1071 w.set_pktcnt(1);
1072 }); 1072 });
1073 1073
1074 if self.info.ep_type == EndpointType::Isochronous {
1075 // Isochronous endpoints must set the correct even/odd frame bit to
1076 // correspond with the next frame's number.
1077 let frame_number = self.regs.dsts().read().fnsof();
1078 let frame_is_odd = frame_number & 0x01 == 1;
1079
1080 self.regs.doepctl(index).modify(|r| {
1081 if frame_is_odd {
1082 r.set_sd0pid_sevnfrm(true);
1083 } else {
1084 r.set_sd1pid_soddfrm(true);
1085 }
1086 });
1087 }
1088
1074 // Clear NAK to indicate we are ready to receive more data 1089 // Clear NAK to indicate we are ready to receive more data
1075 self.regs.doepctl(index).modify(|w| { 1090 self.regs.doepctl(index).modify(|w| {
1076 w.set_cnak(true); 1091 w.set_cnak(true);
@@ -1158,6 +1173,21 @@ impl<'d> embassy_usb_driver::EndpointIn for Endpoint<'d, In> {
1158 w.set_xfrsiz(buf.len() as _); 1173 w.set_xfrsiz(buf.len() as _);
1159 }); 1174 });
1160 1175
1176 if self.info.ep_type == EndpointType::Isochronous {
1177 // Isochronous endpoints must set the correct even/odd frame bit to
1178 // correspond with the next frame's number.
1179 let frame_number = self.regs.dsts().read().fnsof();
1180 let frame_is_odd = frame_number & 0x01 == 1;
1181
1182 self.regs.diepctl(index).modify(|r| {
1183 if frame_is_odd {
1184 r.set_sd0pid_sevnfrm(true);
1185 } else {
1186 r.set_sd1pid_soddfrm(true);
1187 }
1188 });
1189 }
1190
1161 // Enable endpoint 1191 // Enable endpoint
1162 self.regs.diepctl(index).modify(|w| { 1192 self.regs.diepctl(index).modify(|w| {
1163 w.set_cnak(true); 1193 w.set_cnak(true);