Merge #1178
1178: rp: allow isochronous USB endpoints to be up to 1023 bytes in size r=Dirbaio a=nitroxis The datasheet allows isochronous USB endpoints to be up to 1023 bytes in size (see "4.1.2.5. DPSRAM"). This PR changes the check to allow this and also changes the length computation to align to 64 bytes (instead of hardcoded 64 bytes). Embassy does not yet support isochronous USB endpoints, however I'm investigating adding support. This change is simple enough and should be correct according to the datasheet, so maybe future implementers don't run into this issue. Co-authored-by: nitroxis <n@nxs.re>
This commit is contained in:
commit
7ec15f2def
1 changed files with 4 additions and 2 deletions
|
@ -219,14 +219,16 @@ impl<'d, T: Instance> Driver<'d, T> {
|
|||
let (index, ep) = index.ok_or(EndpointAllocError)?;
|
||||
assert!(!ep.used);
|
||||
|
||||
if max_packet_size > 64 {
|
||||
// as per datasheet, the maximum buffer size is 64, except for isochronous
|
||||
// endpoints, which are allowed to be up to 1023 bytes.
|
||||
if (ep_type != EndpointType::Isochronous && max_packet_size > 64) || max_packet_size > 1023 {
|
||||
warn!("max_packet_size too high: {}", max_packet_size);
|
||||
return Err(EndpointAllocError);
|
||||
}
|
||||
|
||||
// ep mem addrs must be 64-byte aligned, so there's no point in trying
|
||||
// to allocate smaller chunks to save memory.
|
||||
let len = 64;
|
||||
let len = (max_packet_size + 63) / 64 * 64;
|
||||
|
||||
let addr = self.ep_mem_free;
|
||||
if addr + len > EP_MEMORY_SIZE as _ {
|
||||
|
|
Loading…
Reference in a new issue