1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

introduced new directory structure for source and header files

This commit is contained in:
Steffen Vogel 2016-06-14 01:17:58 +02:00
parent 43cee1184b
commit 0fa5f5b976
41 changed files with 107 additions and 58 deletions

View file

@ -2,7 +2,7 @@
TARGETS = node pipe signal test
# Libraries
LIBS = libvillas.so
LIBS = libvillas.so thirdparty/xilinx/libxil.so
DEBUG = 1
@ -18,7 +18,7 @@ LIB_OBJS = sample.o path.o node.o \
timing.o
# Source directories
VPATH = src lib
VPATH = src lib lib/kernel lib/nodes lib/hooks lib/fpga
# Default prefix for installation
PREFIX ?= /usr/local
@ -29,13 +29,14 @@ V ?= 2
GIT_REV=$(shell git rev-parse --short HEAD)
# Compiler and linker flags
CC ?= gcc
LDLIBS = -pthread -lrt -lm -lconfig -lvillas
CFLAGS += -std=c11 -Iinclude/ -I. -MMD -mcx16
LIB_LDFLAGS = -shared
CFLAGS += -std=c11 -Iinclude -Iinclude/villas -I. -MMD -mcx16
CFLAGS += -Wall -fdiagnostics-color=auto
CFLAGS += -D_GIT_REV='"$(GIT_REV)"' -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1 -DV=$(V)
LDFLAGS += -L. -Wl,-rpath,'$$ORIGIN'
LDFLAGS += -pthread -L. -Wl,-rpath,'$$ORIGIN'
# pkg-config dependencies
PKGS = libconfig
@ -52,27 +53,29 @@ endif
######## Node types ########
# Enable file node type support
ifndef DISABLE_FILE
LIB_OBJS += file.o
endif
# file node-type is always supported
LIB_OBJS += file.o
# Enable Socket node type when libnl3 is available
ifeq ($(shell pkg-config libnl-route-3.0; echo $$?),0)
LIB_OBJS += socket.o nl.o tc.o if.o msg.o
PKGS += libnl-route-3.0
LIB_OBJS += socket.o nl.o tc.o if.o msg.o
PKGS += libnl-route-3.0
endif
## Enable GTFPGA support when libpci is available
#ifeq ($(shell pkg-config libpci; echo $$?),0)
# LIB_OBJS += gtfpga.o
# PKGS += libpci
#endif
# Enable VILLASfpga support when libpci is available
ifeq ($(shell pkg-config libpci; echo $$?),0)
LIB_OBJS += vfpga.o pci.o dma.o model.o fifo.o xsg.o vfio.o switch.o rtds_axis.o
LDLIBS += -lxil
LDFLAGS += -Lthirdparty/xilinx -Wl,-rpath-link,'$$ORIGIN/thirdparty/xilinx'
CFLAGS += -Ithirdparty/xilinx/include
PKGS += libpci
TARGETS += fpga
endif
# Enable NGSI support
ifeq ($(shell pkg-config libcurl jansson uuid; echo $$?),0)
LIB_OBJS += ngsi.o
PKGS += libcurl jansson uuid
LIB_OBJS += ngsi.o
PKGS += libcurl jansson uuid
endif
## Enable WebSocket support
@ -82,14 +85,16 @@ endif
#endif
# Enable OPAL-RT Asynchronous Process support (will result in 32bit binary!!!)
ifneq (,$(wildcard $(OPALDIR)/include_target/AsyncApi.h))
ifdef WITH_OPAL
ifneq (,$(wildcard thirdparty/opal/include/AsyncApi.h))
LIB_OBJS += opal.o
CFLAGS += -m32
LDFLAGS += -m32
LIB_CFLAGS += -m32 -I$(OPALDIR)/include_target
LIB_LDFLAGS += -m32 -L/lib/i386-linux-gnu/ -L/usr/lib/i386-linux-gnu/ -L$(OPALDIR)/lib/redhawk/
LIB_CFLAGS += -m32 -I thirdparty/opal/include
LIB_LDFLAGS += -m32 -L/lib/i386-linux-gnu/ -L/usr/lib/i386-linux-gnu/ -Lthirdparty/opal/lib/redhawk/
LIB_LDLIBS += -lOpalAsyncApiCore -lOpalCore -lOpalUtils -lirc
endif
endif
# Add flags by pkg-config
LIB_CFLAGS += $(addprefix -DWITH_, $(shell echo ${PKGS} | tr a-z- A-Z_ | tr -dc ' A-Z0-9_' ))
@ -104,20 +109,27 @@ LIB_LDLIBS += $(shell pkg-config --libs ${PKGS})
all: $(LIBS) $(TARGETS)
# Dependencies for individual binaries
node: server.o $(LIBS)
pipe: pipe.o $(LIBS)
test: test.o $(LIBS)
signal: signal.o $(LIBS)
fpga: LDLIBS += -lpci -lxil
node: server.o
fpga: fpga.o fpga-tests.o
pipe: pipe.o
test: test.o
signal: signal.o
# Libraries
$(LIBS): CFLAGS += -fPIC $(LIB_CFLAGS)
$(LIBS): $(LIB_OBJS)
$(CC) $(LIB_LDFLAGS) -shared -o $@ $^ $(LIB_LDLIBS)
$(LIB_OBJS): CFLAGS += -fPIC $(LIB_CFLAGS)
libvillas.so: $(LIB_OBJS)
$(CC) $(LIB_LDFLAGS) -o $@ $^ $(LIB_LDLIBS)
thirdparty/xilinx/libxil.so:
$(MAKE) -C thirdparty/xilinx libxil.so
# Common targets
install: $(TARGETS) $(LIBS)
install -m 0644 $(LIBS) $(PREFIX)/lib
install -m 0755 node -T $(PREFIX)/bin/villas-node
install -m 0755 fpga $(PREFIX)/bin/villas-fpga
install -m 0755 signal $(PREFIX)/bin/villas-signal
install -m 0755 pipe $(PREFIX)/bin/villas-pipe
install -m 0755 test $(PREFIX)/bin/villas-test

