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::{
2
2
future:: { Future , IntoFuture } ,
3
3
ops:: { Deref , DerefMut } ,
4
4
pin:: Pin ,
5
+ sync:: atomic:: { fence, Ordering } ,
5
6
task:: { Context , Poll } ,
6
7
} ;
7
8
@@ -59,14 +60,15 @@ where
59
60
CH : DmaChannel ,
60
61
{
61
62
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 ( ) ;
68
65
}
66
+
69
67
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 ) ;
70
72
}
71
73
}
72
74
80
82
81
83
fn poll ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
82
84
self . channel . waker ( ) . register ( cx. waker ( ) ) ;
83
- if self . is_transfer_complete ( ) ? {
85
+ if self . channel . check_transfer_complete ( ) ? {
84
86
Poll :: Ready ( Ok ( ( ) ) )
85
87
} else {
86
88
Poll :: Pending
98
100
#[ inline( always) ]
99
101
fn handle_interrupt ( ) {
100
102
let ch = Self :: new ( ) ;
101
- ch. waker ( ) . wake ( ) ;
102
103
ch. disable_transfer_interrupts ( ) ;
104
+ ch. waker ( ) . wake ( ) ;
103
105
}
104
106
}
105
107
You can’t perform that action at this time.
0 commit comments