Adding updates for PHY support
This commit is contained in:
parent
11ff93e6f0
commit
f56487401c
12
src/main.rs
12
src/main.rs
|
@ -36,7 +36,7 @@ use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||||
|
|
||||||
use hal::{
|
use hal::{
|
||||||
dma::{DmaChannel, DmaExt, DmaInternal},
|
dma::{DmaChannel, DmaExt, DmaInternal},
|
||||||
ethernet,
|
ethernet::{self, PHY},
|
||||||
rcc::rec::ResetEnable,
|
rcc::rec::ResetEnable,
|
||||||
};
|
};
|
||||||
use smoltcp as net;
|
use smoltcp as net;
|
||||||
|
@ -183,7 +183,7 @@ const APP: () = {
|
||||||
'static,
|
'static,
|
||||||
'static,
|
'static,
|
||||||
ethernet::EthernetDMA<'static>>,
|
ethernet::EthernetDMA<'static>>,
|
||||||
eth_mac: ethernet::EthernetMAC,
|
eth_mac: ethernet::phy::LAN8742A<ethernet::EthernetMAC>,
|
||||||
mac_addr: net::wire::EthernetAddress,
|
mac_addr: net::wire::EthernetAddress,
|
||||||
|
|
||||||
pounder: Option<pounder::PounderDevices<asm_delay::AsmDelay>>,
|
pounder: Option<pounder::PounderDevices<asm_delay::AsmDelay>>,
|
||||||
|
@ -690,6 +690,12 @@ const APP: () = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Reset and initialize the ethernet phy.
|
||||||
|
let mut lan8742a =
|
||||||
|
ethernet::phy::LAN8742A::new(eth_mac.set_phy_addr(0));
|
||||||
|
lan8742a.phy_reset();
|
||||||
|
lan8742a.phy_init();
|
||||||
|
|
||||||
unsafe { ethernet::enable_interrupt() };
|
unsafe { ethernet::enable_interrupt() };
|
||||||
|
|
||||||
let store = unsafe { &mut NET_STORE };
|
let store = unsafe { &mut NET_STORE };
|
||||||
|
@ -708,7 +714,7 @@ const APP: () = {
|
||||||
.ip_addrs(&mut store.ip_addrs[..])
|
.ip_addrs(&mut store.ip_addrs[..])
|
||||||
.finalize();
|
.finalize();
|
||||||
|
|
||||||
(interface, eth_mac)
|
(interface, lan8742a)
|
||||||
};
|
};
|
||||||
|
|
||||||
cp.SCB.enable_icache();
|
cp.SCB.enable_icache();
|
||||||
|
|
Loading…
Reference in New Issue