@@ -108,32 +108,27 @@ where
108
108
// Set up the clocks and reset the MAC periperhal
109
109
setup:: setup ( ) ;
110
110
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
+
111
123
// 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) ;
121
125
122
126
// Configure the ethernet PTP
123
127
#[ cfg( feature = "ptp" ) ]
124
128
let ptp = EthernetPTP :: new ( parts. ptp . into ( ) , clocks, & dma) ;
125
129
126
130
// 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) ?;
137
132
138
133
let parts = Parts {
139
134
mac,
@@ -192,23 +187,25 @@ where
192
187
// Set up the clocks and reset the MAC periperhal
193
188
setup:: setup ( ) ;
194
189
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
+ } ;
196
198
197
199
// 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) ;
199
201
200
202
// Configure the ethernet PTP
201
203
#[ cfg( feature = "ptp" ) ]
202
204
let ptp = EthernetPTP :: new ( parts. ptp . into ( ) , clocks, & dma) ;
203
205
204
206
// 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) ;
212
209
213
210
let parts = Parts {
214
211
mac,
0 commit comments