From 554515fe306f3545390012c586a54dfeb38e5086 Mon Sep 17 00:00:00 2001 From: Niklas Eiling Date: Tue, 25 Jul 2023 18:16:51 +0200 Subject: [PATCH] fix fpga node type to work with current fpga master Signed-off-by: Niklas Eiling --- include/villas/nodes/fpga.hpp | 1 + lib/nodes/fpga.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/villas/nodes/fpga.hpp b/include/villas/nodes/fpga.hpp index e03f36e20..b76aa784e 100644 --- a/include/villas/nodes/fpga.hpp +++ b/include/villas/nodes/fpga.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include diff --git a/lib/nodes/fpga.cpp b/lib/nodes/fpga.cpp index 1462e7468..af884406e 100644 --- a/lib/nodes/fpga.cpp +++ b/lib/nodes/fpga.cpp @@ -149,14 +149,13 @@ int FpgaNode::prepare() auto &alloc = HostDmaRam::getAllocator(); - auto memRx = alloc.allocate(0x100 / sizeof(int32_t)); - auto memTx = alloc.allocate(0x100 / sizeof(int32_t)); + const std::shared_ptr blockRx = alloc.allocateBlock(0x100 * sizeof(float)); + const std::shared_ptr blockTx = alloc.allocateBlock(0x100 * sizeof(float)); + villas::MemoryAccessor memRx = *blockRx; + villas::MemoryAccessor memTx = *blockTx; - blockRx = std::unique_ptr(&memRx.getMemoryBlock()); - blockTx = std::unique_ptr(&memTx.getMemoryBlock()); - - dma->makeAccesibleFromVA(*blockRx); - dma->makeAccesibleFromVA(*blockTx); + dma->makeAccesibleFromVA(blockRx); + dma->makeAccesibleFromVA(blockTx); // Show some debugging infos auto &mm = MemoryManager::get(); @@ -176,7 +175,7 @@ int FpgaNode::_read(Sample *smps[], unsigned cnt) assert(cnt == 1); dma->read(*blockRx, blockRx->getSize()); // TODO: calc size - const size_t bytesRead = dma->readComplete(); + const size_t bytesRead = dma->readComplete().bytes; read = bytesRead / sizeof(int32_t); auto mem = MemoryAccessor(*blockRx);