From 8345a15db01c2d84278f0d0a198c33c6db1f1e8a Mon Sep 17 00:00:00 2001 From: daniel-k Date: Tue, 9 Jan 2018 16:27:02 +0100 Subject: [PATCH] lib/card: implement IP lookup Search for an initialized IP by name. --- fpga/include/villas/fpga/card.hpp | 1 + fpga/lib/card.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/fpga/include/villas/fpga/card.hpp b/fpga/include/villas/fpga/card.hpp index 755926b67..d3a79a4fc 100644 --- a/fpga/include/villas/fpga/card.hpp +++ b/fpga/include/villas/fpga/card.hpp @@ -73,6 +73,7 @@ public: bool reset() { return true; } void dump() { } + ip::IpCore* lookupIp(std::string name) const; ip::IpCoreList ips; ///< IPs located on this FPGA card diff --git a/fpga/lib/card.cpp b/fpga/lib/card.cpp index f03272cba..96da37c74 100644 --- a/fpga/lib/card.cpp +++ b/fpga/lib/card.cpp @@ -132,6 +132,17 @@ fpga::PCIeCardFactory::create() } +ip::IpCore* +PCIeCard::lookupIp(std::string name) const { + for(auto& ip : ips) { + if(*ip == name) { + return ip.get(); + } + } + return nullptr; +} + + bool fpga::PCIeCard::start() { int ret;