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/fpga/card.h

98 lines
2.7 KiB
C
Raw Permalink Normal View History

2017-02-18 10:43:58 -05:00
/** FPGA card
*
* This class represents a FPGA device.
*
* @file
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
2017-04-27 12:56:43 +02:00
* @license GNU General Public License (version 3)
*
* VILLASnode
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
2017-04-27 12:56:43 +02:00
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
2017-04-27 12:56:43 +02:00
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
/** @addtogroup fpga VILLASfpga
* @{
*/
2017-02-18 10:43:58 -05:00
#pragma once
2017-03-03 20:21:33 -04:00
#include <libconfig.h>
#include "common.h"
2017-06-08 12:42:46 +02:00
#include "kernel/pci.h"
#include "kernel/vfio.h"
2017-03-03 20:21:33 -04:00
/* Forward declarations */
struct fpga_ip;
struct vfio_container;
2017-02-18 10:43:58 -05:00
struct fpga_card {
char *name; /**< The name of the FPGA card */
enum state state; /**< The state of this FPGA card. */
2017-02-18 10:43:58 -05:00
struct pci *pci;
struct pci_device filter; /**< Filter for PCI device. */
struct vfio_container *vfio_container;
struct vfio_device vfio_device; /**< VFIO device handle. */
2017-02-18 10:43:58 -05:00
int do_reset; /**< Reset VILLASfpga during startup? */
int affinity; /**< Affinity for MSI interrupts */
struct list ips; /**< List of IP components on FPGA. */
char *map; /**< PCI BAR0 mapping for register access */
size_t maplen;
size_t dmalen;
/* Some IP cores are special and referenced here */
struct fpga_ip *intc;
struct fpga_ip *reset;
struct fpga_ip *sw;
2017-02-18 10:43:58 -05:00
config_setting_t *cfg;
};
/** Initialize FPGA card and its IP components. */
2017-03-03 20:21:33 -04:00
int fpga_card_init(struct fpga_card *c, struct pci *pci, struct vfio_container *vc);
2017-02-18 10:43:58 -05:00
/** Parse configuration of FPGA card including IP cores from config. */
int fpga_card_parse(struct fpga_card *c, config_setting_t *cfg);
int fpga_card_parse_list(struct list *l, config_setting_t *cfg);
2017-02-18 10:43:58 -05:00
/** Check if the FPGA card configuration is plausible. */
int fpga_card_check(struct fpga_card *c);
/** Start FPGA card. */
int fpga_card_start(struct fpga_card *c);
/** Stop FPGA card. */
int fpga_card_stop(struct fpga_card *c);
/** Destroy FPGA card. */
int fpga_card_destroy(struct fpga_card *c);
/** Dump details of FPGA card to stdout. */
void fpga_card_dump(struct fpga_card *c);
2017-02-18 10:43:58 -05:00
/** Reset the FPGA to a known state */
int fpga_card_reset(struct fpga_card *c);
2017-06-08 12:42:46 +02:00
/** @} */