rp: allow isochronous USB endpoints to be up to 1023 in size
This commit is contained in:
parent
ffa75e1e39
commit
1e60c60afd
@ -219,14 +219,16 @@ impl<'d, T: Instance> Driver<'d, T> {
|
|||||||
let (index, ep) = index.ok_or(EndpointAllocError)?;
|
let (index, ep) = index.ok_or(EndpointAllocError)?;
|
||||||
assert!(!ep.used);
|
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);
|
warn!("max_packet_size too high: {}", max_packet_size);
|
||||||
return Err(EndpointAllocError);
|
return Err(EndpointAllocError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ep mem addrs must be 64-byte aligned, so there's no point in trying
|
// ep mem addrs must be 64-byte aligned, so there's no point in trying
|
||||||
// to allocate smaller chunks to save memory.
|
// to allocate smaller chunks to save memory.
|
||||||
let len = 64;
|
let len = (max_packet_size + 63) / 64 * 64;
|
||||||
|
|
||||||
let addr = self.ep_mem_free;
|
let addr = self.ep_mem_free;
|
||||||
if addr + len > EP_MEMORY_SIZE as _ {
|
if addr + len > EP_MEMORY_SIZE as _ {
|
||||||
|
Loading…
Reference in New Issue
Block a user