From 6a76bb693bca3541a03fe463f714bace9d759cf1 Mon Sep 17 00:00:00 2001 From: ROBBE Patrick <robbe@lal.in2p3.fr> Date: Wed, 3 Apr 2019 12:36:49 +0200 Subject: [PATCH] Add pcie40_reload --- .gitignore | 3 +++ Driver/pcie40_reload/Makefile | 2 +- Driver/pcie40_reload/main.c | 8 ++++---- Scripts/testB2L.py | 9 ++++++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 2c5323c..299cb9f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ *~ *.pyc *.log +Driver/pcie40_reload/pcie40_reload +Driver/pcie40_reload/pcie40_reload.out/ + diff --git a/Driver/pcie40_reload/Makefile b/Driver/pcie40_reload/Makefile index f67cdc3..29b8a33 100644 --- a/Driver/pcie40_reload/Makefile +++ b/Driver/pcie40_reload/Makefile @@ -6,7 +6,7 @@ include $(TOP)/common/flags.mk SCRIPTS :=pcie40_reload.sh SCRIPTS_INSTALL =$(DAQ40_PREFIX)/pcie40_reload -PCIE40_RELOAD_SUID :=pcie40_reload_suid +PCIE40_RELOAD_SUID :=pcie40_reload PCIE40_RELOAD_SUID_OBJS =main.o PCIE40_RELOAD_SUID_CFLAGS =$(CFLAGS) PCIE40_RELOAD_SUID_INSTALL =$(SCRIPTS_INSTALL) diff --git a/Driver/pcie40_reload/main.c b/Driver/pcie40_reload/main.c index 34c1611..c678193 100644 --- a/Driver/pcie40_reload/main.c +++ b/Driver/pcie40_reload/main.c @@ -16,10 +16,10 @@ int main(int argc, char *argv[]) perror("readlink"); return -1; } - if (setresuid(0,0,0)) { - perror("setresuid"); - return -1; - } + // if (setresuid(0,0,0)) { + // perror("setresuid"); + // return -1; + //} snprintf(script_path, sizeof(script_path), "%s/pcie40_reload.sh", dirname(here_path)); return execvp(script_path, argv); } diff --git a/Scripts/testB2L.py b/Scripts/testB2L.py index 5f2e624..4fd61fd 100644 --- a/Scripts/testB2L.py +++ b/Scripts/testB2L.py @@ -57,6 +57,13 @@ def _crc16(data, crc, table): import socket hname = socket.gethostname() +# initialize belle2 link in PCIe40 +mem.write( 0 , 0x00050100 , 0x0 ) +mem.write( 0 , 0x00050100 , 0x4 ) +mem.write( 0 , 0x00050100 , 0x0 ) +mem.write( 0 , 0x00050100 , 0x4 ) +mem.write( 0 , 0x00050100 , 0x0 ) + for nev in range( 10 ): # Send trigger (adapt this line to your system) @@ -72,7 +79,7 @@ for nev in range( 10 ): time.sleep( 2 ) status, val = mem.read( 0 , 0x00050080) size = val - + print "Number of words received = {0}".format( size ) if size == 0: -- GitLab