@@ -108,32 +108,27 @@ where
108108 // Set up the clocks and reset the MAC periperhal
109109 setup:: setup ( ) ;
110110
111+ let dma_parts = DmaParts {
112+ eth_dma : parts. dma . into ( ) ,
113+ #[ cfg( feature = "stm32h7xx-hal" ) ]
114+ eth_mtl : parts. mtl ,
115+ } ;
116+
117+ let mac_parts = MacParts {
118+ eth_mac : parts. mac . into ( ) ,
119+ #[ cfg( feature = "f-series" ) ]
120+ eth_mmc : parts. mmc . into ( ) ,
121+ } ;
122+
111123 // Congfigure and start up the ethernet DMA.
112- let dma = EthernetDMA :: new (
113- DmaParts {
114- eth_dma : parts. dma ,
115- #[ cfg( feature = "stm32h7xx-hal" ) ]
116- eth_mtl : parts. mtl ,
117- } ,
118- rx_buffer,
119- tx_buffer,
120- ) ;
124+ let dma = EthernetDMA :: new ( dma_parts, rx_buffer, tx_buffer) ;
121125
122126 // Configure the ethernet PTP
123127 #[ cfg( feature = "ptp" ) ]
124128 let ptp = EthernetPTP :: new ( parts. ptp . into ( ) , clocks, & dma) ;
125129
126130 // Configure the ethernet MAC
127- let mac = EthernetMAC :: new (
128- MacParts {
129- eth_mac : parts. mac . into ( ) ,
130- #[ cfg( feature = "f-series" ) ]
131- eth_mmc : parts. mmc . into ( ) ,
132- } ,
133- clocks,
134- Speed :: FullDuplexBase100Tx ,
135- & dma,
136- ) ?;
131+ let mac = EthernetMAC :: new ( mac_parts, clocks, Speed :: FullDuplexBase100Tx , & dma) ?;
137132
138133 let parts = Parts {
139134 mac,
@@ -192,23 +187,25 @@ where
192187 // Set up the clocks and reset the MAC periperhal
193188 setup:: setup ( ) ;
194189
195- let eth_mac = parts. mac . into ( ) ;
190+ let dma_parts = DmaParts {
191+ eth_dma : parts. dma . into ( ) ,
192+ } ;
193+
194+ let mac_parts = MacParts {
195+ eth_mac : parts. mac . into ( ) ,
196+ eth_mmc : parts. mmc . into ( ) ,
197+ } ;
196198
197199 // Congfigure and start up the ethernet DMA.
198- let dma = EthernetDMA :: new ( parts . dma . into ( ) , rx_buffer, tx_buffer) ;
200+ let dma = EthernetDMA :: new ( dma_parts , rx_buffer, tx_buffer) ;
199201
200202 // Configure the ethernet PTP
201203 #[ cfg( feature = "ptp" ) ]
202204 let ptp = EthernetPTP :: new ( parts. ptp . into ( ) , clocks, & dma) ;
203205
204206 // Configure the ethernet MAC
205- let mac = EthernetMAC :: new (
206- MacParts { eth_mac, eth_mmc } ,
207- clocks,
208- Speed :: FullDuplexBase100Tx ,
209- & dma,
210- ) ?
211- . with_mii ( mdio, mdc) ;
207+ let mac =
208+ EthernetMAC :: new ( mac_parts, clocks, Speed :: FullDuplexBase100Tx , & dma) ?. with_mii ( mdio, mdc) ;
212209
213210 let parts = Parts {
214211 mac,
0 commit comments