aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/eth/mod.rs
diff options
context:
space:
mode:
authorThales Fragoso <[email protected]>2021-06-10 02:38:59 -0300
committerDario Nieuwenhuis <[email protected]>2021-06-16 16:48:35 +0200
commit4cffa200bd976fd415e3419426f5029b2c72cfd2 (patch)
tree45e8814f4fb324de38a3b8315b81e33ca3a3b94e /embassy-stm32/src/eth/mod.rs
parent46e1bae9e36917c2e763082730d99df302c1c625 (diff)
eth: Add lan8742a PHY
Diffstat (limited to 'embassy-stm32/src/eth/mod.rs')
-rw-r--r--embassy-stm32/src/eth/mod.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/embassy-stm32/src/eth/mod.rs b/embassy-stm32/src/eth/mod.rs
index 8791e1552..e41ebf4d0 100644
--- a/embassy-stm32/src/eth/mod.rs
+++ b/embassy-stm32/src/eth/mod.rs
@@ -3,5 +3,32 @@
3#[cfg_attr(eth_v1, path = "v1.rs")] 3#[cfg_attr(eth_v1, path = "v1.rs")]
4#[cfg_attr(eth_v2, path = "v2/mod.rs")] 4#[cfg_attr(eth_v2, path = "v2/mod.rs")]
5mod _version; 5mod _version;
6pub mod lan8742a;
6 7
7pub use _version::*; 8pub use _version::*;
9
10/// Station Management Interface (SMI) on an ethernet PHY
11///
12/// # Safety
13///
14/// The methods cannot move out of self
15pub unsafe trait StationManagement {
16 /// Read a register over SMI.
17 fn smi_read(&mut self, reg: u8) -> u16;
18 /// Write a register over SMI.
19 fn smi_write(&mut self, reg: u8, val: u16);
20}
21
22/// Traits for an Ethernet PHY
23///
24/// # Safety
25///
26/// The methods cannot move S
27pub unsafe trait PHY {
28 /// Reset PHY and wait for it to come out of reset.
29 fn phy_reset<S: StationManagement>(sm: &mut S);
30 /// PHY initialisation.
31 fn phy_init<S: StationManagement>(sm: &mut S);
32 /// Poll link to see if it is up and FD with 100Mbps
33 fn poll_link<S: StationManagement>(sm: &mut S) -> bool;
34}