stm32/dma: panic on DMA error.

This commit is contained in:
Dario Nieuwenhuis 2022-03-09 02:55:08 +01:00
parent 13247897b0
commit 77841a4676
2 changed files with 12 additions and 0 deletions

View File

@ -238,6 +238,12 @@ mod low_level_api {
let isr = dma.isr().read(); let isr = dma.isr().read();
let cr = dma.ch(channel_num).cr(); let cr = dma.ch(channel_num).cr();
if isr.teif(channel_num) {
panic!(
"DMA: error on BDMA@{:08x} channel {}",
dma.0 as u32, channel_num
);
}
if isr.tcif(channel_num) && cr.read().tcie() { if isr.tcif(channel_num) && cr.read().tcie() {
cr.write(|_| ()); // Disable channel interrupts with the default value. cr.write(|_| ()); // Disable channel interrupts with the default value.
STATE.ch_wakers[index].wake(); STATE.ch_wakers[index].wake();

View File

@ -239,6 +239,12 @@ mod low_level_api {
let cr = dma.st(channel_num).cr(); let cr = dma.st(channel_num).cr();
let isr = dma.isr(channel_num / 4).read(); let isr = dma.isr(channel_num / 4).read();
if isr.teif(channel_num % 4) {
panic!(
"DMA: error on DMA@{:08x} channel {}",
dma.0 as u32, channel_num
);
}
if isr.tcif(channel_num % 4) && cr.read().tcie() { if isr.tcif(channel_num % 4) && cr.read().tcie() {
cr.write(|_| ()); // Disable channel interrupts with the default value. cr.write(|_| ()); // Disable channel interrupts with the default value.
STATE.ch_wakers[index].wake(); STATE.ch_wakers[index].wake();