usb: cleanup logging.
This commit is contained in:
parent
d1e4b3d7d5
commit
60d3d11197
3 changed files with 14 additions and 12 deletions
|
@ -213,7 +213,7 @@ impl<'d, T: Instance> driver::Driver<'d> for Driver<'d, T> {
|
||||||
});
|
});
|
||||||
// Enable the USB pullup, allowing enumeration.
|
// Enable the USB pullup, allowing enumeration.
|
||||||
regs.usbpullup.write(|w| w.connect().enabled());
|
regs.usbpullup.write(|w| w.connect().enabled());
|
||||||
info!("enabled");
|
trace!("enabled");
|
||||||
|
|
||||||
Bus {
|
Bus {
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
|
@ -247,23 +247,23 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> {
|
||||||
|
|
||||||
if r.isooutcrc().bit() {
|
if r.isooutcrc().bit() {
|
||||||
regs.eventcause.write(|w| w.isooutcrc().set_bit());
|
regs.eventcause.write(|w| w.isooutcrc().set_bit());
|
||||||
info!("USB event: isooutcrc");
|
trace!("USB event: isooutcrc");
|
||||||
}
|
}
|
||||||
if r.usbwuallowed().bit() {
|
if r.usbwuallowed().bit() {
|
||||||
regs.eventcause.write(|w| w.usbwuallowed().set_bit());
|
regs.eventcause.write(|w| w.usbwuallowed().set_bit());
|
||||||
info!("USB event: usbwuallowed");
|
trace!("USB event: usbwuallowed");
|
||||||
}
|
}
|
||||||
if r.suspend().bit() {
|
if r.suspend().bit() {
|
||||||
regs.eventcause.write(|w| w.suspend().set_bit());
|
regs.eventcause.write(|w| w.suspend().set_bit());
|
||||||
info!("USB event: suspend");
|
trace!("USB event: suspend");
|
||||||
}
|
}
|
||||||
if r.resume().bit() {
|
if r.resume().bit() {
|
||||||
regs.eventcause.write(|w| w.resume().set_bit());
|
regs.eventcause.write(|w| w.resume().set_bit());
|
||||||
info!("USB event: resume");
|
trace!("USB event: resume");
|
||||||
}
|
}
|
||||||
if r.ready().bit() {
|
if r.ready().bit() {
|
||||||
regs.eventcause.write(|w| w.ready().set_bit());
|
regs.eventcause.write(|w| w.ready().set_bit());
|
||||||
info!("USB event: ready");
|
trace!("USB event: ready");
|
||||||
}
|
}
|
||||||
|
|
||||||
Poll::Pending
|
Poll::Pending
|
||||||
|
@ -636,6 +636,7 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn accept(&mut self) {
|
fn accept(&mut self) {
|
||||||
|
debug!("control accept");
|
||||||
let regs = T::regs();
|
let regs = T::regs();
|
||||||
regs.tasks_ep0status
|
regs.tasks_ep0status
|
||||||
.write(|w| w.tasks_ep0status().bit(true));
|
.write(|w| w.tasks_ep0status().bit(true));
|
||||||
|
@ -645,9 +646,9 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> {
|
||||||
fn accept_in<'a>(&'a mut self, buf: &'a [u8]) -> Self::AcceptInFuture<'a> {
|
fn accept_in<'a>(&'a mut self, buf: &'a [u8]) -> Self::AcceptInFuture<'a> {
|
||||||
async move {
|
async move {
|
||||||
#[cfg(feature = "defmt")]
|
#[cfg(feature = "defmt")]
|
||||||
info!("control accept {:x}", buf);
|
debug!("control in accept {:x}", buf);
|
||||||
#[cfg(not(feature = "defmt"))]
|
#[cfg(not(feature = "defmt"))]
|
||||||
info!("control accept {:x?}", buf);
|
debug!("control in accept {:x?}", buf);
|
||||||
let req = self.request.unwrap();
|
let req = self.request.unwrap();
|
||||||
assert!(req.direction == UsbDirection::In);
|
assert!(req.direction == UsbDirection::In);
|
||||||
|
|
||||||
|
@ -666,6 +667,7 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reject(&mut self) {
|
fn reject(&mut self) {
|
||||||
|
debug!("control reject");
|
||||||
let regs = T::regs();
|
let regs = T::regs();
|
||||||
regs.tasks_ep0stall.write(|w| w.tasks_ep0stall().bit(true));
|
regs.tasks_ep0stall.write(|w| w.tasks_ep0stall().bit(true));
|
||||||
self.request = None;
|
self.request = None;
|
||||||
|
|
|
@ -125,7 +125,7 @@ impl<'d> ControlHandler for Control<'d> {
|
||||||
data_bits: data[6],
|
data_bits: data[6],
|
||||||
};
|
};
|
||||||
self.shared().line_coding.lock(|x| x.set(coding));
|
self.shared().line_coding.lock(|x| x.set(coding));
|
||||||
info!("Set line coding to: {:?}", coding);
|
debug!("Set line coding to: {:?}", coding);
|
||||||
|
|
||||||
OutResponse::Accepted
|
OutResponse::Accepted
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ impl<'d> ControlHandler for Control<'d> {
|
||||||
let shared = self.shared();
|
let shared = self.shared();
|
||||||
shared.dtr.store(dtr, Ordering::Relaxed);
|
shared.dtr.store(dtr, Ordering::Relaxed);
|
||||||
shared.rts.store(rts, Ordering::Relaxed);
|
shared.rts.store(rts, Ordering::Relaxed);
|
||||||
info!("Set dtr {}, rts {}", dtr, rts);
|
debug!("Set dtr {}, rts {}", dtr, rts);
|
||||||
|
|
||||||
OutResponse::Accepted
|
OutResponse::Accepted
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ impl<'d> ControlHandler for Control<'d> {
|
||||||
match req.request {
|
match req.request {
|
||||||
// REQ_GET_ENCAPSULATED_COMMAND is not really supported - it will be rejected below.
|
// REQ_GET_ENCAPSULATED_COMMAND is not really supported - it will be rejected below.
|
||||||
REQ_GET_LINE_CODING if req.length == 7 => {
|
REQ_GET_LINE_CODING if req.length == 7 => {
|
||||||
info!("Sending line coding");
|
debug!("Sending line coding");
|
||||||
let coding = self.shared().line_coding.lock(|x| x.get());
|
let coding = self.shared().line_coding.lock(|x| x.get());
|
||||||
assert!(buf.len() >= 7);
|
assert!(buf.len() >= 7);
|
||||||
buf[0..4].copy_from_slice(&coding.data_rate.to_le_bytes());
|
buf[0..4].copy_from_slice(&coding.data_rate.to_le_bytes());
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl<'d, D: Driver<'d>> UsbDevice<'d, D> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Either::Right(req) => {
|
Either::Right(req) => {
|
||||||
info!("control request: {:x}", req);
|
debug!("control request: {:x}", req);
|
||||||
|
|
||||||
match req.direction {
|
match req.direction {
|
||||||
UsbDirection::In => self.handle_control_in(req).await,
|
UsbDirection::In => self.handle_control_in(req).await,
|
||||||
|
|
Loading…
Reference in a new issue