1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

ips/dma: use destructor to reset DMA controller

Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
Niklas Eiling 2022-12-01 15:06:05 +01:00
parent fd3c51ccc0
commit 905d28d1e4
2 changed files with 13 additions and 2 deletions

View file

@ -39,6 +39,7 @@ class Dma : public Node
public:
friend class DmaFactory;
~Dma();
bool init();
bool reset();

View file

@ -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)