From 63a1eb2f7f132a119e1ba75607501a4d59059c68 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 25 Jun 2018 17:22:31 +0200 Subject: [PATCH] remove some obsolete C code files --- fpga/lib/ips/gpio.c | 48 ----------------------- fpga/tests/dma.c | 93 --------------------------------------------- fpga/tests/tmrctr.c | 69 --------------------------------- 3 files changed, 210 deletions(-) delete mode 100644 fpga/lib/ips/gpio.c delete mode 100644 fpga/tests/dma.c delete mode 100644 fpga/tests/tmrctr.c diff --git a/fpga/lib/ips/gpio.c b/fpga/lib/ips/gpio.c deleted file mode 100644 index 14d0809df..000000000 --- a/fpga/lib/ips/gpio.c +++ /dev/null @@ -1,48 +0,0 @@ -/** GPIO related helper functions - * - * @author Daniel Krebs - * @copyright 2017-2018, Daniel Krebs - * @license GNU General Public License (version 3) - * - * VILLASfpga - * - * 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. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - *********************************************************************************/ - -#include "config.h" -#include "plugin.h" - -#include "fpga/ip.h" -#include "fpga/card.h" - -static int gpio_start(struct fpga_ip *c) -{ - (void) c; - - return 0; -} - -static struct plugin p = { - .name = "Xilinx's GPIO controller", - .description = "", - .type = PLUGIN_TYPE_FPGA_IP, - .ip = { - .vlnv = { "xilinx.com", "ip", "axi_gpio", NULL }, - .type = FPGA_IP_TYPE_MISC, - .start = gpio_start, - .size = 0 - } -}; - -REGISTER_PLUGIN(&p) diff --git a/fpga/tests/dma.c b/fpga/tests/dma.c deleted file mode 100644 index 82ec4fef6..000000000 --- a/fpga/tests/dma.c +++ /dev/null @@ -1,93 +0,0 @@ -/** DMA unit test. - * - * @author Steffen Vogel - * @copyright 2017-2018, Steffen Vogel - * @license GNU General Public License (version 3) - * - * VILLASfpga - * - * 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. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - *********************************************************************************/ - -#include - -#include - -#include -#include -#include -#include - -#include -#include - -extern struct fpga_card *card; - -Test(fpga, dma, .description = "DMA") -{ - int ret = -1; - struct dma_mem mem, src, dst; - - for (size_t i = 0; i < list_length(&card->ips); i++) { INDENT - struct fpga_ip *dm = (struct fpga_ip *) list_at(&card->ips, i); - - if (fpga_vlnv_cmp(&dm->vlnv, &(struct fpga_vlnv) { "xilinx.com", "ip", "axi_dma", NULL })) - continue; /* skip non DMA IP cores */ - - struct dma *dma = (struct dma *) dm->_vd; - - /* Simple DMA can only transfer up to 4 kb due to - * PCIe page size burst limitation */ - ssize_t len2, len = dma->inst.HasSg ? 64 << 20 : 1 << 12; - - ret = dma_alloc(dm, &mem, 2 * len, 0); - cr_assert_eq(ret, 0); - - ret = dma_mem_split(&mem, &src, &dst); - cr_assert_eq(ret, 0); - - /* Get new random data */ - len2 = read_random(src.base_virt, len); - if (len2 != len) - serror("Failed to get random data"); - - int irq_mm2s = dm->irq; - int irq_s2mm = dm->irq + 1; - - ret = intc_enable(card->intc, (1 << irq_mm2s) | (1 << irq_s2mm), 0); - cr_assert_eq(ret, 0, "Failed to enable interrupt"); - - ret = switch_connect(card->sw, dm, dm); - cr_assert_eq(ret, 0, "Failed to configure switch"); - - /* Start transfer */ - ret = dma_ping_pong(dm, src.base_phys, dst.base_phys, dst.len); - cr_assert_eq(ret, 0, "DMA ping pong failed"); - - ret = memcmp(src.base_virt, dst.base_virt, src.len); - - info("DMA %s (%s): %s", dm->name, dma->inst.HasSg ? "scatter-gather" : "simple", ret ? CLR_RED("failed") : CLR_GRN("passed")); - - ret = switch_disconnect(card->sw, dm, dm); - cr_assert_eq(ret, 0, "Failed to configure switch"); - - ret = intc_disable(card->intc, (1 << irq_mm2s) | (1 << irq_s2mm)); - cr_assert_eq(ret, 0, "Failed to disable interrupt"); - - ret = dma_free(dm, &mem); - cr_assert_eq(ret, 0, "Failed to release DMA memory"); - } - - cr_assert_eq(ret, 0); -} diff --git a/fpga/tests/tmrctr.c b/fpga/tests/tmrctr.c deleted file mode 100644 index d21722705..000000000 --- a/fpga/tests/tmrctr.c +++ /dev/null @@ -1,69 +0,0 @@ -/** Timer/Counter unit test. - * - * @author Steffen Vogel - * @copyright 2017-2018, Steffen Vogel - * @license GNU General Public License (version 3) - * - * VILLASfpga - * - * 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. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - *********************************************************************************/ - -#include - -#include "config.h" - -#include - -#include -#include -#include - -#include - -extern struct fpga_card *card; - -Test(fpga, timer, .description = "Timer Counter") -{ - int ret; - struct fpga_ip *ip; - struct timer *tmr; - - ip = fpga_vlnv_lookup(&card->ips, &(struct fpga_vlnv) { "xilinx.com", "ip", "axi_timer", NULL }); - cr_assert(ip); - - tmr = (struct timer *) ip->_vd; - - XTmrCtr *xtmr = &tmr->inst; - - ret = intc_enable(card->intc, (1 << ip->irq), 0); - cr_assert_eq(ret, 0, "Failed to enable interrupt"); - - XTmrCtr_SetOptions(xtmr, 0, XTC_EXT_COMPARE_OPTION | XTC_DOWN_COUNT_OPTION); - XTmrCtr_SetResetValue(xtmr, 0, FPGA_AXI_HZ / 125); - XTmrCtr_Start(xtmr, 0); - - uint64_t counter = intc_wait(card->intc, ip->irq); - info("Got IRQ: counter = %ju", counter); - - if (counter == 1) - return; - else - warn("Counter was not 1"); - - intc_disable(card->intc, (1 << ip->irq)); - cr_assert_eq(ret, 0, "Failed to disable interrupt"); - - return; -}