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) {