diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-01-26 22:42:13 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-01-26 22:43:28 +0100 |
| commit | b1245858f355e764a17eda819198f68ad83883ab (patch) | |
| tree | 6fd7b65aa4e66c0874c71112b1d486bcb68928e6 /examples/stm32f4/src | |
| parent | c8d29a1e2cd3f28c3afdd52a679fcb49f67e812c (diff) | |
stm32/eth: rename PHY->Phy, GenericSMI -> GenericPhy. Remove unneeded unsafes.
We shouldn't use `unsafe` to mark merely "dangerous" actions, only actions that
actually cause UB.
Diffstat (limited to 'examples/stm32f4/src')
| -rw-r--r-- | examples/stm32f4/src/bin/eth.rs | 7 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/eth_compliance_test.rs | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/examples/stm32f4/src/bin/eth.rs b/examples/stm32f4/src/bin/eth.rs index a3af8f75c..634d8e2c6 100644 --- a/examples/stm32f4/src/bin/eth.rs +++ b/examples/stm32f4/src/bin/eth.rs | |||
| @@ -5,8 +5,7 @@ use defmt::*; | |||
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_net::tcp::TcpSocket; | 6 | use embassy_net::tcp::TcpSocket; |
| 7 | use embassy_net::{Ipv4Address, StackResources}; | 7 | use embassy_net::{Ipv4Address, StackResources}; |
| 8 | use embassy_stm32::eth::generic_smi::GenericSMI; | 8 | use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; |
| 9 | use embassy_stm32::eth::{Ethernet, PacketQueue}; | ||
| 10 | use embassy_stm32::peripherals::ETH; | 9 | use embassy_stm32::peripherals::ETH; |
| 11 | use embassy_stm32::rng::Rng; | 10 | use embassy_stm32::rng::Rng; |
| 12 | use embassy_stm32::time::Hertz; | 11 | use embassy_stm32::time::Hertz; |
| @@ -21,7 +20,7 @@ bind_interrupts!(struct Irqs { | |||
| 21 | HASH_RNG => rng::InterruptHandler<peripherals::RNG>; | 20 | HASH_RNG => rng::InterruptHandler<peripherals::RNG>; |
| 22 | }); | 21 | }); |
| 23 | 22 | ||
| 24 | type Device = Ethernet<'static, ETH, GenericSMI>; | 23 | type Device = Ethernet<'static, ETH, GenericPhy>; |
| 25 | 24 | ||
| 26 | #[embassy_executor::task] | 25 | #[embassy_executor::task] |
| 27 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { | 26 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { |
| @@ -76,7 +75,7 @@ async fn main(spawner: Spawner) -> ! { | |||
| 76 | p.PG13, | 75 | p.PG13, |
| 77 | p.PB13, | 76 | p.PB13, |
| 78 | p.PG11, | 77 | p.PG11, |
| 79 | GenericSMI::new_auto(), | 78 | GenericPhy::new_auto(), |
| 80 | mac_addr, | 79 | mac_addr, |
| 81 | ); | 80 | ); |
| 82 | 81 | ||
diff --git a/examples/stm32f4/src/bin/eth_compliance_test.rs b/examples/stm32f4/src/bin/eth_compliance_test.rs index 5946fed79..52f9d57f6 100644 --- a/examples/stm32f4/src/bin/eth_compliance_test.rs +++ b/examples/stm32f4/src/bin/eth_compliance_test.rs | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::eth::generic_smi::GenericSMI; | 6 | use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue, StationManagement}; |
| 7 | use embassy_stm32::eth::{Ethernet, PacketQueue, StationManagement}; | ||
| 8 | use embassy_stm32::time::Hertz; | 7 | use embassy_stm32::time::Hertz; |
| 9 | use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; | 8 | use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; |
| 10 | use embassy_time::Timer; | 9 | use embassy_time::Timer; |
| @@ -59,11 +58,11 @@ async fn main(_spawner: Spawner) -> ! { | |||
| 59 | p.PG13, | 58 | p.PG13, |
| 60 | p.PB13, | 59 | p.PB13, |
| 61 | p.PG11, | 60 | p.PG11, |
| 62 | GenericSMI::new(PHY_ADDR), | 61 | GenericPhy::new(PHY_ADDR), |
| 63 | mac_addr, | 62 | mac_addr, |
| 64 | ); | 63 | ); |
| 65 | 64 | ||
| 66 | let sm = unsafe { device.station_management() }; | 65 | let sm = device.station_management(); |
| 67 | 66 | ||
| 68 | // Just an example. Exact register settings depend on the specific PHY and test. | 67 | // Just an example. Exact register settings depend on the specific PHY and test. |
| 69 | sm.smi_write(PHY_ADDR, 0, 0x2100); | 68 | sm.smi_write(PHY_ADDR, 0, 0x2100); |
