1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/include/villas/nodes/fpga.hpp

118 lines
2.1 KiB
C++
Raw Normal View History

2020-06-13 15:49:31 +02:00
/** Communicate with VILLASfpga Xilinx FPGA boards
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
2022-03-15 09:28:57 -04:00
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
2022-07-04 18:20:03 +02:00
* @license Apache 2.0
2020-06-13 15:49:31 +02:00
*********************************************************************************/
#pragma once
#include <villas/node/config.hpp>
#include <villas/node.hpp>
2021-05-10 00:12:30 +02:00
#include <villas/format.hpp>
#include <villas/timing.hpp>
2020-06-13 15:49:31 +02:00
#include <villas/fpga/card.hpp>
#include <villas/fpga/pcie_card.hpp>
#include <villas/fpga/node.hpp>
#include <villas/fpga/ips/dma.hpp>
namespace villas {
namespace node {
#define FPGA_DMA_VLNV
#define FPGA_AURORA_VLNV "acs.eonerc.rwth-aachen.de:user:aurora_axis:"
class FpgaNode : public Node {
protected:
int irqFd;
int coalesce;
bool polling;
2020-06-13 15:49:31 +02:00
std::shared_ptr<fpga::PCIeCard> card;
2020-06-13 15:49:31 +02:00
std::shared_ptr<fpga::ip::Dma> dma;
std::shared_ptr<fpga::ip::Node> intf;
std::unique_ptr<const MemoryBlock> blockRx;
std::unique_ptr<const MemoryBlock> blockTx;
2020-06-13 15:49:31 +02:00
// Config only
std::string cardName;
std::string intfName;
std::string dmaName;
2020-06-13 15:49:31 +02:00
protected:
virtual
int _read(Sample *smps[], unsigned cnt);
virtual
int _write(Sample *smps[], unsigned cnt);
public:
FpgaNode(const uuid_t &id = {}, const std::string &name = "");
virtual
~FpgaNode();
2020-06-13 15:49:31 +02:00
virtual
int parse(json_t *json);
2020-06-13 15:49:31 +02:00
virtual
const std::string & getDetails();
2020-06-13 15:49:31 +02:00
virtual
int check();
2020-06-13 15:49:31 +02:00
virtual
int prepare();
2020-06-13 15:49:31 +02:00
virtual
std::vector<int> getPollFDs();
};
2020-06-13 15:49:31 +02:00
class FpgaNodeFactory : public NodeFactory {
public:
using NodeFactory::NodeFactory;
virtual
Node * make(const uuid_t &id = {}, const std::string &nme = "")
{
auto *n = new FpgaNode(id, nme);
init(n);
return n;
}
virtual
int getFlags() const
{
return (int) NodeFactory::Flags::SUPPORTS_READ |
(int) NodeFactory::Flags::SUPPORTS_WRITE |
(int) NodeFactory::Flags::SUPPORTS_POLL;
}
virtual
std::string getName() const
{
return "fpga";
}
virtual
std::string getDescription() const
{
return "VILLASfpga";
}
virtual
int start(SuperNode *sn);
};
2020-06-13 15:49:31 +02:00
} // namespace node
} // namespace villas