Skip to content

Commit

Permalink
feat: remove cyclic flag, enable err irq
Browse files Browse the repository at this point in the history
  • Loading branch information
patrislav1 committed May 30, 2024
1 parent 254c178 commit 8962c79
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/UioAxiDmaIf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "udmaio/UioAxiDmaIf.hpp"

#include <ios>
#include <stdexcept>

namespace udmaio {

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

ctrl_reg.rs = 1;
ctrl_reg.cyclic_bd_enable = 1;
ctrl_reg.cyclic_bd_enable = 0;
ctrl_reg.ioc_irq_en = 1;
ctrl_reg.err_irq_en = 1;

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

s2mm_dmasr.wr({.ioc_irq = 1});
auto stat = s2mm_dmasr.rd();
if (stat.ioc_irq) {
BOOST_LOG_SEV(_lg, bls::trace) << "I/O IRQ";
}
if (stat.err_irq) {
BOOST_LOG_SEV(_lg, bls::warning) << "ERR IRQ";
if (check_for_errors()) {
throw std::runtime_error("DMA engine error raised");
}
}
s2mm_dmasr.wr({.ioc_irq = stat.ioc_irq, .err_irq = stat.err_irq});

BOOST_LOG_SEV(_lg, bls::trace) << "clear interrupt";
return irq_count;
}

Expand Down

0 comments on commit 8962c79

Please sign in to comment.