Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ features = ['fs']
hs = []
fs = []
xcvrdly = []
cortex-m = []
18 changes: 16 additions & 2 deletions src/endpoint.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::endpoint_memory::{EndpointBuffer, EndpointBufferState};
use crate::ral::{endpoint0_out, endpoint_in, endpoint_out, modify_reg, read_reg, write_reg};
use crate::ral::{endpoint0_out, endpoint_in, endpoint_out, otg_device, modify_reg, read_reg, write_reg};
use crate::target::{fifo_write, UsbRegisters};
use crate::transition::EndpointDescriptor;
use crate::UsbPeripheral;
Expand Down Expand Up @@ -139,7 +139,21 @@ impl EndpointIn {
#[cfg(feature = "hs")]
write_reg!(endpoint_in, ep, DIEPTSIZ, MCNT: 1, PKTCNT: 1, XFRSIZ: buf.len() as u32);

modify_reg!(endpoint_in, ep, DIEPCTL, CNAK: 1, EPENA: 1);
// For isochronous endpoints, we need to set EVEN/ODD frames here
if matches!(self.descriptor.ep_type,usb_device::endpoint::EndpointType::Isochronous{ .. }) {
let mut fnsof = 0;
critical_section::with(|cs| {
let regs = self.usb.device();
fnsof = read_reg!(otg_device, regs, DSTS, FNSOF);
});
if fnsof & 1 == 1 {
modify_reg!(endpoint_in, ep, DIEPCTL, CNAK: 1, EPENA: 1, SD0PID_SEVNFRM: 1);
} else {
modify_reg!(endpoint_in, ep, DIEPCTL, CNAK: 1, EPENA: 1, SODDFRM_SD1PID: 1);
}
} else {
modify_reg!(endpoint_in, ep, DIEPCTL, CNAK: 1, EPENA: 1);
}

fifo_write(self.usb, self.index(), buf);

Expand Down