mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-11 13:01:30 +11:00
Usb fixes (#104)
* Remove check for ep0 buffer.len == 64 * Simplify EP buffer check
This commit is contained in:
parent
0e5d582363
commit
7afa19a82b
|
@ -133,7 +133,7 @@ impl Inner {
|
||||||
|
|
||||||
let is_ep0 = ep_addr.index() == 0;
|
let is_ep0 = ep_addr.index() == 0;
|
||||||
let is_ctrl_ep = ep_type == EndpointType::Control;
|
let is_ctrl_ep = ep_type == EndpointType::Control;
|
||||||
if !(is_ep0 ^ !is_ctrl_ep) || (is_ep0 && (max_packet_size != 64)) {
|
if !(is_ep0 ^ !is_ctrl_ep) {
|
||||||
return Err(UsbError::Unsupported);
|
return Err(UsbError::Unsupported);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,10 +149,12 @@ impl Inner {
|
||||||
return Err(UsbError::InvalidEndpoint);
|
return Err(UsbError::InvalidEndpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate buffer size
|
// Validate buffer size. From datasheet (4.1.2.5):
|
||||||
if let (EndpointType::Isochronous, true) = (ep_type, max_packet_size > 1023) {
|
// Data Buffers are typically 64 bytes long as this is the max normal packet size for most FS packets.
|
||||||
return Err(UsbError::Unsupported);
|
// For Isochronous endpoints a maximum buffer size of 1023 bytes is supported.
|
||||||
} else if max_packet_size > 64 {
|
// For other packet types the maximum size is 64 bytes per buffer.
|
||||||
|
if (ep_type != EndpointType::Isochronous && max_packet_size > 64) || max_packet_size > 1023
|
||||||
|
{
|
||||||
return Err(UsbError::Unsupported);
|
return Err(UsbError::Unsupported);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue