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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

92 lines
2.2 KiB
C++
Raw Permalink Normal View History

/* Communicate with VILLASfpga Xilinx FPGA boards.
2020-06-13 15:49:31 +02:00
*
2022-03-15 09:18:01 -04:00
* Author: Steffen Vogel <post@steffenvogel.de>
* Author: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
2022-03-15 09:28:57 -04:00
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
* SPDX-FileCopyrightText: 2023 Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
2022-07-04 18:20:03 +02:00
* SPDX-License-Identifier: Apache-2.0
2020-06-13 15:49:31 +02:00
*/
#pragma once
2021-05-10 00:12:30 +02:00
#include <villas/format.hpp>
#include <villas/node.hpp>
#include <villas/node/config.hpp>
#include <villas/timing.hpp>
2020-06-13 15:49:31 +02:00
#include <villas/fpga/card.hpp>
#include <villas/fpga/ips/dma.hpp>
#include <villas/fpga/node.hpp>
#include <villas/fpga/pcie_card.hpp>
namespace villas {
namespace node {
class FpgaNode : public Node {
enum InterfaceType { PCIE, PLATFORM };
2020-06-13 15:49:31 +02:00
protected:
// Settings
std::string cardName;
std::list<std::string> connectStrings;
2020-06-13 15:49:31 +02:00
// State
std::shared_ptr<fpga::Card> card;
std::shared_ptr<villas::fpga::ip::Dma> dma;
std::shared_ptr<villas::MemoryBlock> blockRx[2];
std::shared_ptr<villas::MemoryBlock> blockTx;
// Non-public methods
virtual int _read(Sample *smps[], unsigned cnt) override;
virtual int _write(Sample *smps[], unsigned cnt) override;
public:
FpgaNode(const uuid_t &id = {}, const std::string &name = "");
virtual ~FpgaNode();
2020-06-13 15:49:31 +02:00
virtual int prepare() override;
virtual int parse(json_t *json) override;
2020-06-13 15:49:31 +02:00
virtual int check() override;
2020-06-13 15:49:31 +02:00
virtual int start() override;
2020-06-13 15:49:31 +02:00
virtual std::vector<int> getPollFDs() override;
2020-06-13 15:49:31 +02:00
virtual const std::string &getDetails() override;
};
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 = "") override {
auto *n = new FpgaNode(id, nme);
init(n);
return n;
}
virtual int getFlags() const override {
return (int)NodeFactory::Flags::SUPPORTS_READ |
(int)NodeFactory::Flags::SUPPORTS_WRITE |
(int)NodeFactory::Flags::SUPPORTS_POLL;
}
virtual std::string getName() const override { return "fpga"; }
virtual std::string getDescription() const override { return "VILLASfpga"; }
virtual int start(SuperNode *sn) override;
};
2020-06-13 15:49:31 +02:00
} // namespace node
} // namespace villas