rp: allow isochronous USB endpoints to be up to 1023 in size

This commit is contained in:
nitroxis 2023-01-27 07:19:34 +01:00
parent ffa75e1e39
commit 1e60c60afd

View file

@ -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 _ {