diff --git a/fpga/include/villas/fpga/core.hpp b/fpga/include/villas/fpga/core.hpp index 089aaf8e7..bd3637a58 100644 --- a/fpga/include/villas/fpga/core.hpp +++ b/fpga/include/villas/fpga/core.hpp @@ -82,6 +82,8 @@ public: virtual ~Core() = default; public: + void addIrq(std::string irqName, int port_num, InterruptController* intc); + // Generic management interface for IPs // Runtime setup of IP, should access and initialize hardware diff --git a/fpga/include/villas/fpga/ips/intc.hpp b/fpga/include/villas/fpga/ips/intc.hpp index d558f9a82..acf995bf8 100644 --- a/fpga/include/villas/fpga/ips/intc.hpp +++ b/fpga/include/villas/fpga/ips/intc.hpp @@ -26,8 +26,8 @@ public: virtual bool init() override; virtual bool stop() override; - bool enableInterrupt(IrqMaskType mask, bool polling); - bool enableInterrupt(IrqPort irq, bool polling) { + virtual bool enableInterrupt(IrqMaskType mask, bool polling); + virtual bool enableInterrupt(IrqPort irq, bool polling) { return enableInterrupt(1 << irq.num, polling); } @@ -37,7 +37,7 @@ public: ssize_t waitForInterrupt(int irq); ssize_t waitForInterrupt(IrqPort irq) { return waitForInterrupt(irq.num); } -private: +protected: static constexpr char registerMemory[] = "reg0"; std::list getMemoryBlocks() const { diff --git a/fpga/lib/platform_card.cpp b/fpga/lib/platform_card.cpp index 497618772..11315c805 100644 --- a/fpga/lib/platform_card.cpp +++ b/fpga/lib/platform_card.cpp @@ -22,6 +22,8 @@ #include #include +#include + using namespace villas; using namespace villas::fpga; using namespace villas::kernel; @@ -103,6 +105,22 @@ void PlatformCard::connectVFIOtoIps( // Connect vfio vertex to Reg vertex connect(vfio_device->getName(), ip); + + // interrupts + if (vfio_device->getNumberIrqs() > 0) { + for (int i = 0; i < vfio_device->getNumberIrqs(); i++) { + auto intc = new PlatformInterruptController(vfio_device); + + const char *irqName = "iic2intc_irpt"; + int num = 0; + logger->error("Adding Platformintc {}", num); + //* dma + //* mm2s_introut + //* s2mm_introut + + ip->addIrq(irqName, num, intc); + } + } } }