From 449ae0c9efed9b86637b11c1210faafb8530815b Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Fri, 10 Mar 2017 13:20:44 +0100 Subject: [PATCH] New backend (with M2I40xx ADC card) * enabled fc1_backend with M2I40xx ADC card * debian package now depends also on the spcm and libspcm-linux kernel * module and library from Spectrum --- debian/control | 4 ++-- drivers/Spectrum-MI40xxSeries/CMakeLists.txt | 3 +-- drivers/Spectrum-MI40xxSeries/Makefile | 4 ++-- drivers/Spectrum-MI40xxSeries/hw_test_extclock.cpp | 8 ++++---- drivers/Spectrum-MI40xxSeries/hw_test_intclock.cpp | 8 ++++---- .../SpinCore-PulseBlaster/SpinCore-PulseBlaster.cpp | 11 +++++------ machines/CMakeLists.txt | 11 ++++++++--- machines/fc1_backend.cpp | 10 ++++++---- 8 files changed, 32 insertions(+), 27 deletions(-) diff --git a/debian/control b/debian/control index cc73f70..a0b5046 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Build-Depends: debhelper (>=7), Package: damaris-backends Architecture: i386 amd64 -Depends: ${misc:Depends},${shlibs:Depends}, bash (>=4.2), kmod, coreutils (>=8.13), libxerces-c3.1|libxerces-c-dev, udev, libglib2.0-0 +Depends: ${misc:Depends},${shlibs:Depends}, bash (>=4.2), kmod, coreutils (>=8.13), libxerces-c3.1|libxerces-c-dev, udev, libglib2.0-0, libspcm-linux, spcm Recommends: python-damaris|damaris-frontend, damaris-modules Description: DAMARIS backends package This is the DAMARIS backends package. It contains machine definitions @@ -23,7 +23,7 @@ Description: DAMARIS backends package Package: damaris-modules Architecture: i386 amd64 Recommends: damaris-backends -Depends: ${misc:Depends}, kmod +Depends: ${misc:Depends}, kmod, spcm Replaces: damaris-backends (<= 0.13-0.5) Description: Kernel modules for DAMARIS hardware This are kernel modules for DAMARIS compatible hardware. diff --git a/drivers/Spectrum-MI40xxSeries/CMakeLists.txt b/drivers/Spectrum-MI40xxSeries/CMakeLists.txt index 8dd5975..abb6ece 100644 --- a/drivers/Spectrum-MI40xxSeries/CMakeLists.txt +++ b/drivers/Spectrum-MI40xxSeries/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 3.0) - # unpack headers needed set(SPC_DRV drv_header_v402b6844.zip) set(SPC_HEADERS @@ -26,8 +25,8 @@ if(DEFINED ENV{SPC_SOURCE}) message(STATUS "SPC_SOURCE environment variable set" $ENV{SPC_SOURCE}) set(SPC_SRC $ENV{SPC_SOURCE}) else() - message(WARNING "Spectrum driver source path not defined in envirnoment variable SPC_SOURCE") set(SPC_SRC ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv) + message(WARNING "Spectrum driver source path not defined in envirnoment variable SPC_SOURCE, using default:" ${SPC_SOURCE}) endif() set(DRIVER_FILE ${SPC_SRC}/spc_smp.ko ) set(KERNEL_DIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/build" ) diff --git a/drivers/Spectrum-MI40xxSeries/Makefile b/drivers/Spectrum-MI40xxSeries/Makefile index 224f2cb..4c7129b 100644 --- a/drivers/Spectrum-MI40xxSeries/Makefile +++ b/drivers/Spectrum-MI40xxSeries/Makefile @@ -4,8 +4,8 @@ AR=ar SPC_HEADERS = include/spcerr.h include/regs.h include/dlltyp.h include/spcioctl.inc -SPC_ZIP = ../Spectrum-M2i40xxSeries/drv_spcm_linux_drv_v214b5633.zip -#SPC_ZIP = ../Spectrum-MI40xxSeries/drv_header_v402b6844.zip +#SPC_ZIP = ../Spectrum-M2i40xxSeries/drv_spcm_linux_drv_v214b5633.zip +SPC_ZIP = ../Spectrum-MI40xxSeries/drv_header_v402b6844.zip all: clean $(SPC_HEADERS) patch Spectrum-MI40xxSeries.a hw_test_int hw_test_ext diff --git a/drivers/Spectrum-MI40xxSeries/hw_test_extclock.cpp b/drivers/Spectrum-MI40xxSeries/hw_test_extclock.cpp index 558b8a0..06e29fe 100644 --- a/drivers/Spectrum-MI40xxSeries/hw_test_extclock.cpp +++ b/drivers/Spectrum-MI40xxSeries/hw_test_extclock.cpp @@ -10,10 +10,10 @@ #include #include -#include "dlltyp.h" -#include "regs.h" -#include "spcerr.h" -#include "spcioctl.inc" +#include "include/dlltyp.h" +#include "include/regs.h" +#include "include/spcerr.h" +#include "include/spcioctl.inc" // ----- main task ----- diff --git a/drivers/Spectrum-MI40xxSeries/hw_test_intclock.cpp b/drivers/Spectrum-MI40xxSeries/hw_test_intclock.cpp index 9acb756..29e8444 100644 --- a/drivers/Spectrum-MI40xxSeries/hw_test_intclock.cpp +++ b/drivers/Spectrum-MI40xxSeries/hw_test_intclock.cpp @@ -10,10 +10,10 @@ #include #include -#include "dlltyp.h" -#include "regs.h" -#include "spcerr.h" -#include "spcioctl.inc" +#include "include/dlltyp.h" +#include "include/regs.h" +#include "include/spcerr.h" +#include "include/spcioctl.inc" // ----- main task ----- diff --git a/drivers/SpinCore-PulseBlaster/SpinCore-PulseBlaster.cpp b/drivers/SpinCore-PulseBlaster/SpinCore-PulseBlaster.cpp index 5445683..8c43971 100644 --- a/drivers/SpinCore-PulseBlaster/SpinCore-PulseBlaster.cpp +++ b/drivers/SpinCore-PulseBlaster/SpinCore-PulseBlaster.cpp @@ -178,11 +178,9 @@ void SpinCorePulseBlaster::run_pulse_program_w_sync(state& exp, double sync_freq c=prog->create_command(); c->ttls=sync_mask; c->instruction=SpinCorePulseBlaster::WAIT; - c->length=shortest_pulse; + c->length=shortest_pulse*2.0; prog->push_front(c); - - if (1) { // zeroth command: pulse before WAIT opcode needs to be at least 120ns @@ -190,10 +188,11 @@ void SpinCorePulseBlaster::run_pulse_program_w_sync(state& exp, double sync_freq // reported to SpinCore (Contact Request 2016-12-19 at 1482143561) // markusro: When is this necessary? (TODO) c=prog->create_command(); - c->ttls=sync_mask; + //c->ttls=sync_mask; + c->ttls = 0x0; c->instruction=SpinCorePulseBlaster::CONTINUE; - //c->length=shortest_pulse+2; // markusro: why +2 ?? - c->length=12; // markusro: why +2 ?? + //c->length=shortest_pulse+2; // + c->length=12; // markusro: why shortest_pulse+2=11 , tests show 120 ns minimum state time?? prog->push_front(c); } duration+=2.0*shortest_pulse/clock+1.0/sync_freq; diff --git a/machines/CMakeLists.txt b/machines/CMakeLists.txt index ba5f930..5fc1151 100644 --- a/machines/CMakeLists.txt +++ b/machines/CMakeLists.txt @@ -56,9 +56,14 @@ add_executable(fc1neu_backend fc1neu_backend.cpp hardware.cpp) target_link_libraries( fc1neu_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS DAC20 ) # spcm linux driver needs to be installed (see http://spectrum-instrumentation.com/de/downloads/drivers) -#include_directories(${CMAKE_SOURCE_DIR}/drivers/Spectrum-M2i40xxSeries/include) -#add_executable(fc1_vierkanal_backend fc1_vierkanal_backend.cpp hardware.cpp) -#target_link_libraries( fc1_vierkanal_backend pthread ${XERCES_LIBRARIES} core spcm_linux Spectrum-M2i40xxSeries ${PB24} PTS DAC20 ) +include_directories(${CMAKE_SOURCE_DIR}/drivers/Spectrum-M2i40xxSeries/include) +add_executable(fc1_vierkanal_backend fc1_vierkanal_backend.cpp hardware.cpp) +target_link_libraries( fc1_vierkanal_backend pthread ${XERCES_LIBRARIES} core spcm_linux Spectrum-M2i40xxSeries ${PB24} PTS DAC20 ) + +# spcm linux driver needs to be installed (see http://spectrum-instrumentation.com/de/downloads/drivers) +include_directories(${CMAKE_SOURCE_DIR}/drivers/Spectrum-M2i40xxSeries/include) +add_executable(fc1_backend fc1_backend.cpp hardware.cpp) +target_link_libraries( fc1_backend pthread ${XERCES_LIBRARIES} core spcm_linux Spectrum-M2i40xxSeries ${PB24} PTS DAC20 ) add_executable(fc2_backend fc2_backend.cpp hardware.cpp) target_link_libraries( fc2_backend pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries ${PB24} PTS DAC20 ) diff --git a/machines/fc1_backend.cpp b/machines/fc1_backend.cpp index a2620af..f2c7da2 100644 --- a/machines/fc1_backend.cpp +++ b/machines/fc1_backend.cpp @@ -40,9 +40,11 @@ public: FC1_hardware() { ttlout trigger; trigger.id=0; - trigger.ttls=0x400000; /* line 22 */// + //trigger.ttls=0x400000; /* line 22 */// + trigger.ttls=1<<22; /* line 22 */// my_adc=new SpectrumM2i40xxSeries(trigger); - my_pulseblaster=new SpinCorePulseBlaster24Bit(0,1e8,0x800000); + //my_pulseblaster=new SpinCorePulseBlaster24Bit(0,1e8,0x800000); + my_pulseblaster=new SpinCorePulseBlaster24Bit(0,1e8,0);//,0x000000); PTS* my_pts=new PTS_latched(0); // ID of PTS_analogout 0 the_fg=my_pts; the_pg=my_pulseblaster; @@ -66,9 +68,9 @@ public: list_dacs.push_back(dac); } - /* virtual */ void experiment_run_pulse_program(state* work_copy) { +// /* virtual */ void experiment_run_pulse_program(state* work_copy) { //my_pulseblaster->run_pulse_program_w_sync(*work_copy, my_adc->get_sample_clock_frequency()); - } + // } virtual ~FC1_hardware() { if (the_adc!=NULL) delete the_adc;