mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
rp usb: add stall implementation
This commit is contained in:
parent
9cbbedef79
commit
94b38449bd
@ -412,12 +412,38 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
fn endpoint_set_stalled(&mut self, _ep_addr: EndpointAddress, _stalled: bool) {
|
fn endpoint_set_stalled(&mut self, ep_addr: EndpointAddress, stalled: bool) {
|
||||||
todo!();
|
let n = ep_addr.index();
|
||||||
|
|
||||||
|
if n == 0 {
|
||||||
|
T::regs().ep_stall_arm().modify(|w| {
|
||||||
|
if ep_addr.is_in() {
|
||||||
|
w.set_ep0_in(stalled);
|
||||||
|
} else {
|
||||||
|
w.set_ep0_out(stalled);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn endpoint_is_stalled(&mut self, _ep_addr: EndpointAddress) -> bool {
|
let ctrl = if ep_addr.is_in() {
|
||||||
todo!();
|
T::dpram().ep_in_buffer_control(n)
|
||||||
|
} else {
|
||||||
|
T::dpram().ep_out_buffer_control(n)
|
||||||
|
};
|
||||||
|
|
||||||
|
ctrl.modify(|w| w.set_stall(stalled));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn endpoint_is_stalled(&mut self, ep_addr: EndpointAddress) -> bool {
|
||||||
|
let n = ep_addr.index();
|
||||||
|
|
||||||
|
let ctrl = if ep_addr.is_in() {
|
||||||
|
T::dpram().ep_in_buffer_control(n)
|
||||||
|
} else {
|
||||||
|
T::dpram().ep_out_buffer_control(n)
|
||||||
|
};
|
||||||
|
|
||||||
|
ctrl.read().stall()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn endpoint_set_enabled(&mut self, ep_addr: EndpointAddress, enabled: bool) {
|
fn endpoint_set_enabled(&mut self, ep_addr: EndpointAddress, enabled: bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user