1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/lib/fpga/rtds_axis.c

57 lines
2 KiB
C
Raw Normal View History

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>
* @copyright 2015-2016, Steffen Vogel
* This file is part of S2SS. All Rights Reserved. Proprietary and confidential.
* Unauthorized copying of this file, via any medium is strictly prohibited.
**********************************************************************************/
#include <stdint.h>
#include "log.h"
#include "utils.h"
#include "fpga/ip.h"
2016-06-14 01:19:17 +02:00
#include "fpga/rtds_axis.h"
void rtds_axis_dump(struct ip *c)
2016-06-14 01:19:17 +02:00
{
/* Check RTDS_Axis registers */
uint32_t *regs = (uint32_t *) (c->card->map + c->baseaddr);
2016-06-14 01:19:17 +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"));
}
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
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
}
}
double rtds_axis_dt(struct ip *c)
2016-06-14 01:19:17 +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
return (dt == 0xFFFF) ? -1.0 : (double) dt / RTDS_HZ;
}
static struct ip_type ip = {
.vlnv = { "acs.eonerc.rwth-aachen.de", "user", "rtds_axis", NULL },
.dump = rtds_axis_dump
};
REGISTER_IP_TYPE(&ip)