From 4e9c38527e98a1a34a53ce53c51a580e64c85a8c Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 29 Sep 2019 03:01:24 +0200 Subject: [PATCH] rm debug, delint --- src/eth/mod.rs | 11 ++++++----- src/eth/rx.rs | 2 +- src/eth/tx.rs | 2 -- src/main.rs | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/eth/mod.rs b/src/eth/mod.rs index 7197541..95bf7f9 100644 --- a/src/eth/mod.rs +++ b/src/eth/mod.rs @@ -176,16 +176,17 @@ impl<'r> Eth<'r, (), ()> { }; inner.init(); inner.configure(macaddr); + let phy = Phy::find(&mut inner).expect("phy"); phy.reset(&mut inner); phy.restart_autoneg(&mut inner); - let mut eth = Eth { + + Eth { rx: (), tx: (), inner, phy, - }; - eth + } } } @@ -341,7 +342,7 @@ impl<'r, 'rx, 'tx: 'a, 'a> smoltcp::phy::Device<'a> for &mut Eth<'r, rx::DescLis fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)> { match self.rx.recv_next() { - Ok(Some(mut pktref)) => { + Ok(Some(pktref)) => { let tx_token = tx::Token { regs: self.inner.regs, desc_list: &mut self.tx, @@ -441,7 +442,7 @@ impl<'r> EthInner<'r> { fn configure(&mut self, macaddr: [u8; 6]) { let clocks = CpuClocks::get(); - let mut mdc_clk_div = (clocks.cpu_1x() / MAX_MDC) + 1; + let mdc_clk_div = (clocks.cpu_1x() / MAX_MDC) + 1; self.regs.net_cfg.write( regs::NetCfg::zeroed() diff --git a/src/eth/rx.rs b/src/eth/rx.rs index 34a919e..309a0ba 100644 --- a/src/eth/rx.rs +++ b/src/eth/rx.rs @@ -124,7 +124,7 @@ impl<'a> Deref for PktRef<'a> { } impl<'a> smoltcp::phy::RxToken for PktRef<'a> { - fn consume(mut self, _timestamp: smoltcp::time::Instant, f: F) -> smoltcp::Result + fn consume(self, _timestamp: smoltcp::time::Instant, f: F) -> smoltcp::Result where F: FnOnce(&[u8]) -> smoltcp::Result { diff --git a/src/eth/tx.rs b/src/eth/tx.rs index a9b0d19..8852bfe 100644 --- a/src/eth/tx.rs +++ b/src/eth/tx.rs @@ -1,6 +1,5 @@ use core::ops::{Deref, DerefMut}; use crate::{register, register_bit, register_bits, regs::*}; -use crate::println; use super::{MTU, regs}; /// Descriptor entry @@ -101,7 +100,6 @@ impl<'a> Drop for PktRef<'a> { fn drop(&mut self) { self.entry.word1.modify(|_, w| w.used(false)); if ! self.regs.tx_status.read().tx_go() { - println!("tx start_tx"); self.regs.net_ctrl.modify(|_, w| w.start_tx(true) ); diff --git a/src/main.rs b/src/main.rs index 9e1e0e9..c25ab6a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -88,7 +88,7 @@ fn main() { clocks.cpu_2x() / 1_000_000, clocks.cpu_1x() / 1_000_000); - let mut eth = eth::Eth::default(HWADDR.clone()); + let eth = eth::Eth::default(HWADDR.clone()); println!("Eth on"); const RX_LEN: usize = 2;