diff --git a/fpga/include/villas/fpga/ips/dma.hpp b/fpga/include/villas/fpga/ips/dma.hpp index 52acf4cbd..83f25166f 100644 --- a/fpga/include/villas/fpga/ips/dma.hpp +++ b/fpga/include/villas/fpga/ips/dma.hpp @@ -39,6 +39,7 @@ class Dma : public Node public: friend class DmaFactory; + ~Dma(); bool init(); bool reset(); diff --git a/fpga/lib/ips/dma.cpp b/fpga/lib/ips/dma.cpp index 70e793189..62fe6c994 100644 --- a/fpga/lib/ips/dma.cpp +++ b/fpga/lib/ips/dma.cpp @@ -178,6 +178,8 @@ void Dma::setupScatterGatherRingTx() bool Dma::reset() { + XAxiDma_IntrDisable(&xDma, XAXIDMA_IRQ_ALL_MASK, XAXIDMA_DMA_TO_DEVICE); + XAxiDma_IntrDisable(&xDma, XAXIDMA_IRQ_ALL_MASK, XAXIDMA_DEVICE_TO_DMA); XAxiDma_Reset(&xDma); // Value taken from libxil implementation @@ -189,12 +191,20 @@ bool Dma::reset() timeout--; } - - logger->info("DMA has been resetted"); + if (timeout == 0) { + logger->error("DMA reset timed out"); + } else { + logger->info("DMA has been reset."); + } return false; } +Dma::~Dma() +{ + reset(); +} + bool Dma::memcpy(const MemoryBlock &src, const MemoryBlock &dst, size_t len) { if (len == 0)