Skip to content

Commit 8962c79

Browse files
committed
feat: remove cyclic flag, enable err irq
1 parent 254c178 commit 8962c79

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/UioAxiDmaIf.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "udmaio/UioAxiDmaIf.hpp"
1313

1414
#include <ios>
15+
#include <stdexcept>
1516

1617
namespace udmaio {
1718

@@ -32,8 +33,9 @@ void UioAxiDmaIf::start(uintptr_t start_desc) {
3233
<< "DMA ctrl = 0x" << std::hex << reg_to_raw(ctrl_reg) << std::dec;
3334

3435
ctrl_reg.rs = 1;
35-
ctrl_reg.cyclic_bd_enable = 1;
36+
ctrl_reg.cyclic_bd_enable = 0;
3637
ctrl_reg.ioc_irq_en = 1;
38+
ctrl_reg.err_irq_en = 1;
3739

3840
// 3.
3941
s2mm_dmacr.wr(ctrl_reg);
@@ -52,9 +54,18 @@ void UioAxiDmaIf::start(uintptr_t start_desc) {
5254
uint32_t UioAxiDmaIf::clear_interrupt() {
5355
uint32_t irq_count = wait_for_interrupt();
5456

55-
s2mm_dmasr.wr({.ioc_irq = 1});
57+
auto stat = s2mm_dmasr.rd();
58+
if (stat.ioc_irq) {
59+
BOOST_LOG_SEV(_lg, bls::trace) << "I/O IRQ";
60+
}
61+
if (stat.err_irq) {
62+
BOOST_LOG_SEV(_lg, bls::warning) << "ERR IRQ";
63+
if (check_for_errors()) {
64+
throw std::runtime_error("DMA engine error raised");
65+
}
66+
}
67+
s2mm_dmasr.wr({.ioc_irq = stat.ioc_irq, .err_irq = stat.err_irq});
5668

57-
BOOST_LOG_SEV(_lg, bls::trace) << "clear interrupt";
5869
return irq_count;
5970
}
6071

0 commit comments

Comments
 (0)