mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix villas-fpga-pipe
Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
parent
cbad1ca9d1
commit
6b58624e57
6 changed files with 21 additions and 12 deletions
2
fpga/.vscode/launch.json
vendored
2
fpga/.vscode/launch.json
vendored
|
@ -10,7 +10,7 @@
|
|||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/src/villas-fpga-ctrl",
|
||||
"args": [
|
||||
"-c", "${workspaceFolder}/etc/fpgas.json", "--connect", "\"2<->stdout\""
|
||||
"-c", "${workspaceFolder}/etc/fpgas.json", "--connect", "\"4<->stdout\""
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
|
|
|
@ -129,7 +129,7 @@ private:
|
|||
int delay = 0;
|
||||
// Coalesce is the number of messages/BDs to wait for before issuing an interrupt
|
||||
uint32_t writeCoalesce = 1;
|
||||
uint32_t readCoalesce = 16;
|
||||
uint32_t readCoalesce = 1;
|
||||
|
||||
// (maximum) size of a single message on the read channel in bytes.
|
||||
// The message buffer/BD should have enough room for this many bytes.
|
||||
|
|
|
@ -84,9 +84,11 @@ void fpga::ConnectString::parseString(std::string& connectString)
|
|||
dstAsInt = portStringToInt(dstStr);
|
||||
if (srcAsInt == -1) {
|
||||
srcIsStdin = true;
|
||||
dstIsStdout = bidirectional;
|
||||
}
|
||||
if (dstAsInt == -1) {
|
||||
dstIsStdout = true;
|
||||
srcIsStdin = bidirectional;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,4 +11,11 @@ target_link_libraries(villas-fpga-ctrl PUBLIC
|
|||
villas-fpga
|
||||
)
|
||||
|
||||
add_executable(villas-fpga-pipe villas-fpga-pipe.cpp)
|
||||
|
||||
target_link_libraries(villas-fpga-pipe PUBLIC
|
||||
villas-fpga
|
||||
)
|
||||
|
||||
|
||||
add_executable(pcimem pcimem.c)
|
||||
|
|
|
@ -51,7 +51,7 @@ void writeToDmaFromStdIn(std::shared_ptr<villas::fpga::ip::Dma> dma)
|
|||
}
|
||||
|
||||
size_t cur = 0, next = 1;
|
||||
std::ios::sync_with_stdio(false);
|
||||
er //std::ios::sync_with_stdio(false);
|
||||
std::string line;
|
||||
bool firstXfer = true;
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ int main(int argc, char* argv[])
|
|||
dma->connectLoopback();
|
||||
#endif
|
||||
auto &alloc = villas::HostRam::getAllocator();
|
||||
auto mem = alloc.allocate<int32_t>(0x100);
|
||||
auto block = mem.getMemoryBlock();
|
||||
std::shared_ptr<villas::MemoryBlock> block = alloc.allocateBlock(0x100 * sizeof(int32_t));
|
||||
villas::MemoryAccessor<int32_t> mem = *block;
|
||||
|
||||
dma->makeAccesibleFromVA(block);
|
||||
|
||||
|
@ -99,7 +99,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
while (true) {
|
||||
// Setup read transfer
|
||||
dma->read(block, block.getSize());
|
||||
dma->read(*block, block->getSize());
|
||||
|
||||
// Read values from stdin
|
||||
std::string line;
|
||||
|
@ -115,16 +115,16 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
// Initiate write transfer
|
||||
bool state = dma->write(block, i * sizeof(int32_t));
|
||||
bool state = dma->write(*block, i * sizeof(int32_t));
|
||||
if (!state)
|
||||
logger->error("Failed to write to device");
|
||||
|
||||
auto bytesWritten = dma->writeComplete();
|
||||
logger->info("Wrote {} bytes", bytesWritten);
|
||||
auto writeComp = dma->writeComplete();
|
||||
logger->info("Wrote {} bytes", writeComp.bytes);
|
||||
|
||||
auto bytesRead = dma->readComplete();
|
||||
auto valuesRead = bytesRead / sizeof(int32_t);
|
||||
logger->info("Read {} bytes", bytesRead);
|
||||
auto readComp = dma->readComplete();
|
||||
auto valuesRead = readComp.bytes / sizeof(int32_t);
|
||||
logger->info("Read {} bytes, {} bds, {} interrupts", readComp.bytes, readComp.bds, readComp.interrupts);
|
||||
|
||||
for (size_t i = 0; i < valuesRead; i++)
|
||||
std::cerr << mem[i] << ";";
|
||||
|
|
Loading…
Add table
Reference in a new issue