@@ -128,18 +128,6 @@ impl<'rx, 'tx> EthernetDMA<'rx, 'tx> {
128
128
dma
129
129
}
130
130
131
- #[ cfg( feature = "async-await" ) ]
132
- pub ( crate ) fn rx_waker ( ) -> & ' static AtomicWaker {
133
- static WAKER : AtomicWaker = AtomicWaker :: new ( ) ;
134
- & WAKER
135
- }
136
-
137
- #[ cfg( feature = "async-await" ) ]
138
- pub ( crate ) fn tx_waker ( ) -> & ' static AtomicWaker {
139
- static WAKER : AtomicWaker = AtomicWaker :: new ( ) ;
140
- & WAKER
141
- }
142
-
143
131
/// Split the [`EthernetDMA`] into concurrently operating send and
144
132
/// receive parts.
145
133
pub fn split ( & mut self ) -> ( & mut RxRing < ' rx > , & mut TxRing < ' tx > ) {
@@ -259,19 +247,39 @@ impl<'rx, 'tx> EthernetDMA<'rx, 'tx> {
259
247
pub fn tx_available ( & mut self ) -> bool {
260
248
self . tx_ring . next_entry_available ( )
261
249
}
250
+ }
251
+
252
+ impl Drop for EthernetDMA < ' _ , ' _ > {
253
+ // On drop, stop all DMA actions.
254
+ fn drop ( & mut self ) {
255
+ self . tx_ring . stop ( & self . eth_dma ) ;
256
+
257
+ self . rx_ring . stop ( & self . eth_dma ) ;
258
+ }
259
+ }
260
+
261
+ #[ cfg( feature = "async-await" ) ]
262
+ impl < ' rx , ' tx > EthernetDMA < ' rx , ' tx > {
263
+ pub ( crate ) fn rx_waker ( ) -> & ' static AtomicWaker {
264
+ static WAKER : AtomicWaker = AtomicWaker :: new ( ) ;
265
+ & WAKER
266
+ }
267
+
268
+ pub ( crate ) fn tx_waker ( ) -> & ' static AtomicWaker {
269
+ static WAKER : AtomicWaker = AtomicWaker :: new ( ) ;
270
+ & WAKER
271
+ }
262
272
263
273
/// Receive a packet.
264
274
///
265
275
/// See [`RxRing::recv`].
266
- #[ cfg( feature = "async-await" ) ]
267
276
pub async fn recv ( & mut self , packet_id : Option < PacketId > ) -> RxPacket {
268
277
self . rx_ring . recv ( packet_id) . await
269
278
}
270
279
271
280
/// Prepare a packet for sending.
272
281
///
273
282
/// See [`TxRing::prepare_packet`].
274
- #[ cfg( feature = "async-await" ) ]
275
283
pub async fn prepare_packet < ' borrow > (
276
284
& ' borrow mut self ,
277
285
length : usize ,
@@ -282,7 +290,6 @@ impl<'rx, 'tx> EthernetDMA<'rx, 'tx> {
282
290
283
291
/// Wait for an RX or TX interrupt to have
284
292
/// occured.
285
- #[ cfg( feature = "async-await" ) ]
286
293
pub async fn rx_or_tx ( & mut self ) {
287
294
let mut polled_once = false ;
288
295
core:: future:: poll_fn ( |ctx| {
@@ -299,15 +306,6 @@ impl<'rx, 'tx> EthernetDMA<'rx, 'tx> {
299
306
}
300
307
}
301
308
302
- impl Drop for EthernetDMA < ' _ , ' _ > {
303
- // On drop, stop all DMA actions.
304
- fn drop ( & mut self ) {
305
- self . tx_ring . stop ( & self . eth_dma ) ;
306
-
307
- self . rx_ring . stop ( & self . eth_dma ) ;
308
- }
309
- }
310
-
311
309
#[ cfg( feature = "ptp" ) ]
312
310
impl EthernetDMA < ' _ , ' _ > {
313
311
/// Try to get the timestamp for the given packet ID.
0 commit comments