2016-06-14 01:19:17 +02:00
|
|
|
/** Driver for AXI Stream wrapper around RTDS_InterfaceModule (rtds_axis )
|
|
|
|
*
|
|
|
|
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
2017-03-03 20:20:13 -04:00
|
|
|
* @copyright 2017, Steffen Vogel
|
2016-06-14 01:19:17 +02:00
|
|
|
**********************************************************************************/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
#include "utils.h"
|
2017-02-12 14:35:05 -03:00
|
|
|
#include "plugin.h"
|
2016-06-14 01:19:17 +02:00
|
|
|
|
2016-06-26 15:22:25 +02:00
|
|
|
#include "fpga/ip.h"
|
2017-02-18 10:43:58 -05:00
|
|
|
#include "fpga/card.h"
|
|
|
|
#include "fpga/ips/rtds_axis.h"
|
2016-06-14 01:19:17 +02:00
|
|
|
|
2017-02-18 10:43:58 -05:00
|
|
|
void rtds_axis_dump(struct fpga_ip *c)
|
2016-06-14 01:19:17 +02:00
|
|
|
{
|
|
|
|
/* Check RTDS_Axis registers */
|
2016-06-26 15:22:25 +02:00
|
|
|
uint32_t *regs = (uint32_t *) (c->card->map + c->baseaddr);
|
2016-06-14 01:19:17 +02:00
|
|
|
|
2016-06-26 15:22:25 +02:00
|
|
|
uint32_t sr = regs[RTDS_AXIS_SR_OFFSET/4];
|
2016-06-14 01:19:17 +02:00
|
|
|
info("RTDS AXI Stream interface details");
|
|
|
|
{ INDENT
|
|
|
|
info("RTDS status: %#08x", sr);
|
|
|
|
{ INDENT
|
|
|
|
info("Card detected: %s", sr & RTDS_AXIS_SR_CARDDETECTED ? GRN("yes") : RED("no"));
|
|
|
|
info("Link up: %s", sr & RTDS_AXIS_SR_LINKUP ? GRN("yes") : RED("no"));
|
|
|
|
info("TX queue full: %s", sr & RTDS_AXIS_SR_TX_FULL ? RED("yes") : GRN("no"));
|
|
|
|
info("TX in progress: %s", sr & RTDS_AXIS_SR_TX_INPROGRESS ? YEL("yes") : "no");
|
|
|
|
info("Case running: %s", sr & RTDS_AXIS_SR_CASE_RUNNING ? GRN("yes") : RED("no"));
|
|
|
|
}
|
|
|
|
|
2016-06-26 15:22:25 +02:00
|
|
|
info("RTDS control: %#08x", regs[RTDS_AXIS_CR_OFFSET/4]);
|
|
|
|
info("RTDS IRQ coalesc: %u", regs[RTDS_AXIS_COALESC_OFFSET/4]);
|
|
|
|
info("RTDS IRQ version: %#06x", regs[RTDS_AXIS_VERSION_OFFSET/4]);
|
|
|
|
info("RTDS IRQ multi-rate: %u", regs[RTDS_AXIS_MRATE/4]);
|
2016-06-14 01:19:17 +02:00
|
|
|
|
2016-06-26 15:22:25 +02:00
|
|
|
info("RTDS timestep counter: %lu", (uint64_t) regs[RTDS_AXIS_TSCNT_LOW_OFFSET/4] | (uint64_t) regs[RTDS_AXIS_TSCNT_HIGH_OFFSET/4] << 32);
|
|
|
|
info("RTDS timestep period: %.3f uS", rtds_axis_dt(c) * 1e6);
|
2016-06-14 01:19:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-18 10:43:58 -05:00
|
|
|
double rtds_axis_dt(struct fpga_ip *c)
|
2016-06-14 01:19:17 +02:00
|
|
|
{
|
2016-06-26 15:22:25 +02:00
|
|
|
uint32_t *regs = (uint32_t *) (c->card->map + c->baseaddr);
|
|
|
|
uint16_t dt = regs[RTDS_AXIS_TS_PERIOD_OFFSET/4];
|
2016-06-14 01:19:17 +02:00
|
|
|
|
2016-06-26 15:22:25 +02:00
|
|
|
return (dt == 0xFFFF) ? -1.0 : (double) dt / RTDS_HZ;
|
|
|
|
}
|
|
|
|
|
2017-02-12 14:35:05 -03:00
|
|
|
static struct plugin p = {
|
|
|
|
.name = "RTDS's AXI4-Stream - GTFPGA interface",
|
|
|
|
.description = "",
|
|
|
|
.type = PLUGIN_TYPE_FPGA_IP,
|
|
|
|
.ip = {
|
2017-02-18 10:43:58 -05:00
|
|
|
.vlnv = { "acs.eonerc.rwth-aachen.de", "user", "rtds_axis", NULL },
|
|
|
|
.type = FPGA_IP_TYPE_INTERFACE,
|
2017-03-25 21:10:25 +01:00
|
|
|
.dump = rtds_axis_dump,
|
|
|
|
.size = 0
|
2017-02-12 14:35:05 -03:00
|
|
|
}
|
2016-06-26 15:22:25 +02:00
|
|
|
};
|
|
|
|
|
2017-02-12 14:35:05 -03:00
|
|
|
REGISTER_PLUGIN(&p)
|