2020-06-13 15:49:31 +02:00
|
|
|
/** Communicate with VILLASfpga Xilinx FPGA boards
|
|
|
|
*
|
|
|
|
* @file
|
2022-12-14 17:41:58 +01:00
|
|
|
* @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
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <villas/node/config.hpp>
|
2021-02-24 15:33:47 +01:00
|
|
|
#include <villas/node.hpp>
|
2021-05-10 00:12:30 +02:00
|
|
|
#include <villas/format.hpp>
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <villas/timing.hpp>
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2020-06-15 22:21:56 +02:00
|
|
|
#include <villas/fpga/card.hpp>
|
2023-07-25 18:16:51 +02:00
|
|
|
#include <villas/fpga/pcie_card.hpp>
|
2020-06-15 22:21:56 +02:00
|
|
|
#include <villas/fpga/node.hpp>
|
|
|
|
#include <villas/fpga/ips/dma.hpp>
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
2020-06-15 22:21:56 +02:00
|
|
|
#define FPGA_DMA_VLNV
|
|
|
|
#define FPGA_AURORA_VLNV "acs.eonerc.rwth-aachen.de:user:aurora_axis:"
|
|
|
|
|
2021-02-24 15:33:47 +01:00
|
|
|
class FpgaNode : public Node {
|
|
|
|
|
|
|
|
protected:
|
2020-06-15 22:21:56 +02:00
|
|
|
int irqFd;
|
|
|
|
int coalesce;
|
|
|
|
bool polling;
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
std::shared_ptr<fpga::PCIeCard> card;
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
std::shared_ptr<fpga::ip::Dma> dma;
|
|
|
|
std::shared_ptr<fpga::ip::Node> intf;
|
2020-06-15 22:21:56 +02:00
|
|
|
|
2022-11-03 07:51:23 -04:00
|
|
|
std::unique_ptr<const MemoryBlock> blockRx;
|
|
|
|
std::unique_ptr<const MemoryBlock> blockTx;
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2020-06-15 22:21:56 +02:00
|
|
|
// Config only
|
|
|
|
std::string cardName;
|
|
|
|
std::string intfName;
|
|
|
|
std::string dmaName;
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2022-11-03 07:51:23 -04:00
|
|
|
protected:
|
2022-12-07 18:51:25 +01:00
|
|
|
virtual
|
|
|
|
int _read(Sample *smps[], unsigned cnt);
|
2022-11-03 07:51:23 -04:00
|
|
|
|
2022-12-07 18:51:25 +01:00
|
|
|
virtual
|
|
|
|
int _write(Sample *smps[], unsigned cnt);
|
2022-11-03 07:51:23 -04:00
|
|
|
|
2021-02-24 15:33:47 +01:00
|
|
|
public:
|
2023-06-30 11:30:05 +02:00
|
|
|
FpgaNode(const uuid_t &id = {}, const std::string &name = "");
|
2022-12-07 18:51:25 +01:00
|
|
|
|
|
|
|
virtual
|
|
|
|
~FpgaNode();
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2022-11-03 07:51:23 -04:00
|
|
|
virtual
|
2023-06-30 10:51:01 +02:00
|
|
|
int parse(json_t *json);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2022-11-03 07:51:23 -04:00
|
|
|
virtual
|
|
|
|
const std::string & getDetails();
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2022-11-03 07:51:23 -04:00
|
|
|
virtual
|
|
|
|
int check();
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2022-11-03 07:51:23 -04:00
|
|
|
virtual
|
|
|
|
int prepare();
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2022-11-03 07:51:23 -04:00
|
|
|
virtual
|
|
|
|
std::vector<int> getPollFDs();
|
|
|
|
};
|
2020-06-13 15:49:31 +02:00
|
|
|
|
|
|
|
|
2022-11-03 07:51:23 -04:00
|
|
|
class FpgaNodeFactory : public NodeFactory {
|
|
|
|
|
|
|
|
public:
|
|
|
|
using NodeFactory::NodeFactory;
|
|
|
|
|
|
|
|
virtual
|
2023-06-30 11:30:05 +02:00
|
|
|
Node * make(const uuid_t &id = {}, const std::string &nme = "")
|
2022-11-03 07:51:23 -04:00
|
|
|
{
|
2023-06-30 11:30:05 +02:00
|
|
|
auto *n = new FpgaNode(id, nme);
|
2022-11-09 17:00:50 -05:00
|
|
|
|
|
|
|
init(n);
|
|
|
|
|
|
|
|
return n;
|
2022-11-03 07:51:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2021-02-24 15:33:47 +01:00
|
|
|
};
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|