From e735c7e24837fc2a3a8da0f5d09833fe8e79316c Mon Sep 17 00:00:00 2001 From: daniel-k Date: Tue, 5 Dec 2017 18:07:10 +0100 Subject: [PATCH] make linking of the lib work by using old C-symbols until replaced --- fpga/include/villas/fpga/ip.h | 7 +++++++ fpga/include/villas/fpga/vlnv.h | 8 ++++++++ fpga/include/villas/fpga/vlnv.hpp | 1 - fpga/include/villas/kernel/kernel.h | 8 ++++++++ fpga/include/villas/kernel/vfio.h | 8 ++++++++ fpga/lib/CMakeLists.txt | 3 +++ fpga/lib/ips/intc.cpp | 3 +++ fpga/lib/log.c | 1 + fpga/lib/vlnv.cpp | 8 ++++---- 9 files changed, 42 insertions(+), 5 deletions(-) diff --git a/fpga/include/villas/fpga/ip.h b/fpga/include/villas/fpga/ip.h index 5c078f596..b6723043d 100644 --- a/fpga/include/villas/fpga/ip.h +++ b/fpga/include/villas/fpga/ip.h @@ -44,6 +44,10 @@ #include "fpga/ips/dft.h" #include "fpga/ips/intc.h" +#ifdef __cplusplus +extern "C" { +#endif + enum fpga_ip_types { FPGA_IP_TYPE_DM_DMA, /**< A datamover IP exchanges streaming data between the FPGA and the CPU. */ FPGA_IP_TYPE_DM_FIFO, /**< A datamover IP exchanges streaming data between the FPGA and the CPU. */ @@ -115,5 +119,8 @@ int fpga_ip_reset(struct fpga_ip *c); /** Find a registered FPGA IP core type with the given VLNV identifier. */ struct fpga_ip_type * fpga_ip_type_lookup(const char *vstr); +#ifdef __cplusplus +} +#endif /** @} */ diff --git a/fpga/include/villas/fpga/vlnv.h b/fpga/include/villas/fpga/vlnv.h index d24385271..2de8bbbcb 100644 --- a/fpga/include/villas/fpga/vlnv.h +++ b/fpga/include/villas/fpga/vlnv.h @@ -28,6 +28,10 @@ #ifndef _FPGA_VLNV_H_ #define _FPGA_VLNV_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* Forward declarations */ struct list; @@ -50,4 +54,8 @@ int fpga_vlnv_parse(struct fpga_vlnv *c, const char *vlnv); /** Release memory allocated by fpga_vlnv_parse(). */ int fpga_vlnv_destroy(struct fpga_vlnv *v); +#ifdef __cplusplus +} +#endif + #endif /** _FPGA_VLNV_H_ @} */ diff --git a/fpga/include/villas/fpga/vlnv.hpp b/fpga/include/villas/fpga/vlnv.hpp index c089ce4e9..7785c56d2 100644 --- a/fpga/include/villas/fpga/vlnv.hpp +++ b/fpga/include/villas/fpga/vlnv.hpp @@ -37,7 +37,6 @@ class FpgaVlnv { public: static constexpr char delimiter = ':'; - static constexpr char wildcard[] = "*"; FpgaVlnv() : vendor(""), library(""), name(""), version("") {} diff --git a/fpga/include/villas/kernel/kernel.h b/fpga/include/villas/kernel/kernel.h index 9837e03b7..93cfa3130 100644 --- a/fpga/include/villas/kernel/kernel.h +++ b/fpga/include/villas/kernel/kernel.h @@ -28,6 +28,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* Forward declarations */ struct version; @@ -87,4 +91,8 @@ int kernel_get_hugepage_size(); /** Set SMP affinity of IRQ */ int kernel_irq_setaffinity(unsigned irq, uintmax_t affinity, uintmax_t *old); +#ifdef __cplusplus +} +#endif + /** @} */ diff --git a/fpga/include/villas/kernel/vfio.h b/fpga/include/villas/kernel/vfio.h index bb6f12329..1b4a9c336 100644 --- a/fpga/include/villas/kernel/vfio.h +++ b/fpga/include/villas/kernel/vfio.h @@ -20,6 +20,10 @@ #define VFIO_DEV(x) "/dev/vfio/" x +#ifdef __cplusplus +extern "C" { +#endif + /* Forward declarations */ struct pci_device; @@ -109,4 +113,8 @@ int vfio_unmap_dma(struct vfio_container *c, uint64_t virt, uint64_t phys, size_ /** munmap() a region which has been mapped by vfio_map_region() */ int vfio_unmap_region(struct vfio_device *d, int idx); +#ifdef __cplusplus +} +#endif + /** @} */ diff --git a/fpga/lib/CMakeLists.txt b/fpga/lib/CMakeLists.txt index e13b43edd..1c03327a8 100644 --- a/fpga/lib/CMakeLists.txt +++ b/fpga/lib/CMakeLists.txt @@ -1,6 +1,8 @@ set(SOURCES ip.cpp + ip.c vlnv.cpp + vlnv.c card.c ips/timer.c @@ -17,6 +19,7 @@ set(SOURCES kernel/pci.c kernel/vfio.c + plugin.c plugin.cpp utils.c list.c diff --git a/fpga/lib/ips/intc.cpp b/fpga/lib/ips/intc.cpp index d17a2c9a1..9471636e9 100644 --- a/fpga/lib/ips/intc.cpp +++ b/fpga/lib/ips/intc.cpp @@ -35,6 +35,9 @@ namespace villas { +// instantiate factory to make available to plugin infrastructure +static InterruptControllerFactory factory; + InterruptController::~InterruptController() { vfio_pci_msi_deinit(&card->vfio_device , this->efds); diff --git a/fpga/lib/log.c b/fpga/lib/log.c index b9af2d1b6..0fe097288 100644 --- a/fpga/lib/log.c +++ b/fpga/lib/log.c @@ -39,6 +39,7 @@ #endif struct log *global_log; +struct log default_log; /* We register a default log instance */ __attribute__((constructor)) diff --git a/fpga/lib/vlnv.cpp b/fpga/lib/vlnv.cpp index b9b007ce4..cf44c483f 100644 --- a/fpga/lib/vlnv.cpp +++ b/fpga/lib/vlnv.cpp @@ -59,10 +59,10 @@ FpgaVlnv::parseFromString(std::string vlnv) std::getline(sstream, version, delimiter); // represent wildcard internally as empty string - if(vendor == wildcard) vendor = ""; - if(library == wildcard) library = ""; - if(name == wildcard) name = ""; - if(version == wildcard) version = ""; + if(vendor == "*") vendor = ""; + if(library == "*") library = ""; + if(name == "*") name = ""; + if(version == "*") version = ""; }