1
0
Fork 0

rustfmt, squash warnings, add bmp support

This commit is contained in:
topquark12 2022-11-02 17:18:33 +08:00
parent dab73c3fec
commit 7e314410a0
13 changed files with 120 additions and 107 deletions

View File

@ -1,5 +1,5 @@
[target.thumbv7em-none-eabihf] [target.thumbv7em-none-eabihf]
runner = "gdb -q -x openocd.gdb" runner = "gdb -batch -q -x bmp.gdb"
rustflags = [ rustflags = [
"-C", "link-arg=-Tlink.x", "-C", "link-arg=-Tlink.x",
] ]

1
Cargo.lock generated
View File

@ -683,7 +683,6 @@ checksum = "72165c4af59f5f19c7fb774b88b95660591b612380305b5f4503157341a9f7ee"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"byteorder", "byteorder",
"log",
"managed", "managed",
] ]

View File

@ -24,7 +24,7 @@ nb = "1"
cortex-m-log = { version = "0.7.0", features = ["log-integration", "semihosting"] } cortex-m-log = { version = "0.7.0", features = ["log-integration", "semihosting"] }
stm32f4xx-hal = { version = "0.13.2", features = ["rt", "stm32f407", "usb_fs", "rtic-monotonic"] } stm32f4xx-hal = { version = "0.13.2", features = ["rt", "stm32f407", "usb_fs", "rtic-monotonic"] }
stm32-eth = { git = "https://github.com/stm32-rs/stm32-eth", features = ["stm32f407", "smoltcp-phy", "smoltcp"] } stm32-eth = { git = "https://github.com/stm32-rs/stm32-eth", features = ["stm32f407", "smoltcp-phy", "smoltcp"] }
smoltcp = { version = "0.8.1", default-features = false, features = ["proto-ipv4", "socket-tcp", "log", "medium-ethernet"] } smoltcp = { version = "0.8.1", default-features = false, features = ["proto-ipv4", "socket-tcp", "medium-ethernet"] }
ieee802_3_miim = "0.7.2" ieee802_3_miim = "0.7.2"
num-traits = { version = "0.2.15", default-features = false, features = ["libm"] } num-traits = { version = "0.2.15", default-features = false, features = ["libm"] }
usb-device = "0.2.9" usb-device = "0.2.9"
@ -35,6 +35,7 @@ cortex-m-rtic = "1.0.0"
systick-monotonic = "1.0.0" systick-monotonic = "1.0.0"
[features] [features]
default = ["RTT"]
semihosting = ["cortex-m-log/semihosting"] semihosting = ["cortex-m-log/semihosting"]
RTT = [] RTT = []

6
bmp.gdb Normal file
View File

@ -0,0 +1,6 @@
target extended-remote /dev/ttyBmpGdb
monitor swdp_scan
attach 1
load
compare-sections
kill

View File

@ -66,7 +66,7 @@
buildInputs = with pkgs; [ buildInputs = with pkgs; [
rustPlatform.rust.rustc rustPlatform.rust.rustc
rustPlatform.rust.cargo rustPlatform.rust.cargo
openocd dfu-util glibc openocd dfu-util glibc picocom gdb
] ++ (with python3Packages; [ ] ++ (with python3Packages; [
numpy matplotlib pyqtgraph numpy matplotlib pyqtgraph
]); ]);

View File

