From 3b28eea7d20972ad0394ae8f9e6e08af5d76e189 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 11 Jun 2020 13:08:42 +0200 Subject: [PATCH] aurora_axis: add two functions to reset counters and configure loopback mode --- fpga/include/villas/fpga/ips/aurora.hpp | 9 ++++++++- fpga/lib/ips/aurora.cpp | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/fpga/include/villas/fpga/ips/aurora.hpp b/fpga/include/villas/fpga/ips/aurora.hpp index 58debed51..c3eacd8f8 100644 --- a/fpga/include/villas/fpga/ips/aurora.hpp +++ b/fpga/include/villas/fpga/ips/aurora.hpp @@ -69,10 +69,17 @@ public: std::string getDescription() const - { return "Aurora 8B/10B and additional support modules, like, communication with NovaCor and read/write status/control registers."; } + { return "Aurora 8B/10B and additional support modules, like an AXI4-Lite register interface."; } Vlnv getCompatibleVlnv() const { return {"acs.eonerc.rwth-aachen.de:user:aurora_axis:"}; } + + void + setLoopback(bool state); + + void + resetFrameCounters(); + }; } // namespace ip diff --git a/fpga/lib/ips/aurora.cpp b/fpga/lib/ips/aurora.cpp index 0669a7dba..daaee9f29 100644 --- a/fpga/lib/ips/aurora.cpp +++ b/fpga/lib/ips/aurora.cpp @@ -98,6 +98,27 @@ void Aurora::dump() logger->info("Aurora frames sent: {}", outCnt); } +void Aurora::setLoopback(bool state) +{ + auto cr = readMemory(registerMemory, AURORA_AXIS_CR_OFFSET); + + if (state) + cr |= AURORA_AXIS_CR_LOOPBACK; + else + cr &= ~AURORA_AXIS_CR_LOOPBACK; + + writeMemory(registerMemory, AURORA_AXIS_CR_OFFSET, cr); +} + +void Aurora::resetFrameCounters() +{ + auto cr = readMemory(registerMemory, AURORA_AXIS_CR_OFFSET); + + cr |= AURORA_AXIS_CR_RST_CTRS; + + writeMemory(registerMemory, AURORA_AXIS_CR_OFFSET, cr); +} + AuroraFactory::AuroraFactory() : IpNodeFactory(getName()) {