From e4b43097118cbc4c8b9f79a7192be2079f11e0d5 Mon Sep 17 00:00:00 2001 From: astromech Date: Mon, 6 Feb 2017 22:05:00 +0100 Subject: [PATCH 1/3] Fixed accidentally removed else test, ADC was never setted --- .../Spectrum-MI40xxSeries/Spectrum-MI40xxSeries.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/Spectrum-MI40xxSeries/Spectrum-MI40xxSeries.cpp b/drivers/Spectrum-MI40xxSeries/Spectrum-MI40xxSeries.cpp index 202ea43..842272a 100644 --- a/drivers/Spectrum-MI40xxSeries/Spectrum-MI40xxSeries.cpp +++ b/drivers/Spectrum-MI40xxSeries/Spectrum-MI40xxSeries.cpp @@ -142,7 +142,7 @@ if (name == NULL) { FreeLibrary(spectrum_driver_dll); \ /* print lines with useful information: */ fprintf(stderr, "Spectrum MI40xx series board with %d byte memory\n", memory_size); fprintf(stderr, - " impedance set to %g Ohm\n expecting trigger on id=%d ttls=0x%lx\n external clock frequency set to %g Hz\n", + " impedance set to %g Ohm\n expecting trigger on id=%d ttl=0x%lx\n external clock frequency is %f Hz\n", impedance, t_line.id, t_line.ttls.to_ulong(), @@ -178,12 +178,13 @@ void SpectrumMI40xxSeries::collect_config_recursive(state_sequent& exp, Spectrum settings.data_structure=where_to_append; collect_config_recursive(*a_sequence, settings); settings.data_structure=tmp_structure; - //} /* end working on sequence */ - //else { + } /* end working on sequence */ + else { // found a state, not a sequence settings.timeout+=a_state->length; + #if SPC_DEBUG - fprintf(stderr,"SETTINGS %e %e\n",settings.timeout,a_state->length); + fprintf(stderr,"SETTINGS %e %e\n",settings.timeout, a_state->length); #endif // collect analogin sections in state std::list inputs; @@ -533,6 +534,7 @@ void SpectrumMI40xxSeries::set_daq(state & exp) { /* nothing to do! */ if (sampleno==0) { + fprintf(stderr, "oops, no sample number\n"); delete conf; effective_settings=NULL; return; From c590c08e237d9067d0155cb096718b509dbc90b8 Mon Sep 17 00:00:00 2001 From: astromech Date: Mon, 6 Feb 2017 22:31:58 +0100 Subject: [PATCH 2/3] added .gitignore --- CMakeLists.txt | 5 ++- drivers/Spectrum-MI40xxSeries/CMakeLists.txt | 5 +++ drivers/Spectrum-MI40xxSeries/Makefile | 1 + machines/general.cpp | 43 ++++++++++++++------ 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11a8b6c..52d8cab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,10 @@ include(GNUInstallDirs) # 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(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow -Wall -O0 -g") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -Wshadow -Wall -O0 -g") +#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow -Wall -O0 -g -DSP_DEBUG -DSPC_DEBUG") + set(CPACK_PACKAGING_INSTALL_PREFIX "/") #set(CMAKE_INSTALL_PREFIX "/") diff --git a/drivers/Spectrum-MI40xxSeries/CMakeLists.txt b/drivers/Spectrum-MI40xxSeries/CMakeLists.txt index 6e16259..17b2e2c 100644 --- a/drivers/Spectrum-MI40xxSeries/CMakeLists.txt +++ b/drivers/Spectrum-MI40xxSeries/CMakeLists.txt @@ -48,3 +48,8 @@ else() endif() add_library(Spectrum_MI40xxSeries STATIC Spectrum-MI40xxSeries.cpp GatedData.cpp ${SPC_HEADERS}) +#add_executable(hw_test_ext hw_test_extclock.cpp GatedData.cpp) +#target_sources(hw_test_ext PRIVATE ${SPC_HEADERS}) + +#add_executable(hw_test_int hw_test_intclock.cpp GatedData.cpp) +#target_include_directories(hw_test_int ${SPC_HEADERS}) diff --git a/drivers/Spectrum-MI40xxSeries/Makefile b/drivers/Spectrum-MI40xxSeries/Makefile index 902bfec..224f2cb 100644 --- a/drivers/Spectrum-MI40xxSeries/Makefile +++ b/drivers/Spectrum-MI40xxSeries/Makefile @@ -5,6 +5,7 @@ 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 all: clean $(SPC_HEADERS) patch Spectrum-MI40xxSeries.a hw_test_int hw_test_ext diff --git a/machines/general.cpp b/machines/general.cpp index 5f13588..c44be95 100644 --- a/machines/general.cpp +++ b/machines/general.cpp @@ -36,6 +36,7 @@ class general_hardware: public hardware PTS* my_pts; SpinCorePulseBlaster24Bit* my_pulseblaster; SpectrumMI40xxSeries* my_adc; + bool with_sync; public: general_hardware() @@ -91,6 +92,7 @@ public: USRCONF = 1; if (!(SYSCONF | USRCONF)) throw(core_exception("configuration failed!\n")); + printf("done!\n"); /* configure ADC card */ ttlout trigger; @@ -98,8 +100,7 @@ public: if (error) g_error(error->message); error = NULL; - //g_error(error->message); - trigger.ttls = 1 << g_key_file_get_integer(cfg_file, "ADC", "trigger_line", &error); + trigger.ttls = (channel_array) (1 << g_key_file_get_integer(cfg_file, "ADC", "trigger_line", &error)); if (error) g_error(error->message); error = NULL; @@ -112,7 +113,7 @@ public: g_error(error->message); error = NULL; - my_adc = new SpectrumMI40xxSeries(trigger, impedance, ext_reference_clock); + my_adc = new SpectrumMI40xxSeries(trigger, (float) impedance, ext_reference_clock); /* configure PulseBlaster */ int pb_id = g_key_file_get_integer(cfg_file, "PB", "id", &error); @@ -128,11 +129,15 @@ public: g_error(error->message); error = NULL; int pb_sync = 0; - if (pb_sync_bit != 128) + if (pb_sync_bit != 128) { pb_sync = 1 << pb_sync_bit; - - my_pulseblaster = new SpinCorePulseBlaster24Bit(pb_id, pb_refclock, pb_sync); - + with_sync = 1; + my_pulseblaster = new SpinCorePulseBlaster24Bit(pb_id, pb_refclock, pb_sync); + } + else { + with_sync = 0; + my_pulseblaster = new SpinCorePulseBlaster24Bit(pb_id, pb_refclock,0); + } /* configure PTS */ int pts_id = g_key_file_get_integer(cfg_file, "PTS", "id", &error); if (error) @@ -140,7 +145,7 @@ public: error = NULL; my_pts = new PTS_latched(pts_id); // PTS 500 has 0.36 or 0.72 above 200MHz ; PTS 310 has 0.225 degrees/step - my_pts->phase_step = g_key_file_get_double(cfg_file, "PTS", "phase_stepsize", &error); + my_pts->phase_step = (float) g_key_file_get_double(cfg_file, "PTS", "phase_stepsize", &error); if (error) g_error(error->message); error = NULL; @@ -158,22 +163,36 @@ public: { state* work_copy = exp.copy_flat(); if (work_copy == NULL) - return new error_result(1, "could create work copy of experiment sequence"); + return new error_result(1, "could not create work copy of experiment sequence"); try { if (the_fg != NULL) the_fg->set_frequency(*work_copy); if (the_adc != NULL) the_adc->set_daq(*work_copy); + else + throw ADC_exception("the_adc == NULL\n"); // the pulse generator is necessary - my_pulseblaster->run_pulse_program_w_sync(*work_copy, my_adc->get_sample_clock_frequency()); + if (with_sync) { + my_pulseblaster->run_pulse_program_w_sync(*work_copy, my_adc->get_sample_clock_frequency()); + + } + else { + //experiment_prepare_dacs(work_copy); + //experiment_run_pulse_program(work_copy); + the_pg->run_pulse_program(*work_copy); + } // wait for pulse generator the_pg->wait_till_end(); + // after that, the result must be available - if (the_adc != NULL) + if (the_adc != NULL) { r = the_adc->get_samples(); - else + } + else { r = new adc_result(1, 0, NULL); + throw ADC_exception("ADC result not available"); + } } catch (const RecoverableException &e) { From 984fd4dc83dc60edae9048b5365dcbd55f290b14 Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Mon, 6 Feb 2017 22:46:25 +0100 Subject: [PATCH 3/3] clean up --- clean.sh | 3 ++ debian/damaris-backends.debhelper.log | 52 ----------------------- debian/damaris-backends.substvars | 2 - debian/damaris-modules.debhelper.log | 52 ----------------------- debian/damaris-modules.postinst.debhelper | 31 -------------- debian/damaris-modules.postrm.debhelper | 22 ---------- debian/damaris-modules.preinst.debhelper | 11 ----- debian/damaris-modules.prerm.debhelper | 5 --- debian/damaris-modules.substvars | 1 - debian/files | 2 - 10 files changed, 3 insertions(+), 178 deletions(-) create mode 100644 clean.sh delete mode 100644 debian/damaris-backends.debhelper.log delete mode 100644 debian/damaris-backends.substvars delete mode 100644 debian/damaris-modules.debhelper.log delete mode 100644 debian/damaris-modules.postinst.debhelper delete mode 100644 debian/damaris-modules.postrm.debhelper delete mode 100644 debian/damaris-modules.preinst.debhelper delete mode 100644 debian/damaris-modules.prerm.debhelper delete mode 100644 debian/damaris-modules.substvars delete mode 100644 debian/files diff --git a/clean.sh b/clean.sh new file mode 100644 index 0000000..b8c539c --- /dev/null +++ b/clean.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +dpkg-buildpackage -rfakeroot -Tclean diff --git a/debian/damaris-backends.debhelper.log b/debian/damaris-backends.debhelper.log deleted file mode 100644 index 57d3323..0000000 --- a/debian/damaris-backends.debhelper.log +++ /dev/null @@ -1,52 +0,0 @@ -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_pysupport -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.substvars b/debian/damaris-backends.substvars deleted file mode 100644 index d131348..0000000 --- a/debian/damaris-backends.substvars +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 57d3323..0000000 --- a/debian/damaris-modules.debhelper.log +++ /dev/null @@ -1,52 +0,0 @@ -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_pysupport -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.postinst.debhelper b/debian/damaris-modules.postinst.debhelper deleted file mode 100644 index e6717ec..0000000 --- a/debian/damaris-modules.postinst.debhelper +++ /dev/null @@ -1,31 +0,0 @@ -# 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 deleted file mode 100644 index 1e2c915..0000000 --- a/debian/damaris-modules.postrm.debhelper +++ /dev/null @@ -1,22 +0,0 @@ -# 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 deleted file mode 100644 index b3367fb..0000000 --- a/debian/damaris-modules.preinst.debhelper +++ /dev/null @@ -1,11 +0,0 @@ -# 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 deleted file mode 100644 index 29de3e6..0000000 --- a/debian/damaris-modules.prerm.debhelper +++ /dev/null @@ -1,5 +0,0 @@ -# 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 deleted file mode 100644 index abd3ebe..0000000 --- a/debian/damaris-modules.substvars +++ /dev/null @@ -1 +0,0 @@ -misc:Depends= diff --git a/debian/files b/debian/files deleted file mode 100644 index bd27202..0000000 --- a/debian/files +++ /dev/null @@ -1,2 +0,0 @@ -damaris-backends_0.16+nmu803_amd64.deb science optional -damaris-modules_0.16+nmu803_amd64.deb science optional