@ -1,8 +1,7 @@
use super::{gpio, usb, delay}; use super::{delay, gpio, usb};
use crate::laser_diode::current_sources::*; use crate::laser_diode::current_sources::*;
use smoltcp::iface::{SocketHandle, Interface}; use crate::network::network;
use stm32_eth::stm32::ETHERNET_DMA; use crate::network::network::EthernetPeripherals;
use systick_monotonic::Systick;
use fugit::ExtU32; use fugit::ExtU32;
use log::info; use log::info;
use stm32f4xx_hal::{ use stm32f4xx_hal::{
@ -11,15 +10,22 @@ use stm32f4xx_hal::{
time::MegaHertz, time::MegaHertz,
watchdog::IndependentWatchdog, watchdog::IndependentWatchdog,
}; };
use crate::network::network; use systick_monotonic::Systick;
use crate::network::network::EthernetPeripherals;
#[cfg(not(feature = "semihosting"))] #[cfg(not(feature = "semihosting"))]
const WATCHDOG_PERIOD: u32 = 1000; const WATCHDOG_PERIOD: u32 = 1000;
#[cfg(feature = "semihosting")] #[cfg(feature = "semihosting")]
const WATCHDOG_PERIOD: u32 = 30000; const WATCHDOG_PERIOD: u32 = 30000;
pub fn bootup(mut core_perif: CorePeripherals, perif: Peripherals, server_storage: &'static mut network::ServerStorage) -> (IndependentWatchdog, Systick<1000_u32>, network::ServerHandle) { pub fn bootup(
mut core_perif: CorePeripherals,
perif: Peripherals,
server_storage: &'static mut network::ServerStorage,
) -> (
IndependentWatchdog,
Systick<1000_u32>,
network::ServerHandle,
) {
core_perif.SCB.enable_icache(); core_perif.SCB.enable_icache();
core_perif.SCB.enable_dcache(&mut core_perif.CPUID); core_perif.SCB.enable_dcache(&mut core_perif.CPUID);
@ -43,7 +49,6 @@ pub fn bootup(mut core_perif: CorePeripherals, perif: Peripherals, server_storag
perif.GPIOB, perif.GPIOB,
perif.GPIOC, perif.GPIOC,
perif.GPIOD, perif.GPIOD,
perif.GPIOG,
perif.SPI2, perif.SPI2,
perif.OTG_FS_GLOBAL, perif.OTG_FS_GLOBAL,
perif.OTG_FS_DEVICE, perif.OTG_FS_DEVICE,

View File

@ -1,7 +1,7 @@
//! Basic blocking delay //! Basic blocking delay
//! //!
//! This module provides a basic asm-based blocking delay. //! This module provides a basic asm-based blocking delay.
//! Borrowed from our good friends at Quartiq: //! Borrowed from our good friends at Quartiq:
//! https://github.com/quartiq/stabilizer/blob/master/src/hardware/delay.rs //! https://github.com/quartiq/stabilizer/blob/master/src/hardware/delay.rs
//! //!
@ -43,4 +43,4 @@ where
fn delay_ms(&mut self, ms: U) { fn delay_ms(&mut self, ms: U) {
cortex_m::asm::delay(self.frequency_ms * ms.into()) cortex_m::asm::delay(self.frequency_ms * ms.into())
} }
} }

View File

@ -2,9 +2,9 @@ use crate::laser_diode::current_sources::*;
use fugit::RateExtU32; use fugit::RateExtU32;
use stm32_eth::EthPins; use stm32_eth::EthPins;
use stm32f4xx_hal::{ use stm32f4xx_hal::{
gpio::{GpioExt, AF11, Speed, Alternate}, gpio::{Alternate, GpioExt, Speed},
otg_fs::USB, otg_fs::USB,
pac::{GPIOA, GPIOB, GPIOC, GPIOD, GPIOG, OTG_FS_DEVICE, OTG_FS_GLOBAL, OTG_FS_PWRCLK, SPI2}, pac::{GPIOA, GPIOB, GPIOC, GPIOD, OTG_FS_DEVICE, OTG_FS_GLOBAL, OTG_FS_PWRCLK, SPI2},
rcc::Clocks, rcc::Clocks,
spi, spi,
spi::{NoMiso, Spi}, spi::{NoMiso, Spi},
@ -18,7 +18,6 @@ pub fn setup(
gpiob: GPIOB, gpiob: GPIOB,
gpioc: GPIOC, gpioc: GPIOC,
gpiod: GPIOD, gpiod: GPIOD,
gpiog: GPIOG,
spi2: SPI2, spi2: SPI2,
otg_fs_global: OTG_FS_GLOBAL, otg_fs_global: OTG_FS_GLOBAL,
otg_fs_device: OTG_FS_DEVICE, otg_fs_device: OTG_FS_DEVICE,
@ -28,15 +27,13 @@ pub fn setup(
USB, USB,
CurrentSourcePhyConstruct<CurrentSourcePhyCh0>, CurrentSourcePhyConstruct<CurrentSourcePhyCh0>,
stm32f4xx_hal::gpio::PA2<Alternate<11>>, stm32f4xx_hal::gpio::PA2<Alternate<11>>,
stm32f4xx_hal::gpio::PC1<Alternate<11>> stm32f4xx_hal::gpio::PC1<Alternate<11>>, // photo_diode_phy,
// photo_diode_phy, // thermostat_phy
// thermostat_phy
) { ) {
let gpioa = gpioa.split(); let gpioa = gpioa.split();
let gpiob = gpiob.split(); let gpiob = gpiob.split();
let gpioc = gpioc.split(); let gpioc = gpioc.split();
let gpiod = gpiod.split(); let gpiod = gpiod.split();
let gpiog = gpiog.split();
let usb = USB { let usb = USB {
usb_global: otg_fs_global, usb_global: otg_fs_global,
@ -61,7 +58,6 @@ pub fn setup(
let mut mdc = gpioc.pc1.into_alternate::<11>(); let mut mdc = gpioc.pc1.into_alternate::<11>();
mdio.set_speed(Speed::VeryHigh); mdio.set_speed(Speed::VeryHigh);
mdc.set_speed(Speed::VeryHigh); mdc.set_speed(Speed::VeryHigh);
let current_source_phy = CurrentSourcePhyConstruct { let current_source_phy = CurrentSourcePhyConstruct {
max5719_spi: Spi::new( max5719_spi: Spi::new(

View File

@ -1,6 +1,6 @@
pub mod boot; pub mod boot;
pub mod delay;
pub mod gpio; pub mod gpio;
pub mod log_setup; pub mod log_setup;
pub mod rtt_logger; pub mod rtt_logger;
pub mod delay;
pub mod usb; pub mod usb;

View File

@ -3,7 +3,7 @@ use stm32f4xx_hal::{
gpio::{gpioa::*, gpiob::*, gpiod::*, Alternate, Output, PushPull, PD9}, gpio::{gpioa::*, gpiob::*, gpiod::*, Alternate, Output, PushPull, PD9},
hal::{blocking::spi::Write, digital::v2::OutputPin}, hal::{blocking::spi::Write, digital::v2::OutputPin},
pac::SPI2, pac::SPI2,
spi::{NoMiso, Spi, TransferModeNormal} spi::{NoMiso, Spi, TransferModeNormal},
}; };
pub trait CurrentSourcePhy { pub trait CurrentSourcePhy {
@ -43,7 +43,7 @@ impl CurrentSourcePhy for CurrentSourcePhyCh0 {
use crate::device::delay; use crate::device::delay;
impl<C: CurrentSourcePhy> CurrentSource<C> { impl<C: CurrentSourcePhy> CurrentSource<C> {
pub fn setup(&mut self, mut delay : delay::AsmDelay) { pub fn setup(&mut self, mut delay: delay::AsmDelay) {
let _ = self.phy.max5719_load.set_high(); let _ = self.phy.max5719_load.set_high();
let _ = self.phy.max5719_cs.set_high(); let _ = self.phy.max5719_cs.set_high();
let _ = self.phy.current_source_ldo_en.set_high(); let _ = self.phy.current_source_ldo_en.set_high();

View File

@ -8,10 +8,7 @@ mod network;
// If RTT is used, print panic info through RTT // If RTT is used, print panic info through RTT
#[cfg(feature = "RTT")] #[cfg(feature = "RTT")]
use { use {core::panic::PanicInfo, rtt_target::rprintln};
core::panic::PanicInfo,
rtt_target::rprintln,
};
#[cfg(feature = "RTT")] #[cfg(feature = "RTT")]
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
@ -26,52 +23,47 @@ use panic_halt as _;
#[app(device = stm32f4xx_hal::pac, peripherals = true, dispatchers = [TIM8_CC, TIM8_BRK_TIM12])] #[app(device = stm32f4xx_hal::pac, peripherals = true, dispatchers = [TIM8_CC, TIM8_BRK_TIM12])]
mod app { mod app {
use log::info;
use stm32_eth::stm32::ETHERNET_DMA;
use systick_monotonic::Systick;
use fugit::ExtU32;
use stm32f4xx_hal::watchdog::IndependentWatchdog;
use crate::device::{boot::bootup, log_setup}; use crate::device::{boot::bootup, log_setup};
use smoltcp::iface::{SocketHandle, Interface};
use crate::network::network; use crate::network::network;
use fugit::ExtU32;
fn now_fn() -> smoltcp::time::Instant { use log::info;
let time = monotonics::now().duration_since_epoch().to_millis(); use stm32f4xx_hal::watchdog::IndependentWatchdog;
smoltcp::time::Instant::from_millis(time as i64) use systick_monotonic::Systick;
}
#[monotonic(binds = SysTick, default = true)] #[monotonic(binds = SysTick, default = true)]
type SystickTimer = Systick<1000>; type SystickTimer = Systick<1000>;
#[shared] #[shared]
struct Shared { struct Shared {}
}
#[local] #[local]
struct Local { struct Local {
wd: IndependentWatchdog, wd: IndependentWatchdog,
// server_storage: network::network::ServerStorage::new(), // server_storage: network::network::ServerStorage::new(),
server_handle: network::ServerHandle server_handle: network::ServerHandle,
} }
#[init( local = [server_storage: network::ServerStorage = network::ServerStorage::new()] )] #[init( local = [server_storage: network::ServerStorage = network::ServerStorage::new()] )]
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
log_setup::init_log(); log_setup::init_log();
info!("Kirdy init"); info!("Kirdy init");
let core_perif = cx.core; let core_perif = cx.core;
let perif = cx.device; let perif = cx.device;
let server_storage = cx.local.server_storage; let server_storage = cx.local.server_storage;
let (wd, systick, server_handle) = bootup(core_perif, perif, server_storage); let (wd, systick, server_handle) = bootup(core_perif, perif, server_storage);
wd_feed::spawn().unwrap(); wd_feed::spawn().unwrap();
// server_poll::spawn().unwrap(); // server_poll::spawn().unwrap();
(Shared {}, Local {wd, server_handle}, init::Monotonics(systick)) (
Shared {},
Local { wd, server_handle },
init::Monotonics(systick),
)
} }
#[task(priority = 5, local = [wd])] #[task(priority = 5, local = [wd])]
fn wd_feed (cx: wd_feed::Context) { fn wd_feed(cx: wd_feed::Context) {
let start = monotonics::now(); let start = monotonics::now();
let wd = cx.local.wd; let wd = cx.local.wd;
// info!("feed wd"); // info!("feed wd");
@ -80,7 +72,7 @@ mod app {
} }
#[task(binds = ETH, priority = 2, local = [server_handle, data: [u8; 512] = [0u8; 512]])] #[task(binds = ETH, priority = 2, local = [server_handle, data: [u8; 512] = [0u8; 512]])]
fn server_poll (cx: server_poll::Context) { fn server_poll(cx: server_poll::Context) {
let data = cx.local.data; let data = cx.local.data;
let server_handle = cx.local.server_handle; let server_handle = cx.local.server_handle;
server_handle.poll(data); server_handle.poll(data);
@ -93,6 +85,4 @@ mod app {
cortex_m::asm::nop(); cortex_m::asm::nop();
} }
} }
} }

View File

@ -1 +1 @@
pub mod network; pub mod network;

View File

@ -1,29 +1,34 @@
use fugit::Instant; // Modified by Wong Tat Hang (aw@m-labs.hk), with original source from
use smoltcp::iface::{InterfaceBuilder, NeighborCache, SocketHandle, Interface, SocketStorage}; // https://github.com/stm32-rs/stm32-eth/blob/master/examples/rtic-echo.rs
use smoltcp::socket::{TcpSocket, TcpSocketBuffer, self, Socket};
use smoltcp::storage::RingBuffer; // Licensed under the Apache License, Version 2.0 (the "License");
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address}; // you may not use this file except in compliance with the License.
use stm32f4xx_hal::gpio::{gpioa::*, gpiob::*, gpioc::*, gpiog::*, Input}; // You may obtain a copy of the License at
use stm32_eth::{EthPins, TxDescriptor, RxDescriptor, EthernetMAC};
use stm32_eth::stm32::{ETHERNET_DMA, ETHERNET_MAC, ETHERNET_MMC}; // http://www.apache.org/licenses/LICENSE-2.0
use stm32_eth::RingEntry;
use stm32_eth::TxRingEntry; // Unless required by applicable law or agreed to in writing, software
use stm32_eth::RxRingEntry; // distributed under the License is distributed on an "AS IS" BASIS,
use stm32f4xx_hal::rcc::Clocks; // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
use smoltcp::iface::Neighbor; // See the License for the specific language governing permissions and
use stm32_eth::*; // limitations under the License.
use log::{info, warn, debug};
use smoltcp::iface::Route; use log::{info, warn};
use smoltcp::wire::Ipv4Cidr;
use stm32f4xx_hal::gpio::Alternate;
use smoltcp::{ use smoltcp::{
iface::{self}, iface::{
socket::{TcpState}, Interface, InterfaceBuilder, Neighbor, NeighborCache, Route, SocketHandle, SocketStorage,
},
socket::{TcpSocket, TcpSocketBuffer, TcpState},
wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv4Cidr},
};
use stm32_eth::stm32::{ETHERNET_DMA, ETHERNET_MAC, ETHERNET_MMC};
use stm32_eth::*;
use stm32f4xx_hal::{
gpio::{gpioa::*, gpiob::*, gpioc::*, Alternate, Input},
rcc::Clocks,
}; };
use crate::app::monotonics;
use crate::app::monotonics::{self, now};
pub type EthernetPins = pub type EthernetPins =
EthPins<PA1<Input>, PA7<Input>, PB11<Input>, PB12<Input>, PB13<Input>, PC4<Input>, PC5<Input>>; EthPins<PA1<Input>, PA7<Input>, PB11<Input>, PB12<Input>, PB13<Input>, PC4<Input>, PC5<Input>>;
@ -31,8 +36,16 @@ pub type EthernetPins =
pub type EthInterface = Interface<'static, &'static mut EthernetDMA<'static, 'static>>; pub type EthInterface = Interface<'static, &'static mut EthernetDMA<'static, 'static>>;
const IPV4_ADDR: (u8, u8, u8, u8) = (192, 168, 1, 132); const IPV4_ADDR: (u8, u8, u8, u8) = (192, 168, 1, 132);
const ADDRESS: (IpAddress, u16) = (IpAddress::Ipv4(Ipv4Address::new(IPV4_ADDR.0, IPV4_ADDR.1,IPV4_ADDR.2,IPV4_ADDR.3)), 1337); const ADDRESS: (IpAddress, u16) = (
const MAC: [u8; 6] = [0x02,0x5f,0x25,0x37,0x93,0x0e]; IpAddress::Ipv4(Ipv4Address::new(
IPV4_ADDR.0,
IPV4_ADDR.1,
IPV4_ADDR.2,
IPV4_ADDR.3,
)),
1337,
);
const MAC: [u8; 6] = [0x02, 0x5f, 0x25, 0x37, 0x93, 0x0e];
pub struct EthernetPeripherals { pub struct EthernetPeripherals {
pub dma: ETHERNET_DMA, pub dma: ETHERNET_DMA,
pub mac: ETHERNET_MAC, pub mac: ETHERNET_MAC,
@ -41,8 +54,8 @@ pub struct EthernetPeripherals {
pub struct ServerHandle { pub struct ServerHandle {
// storage: &'static mut ServerStorage, // storage: &'static mut ServerStorage,
socket_handle: SocketHandle, socket_handle: SocketHandle,
iface: EthInterface iface: EthInterface,
} }
pub struct ServerStorage { pub struct ServerStorage {
@ -54,11 +67,20 @@ pub struct ServerStorage {
impl ServerStorage { impl ServerStorage {
pub const fn new() -> Self { pub const fn new() -> Self {
ServerStorage { ServerStorage {
rx_ring: [RxRingEntry::new(),RxRingEntry::new(),RxRingEntry::new(),RxRingEntry::new(),RxRingEntry::new(),RxRingEntry::new(),RxRingEntry::new(),RxRingEntry::new()], rx_ring: [
tx_ring: [TxRingEntry::new(),TxRingEntry::new()], RxRingEntry::new(),
RxRingEntry::new(),
RxRingEntry::new(),
RxRingEntry::new(),
RxRingEntry::new(),
RxRingEntry::new(),
RxRingEntry::new(),
RxRingEntry::new(),
],
tx_ring: [TxRingEntry::new(), TxRingEntry::new()],
storage: NetworkStorage::new(), storage: NetworkStorage::new(),
dma: core::mem::MaybeUninit::uninit(), dma: core::mem::MaybeUninit::uninit(),
} }
} }
} }
@ -73,8 +95,10 @@ pub struct NetworkStorage {
} }
impl NetworkStorage { impl NetworkStorage {
const IP_INIT: IpCidr = const IP_INIT: IpCidr = IpCidr::Ipv4(Ipv4Cidr::new(
IpCidr::Ipv4(Ipv4Cidr::new(Ipv4Address::new(IPV4_ADDR.0, IPV4_ADDR.1,IPV4_ADDR.2,IPV4_ADDR.3), 24)); Ipv4Address::new(IPV4_ADDR.0, IPV4_ADDR.1, IPV4_ADDR.2, IPV4_ADDR.3),
24,
));
pub const fn new() -> Self { pub const fn new() -> Self {
NetworkStorage { NetworkStorage {
@ -109,16 +133,14 @@ fn now_fn() -> smoltcp::time::Instant {
} }
impl ServerHandle { impl ServerHandle {
pub fn new( pub fn new(
eth_pins: EthernetPins, eth_pins: EthernetPins,
ethernet: EthernetPeripherals, ethernet: EthernetPeripherals,
clocks: Clocks, clocks: Clocks,
storage: &'static mut ServerStorage, storage: &'static mut ServerStorage,
mdio: stm32f4xx_hal::gpio::PA2<Alternate<11>>, mdio: stm32f4xx_hal::gpio::PA2<Alternate<11>>,
mdc: stm32f4xx_hal::gpio::PC1<Alternate<11>> mdc: stm32f4xx_hal::gpio::PC1<Alternate<11>>,
) -> ServerHandle { ) -> ServerHandle {
let (dma, mac) = stm32_eth::new_with_mii( let (dma, mac) = stm32_eth::new_with_mii(
ethernet.mac, ethernet.mac,
ethernet.mmc, ethernet.mmc,
@ -128,7 +150,7 @@ impl ServerHandle {
clocks, clocks,
eth_pins, eth_pins,
mdio, mdio,
mdc mdc,
) )
.unwrap(); .unwrap();
@ -137,12 +159,13 @@ impl ServerHandle {
.add_default_ipv4_route(Ipv4Address::new(192, 168, 1, 1)) .add_default_ipv4_route(Ipv4Address::new(192, 168, 1, 1))
.ok(); .ok();
let dma = storage.dma.write(dma); let dma = storage.dma.write(dma);
dma.enable_interrupt(); dma.enable_interrupt();
let rx_buffer = TcpSocketBuffer::new(&mut storage.storage.tcp_socket_storage.rx_storage[..]); let rx_buffer =
let tx_buffer = TcpSocketBuffer::new(&mut storage.storage.tcp_socket_storage.tx_storage[..]); TcpSocketBuffer::new(&mut storage.storage.tcp_socket_storage.rx_storage[..]);
let tx_buffer =
TcpSocketBuffer::new(&mut storage.storage.tcp_socket_storage.tx_storage[..]);
let socket = TcpSocket::new(rx_buffer, tx_buffer); let socket = TcpSocket::new(rx_buffer, tx_buffer);
let mut iface = InterfaceBuilder::new(dma, &mut storage.storage.sockets[..]) let mut iface = InterfaceBuilder::new(dma, &mut storage.storage.sockets[..])
@ -153,11 +176,11 @@ impl ServerHandle {
.finalize(); .finalize();
let mut server = ServerHandle { let mut server = ServerHandle {
socket_handle: iface.add_socket(socket), socket_handle: iface.add_socket(socket),
iface: iface iface: iface,
}; };
let socket = server.iface.get_socket::<TcpSocket>(server.socket_handle); let socket = server.iface.get_socket::<TcpSocket>(server.socket_handle);
socket.listen(ADDRESS).ok(); socket.listen(ADDRESS).ok();
server.iface.poll(now_fn()); server.iface.poll(now_fn()).ok();
if let Ok(mut phy) = EthernetPhy::from_miim(mac, 0) { if let Ok(mut phy) = EthernetPhy::from_miim(mac, 0) {
info!( info!(
"Resetting PHY as an extra step. Type: {}", "Resetting PHY as an extra step. Type: {}",
@ -173,11 +196,6 @@ impl ServerHandle {
} }
pub fn poll(&mut self, buffer: &mut [u8]) { pub fn poll(&mut self, buffer: &mut [u8]) {
// info!("poll eth");
let interrupt_reason = self.iface.device_mut().interrupt_handler();
// debug!("Reason: {:?}", interrupt_reason);
self.iface.poll(now_fn()).ok(); self.iface.poll(now_fn()).ok();
let socket = self.iface.get_socket::<TcpSocket>(self.socket_handle); let socket = self.iface.get_socket::<TcpSocket>(self.socket_handle);
@ -195,11 +213,9 @@ impl ServerHandle {
} }
self.iface.poll(now_fn()).ok(); self.iface.poll(now_fn()).ok();
} }
} }
use ieee802_3_miim::{ use ieee802_3_miim::{
phy::{ phy::{
lan87xxa::{LAN8720A, LAN8742A}, lan87xxa::{LAN8720A, LAN8742A},
@ -277,4 +293,4 @@ impl<M: Miim> EthernetPhy<M> {
} }
} }
} }
} }