From a1daf95202cd99af6ae9d3fcab04b19517c478e9 Mon Sep 17 00:00:00 2001 From: Daniel Krebs Date: Mon, 4 Jun 2018 13:51:58 +0200 Subject: [PATCH] lib/card: lookup IP by identifier --- 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 1abd659e6..93a80be97 100644 --- a/fpga/include/villas/fpga/card.hpp +++ b/fpga/include/villas/fpga/card.hpp @@ -77,6 +77,7 @@ public: ip::IpCore* lookupIp(const std::string& name) const; ip::IpCore* lookupIp(const Vlnv& vlnv) const; + ip::IpCore* lookupIp(const ip::IpIdentifier& id) const; bool mapMemoryBlock(const MemoryBlock& block); diff --git a/fpga/lib/card.cpp b/fpga/lib/card.cpp index 9effeb26a..06f00cf66 100644 --- a/fpga/lib/card.cpp +++ b/fpga/lib/card.cpp @@ -161,6 +161,17 @@ PCIeCard::lookupIp(const Vlnv& vlnv) const return nullptr; } +ip::IpCore*PCIeCard::lookupIp(const ip::IpIdentifier& id) const +{ + for(auto& ip : ips) { + if(*ip == id) { + return ip.get(); + } + } + + return nullptr; +} + bool PCIeCard::mapMemoryBlock(const MemoryBlock& block)