mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
usb: remove is_stalled, set_stalled from Endpoint.
They're unused, and I believe it's not allowed for classes to stall EPs on their own?
This commit is contained in:
parent
98d8c9373d
commit
1ec2e5672f
@ -101,37 +101,6 @@ impl<'d, T: Instance> Driver<'d, T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn set_stalled(ep_addr: EndpointAddress, stalled: bool) {
|
||||
let regs = T::regs();
|
||||
|
||||
unsafe {
|
||||
if ep_addr.index() == 0 {
|
||||
regs.tasks_ep0stall
|
||||
.write(|w| w.tasks_ep0stall().bit(stalled));
|
||||
} else {
|
||||
regs.epstall.write(|w| {
|
||||
w.ep().bits(ep_addr.index() as u8 & 0b111);
|
||||
w.io().bit(ep_addr.is_in());
|
||||
w.stall().bit(stalled)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//if stalled {
|
||||
// self.busy_in_endpoints &= !(1 << ep_addr.index());
|
||||
//}
|
||||
}
|
||||
|
||||
fn is_stalled(ep_addr: EndpointAddress) -> bool {
|
||||
let regs = T::regs();
|
||||
|
||||
let i = ep_addr.index();
|
||||
match ep_addr.direction() {
|
||||
UsbDirection::Out => regs.halted.epout[i].read().getstatus().is_halted(),
|
||||
UsbDirection::In => regs.halted.epin[i].read().getstatus().is_halted(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d, T: Instance> driver::Driver<'d> for Driver<'d, T> {
|
||||
@ -294,11 +263,28 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> {
|
||||
}
|
||||
|
||||
fn endpoint_set_stalled(&mut self, ep_addr: EndpointAddress, stalled: bool) {
|
||||
Driver::<T>::set_stalled(ep_addr, stalled)
|
||||
let regs = T::regs();
|
||||
unsafe {
|
||||
if ep_addr.index() == 0 {
|
||||
regs.tasks_ep0stall
|
||||
.write(|w| w.tasks_ep0stall().bit(stalled));
|
||||
} else {
|
||||
regs.epstall.write(|w| {
|
||||
w.ep().bits(ep_addr.index() as u8 & 0b111);
|
||||
w.io().bit(ep_addr.is_in());
|
||||
w.stall().bit(stalled)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn endpoint_is_stalled(&mut self, ep_addr: EndpointAddress) -> bool {
|
||||
Driver::<T>::is_stalled(ep_addr)
|
||||
let regs = T::regs();
|
||||
let i = ep_addr.index();
|
||||
match ep_addr.direction() {
|
||||
UsbDirection::Out => regs.halted.epout[i].read().getstatus().is_halted(),
|
||||
UsbDirection::In => regs.halted.epin[i].read().getstatus().is_halted(),
|
||||
}
|
||||
}
|
||||
|
||||
fn endpoint_set_enabled(&mut self, ep_addr: EndpointAddress, enabled: bool) {
|
||||
@ -464,14 +450,6 @@ impl<'d, T: Instance, Dir: EndpointDir> driver::Endpoint for Endpoint<'d, T, Dir
|
||||
&self.info
|
||||
}
|
||||
|
||||
fn set_stalled(&self, stalled: bool) {
|
||||
Driver::<T>::set_stalled(self.info.addr, stalled)
|
||||
}
|
||||
|
||||
fn is_stalled(&self) -> bool {
|
||||
Driver::<T>::is_stalled(self.info.addr)
|
||||
}
|
||||
|
||||
type WaitEnabledFuture<'a> = impl Future<Output = ()> + 'a where Self: 'a;
|
||||
|
||||
fn wait_enabled(&mut self) -> Self::WaitEnabledFuture<'_> {
|
||||
|
@ -118,17 +118,8 @@ pub trait Endpoint {
|
||||
/// Get the endpoint address
|
||||
fn info(&self) -> &EndpointInfo;
|
||||
|
||||
/// Sets or clears the STALL condition for an endpoint. If the endpoint is an OUT endpoint, it
|
||||
/// should be prepared to receive data again.
|
||||
fn set_stalled(&self, stalled: bool);
|
||||
|
||||
/// Gets whether the STALL condition is set for an endpoint.
|
||||
fn is_stalled(&self) -> bool;
|
||||
|
||||
/// Waits for the endpoint to be enabled.
|
||||
fn wait_enabled(&mut self) -> Self::WaitEnabledFuture<'_>;
|
||||
|
||||
// TODO enable/disable?
|
||||
}
|
||||
|
||||
pub trait EndpointOut: Endpoint {
|
||||
|
Loading…
Reference in New Issue
Block a user