stm32h7_ethernet/lib.rs
1//! ## This crate has been replaced by [Ethernet support within
2//! stm32h7xx-hal](https://docs.rs/stm32h7xx-hal/latest/stm32h7xx_hal/ethernet/index.html).
3//!
4//! ## License
5//!
6//! Licensed under either of
7//!
8//! - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
9//! - MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
10//!
11//! at your option.
12//!
13//! [stm32h7xx-hal]: https://github.com/stm32-rs/stm32h7xx-hal
14//! [smoltcp]: https://github.com/smoltcp-rs/smoltcp
15#![no_std]
16
17#[macro_use]
18extern crate log;
19
20mod ethernet;
21
22#[cfg(feature = "phy_ksz8081r")]
23mod ksz8081r;
24#[cfg(feature = "phy_lan8742a")]
25mod lan8742a;
26#[cfg(not(any(feature = "phy_ksz8081r", feature = "phy_lan8742a")))]
27compile_error!(
28 "A least one PHY device must be enabled. Use a feature gate to
29enable."
30);
31#[cfg(all(feature = "phy_ksz8081r", feature = "phy_lan8742a"))]
32compile_error!(
33 "Cannot enable multiple PHY devices. Try setting
34`default-features = false`."
35);
36
37/// PHY address
38pub const ETH_PHY_ADDR: u8 = 0;
39
40/// Station Management Interface (SMI) on an ethernet PHY
41pub trait StationManagement {
42 /// Read a register over SMI.
43 fn smi_read(&mut self, reg: u8) -> u16;
44 /// Write a register over SMI.
45 fn smi_write(&mut self, reg: u8, val: u16);
46}
47
48/// Traits for an Ethernet PHY
49trait PHY {
50 /// Reset PHY and wait for it to come out of reset.
51 fn phy_reset(&mut self);
52 /// PHY initialisation.
53 fn phy_init(&mut self);
54}
55
56pub use ethernet::{enable_interrupt, ethernet_init, interrupt_handler};
57pub use ethernet::{DesRing, EthernetDMA, EthernetMAC};