View file

@ -35,8 +35,6 @@ struct opal {
int send_id;
int recv_id;
int seq_no;
Opal_SendAsyncParam send_params;
Opal_RecvAsyncParam recv_params;
@ -70,9 +68,9 @@ int opal_open(struct node *n);
int opal_close(struct node *n);
/** @see node_vtable::read */
int opal_read(struct node *n, struct pool *pool, int cnt);
int opal_read(struct node *n, struct sample *smps[], unsigned cnt);
/** @see node_vtable::write */
int opal_write(struct node *n, struct pool *pool, int cnt);
int opal_write(struct node *n, struct sample *smps[], unsigned cnt);
#endif /** _OPAL_H_ @} */

View file

@ -14,6 +14,7 @@
#include <stdint.h>
#include <sched.h>
#include <assert.h>
#include <sys/types.h>
#include "log.h"
@ -75,6 +76,12 @@
})
#endif
#define BITS_PER_LONGLONG (sizeof(long long) * 8)
/* Some helper macros */
#define BITMASK(h, l) (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONGLONG - 1 - (h))))
#define BIT(nr) (1UL << (nr))
/* Forward declarations */
struct settings;
struct timespec;
@ -162,5 +169,34 @@ int version_parse(const char *s, struct version *v);
} while (0)
#endif
#endif /* _UTILS_H_ */
/** Wait on eventfd */
uint64_t wait_irq(int irq);
/** Fill buffer with random data */
int read_random(char *buf, size_t len);
/** Hexdump bytes */
void printb(void *mem, size_t len);
/** Hexdump 32-bit dwords */
void printdw(void *mem, size_t len);
/** Get CPU timestep counter */
__attribute__((always_inline)) static inline uint64_t rdtscp()
{
uint64_t tsc;
__asm__ ("rdtscp;"
"shl $32, %%rdx;"
"or %%rdx,%%rax"
: "=a" (tsc)
:
: "%rcx", "%rdx", "memory");
return tsc;
}
/** Sleep with rdtsc */
void rdtsc_sleep(uint64_t nanosecs, uint64_t start);
#endif /* _UTILS_H_ */

