File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use core::{
22 future:: { Future , IntoFuture } ,
33 ops:: { Deref , DerefMut } ,
44 pin:: Pin ,
5+ sync:: atomic:: { fence, Ordering } ,
56 task:: { Context , Poll } ,
67} ;
78
@@ -59,14 +60,15 @@ where
5960 CH : DmaChannel ,
6061{
6162 fn drop ( & mut self ) {
62- match self . abort ( ) {
63- Ok ( ( ) ) => { }
64- Err ( _error) => {
65- #[ cfg( feature = "log" ) ]
66- log:: error!( "Error aborting DMA transfer: {_error:?}" ) ;
67- }
63+ if self . is_running ( ) {
64+ self . channel . abort ( ) ;
6865 }
66+
6967 self . disable_interrupts ( ) ;
68+
69+ // Preserve the instruction and bus sequence of the preceding operation and
70+ // the subsequent buffer access.
71+ fence ( Ordering :: SeqCst ) ;
7072 }
7173}
7274
8082
8183 fn poll ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
8284 self . channel . waker ( ) . register ( cx. waker ( ) ) ;
83- if self . is_transfer_complete ( ) ? {
85+ if self . channel . check_transfer_complete ( ) ? {
8486 Poll :: Ready ( Ok ( ( ) ) )
8587 } else {
8688 Poll :: Pending
98100 #[ inline( always) ]
99101 fn handle_interrupt ( ) {
100102 let ch = Self :: new ( ) ;
101- ch. waker ( ) . wake ( ) ;
102103 ch. disable_transfer_interrupts ( ) ;
104+ ch. waker ( ) . wake ( ) ;
103105 }
104106}
105107
You can’t perform that action at this time.
0 commit comments