diff --git a/CMakeLists.txt b/CMakeLists.txt index 42b3c3f..11a8b6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,16 @@ cmake_minimum_required(VERSION 3.0) -project(damaris_backends) +project(damaris-backends) include(FindPkgConfig) +include(GNUInstallDirs) +# http://stackoverflow.com/questions/39481958/setting-cmake-install-prefix-from-cmakelists-txt-file +#IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) +# SET(CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Set install prefix" FORCE) +#ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow -Wall -O0 -g -DSPC_DEBUG=0") - +set(CPACK_PACKAGING_INSTALL_PREFIX "/") +#set(CMAKE_INSTALL_PREFIX "/") find_package(EXPAT REQUIRED) find_package(PkgConfig REQUIRED) @@ -15,11 +21,10 @@ pkg_check_modules (XERCES xerces-c REQUIRED) include_directories (. ${GLIB2_INCLUDE_DIRS} ${XERCES_INCLUDE_DIRS}) link_directories (${GLIB2_LIBRARY_DIRS} ${XERCES_LIBRARY_DIRS}) - add_subdirectory(core) #add_subdirectory(doc) add_subdirectory(drivers) -#add_subdirectory(tools) +add_subdirectory(tools) #add_subdirectory(tests) add_subdirectory(machines) #add_executable(backends ${SOURCE_FILES}) diff --git a/core/xml_states.cpp b/core/xml_states.cpp index 6b41310..3ebbe7e 100644 --- a/core/xml_states.cpp +++ b/core/xml_states.cpp @@ -361,7 +361,9 @@ int xml_state_writer::write_states(FILE* output, const state_atom& states_to_wri strcat(args, buffer); } strcat(args, "/>\n"); - fprintf(output, args); + // fix -Werror=format-security + //fprintf(output, args); + fputs(args,output); return 1; } fprintf(output,"%s\n",indent_string.c_str()); diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..afcf422 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,204 @@ +damaris (0.15) UNRELEASED; urgency=low + + * new SVN pacakges + * new SPC driver + * move from xerces-c28 to xerces-c31 (nedded to build on jessie) + + -- Markus Rosenstihl Fri, 08 Aug 2014 09:49:36 +0100 + +damaris (0.14-svn730) experimental; urgency=low + + * removed exe extensions from backends + * changed default frontend renderer to GTKAgg + + -- Markus Rosenstihl Fri, 28 Jun 2013 17:13:10 +0200 + +damaris (0.14-svn727) experimental; urgency=low + + * r714 Big Kernel Lock was removed in linux kernel 2.6.39, + * kernel driver adjusted accordingly, compiles on kernel 3.2.0 + * new driver from Spectrum GmbH for kernel > 2.6.39 + * DAMARIS builds now in Wheezy + * several fixes/more prices warnings in Spectrum and Spincore drivers + * external clock impedance not set to 50 Ohms anymore. + * (new PB24-64k SP17-revB boards clock is not capable of driveing 50 Ohms) + * Stefan: some fixes for the ADC driver: + - frequency is not always set correctly, which could lead to TOs, exception + added to handle this + - gating delay does not appear to be active below 500 kHz, despite manual + - gating time is now correctly rounded up to next 10 ns + + -- Markus Rosenstihl Thu, 27 Jun 2013 14:34:24 +0200 + +damaris (0.14-svn713) experimental; urgency=low + + * added Spectrum M2i40xx Series ADC Cards (Stefan Reutter) + * added birgit back end + + -- Markus Rosenstihl Mon, 11 Mar 2013 15:58:47 +0000 + +damaris (0.14-svn697) experimental; urgency=low + + * MI40xx driver bugs: + - pre-gating implemented for other configurations according to the manual + - ADC_Excpetion is thrown if a timeout occured + - timeout is now correct, no need to add extra time in frontend: + the card records upto 7 samples more after gating stops + * "general" backend: configurable via glib KeyValue config file (follows XDG standard) + * added glib-2.0 dependcy for configuration file + * backend.conf allows to disable synchronization + * backend.conf example in /usr/share/doc/damaris-backends/backend.conf + + -- Markus Rosenstihl Wed, 21 Nov 2012 09:47:10 +0100 + +damaris (0.13-0) experimental; urgency=low + * Packages are compiling now on squeeze (and Ubuntu 10.04) + * fixed /sbin/udevsettle (lenny) vs /sbin/udevadm settle (squeeze) in init script + + -- Markus Rosenstihl Sun, 28 Nov 2010 01:00:39 +0100 + +damaris (0.11-0.2) experimental; urgency=low + + * Spectrum MI4021 driver + - Can change now ext. ref clock frequency (needed for PulseBlaster 24 SP 17) + - Testing for timeout now checks the proper timeout variable + * PTS driver + - We can now change the phase_step in the machine file. Needed to accomodate PTS 500. + * backends + - Added berta backend (Using PB 24 SP 17; PTS 500) + + -- Markus Rosenstihl Fri, 08 Jan 2010 14:27:16 +0100 + +damaris (0.11-0.1) experimental; urgency=low + + * pulseblaster module + - New udev support for 2.6.26 - 2.6.30, breaking prior support + * backends + - Make DAC20 more generic + - DAC20: Improve init- and exit-sequences + - Add FC2 backend (with two DACs) + - Some little buildsystem updates + * Kernel modules for version 2.6.26-2 + + -- Christian Tacke Fri, 08 Jan 2010 14:27:16 +0100 + +damaris (0.11-0) experimental; urgency=low + + * pulseblaster module renewed: sysfs support, multiple pci devices, device probing + * udev support + * periodically call schedule instruction when writing to pulseblaster board + * non-pausing io instructions + * debian testing: xen-686 kernels omitted: some pci_* functions are not defined + * reasonable errno values returned from kernel module + * review of synchronization board code + + -- Achim Gaedke Wed, 26 Jun 2008 15:30:00 +0100 + +damaris (0.10-4) experimental; urgency=low + + * Kernel modules compiled and tested for version 2.6.18-6 + + -- Achim Gaedke Fri, 1 Feb 2008 17:24:38 +0100 + +damaris (0.10-3) experimental; urgency=low + + * PulseBlaster Programs are loaded in chunks, prevents system freeze for seconds + + -- Achim Gaedke Thu, 18 Oct 2007 18:07:01 +0200 + +damaris (0.10-2) experimental; urgency=low + + * damaris-modules package contains various modules for testing and stable + * damaris-modules package has exact dependencies for supported kernel versions + * pulseblaster module does not reset device (because reset sequence is device dependent) + * damaris-backends hardware init script does not fail when modules are not available + + -- Achim Gaedke Wed, 17 Oct 2007 14:23:25 +0200 + +damaris (0.10-1) experimental; urgency=low + + [ Achim Gaedke ] + * check maximum number of instructions in backend and report proper + error + + [ Christian Tacke ] + * Bump main version to 0.10 + * Build-Depend on linux-headers-2.6-all | linux-headers-2.6.18-5-all + to really get headers for all subarchs + * No need to Build-Depend on g++,make,dpkg-dev as build-essential + depends on them + + -- Christian Tacke Thu, 4 Oct 2007 17:51:42 +0200 + +damaris (0.9-0.5.2) experimental; urgency=low + + * python-gui: separate package in frontends/greendamaris + + -- Achim Gaedke Thu, 06 Sep 2007 11:35:09 +0200 + +damaris (0.9-0.5.1) experimental; urgency=low + + * Split kernel modules into new damaris-modules package, + in preparation for per kernelversion packages + * Fix depedencies of damaris-backends + * Add Mobile_wo_sync_backend + + -- Christian Tacke Fri, 31 Aug 2007 11:15:38 +0200 + +damaris (0.9-0.5) experimental; urgency=low + + * python-gui: directory creation for dump files + * python-gui: release of backend subprocess + + -- Achim Gaedke Fri, 17 Aug 2007 11:46:08 +0200 + +damaris (0.9-0.4) experimental; urgency=low + + * python-gui: DAMARIS version information + * python-gui: correct matplotlib choice and recognition + * python-gui: counter for results produced by backend + * python-gui: clean up of internal counters and start/stop mechanisms + * drivres: pulseblaster-module directory removed with cleanup + * python-gui: disable hdf file generation by empty data pool filename + + -- Achim Gaedke Sun, 6 May 2007 19:40:08 +0200 + +damaris (0.9-0.3) experimental; urgency=high + + * checked all lock issues for threads + * basic debugging features --debug flag + * removed gtk.gdk.flush() command + * matplotlib backend can be chosen via -d option (recommending GTKCairo) + * be more careful with stop button: delayed change to insensitvity + * changed delay parameters to slow down scripts while observing the results + + -- Achim Gaedke Wed, 2 May 2007 12:46:10 +0200 + +damaris (0.9-0.2) experimental; urgency=high + + * python-gui: full cleanup in greendamaris + * backends: postrm removes nmr group while purging + * python-gui: classes of experiments and data modules are directly available (eg damaris.data.Accumulation) + * python-gui: automatic import of experiment classes to experiment script and data classes to result script + * python-gui: periodic dumping in extra thread without stopping measurement + * core: taking care of realloc return value + * python-gui renewed glade file, added missing alignment information + * backends: optimization for backend -O2 (makefile changes) + * backends: printf issue for size_t solved + * backends: striped .exe suffix from executables (linux not windows!) + + -- Achim Gaedke Tue, 24 Apr 2007 15:58:40 +0200 + +damaris (0.9-0.1) experimental; urgency=medium + + * added i386 and amd64 targets and kernel modules + * fixed class prefixes in damaris modules + * adapted init script to new spectrum modules + + -- Achim Gaedke Thu, 19 Apr 2007 14:00:00 +0100 + +damaris (0.9-0.0) experimental; urgency=medium + + * started debianization + + -- Achim Gaedke Fri, 13 Apr 2007 14:12:12 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..fd89a22 --- /dev/null +++ b/debian/control @@ -0,0 +1,30 @@ +Source: damaris +Section: science +Priority: optional +Standards-Version: 3.9.6 +Maintainer: Markus Rosenstihl +Uploaders: Markus Rosenstihl +Build-Depends: debhelper, + libxerces-c3-dev|libxerces-c-dev, + libexpat-dev|libexpat1-dev, + unzip, + libglib2.0-dev, + linux-headers|linux-headers-amd64, + cmake, + +Package: damaris-backends +Architecture: i386 amd64 +Depends: ${shlibs:Depends}, bash (>=4.2), modutils|module-init-tools, coreutils (>=8.13), libxerces-c3.1|libxerces-c-dev, udev, lsof, libglib2.0-0 +Recommends: python-damaris|damaris-frontend, damaris-modules +Description: DAMARIS backends package + This is the DAMARIS backends package. It contains machine definitions (the backends) for running DAMARIS experiments. + +Package: damaris-modules +Architecture: i386 amd64 +Recommends: damaris-backends +Depends: ${linux-image:Depends} +Replaces: damaris-backends (<= 0.13-0.5) +Description: Kernel modules for DAMARIS hardware + This are kernel modules for DAMARIS compatible hardware. Currently there are two binary drivers: + one for SpinCore PulseBlaster and Spectrum MI40xx ADC cards. + diff --git a/debian/damaris-backends.debhelper.log b/debian/damaris-backends.debhelper.log new file mode 100644 index 0000000..34a1de4 --- /dev/null +++ b/debian/damaris-backends.debhelper.log @@ -0,0 +1,51 @@ +override_dh_auto_configure dh_auto_configure +dh_auto_configure +dh_auto_build +dh_auto_test +dh_prep +dh_installdirs +dh_auto_install +override_dh_install dh_install +override_dh_install dh_installmodules +dh_install +dh_installdocs +dh_installchangelogs +dh_installexamples +dh_installman +dh_installcatalogs +dh_installcron +dh_installdebconf +dh_installemacsen +dh_installifupdown +dh_installinfo +dh_installinit +dh_installmenu +dh_installmime +dh_installmodules +dh_installlogcheck +dh_installlogrotate +dh_installpam +dh_installppp +dh_installudev +dh_installwm +dh_installgsettings +dh_bugfiles +dh_ucf +dh_lintian +dh_gconf +dh_icons +dh_perl +dh_usrlocal +dh_link +dh_installxfonts +dh_compress +dh_fixperms +dh_strip +dh_makeshlibs +dh_shlibdeps +dh_installdeb +dh_gencontrol +dh_md5sums +dh_builddeb +dh_builddeb +dh_builddeb diff --git a/debian/damaris-backends.install b/debian/damaris-backends.install new file mode 100644 index 0000000..0346a77 --- /dev/null +++ b/debian/damaris-backends.install @@ -0,0 +1,4 @@ +debian/tmp/usr/lib/damaris/backends/* +debian/tmp/usr/share/doc/damaris-backends/backend.conf +debian/tmp/etc/xdg/damaris/backend.conf + diff --git a/debian/damaris-backends.postinst b/debian/damaris-backends.postinst new file mode 100755 index 0000000..ba38f29 --- /dev/null +++ b/debian/damaris-backends.postinst @@ -0,0 +1,27 @@ +#! /bin/sh + +if grep nmr /etc/group >/dev/null; then + echo "group nmr already exists" ; +else + echo "creating group nmr" ; + groupadd nmr || echo "failed!" +fi + +find /usr/lib/damaris/backends -type f \ +\! -name dummycore \ +-exec chgrp nmr {} \; \ +-exec chmod u+s,o= {} \; + +#DEBHELPER# + +if [ "$1" = "configure" -a -n "$2" ]; then + comparableversion=`echo "$2"|sed 's/[\.-]/ /g'|xargs printf "%03d%03d%03d"` + if [ "000011000" -gt $comparableversion ]; then + # transition to version with udev + if [ \! -e /etc/udev/rules.d/z60_damaris-backends.rules ]; then + # check whether the link/script was done when updating from 0.11 to newer version + ln -s ../damaris-backends.rules /etc/udev/rules.d/z60_damaris-backends.rules + fi + fi +fi + diff --git a/debian/damaris-backends.postrm b/debian/damaris-backends.postrm new file mode 100755 index 0000000..c6df39b --- /dev/null +++ b/debian/damaris-backends.postrm @@ -0,0 +1,13 @@ +#! /bin/sh + +if test x$1 = xpurge; then + if grep nmr /etc/group >/dev/null; then + echo "deleting group nmr" ; + # be sure this does not stop the process + groupdel nmr || true + else + echo "group nmr already removed" ; + fi +fi + +#DEBHELPER# diff --git a/debian/damaris-backends.substvars b/debian/damaris-backends.substvars new file mode 100644 index 0000000..d131348 --- /dev/null +++ b/debian/damaris-backends.substvars @@ -0,0 +1,2 @@ +shlibs:Depends=libc6 (>= 2.14), libexpat1 (>= 2.0.1), libgcc1 (>= 1:4.1.1), libglib2.0-0 (>= 2.12.0), libstdc++6 (>= 4.9), libxerces-c3.1 +misc:Depends= diff --git a/debian/damaris-modules.debhelper.log b/debian/damaris-modules.debhelper.log new file mode 100644 index 0000000..34a1de4 --- /dev/null +++ b/debian/damaris-modules.debhelper.log @@ -0,0 +1,51 @@ +override_dh_auto_configure dh_auto_configure +dh_auto_configure +dh_auto_build +dh_auto_test +dh_prep +dh_installdirs +dh_auto_install +override_dh_install dh_install +override_dh_install dh_installmodules +dh_install +dh_installdocs +dh_installchangelogs +dh_installexamples +dh_installman +dh_installcatalogs +dh_installcron +dh_installdebconf +dh_installemacsen +dh_installifupdown +dh_installinfo +dh_installinit +dh_installmenu +dh_installmime +dh_installmodules +dh_installlogcheck +dh_installlogrotate +dh_installpam +dh_installppp +dh_installudev +dh_installwm +dh_installgsettings +dh_bugfiles +dh_ucf +dh_lintian +dh_gconf +dh_icons +dh_perl +dh_usrlocal +dh_link +dh_installxfonts +dh_compress +dh_fixperms +dh_strip +dh_makeshlibs +dh_shlibdeps +dh_installdeb +dh_gencontrol +dh_md5sums +dh_builddeb +dh_builddeb +dh_builddeb diff --git a/debian/damaris-modules.init b/debian/damaris-modules.init new file mode 100755 index 0000000..000560a --- /dev/null +++ b/debian/damaris-modules.init @@ -0,0 +1,158 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: damaris-backends +# Required-Start: $syslog +# Required-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Startup script to load nmr hardware drivers for use with damaris backends +# Description: loads available nmr hardware drivers and grants rights to nmr group +# these drivers will be typically used by damaris backends and accompanying programs +### END INIT INFO + +# Script Author: Achim Gaedke +# Created: February 28th, 2005, adapted to LSB June 2008 + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +. /lib/lsb/init-functions + +RETVAL=0 +# failure value for nonexisting hardware +HARDWARE_FAIL_RETVAL=0 + +NMR_MODULE_DIR=/lib/modules/`uname -r`/kernel/damaris +NMR_GROUP="nmr" + +# tools +RMMOD=/sbin/rmmod +MODPROBE=/sbin/modprobe +KERNELCONF=/boot/config-`uname -r` + +# spectrum related stuff +SPECTRUM_NAME=spc +CONFIG_SMP="`grep 'CONFIG_SMP *=' $KERNELCONF | sed 's/.*=//'`" +if test "x$CONFIG_SMP" = "xy"; then + SPECTRUM_SMP_EXT="_smp"; +else + SPECTRUM_SMP_EXT=""; +fi +SPECTRUM_DEV=/dev/${SPECTRUM_NAME}0 +SPECTRUM_MOD_FILE=$NMR_MODULE_DIR/${SPECTRUM_NAME}${SPECTRUM_SMP_EXT}.ko + +# pulseblaster related stuff +PULSEBLASTER_NAME=pulseblaster +PULSEBLASTER_MOD_FILE=$NMR_MODULE_DIR/$PULSEBLASTER_NAME.ko +PULSEBLASTER_DEV=/dev/$PULSEBLASTER_NAME + +start() { + + SPECTRUM_RETVAL=0 + # find out whether spectrum module is running + if egrep "^spc${SPECTRUM_SMP_EXT} " /proc/modules >/dev/null ; then + echo "spectrum module already loaded" + else + # ok, load it + if test -f $SPECTRUM_MOD_FILE; then + if ! $MODPROBE ${SPECTRUM_NAME}${SPECTRUM_SMP_EXT} >/dev/null 2>&1; then + echo "spectrum module failed to load" + SPECTRUM_RETVAL=1 + fi + else + echo "spectrum module not found" + SPECTRUM_RETVAL=1 + fi + fi + + PULSEBLASTER_RETVAL=0 + # find out whether pulseblaster module is running + if egrep "^pulseblaster " /proc/modules >/dev/null ; then + echo "pulseblaster module already loaded" + else + # ok, load it + if test -f $PULSEBLASTER_MOD_FILE; then + if ! $MODPROBE $PULSEBLASTER_NAME >/dev/null 2>&1; then + echo "pulseblaster module failed to load" + PULSEBLASTER_RETVAL=1 + fi + else + echo "pulseblaster module not found" + PULSEBLASTER_RETVAL=1 + fi + fi + + # have to wait for a short time, let udev do the work + if [ -x /sbin/udevsettle ]; then + /sbin/udevsettle + fi + if [ -x /sbin/udevadm ]; then + /sbin/udevadm settle + fi + if ! test $PULSEBLASTER_RETVAL -ne 0 -o -c ${PULSEBLASTER_DEV}0 ; then + echo "no pulseblaster board is found, only the debug device at ${PULSEBLASTER_DEV}_debug is available" + fi + + # with udev, we should have links and also the rights set correctly + if test $PULSEBLASTER_RETVAL -ne 0 -o $SPECTRUM_RETVAL -ne 0; then + RETVAL=$HARDWARE_FAIL_RETVAL + fi + +} + +stop() { + if egrep "^spc$SPECTRUM_SMP_EXT " /proc/modules >/dev/null ; then + # test wheter spectrum driver is still used + # !!!! the usage counter of the spc kernel module is not maintained!!!! + if test "`lsof $SPECTRUM_DEV`x" = "x"; then + $MODPROBE -r ${SPECTRUM_NAME}${SPECTRUM_SMP_EXT} || RETVAL=1 + else + echo "spectrum driver still in use (use lsof)" + RETVAL=1 + fi + fi + if egrep "^${PULSEBLASTER_NAME} " /proc/modules > /dev/null ; then + # test wheter it is still used + $MODPROBE -r ${PULSEBLASTER_NAME} || RETVAL=1 + fi + # have to wait for a short time, let udev do the work + if [ -x /sbin/udevsettle ]; then + /sbin/udevsettle + fi + if [ -x /sbin/udevadm ]; then + /sbin/udevadm settle + fi +} + +status () { + if egrep "^${SPECTRUM_NAME}$SPECTRUM_SMP_EXT " /proc/modules > /dev/null ; then + echo spectrum module loaded + else + echo spectrum module not loaded + RETVAL=3 + fi + if egrep "^${PULSEBLASTER_NAME} " /proc/modules > /dev/null ; then + echo pulseblaster module loaded + else + echo pulseblaster module not loaded + RETVAL=3 + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + status) + status + ;; + *) + printf "Usage: %s {start|stop|restart|status}\n" "$0" + RETVAL=1 +esac +exit $RETVAL diff --git a/debian/damaris-modules.install b/debian/damaris-modules.install new file mode 100644 index 0000000..5e40ba0 --- /dev/null +++ b/debian/damaris-modules.install @@ -0,0 +1,2 @@ +debian/tmp/lib/modules/* + diff --git a/debian/damaris-modules.postinst b/debian/damaris-modules.postinst new file mode 100755 index 0000000..213910e --- /dev/null +++ b/debian/damaris-modules.postinst @@ -0,0 +1,8 @@ +#! /bin/sh +if grep -q nmr /etc/group; then + echo "group nmr already exists" ; +else + echo "creating group nmr" ; + groupadd nmr || echo "failed!" +fi + diff --git a/debian/damaris-modules.postinst.debhelper b/debian/damaris-modules.postinst.debhelper new file mode 100644 index 0000000..e6717ec --- /dev/null +++ b/debian/damaris-modules.postinst.debhelper @@ -0,0 +1,31 @@ +# Automatically added by dh_installmodules +if [ "$1" = "configure" ]; then + if [ -e /boot/System.map-4.8.0-0.bpo.2-amd64 ]; then + depmod -a -F /boot/System.map-4.8.0-0.bpo.2-amd64 4.8.0-0.bpo.2-amd64 || true + fi +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/damaris-modules" ]; then + update-rc.d damaris-modules defaults >/dev/null + invoke-rc.d damaris-modules start || exit $? +fi +# End automatically added section +# Automatically added by dh_installmodules +if [ "$1" = "configure" ]; then + if [ -e /boot/System.map-4.8.0-0.bpo.2-amd64 ]; then + depmod -a -F /boot/System.map-4.8.0-0.bpo.2-amd64 4.8.0-0.bpo.2-amd64 || true + fi +fi +# End automatically added section +# Automatically added by dh_installudev +if [ "$1" = configure ]; then + if [ -e "/etc/udev/rules.d/z60_damaris-modules.rules" ]; then + echo "Preserving user changes to /etc/udev/rules.d/60-damaris-modules.rules ..." + if [ -e "/etc/udev/rules.d/60-damaris-modules.rules" ]; then + mv -f "/etc/udev/rules.d/60-damaris-modules.rules" "/etc/udev/rules.d/60-damaris-modules.rules.dpkg-new" + fi + mv -f "/etc/udev/rules.d/z60_damaris-modules.rules" "/etc/udev/rules.d/60-damaris-modules.rules" + fi +fi +# End automatically added section diff --git a/debian/damaris-modules.postrm.debhelper b/debian/damaris-modules.postrm.debhelper new file mode 100644 index 0000000..1e2c915 --- /dev/null +++ b/debian/damaris-modules.postrm.debhelper @@ -0,0 +1,22 @@ +# Automatically added by dh_installmodules +if [ -e /boot/System.map-4.8.0-0.bpo.2-amd64 ]; then + depmod -a -F /boot/System.map-4.8.0-0.bpo.2-amd64 4.8.0-0.bpo.2-amd64 || true +fi +# End automatically added section +# Automatically added by dh_installinit +if [ "$1" = "purge" ] ; then + update-rc.d damaris-modules remove >/dev/null +fi + + +# In case this system is running systemd, we make systemd reload the unit files +# to pick up changes. +if [ -d /run/systemd/system ] ; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installmodules +if [ -e /boot/System.map-4.8.0-0.bpo.2-amd64 ]; then + depmod -a -F /boot/System.map-4.8.0-0.bpo.2-amd64 4.8.0-0.bpo.2-amd64 || true +fi +# End automatically added section diff --git a/debian/damaris-modules.preinst.debhelper b/debian/damaris-modules.preinst.debhelper new file mode 100644 index 0000000..b3367fb --- /dev/null +++ b/debian/damaris-modules.preinst.debhelper @@ -0,0 +1,11 @@ +# Automatically added by dh_installudev +if [ "$1" = install ] || [ "$1" = upgrade ]; then + if [ -e "/etc/udev/rules.d/z60_damaris-modules.rules" ]; then + if [ "`md5sum \"/etc/udev/rules.d/z60_damaris-modules.rules\" | sed -e \"s/ .*//\"`" = \ + "`dpkg-query -W -f='${Conffiles}' damaris-modules | sed -n -e \"\\\\' /etc/udev/rules.d/z60_damaris-modules.rules '{s/ obsolete$//;s/.* //p}\"`" ] + then + rm -f "/etc/udev/rules.d/z60_damaris-modules.rules" + fi + fi +fi +# End automatically added section diff --git a/debian/damaris-modules.prerm.debhelper b/debian/damaris-modules.prerm.debhelper new file mode 100644 index 0000000..29de3e6 --- /dev/null +++ b/debian/damaris-modules.prerm.debhelper @@ -0,0 +1,5 @@ +# Automatically added by dh_installinit +if [ -x "/etc/init.d/damaris-modules" ]; then + invoke-rc.d damaris-modules stop || exit $? +fi +# End automatically added section diff --git a/debian/damaris-modules.substvars b/debian/damaris-modules.substvars new file mode 100644 index 0000000..abd3ebe --- /dev/null +++ b/debian/damaris-modules.substvars @@ -0,0 +1 @@ +misc:Depends= diff --git a/debian/damaris-modules.udev b/debian/damaris-modules.udev new file mode 100644 index 0000000..f2cf586 --- /dev/null +++ b/debian/damaris-modules.udev @@ -0,0 +1,21 @@ +# Achim Gaedke, Jun 2008 +# udev rules for driver access + +# create nmr group first using the command +# addgroup nmr + +# add users authorized to use nmr devices to that group +# usermod -a -G nmr bloch + +# pulseblaster +SUBSYSTEM=="pulseblaster", GROUP="nmr" +# spectrum driver +SUBSYSTEM=="misc", KERNEL=="spc?*", GROUP="nmr" + +# mainly for backward compatibility +SUBSYSTEM=="pulseblaster", KERNEL=="pulseblaster0", SYMLINK+="pulseblaster" + +# if you use parport for stepper motor control +# and remove /usr/lib/cups/backend/parallel to disable cups access +# KERNEL=="parport0", GROUP="nmr" + diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..eddebd9 --- /dev/null +++ b/debian/files @@ -0,0 +1,2 @@ +damaris-backends_0.15_amd64.deb science optional +damaris-modules_0.15_amd64.deb science optional diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..40a3f4b --- /dev/null +++ b/debian/rules @@ -0,0 +1,52 @@ +#!/usr/bin/make -f + +# Achim Gaedke +# May 2007 + +# Uncomment this to turn on verbose mode. +DH_VERBOSE=1 +export DH_OPTIONS=-v + +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/default.mk + +BACKENDSBASE=$(shell pwd)/debian/damaris-backends +BACKENDSMACHINES = \ + dummycore \ + deuteron_backend \ + magnexgrad_backend \ + magnexgrad_backend_dds \ + PFGcore \ + fc2_backend \ + bg_backend \ + Mobilecore \ + berta \ + birgit \ + Mobile_wo_sync_backend \ + general + +tmp_kernel_makefiles = $(wildcard /lib/modules/*/build/Makefile) +#if we are no debian testing, exclude xen-686 (problems with pci_... support in pulseblaster and spc driver) +# with xen-686, waiting for problems to be fixed +#KERNELVERSIONS = $(filter-out %-xen-686, $(tmp_kernel_makefiles:/lib/modules/%/build/Makefile=%)) +# for stable everything is still fine +KERNELVERSIONS = $(tmp_kernel_makefiles:/lib/modules/%/build/Makefile=%) +DEB_BUILD_ARCH=$(strip $(shell dpkg-architecture -qDEB_BUILD_ARCH)) + + +#build: build-stamp + +%: + dh $@ --buildsystem=cmake --parallel --builddirectory=build + +clean: + rm -rf build + dh_clean + +override_dh_auto_configure: + dh_auto_configure -- -DCMAKE_INSTALL_SYSCONFDIR=/etc + +override_dh_install: + dh_install + dh_installmodules + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/drivers/Spectrum-MI40xxSeries/CMakeLists.txt b/drivers/Spectrum-MI40xxSeries/CMakeLists.txt index 43d420d..2f4610e 100644 --- a/drivers/Spectrum-MI40xxSeries/CMakeLists.txt +++ b/drivers/Spectrum-MI40xxSeries/CMakeLists.txt @@ -15,7 +15,12 @@ add_custom_command(OUTPUT ${SPC_HEADERS} COMMENT "Unpacking SPC headers" VERBATIM) -# Creating spc kernel module if the folder +# Kernelmodule is build from NDA source code. +# just go to the current directory and tar xfz drvsrc_all_V*.tgz +# this will usually create a "linux" folder +# the actual kernel source file is in the src_all/micx_drv subfolder +# If the "linux" folder exists the driver will be build + set(SPC_SRC ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv) set(DRIVER_FILE ${SPC_SRC}/spc_smp.ko ) set(KERNEL_DIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/build" ) @@ -32,7 +37,9 @@ add_custom_command(OUTPUT ${DRIVER_FILE} WORKING_DIRECTORY ${SPC_SRC} VERBATIM) if(EXISTS ${CMAKE_SOURCE_DIR}/drivers/Spectrum-MI40xxSeries/linux) -add_custom_target (micx_drv ALL DEPENDS ${DRIVER_FILE} ) + add_custom_target (micx_drv ALL DEPENDS ${DRIVER_FILE} ) + install(FILES ${DRIVER_FILE} DESTINATION /lib/modules/${CMAKE_SYSTEM_VERSION}/kernel/damaris) + else() message(Spectrum MI40xx dirver not found, unpack and configure it) endif() diff --git a/drivers/SpinCore-PulseBlaster/CMakeLists.txt b/drivers/SpinCore-PulseBlaster/CMakeLists.txt index b3de4fb..d401b66 100644 --- a/drivers/SpinCore-PulseBlaster/CMakeLists.txt +++ b/drivers/SpinCore-PulseBlaster/CMakeLists.txt @@ -13,8 +13,8 @@ add_custom_command(OUTPUT ${DRIVER_FILE} COMMENT "Building pulseblaster.ko" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} VERBATIM) - add_custom_target(pulseblaster_drv ALL DEPENDS ${DRIVER_FILE} ) +install(FILES ${DRIVER_FILE} DESTINATION /lib/modules/${CMAKE_SYSTEM_VERSION}/kernel/damaris) #include_directories(..) add_library(SpinCore-PulseBlaster SpinCore-PulseBlaster.cpp) diff --git a/machines/CMakeLists.txt b/machines/CMakeLists.txt index 77ed01b..2938d1a 100644 --- a/machines/CMakeLists.txt +++ b/machines/CMakeLists.txt @@ -21,15 +21,17 @@ set(PBDDS SpinCore-PulseBlasterDDSIII SpinCore-PulseBlaster PulseBlasterProgram) add_executable(dummycore dummycore.cpp hardware.cpp) target_link_libraries(dummycore pthread ${XERCES_LIBRARIES} core dummy tempcont Eurotherm-2000Series) +install(TARGETS dummycore DESTINATION lib/damaris/backends) add_executable(berta berta.cpp hardware.cpp) target_link_libraries(berta pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS ) +install(TARGETS berta DESTINATION lib/damaris/backends) add_executable(birgit birgit.cpp hardware.cpp) target_link_libraries(birgit pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS ) +install(TARGETS birgit DESTINATION lib/damaris/backends) add_executable(bg_backend bg_backend.cpp hardware.cpp) - target_link_libraries(bg_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS ) add_executable(Mobilecore Mobilecore.cpp hardware.cpp) @@ -38,7 +40,6 @@ target_link_libraries(Mobilecore pthread ${XERCES_LIBRARIES} core Spectrum_MI40x add_executable(Mobilecore_wo_sync_backend Mobile_wo_sync_backend.cpp hardware.cpp) target_link_libraries(Mobilecore_wo_sync_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS ) - add_executable(deuteron_backend deuteron_backend.cpp hardware.cpp) target_link_libraries(deuteron_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} ${PBDDS} PTS ) @@ -70,4 +71,21 @@ add_executable(magnexgrad_dds_backend magnexgrad_backend_dds.cpp hardware.cpp) target_link_libraries( magnexgrad_dds_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PBDDS} PTS DAC20 tempcont Eurotherm-2000Series) add_executable(pulseblaster_only pulseblaster_only.cpp hardware.cpp) -target_link_libraries(pulseblaster_only pthread ${XERCES_LIBRARIES} core ${PB24} PTS dummy DAC20 tempcont Eurotherm-2000Series ) \ No newline at end of file +target_link_libraries(pulseblaster_only pthread ${XERCES_LIBRARIES} core ${PB24} PTS dummy DAC20 tempcont Eurotherm-2000Series ) +install(TARGETS dummycore + berta + birgit + bg_backend + Mobilecore + Mobilecore_wo_sync_backend + deuteron_backend + fc1neu_backend + PFGcore + fc2_backend + fc2_AD5791_backend + general + magnexgrad_backend + magnexgrad_dds_backend + pulseblaster_only + DESTINATION lib/damaris/backends) + diff --git a/machines/Makefile b/machines/Makefile index 5534fca..068524c 100644 --- a/machines/Makefile +++ b/machines/Makefile @@ -28,6 +28,7 @@ MACHINES = \ Mobile_wo_sync_backend$(EXEEXT) \ berta \ general \ + birgit \ pulseblaster_only DRV_SPC_MI40xx = ../drivers/Spectrum-MI40xxSeries/Spectrum-MI40xxSeries.a diff --git a/machines/general.cpp b/machines/general.cpp index ad406fb..5f13588 100644 --- a/machines/general.cpp +++ b/machines/general.cpp @@ -62,8 +62,8 @@ public: { if (error->code != 4) { - fprintf(stdout, "found!\n"); - g_log(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, error->message); + fprintf(stdout, "%s","found!\n"); + g_log(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "%s", error->message); } else printf("not found!\n"); @@ -81,7 +81,7 @@ public: if (error->code != 4) { fprintf(stdout, "found!\n"); - g_log(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, error->message); + g_log(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,"%s", error->message); } else printf("not found!\n"); diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000..439a3fa --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.0) +include(GNUInstallDirs) + +install(FILES backend.conf + DESTINATION ${CMAKE_INSTALL_FULL_DOCDIR}) +install(FILES backend.conf + DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/xdg/damaris) \ No newline at end of file