From 5b0013b33522767e4767a9c2edb2bc8dfd471db8 Mon Sep 17 00:00:00 2001 From: Daniel Krebs Date: Tue, 13 Feb 2018 13:45:38 +0100 Subject: [PATCH] lib/card: add IP lookup by VLNV --- 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 4d838559c..4b64a33ec 100644 --- a/fpga/include/villas/fpga/card.hpp +++ b/fpga/include/villas/fpga/card.hpp @@ -76,6 +76,7 @@ public: void dump() { } ip::IpCore* lookupIp(const std::string& name) const; + ip::IpCore* lookupIp(const Vlnv& vlnv) const; ip::IpCoreList ips; ///< IPs located on this FPGA card diff --git a/fpga/lib/card.cpp b/fpga/lib/card.cpp index b15328566..5b38d210c 100644 --- a/fpga/lib/card.cpp +++ b/fpga/lib/card.cpp @@ -142,6 +142,17 @@ PCIeCard::lookupIp(const std::string& name) const return nullptr; } +ip::IpCore* +PCIeCard::lookupIp(const Vlnv& vlnv) const +{ + for(auto& ip : ips) { + if(*ip == vlnv) { + return ip.get(); + } + } + return nullptr; +} + bool fpga::PCIeCard::init() {