Merge pull request #1573 from embassy-rs/stm32-gpdma-clear-irqs
stm32: GPDMA clear irqs
This commit is contained in:
commit
37a1e9f971
@ -252,6 +252,7 @@ impl<'a, C: Channel> Transfer<'a, C> {
|
|||||||
super::dmamux::configure_dmamux(&mut *this.channel, request);
|
super::dmamux::configure_dmamux(&mut *this.channel, request);
|
||||||
|
|
||||||
ch.cr().write(|w| w.set_reset(true));
|
ch.cr().write(|w| w.set_reset(true));
|
||||||
|
ch.fcr().write(|w| w.0 = 0xFFFF_FFFF); // clear all irqs
|
||||||
ch.llr().write(|_| {}); // no linked list
|
ch.llr().write(|_| {}); // no linked list
|
||||||
ch.tr1().write(|w| {
|
ch.tr1().write(|w| {
|
||||||
w.set_sdw(data_size.into());
|
w.set_sdw(data_size.into());
|
||||||
|
@ -69,24 +69,27 @@ async fn main(_spawner: Spawner) {
|
|||||||
const LEN: usize = 128;
|
const LEN: usize = 128;
|
||||||
let mut tx_buf = [0; LEN];
|
let mut tx_buf = [0; LEN];
|
||||||
let mut rx_buf = [0; LEN];
|
let mut rx_buf = [0; LEN];
|
||||||
for i in 0..LEN {
|
|
||||||
tx_buf[i] = i as u8;
|
|
||||||
}
|
|
||||||
|
|
||||||
let (mut tx, mut rx) = usart.split();
|
let (mut tx, mut rx) = usart.split();
|
||||||
|
|
||||||
let tx_fut = async {
|
for n in 0..42 {
|
||||||
tx.write(&tx_buf).await.unwrap();
|
for i in 0..LEN {
|
||||||
};
|
tx_buf[i] = (i ^ n) as u8;
|
||||||
let rx_fut = async {
|
}
|
||||||
rx.read(&mut rx_buf).await.unwrap();
|
|
||||||
};
|
|
||||||
|
|
||||||
// note: rx needs to be polled first, to workaround this bug:
|
let tx_fut = async {
|
||||||
// https://github.com/embassy-rs/embassy/issues/1426
|
tx.write(&tx_buf).await.unwrap();
|
||||||
join(rx_fut, tx_fut).await;
|
};
|
||||||
|
let rx_fut = async {
|
||||||
|
rx.read(&mut rx_buf).await.unwrap();
|
||||||
|
};
|
||||||
|
|
||||||
assert_eq!(tx_buf, rx_buf);
|
// note: rx needs to be polled first, to workaround this bug:
|
||||||
|
// https://github.com/embassy-rs/embassy/issues/1426
|
||||||
|
join(rx_fut, tx_fut).await;
|
||||||
|
|
||||||
|
assert_eq!(tx_buf, rx_buf);
|
||||||
|
}
|
||||||
|
|
||||||
info!("Test OK");
|
info!("Test OK");
|
||||||
cortex_m::asm::bkpt();
|
cortex_m::asm::bkpt();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user