mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
fix handlers to adjust max packet size to enumeration speed
this seems to make enumeration more reliable with weird cables
This commit is contained in:
parent
78f0fcac1a
commit
c5fb3f282d
2 changed files with 28 additions and 8 deletions
|
|
@ -69,8 +69,12 @@ pub const FS_MAX_PKT_SIZE: usize = 64;
|
|||
pub const HS_MAX_PKT_SIZE: usize = 512;
|
||||
|
||||
pub(crate) fn enable_mass_storage_eps(this: &mut CorigineUsb, ep_num: u8) {
|
||||
this.ep_enable(ep_num, USB_RECV, HS_MAX_PKT_SIZE as _, EpType::BulkOutbound);
|
||||
this.ep_enable(ep_num, USB_SEND, HS_MAX_PKT_SIZE as _, EpType::BulkInbound);
|
||||
let mps = match this.get_speed() {
|
||||
PortSpeed::Fs => FS_MAX_PKT_SIZE,
|
||||
_ => HS_MAX_PKT_SIZE,
|
||||
};
|
||||
this.ep_enable(ep_num, USB_RECV, mps as _, EpType::BulkOutbound);
|
||||
this.ep_enable(ep_num, USB_SEND, mps as _, EpType::BulkInbound);
|
||||
}
|
||||
|
||||
// Call from USB_REQ_SET_CONFIGURATION after setting device state to Configured
|
||||
|
|
@ -78,12 +82,20 @@ pub(crate) fn enable_composite_eps(this: &mut CorigineUsb) {
|
|||
// MSD endpoints
|
||||
enable_mass_storage_eps(this, 1);
|
||||
|
||||
let int_mps = match this.get_speed() {
|
||||
PortSpeed::Fs => FS_INT_MPS,
|
||||
_ => HS_INT_MPS,
|
||||
};
|
||||
// CDC notification IN (interrupt)
|
||||
this.ep_enable(2, USB_SEND, HS_INT_MPS as _, EpType::IntrInbound);
|
||||
this.ep_enable(2, USB_SEND, int_mps as _, EpType::IntrInbound);
|
||||
|
||||
let bulk_mps = match this.get_speed() {
|
||||
PortSpeed::Fs => FS_BULK_MPS,
|
||||
_ => HS_BULK_MPS,
|
||||
};
|
||||
// CDC data bulk OUT and IN
|
||||
this.ep_enable(3, USB_RECV, HS_BULK_MPS as _, EpType::BulkOutbound);
|
||||
this.ep_enable(3, USB_SEND, HS_BULK_MPS as _, EpType::BulkInbound);
|
||||
this.ep_enable(3, USB_RECV, bulk_mps as _, EpType::BulkOutbound);
|
||||
this.ep_enable(3, USB_SEND, bulk_mps as _, EpType::BulkInbound);
|
||||
}
|
||||
|
||||
pub fn get_descriptor_request(this: &mut CorigineUsb, value: u16, _index: usize, length: usize) {
|
||||
|
|
|
|||
|
|
@ -9,12 +9,20 @@ pub static TX_IDLE: core::sync::atomic::AtomicBool = core::sync::atomic::AtomicB
|
|||
|
||||
// Call from USB_REQ_SET_CONFIGURATION after setting device state to Configured
|
||||
pub(crate) fn enable_serial_eps(this: &mut CorigineUsb) {
|
||||
let int_mps = match this.get_speed() {
|
||||
PortSpeed::Fs => FS_INT_MPS,
|
||||
_ => HS_INT_MPS,
|
||||
};
|
||||
// CDC notification IN (interrupt)
|
||||
this.ep_enable(2, USB_SEND, HS_INT_MPS as _, EpType::IntrInbound);
|
||||
this.ep_enable(2, USB_SEND, int_mps as _, EpType::IntrInbound);
|
||||
|
||||
let bulk_mps = match this.get_speed() {
|
||||
PortSpeed::Fs => FS_BULK_MPS,
|
||||
_ => HS_BULK_MPS,
|
||||
};
|
||||
// CDC data bulk OUT and IN
|
||||
this.ep_enable(3, USB_RECV, HS_BULK_MPS as _, EpType::BulkOutbound);
|
||||
this.ep_enable(3, USB_SEND, HS_BULK_MPS as _, EpType::BulkInbound);
|
||||
this.ep_enable(3, USB_RECV, bulk_mps as _, EpType::BulkOutbound);
|
||||
this.ep_enable(3, USB_SEND, bulk_mps as _, EpType::BulkInbound);
|
||||
}
|
||||
|
||||
pub fn get_descriptor_request(this: &mut CorigineUsb, value: u16, _index: usize, length: usize) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue