diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-04-30 04:06:17 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-30 04:06:17 +0000 |
| commit | c474682ea97add6ae8d448e8472ee0444c3cc366 (patch) | |
| tree | b589a963f8256448eb404cb4569479b8ded9ddc2 /examples | |
| parent | 2f43969dd4ce295e38280e517043a6b674862f4d (diff) | |
| parent | 804b20c5af787518c7b29d1e5689b708190c2ec3 (diff) | |
Merge #733
733: Add f107 ethernet support. r=Dirbaio a=davidlenfesty
The original driver works perfectly, the only required changes were only to clock and pin configuration.
Bits that are also present and deserve some scrutiny:
- Migrated LAN8742a driver to a generic SMI version (only *functional* difference is a couple extra status checks for the link poll, which IMO weren't great anyways (i.e. it would consider the link down if it negotiated to 10M)
- Migrated f1 RCC init to "new" style. As of creating this draft PR, it is pretty much only tested on the happy path for my specific configuration, and also needs a couple things done (calculated clock speeds are hardcoded and ADC clock isn't implemented)
- Support for v1b driver (f2 and f4) was added, but not tested.
(Made a draft PR until f4 support is verified and I finish the clock init - adding testing and at least feature parity with how it was before)
Co-authored-by: David Lenfesty <[email protected]>
Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32f7/src/bin/eth.rs | 8 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/eth.rs | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/examples/stm32f7/src/bin/eth.rs b/examples/stm32f7/src/bin/eth.rs index 446756c29..33e41de9c 100644 --- a/examples/stm32f7/src/bin/eth.rs +++ b/examples/stm32f7/src/bin/eth.rs | |||
| @@ -11,7 +11,7 @@ use embassy::util::Forever; | |||
| 11 | use embassy_net::{ | 11 | use embassy_net::{ |
| 12 | Config as NetConfig, Ipv4Address, Ipv4Cidr, StackResources, StaticConfigurator, TcpSocket, | 12 | Config as NetConfig, Ipv4Address, Ipv4Cidr, StackResources, StaticConfigurator, TcpSocket, |
| 13 | }; | 13 | }; |
| 14 | use embassy_stm32::eth::lan8742a::LAN8742A; | 14 | use embassy_stm32::eth::generic_smi::GenericSMI; |
| 15 | use embassy_stm32::eth::{Ethernet, State}; | 15 | use embassy_stm32::eth::{Ethernet, State}; |
| 16 | use embassy_stm32::interrupt; | 16 | use embassy_stm32::interrupt; |
| 17 | use embassy_stm32::peripherals::ETH; | 17 | use embassy_stm32::peripherals::ETH; |
| @@ -26,7 +26,7 @@ use panic_probe as _; | |||
| 26 | 26 | ||
| 27 | #[embassy::task] | 27 | #[embassy::task] |
| 28 | async fn main_task( | 28 | async fn main_task( |
| 29 | device: &'static mut Ethernet<'static, ETH, LAN8742A, 4, 4>, | 29 | device: &'static mut Ethernet<'static, ETH, GenericSMI, 4, 4>, |
| 30 | config: &'static mut StaticConfigurator, | 30 | config: &'static mut StaticConfigurator, |
| 31 | spawner: Spawner, | 31 | spawner: Spawner, |
| 32 | ) { | 32 | ) { |
| @@ -82,7 +82,7 @@ static mut RNG_INST: Option<Rng<RNG>> = None; | |||
| 82 | 82 | ||
| 83 | static EXECUTOR: Forever<Executor> = Forever::new(); | 83 | static EXECUTOR: Forever<Executor> = Forever::new(); |
| 84 | static STATE: Forever<State<'static, ETH, 4, 4>> = Forever::new(); | 84 | static STATE: Forever<State<'static, ETH, 4, 4>> = Forever::new(); |
| 85 | static ETH: Forever<Ethernet<'static, ETH, LAN8742A, 4, 4>> = Forever::new(); | 85 | static ETH: Forever<Ethernet<'static, ETH, GenericSMI, 4, 4>> = Forever::new(); |
| 86 | static CONFIG: Forever<StaticConfigurator> = Forever::new(); | 86 | static CONFIG: Forever<StaticConfigurator> = Forever::new(); |
| 87 | static NET_RESOURCES: Forever<StackResources<1, 2, 8>> = Forever::new(); | 87 | static NET_RESOURCES: Forever<StackResources<1, 2, 8>> = Forever::new(); |
| 88 | 88 | ||
| @@ -112,7 +112,7 @@ fn main() -> ! { | |||
| 112 | let eth = unsafe { | 112 | let eth = unsafe { |
| 113 | ETH.put(Ethernet::new( | 113 | ETH.put(Ethernet::new( |
| 114 | state, p.ETH, eth_int, p.PA1, p.PA2, p.PC1, p.PA7, p.PC4, p.PC5, p.PG13, p.PB13, | 114 | state, p.ETH, eth_int, p.PA1, p.PA2, p.PC1, p.PA7, p.PC4, p.PC5, p.PG13, p.PB13, |
| 115 | p.PG11, LAN8742A, mac_addr, 0, | 115 | p.PG11, GenericSMI, mac_addr, 0, |
| 116 | )) | 116 | )) |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs index 4eb5421a8..9a2e7a33d 100644 --- a/examples/stm32h7/src/bin/eth.rs +++ b/examples/stm32h7/src/bin/eth.rs | |||
| @@ -14,7 +14,7 @@ use embassy::util::Forever; | |||
| 14 | use embassy_net::{ | 14 | use embassy_net::{ |
| 15 | Config as NetConfig, Ipv4Address, Ipv4Cidr, StackResources, StaticConfigurator, TcpSocket, | 15 | Config as NetConfig, Ipv4Address, Ipv4Cidr, StackResources, StaticConfigurator, TcpSocket, |
| 16 | }; | 16 | }; |
| 17 | use embassy_stm32::eth::lan8742a::LAN8742A; | 17 | use embassy_stm32::eth::generic_smi::GenericSMI; |
| 18 | use embassy_stm32::eth::{Ethernet, State}; | 18 | use embassy_stm32::eth::{Ethernet, State}; |
| 19 | use embassy_stm32::interrupt; | 19 | use embassy_stm32::interrupt; |
| 20 | use embassy_stm32::peripherals::ETH; | 20 | use embassy_stm32::peripherals::ETH; |
| @@ -26,7 +26,7 @@ use heapless::Vec; | |||
| 26 | 26 | ||
| 27 | #[embassy::task] | 27 | #[embassy::task] |
| 28 | async fn main_task( | 28 | async fn main_task( |
| 29 | device: &'static mut Ethernet<'static, ETH, LAN8742A, 4, 4>, | 29 | device: &'static mut Ethernet<'static, ETH, GenericSMI, 4, 4>, |
| 30 | config: &'static mut StaticConfigurator, | 30 | config: &'static mut StaticConfigurator, |
| 31 | spawner: Spawner, | 31 | spawner: Spawner, |
| 32 | ) { | 32 | ) { |
| @@ -82,7 +82,7 @@ static mut RNG_INST: Option<Rng<RNG>> = None; | |||
| 82 | 82 | ||
| 83 | static EXECUTOR: Forever<Executor> = Forever::new(); | 83 | static EXECUTOR: Forever<Executor> = Forever::new(); |
| 84 | static STATE: Forever<State<'static, ETH, 4, 4>> = Forever::new(); | 84 | static STATE: Forever<State<'static, ETH, 4, 4>> = Forever::new(); |
| 85 | static ETH: Forever<Ethernet<'static, ETH, LAN8742A, 4, 4>> = Forever::new(); | 85 | static ETH: Forever<Ethernet<'static, ETH, GenericSMI, 4, 4>> = Forever::new(); |
| 86 | static CONFIG: Forever<StaticConfigurator> = Forever::new(); | 86 | static CONFIG: Forever<StaticConfigurator> = Forever::new(); |
| 87 | static NET_RESOURCES: Forever<StackResources<1, 2, 8>> = Forever::new(); | 87 | static NET_RESOURCES: Forever<StackResources<1, 2, 8>> = Forever::new(); |
| 88 | 88 | ||
| @@ -114,7 +114,7 @@ fn main() -> ! { | |||
| 114 | let eth = unsafe { | 114 | let eth = unsafe { |
| 115 | ETH.put(Ethernet::new( | 115 | ETH.put(Ethernet::new( |
| 116 | state, p.ETH, eth_int, p.PA1, p.PA2, p.PC1, p.PA7, p.PC4, p.PC5, p.PG13, p.PB13, | 116 | state, p.ETH, eth_int, p.PA1, p.PA2, p.PC1, p.PA7, p.PC4, p.PC5, p.PG13, p.PB13, |
| 117 | p.PG11, LAN8742A, mac_addr, 0, | 117 | p.PG11, GenericSMI, mac_addr, 0, |
| 118 | )) | 118 | )) |
| 119 | }; | 119 | }; |
| 120 | 120 | ||
