diff options
| author | xoviat <[email protected]> | 2023-07-15 09:32:36 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-07-15 09:32:36 -0500 |
| commit | 48b37aa2bf83b8fccb293fcda7f51149a4ec1a24 (patch) | |
| tree | e0f2491897f7eeca1e3ed078ee0b451c0a0daa22 /embassy-stm32/src/eth/mod.rs | |
| parent | 3bae53306683a57020ba751afaf631ec169deeed (diff) | |
stm32/eth: refactor genericsmi
Diffstat (limited to 'embassy-stm32/src/eth/mod.rs')
| -rw-r--r-- | embassy-stm32/src/eth/mod.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/embassy-stm32/src/eth/mod.rs b/embassy-stm32/src/eth/mod.rs index 4989e17c7..1687cb319 100644 --- a/embassy-stm32/src/eth/mod.rs +++ b/embassy-stm32/src/eth/mod.rs | |||
| @@ -81,9 +81,7 @@ impl<'d, T: Instance, P: PHY> embassy_net_driver::Driver for Ethernet<'d, T, P> | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | fn link_state(&mut self, cx: &mut Context) -> LinkState { | 83 | fn link_state(&mut self, cx: &mut Context) -> LinkState { |
| 84 | // TODO: wake cx.waker on link state change | 84 | if self.phy.poll_link(&mut self.station_management, cx) { |
| 85 | cx.waker().wake_by_ref(); | ||
| 86 | if P::poll_link(self) { | ||
| 87 | LinkState::Up | 85 | LinkState::Up |
| 88 | } else { | 86 | } else { |
| 89 | LinkState::Down | 87 | LinkState::Down |
| @@ -148,11 +146,11 @@ pub unsafe trait StationManagement { | |||
| 148 | /// The methods cannot move S | 146 | /// The methods cannot move S |
| 149 | pub unsafe trait PHY { | 147 | pub unsafe trait PHY { |
| 150 | /// Reset PHY and wait for it to come out of reset. | 148 | /// Reset PHY and wait for it to come out of reset. |
| 151 | fn phy_reset<S: StationManagement>(sm: &mut S); | 149 | fn phy_reset<S: StationManagement>(&mut self, sm: &mut S); |
| 152 | /// PHY initialisation. | 150 | /// PHY initialisation. |
| 153 | fn phy_init<S: StationManagement>(sm: &mut S); | 151 | fn phy_init<S: StationManagement>(&mut self, sm: &mut S); |
| 154 | /// Poll link to see if it is up and FD with 100Mbps | 152 | /// Poll link to see if it is up and FD with 100Mbps |
| 155 | fn poll_link<S: StationManagement>(sm: &mut S) -> bool; | 153 | fn poll_link<S: StationManagement>(&mut self, sm: &mut S, cx: &mut Context) -> bool; |
| 156 | } | 154 | } |
| 157 | 155 | ||
| 158 | pub(crate) mod sealed { | 156 | pub(crate) mod sealed { |
