2020-06-13 15:49:31 +02:00
|
|
|
/** Communicate with VILLASfpga Xilinx FPGA boards
|
|
|
|
*
|
|
|
|
* @file
|
2022-03-15 09:18:01 -04:00
|
|
|
* @author Steffen Vogel <svogel2@eonerc.rwth-aachen.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-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>
|
|
|
|
#include <villas/fpga/node.hpp>
|
|
|
|
#include <villas/fpga/ips/dma.hpp>
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
2021-06-21 16:11:42 -04:00
|
|
|
/* Forward declarations */
|
2021-08-10 10:12:48 -04:00
|
|
|
class NodeCompat;
|
2021-06-21 16:11:42 -04:00
|
|
|
|
2020-06-15 22:21:56 +02:00
|
|
|
using namespace villas;
|
|
|
|
|
|
|
|
#define FPGA_DMA_VLNV
|
|
|
|
#define FPGA_AURORA_VLNV "acs.eonerc.rwth-aachen.de:user:aurora_axis:"
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
struct fpga_node {
|
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
|
|
|
|
|
|
|
struct {
|
2021-08-10 10:12:48 -04:00
|
|
|
struct {
|
|
|
|
MemoryAccessor<int32_t> i;
|
|
|
|
MemoryAccessor<float> f;
|
|
|
|
} accessor;
|
|
|
|
MemoryBlock::Ptr block;
|
2020-06-15 22:21:56 +02:00
|
|
|
} in, out;
|
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
|
|
|
};
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int fpga_type_start(SuperNode *sn);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2020-06-15 22:21:56 +02:00
|
|
|
int fpga_type_stop();
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int fpga_init(NodeCompat *n);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int fpga_destroy(NodeCompat *n);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int fpga_parse(NodeCompat *n, json_t *json);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
char * fpga_print(NodeCompat *n);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int fpga_check(NodeCompat *n);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int fpga_prepare(NodeCompat *n);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int fpga_write(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int fpga_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int fpga_poll_fds(NodeCompat *n, int fds[]);
|
2020-06-13 15:49:31 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
} /* namespace node */
|
|
|
|
} /* namespace villas */
|