Stop active DMA transfer on drop
This commit is contained in:
parent
d35a1c9790
commit
3bbfc11f45
@ -30,9 +30,6 @@ pub fn copy<'a, C: Channel, W: Word>(ch: impl Peripheral<P = C> + 'a, from: &[W]
|
|||||||
w.set_en(true);
|
w.set_en(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// FIXME:
|
|
||||||
while p.ctrl_trig().read().busy() {}
|
|
||||||
|
|
||||||
compiler_fence(Ordering::SeqCst);
|
compiler_fence(Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
Transfer::new(ch)
|
Transfer::new(ch)
|
||||||
@ -51,8 +48,11 @@ impl<'a, C: Channel> Transfer<'a, C> {
|
|||||||
|
|
||||||
impl<'a, C: Channel> Drop for Transfer<'a, C> {
|
impl<'a, C: Channel> Drop for Transfer<'a, C> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
// self.channel.request_stop();
|
let p = self.channel.regs();
|
||||||
// while self.channel.is_running() {}
|
unsafe {
|
||||||
|
p.ctrl_trig().write(|w| w.set_en(false));
|
||||||
|
while p.ctrl_trig().read().busy() {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,9 +87,7 @@ pub trait Channel: Peripheral<P = Self> + sealed::Channel + Into<AnyChannel> + S
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn degrade(self) -> AnyChannel {
|
fn degrade(self) -> AnyChannel {
|
||||||
AnyChannel {
|
AnyChannel { number: self.number() }
|
||||||
number: self.number(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user