@@ -2528,60 +2528,6 @@ pub(crate) mod dma_private {
25282528 }
25292529}
25302530
2531- /// DMA transaction for TX only transfers
2532- ///
2533- /// # Safety
2534- ///
2535- /// Never use [core::mem::forget] on an in-progress transfer
2536- #[ non_exhaustive]
2537- #[ must_use]
2538- pub struct DmaTransferTx < ' a , I >
2539- where
2540- I : dma_private:: DmaSupportTx ,
2541- {
2542- instance : & ' a mut I ,
2543- }
2544-
2545- impl < ' a , I > DmaTransferTx < ' a , I >
2546- where
2547- I : dma_private:: DmaSupportTx ,
2548- {
2549- #[ cfg_attr( esp32c2, allow( dead_code) ) ]
2550- pub ( crate ) fn new ( instance : & ' a mut I ) -> Self {
2551- Self { instance }
2552- }
2553-
2554- /// Wait for the transfer to finish.
2555- pub fn wait ( self ) -> Result < ( ) , DmaError > {
2556- self . instance . peripheral_wait_dma ( false , true ) ;
2557-
2558- if self
2559- . instance
2560- . tx ( )
2561- . pending_out_interrupts ( )
2562- . contains ( DmaTxInterrupt :: DescriptorError )
2563- {
2564- Err ( DmaError :: DescriptorError )
2565- } else {
2566- Ok ( ( ) )
2567- }
2568- }
2569-
2570- /// Check if the transfer is finished.
2571- pub fn is_done ( & mut self ) -> bool {
2572- self . instance . tx ( ) . is_done ( )
2573- }
2574- }
2575-
2576- impl < I > Drop for DmaTransferTx < ' _ , I >
2577- where
2578- I : dma_private:: DmaSupportTx ,
2579- {
2580- fn drop ( & mut self ) {
2581- self . instance . peripheral_wait_dma ( true , false ) ;
2582- }
2583- }
2584-
25852531/// DMA transaction for RX only transfers
25862532///
25872533/// # Safety
@@ -2596,37 +2542,6 @@ where
25962542 instance : & ' a mut I ,
25972543}
25982544
2599- impl < ' a , I > DmaTransferRx < ' a , I >
2600- where
2601- I : dma_private:: DmaSupportRx ,
2602- {
2603- #[ cfg_attr( esp32c2, allow( dead_code) ) ]
2604- pub ( crate ) fn new ( instance : & ' a mut I ) -> Self {
2605- Self { instance }
2606- }
2607-
2608- /// Wait for the transfer to finish.
2609- pub fn wait ( self ) -> Result < ( ) , DmaError > {
2610- self . instance . peripheral_wait_dma ( true , false ) ;
2611-
2612- if self
2613- . instance
2614- . rx ( )
2615- . pending_in_interrupts ( )
2616- . contains ( DmaRxInterrupt :: DescriptorError )
2617- {
2618- Err ( DmaError :: DescriptorError )
2619- } else {
2620- Ok ( ( ) )
2621- }
2622- }
2623-
2624- /// Check if the transfer is finished.
2625- pub fn is_done ( & mut self ) -> bool {
2626- self . instance . rx ( ) . is_done ( )
2627- }
2628- }
2629-
26302545impl < I > Drop for DmaTransferRx < ' _ , I >
26312546where
26322547 I : dma_private:: DmaSupportRx ,
@@ -2830,63 +2745,6 @@ pub(crate) mod asynch {
28302745
28312746 use super :: * ;
28322747
2833- #[ must_use = "futures do nothing unless you `.await` or poll them" ]
2834- pub struct DmaTxFuture < ' a , CH >
2835- where
2836- CH : DmaTxChannel ,
2837- {
2838- pub ( crate ) tx : & ' a mut ChannelTx < Async , CH > ,
2839- }
2840-
2841- impl < ' a , CH > DmaTxFuture < ' a , CH >
2842- where
2843- CH : DmaTxChannel ,
2844- {
2845- #[ cfg_attr( esp32c2, allow( dead_code) ) ]
2846- pub fn new ( tx : & ' a mut ChannelTx < Async , CH > ) -> Self {
2847- Self { tx }
2848- }
2849- }
2850-
2851- impl < CH > core:: future:: Future for DmaTxFuture < ' _ , CH >
2852- where
2853- CH : DmaTxChannel ,
2854- {
2855- type Output = Result < ( ) , DmaError > ;
2856-
2857- fn poll (
2858- self : core:: pin:: Pin < & mut Self > ,
2859- cx : & mut core:: task:: Context < ' _ > ,
2860- ) -> Poll < Self :: Output > {
2861- if self . tx . is_done ( ) {
2862- self . tx . clear_interrupts ( ) ;
2863- Poll :: Ready ( Ok ( ( ) ) )
2864- } else if self
2865- . tx
2866- . pending_out_interrupts ( )
2867- . contains ( DmaTxInterrupt :: DescriptorError )
2868- {
2869- self . tx . clear_interrupts ( ) ;
2870- Poll :: Ready ( Err ( DmaError :: DescriptorError ) )
2871- } else {
2872- self . tx . waker ( ) . register ( cx. waker ( ) ) ;
2873- self . tx
2874- . listen_out ( DmaTxInterrupt :: TotalEof | DmaTxInterrupt :: DescriptorError ) ;
2875- Poll :: Pending
2876- }
2877- }
2878- }
2879-
2880- impl < CH > Drop for DmaTxFuture < ' _ , CH >
2881- where
2882- CH : DmaTxChannel ,
2883- {
2884- fn drop ( & mut self ) {
2885- self . tx
2886- . unlisten_out ( DmaTxInterrupt :: TotalEof | DmaTxInterrupt :: DescriptorError ) ;
2887- }
2888- }
2889-
28902748 #[ must_use = "futures do nothing unless you `.await` or poll them" ]
28912749 pub struct DmaRxFuture < ' a , CH >
28922750 where
0 commit comments