View file

@ -12,7 +12,6 @@
#include "utils.h"
#include "list.h"
#include "if.h"
#include "cfg.h"
#include "node.h"
#include "path.h"

View file

@ -16,12 +16,14 @@
#include <netlink/route/link.h>
#include <netlink/route/route.h>
#include "if.h"
#include "tc.h"
#include "nl.h"
#include "socket.h"
#include "kernel/if.h"
#include "kernel/tc.h"
#include "kernel/nl.h"
#include "kernel/kernel.h"
#include "nodes/socket.h"
#include "utils.h"
#include "kernel.h"
struct interface * if_create(struct rtnl_link *link)
{

View file

@ -20,7 +20,7 @@
#include "utils.h"
#include "config.h"
#include "kernel.h"
#include "kernel/kernel.h"
int kernel_module_set_param(const char *module, const char *param, const char *value)
{

View file

@ -13,8 +13,9 @@
#include <netlink/route/route.h>
#include <netlink/route/link.h>
#include "kernel/nl.h"
#include "utils.h"
#include "nl.h"
/** Singleton for global netlink socket */
static struct nl_sock *sock = NULL;

View file

@ -14,10 +14,11 @@
#include <linux/if_ether.h>
#include "kernel/if.h"
#include "kernel/tc.h"
#include "kernel/nl.h"
#include "utils.h"
#include "if.h"
#include "tc.h"
#include "nl.h"
int tc_parse(config_setting_t *cfg, struct rtnl_qdisc **netem)
{

View file

@ -9,8 +9,7 @@
#include <unistd.h>
#include <string.h>
#include "msg.h"
#include "file.h"
#include "nodes/file.h"
#include "utils.h"
#include "timing.h"
#include "queue.h"

View file

@ -16,10 +16,10 @@
#include <pthread.h>
#include <unistd.h>
#include "ngsi.h"
#include "nodes/ngsi.h"
#include "utils.h"
#include "timing.h"
#include "pool.h"
/* Some global settings */
static char *name = NULL;

View file

@ -179,7 +179,7 @@ int opal_close(struct node *n)
return 0;
}
int opal_read(struct node *n, struct pool *pool, int cnt)
int opal_read(struct node *n, struct pool *pool, unsigned cnt)
{
struct opal *o = n->_vd;
@ -244,7 +244,7 @@ int opal_read(struct node *n, struct pool *pool, int cnt)
return 1;
}
int opal_write(struct node *n, struct pool *pool, int cnt)
int opal_write(struct node *n, struct pool *pool, unsigned cnt)
{
struct opal *o = n->_vd;

View file

@ -19,13 +19,14 @@
#include <linux/if_packet.h>
#include <arpa/inet.h>
#include "socket.h"
#include "nodes/socket.h"
#include "kernel/if.h"
#include "kernel/nl.h"
#include "kernel/tc.h"
#include "config.h"
#include "utils.h"
#include "if.h"
#include "nl.h"
#include "tc.h"
#include "msg.h"
#include "sample.h"
#include "queue.h"

View file

@ -323,7 +323,7 @@ shutdown:
warn("Dropping connection: node is currently shutting down");
#if LWS_LIBRARY_VERSION_NUMBER > 1006002
char *bye = "S2SS is shutting down. Bye";
char *bye = "VILLASnode is shutting down. Bye";
lws_close_reason(wsi, LWS_CLOSE_STATUS_GOINGAWAY, (unsigned char *) bye, strlen(bye));
#endif
@ -377,7 +377,7 @@ int websocket_init(int argc, char * argv[], config_setting_t *cfg)
if (!port)
port = 80;
if (!htdocs)
htdocs = "/s2ss/contrib/websocket";
htdocs = "/villas/contrib/websocket";
/* Start server */
struct lws_context_creation_info info = {

View file

@ -11,7 +11,7 @@
#include "utils.h"
#include "pool.h"
#include "kernel.h"
#include "kernel/kernel.h"
int pool_init_mmap(struct pool *p, size_t blocksz, size_t cnt)
{