From e51c6d7ec5e84368895e3e9d13b05e9de839824f Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Wed, 26 Feb 2020 10:50:44 +0100 Subject: [PATCH 01/13] Add ZynqManager::Setup() command to handle setup after a reboot. This is called at the end of RunInstrument::NightOperations(). --- .../src/instrument/RunInstrument.cpp | 8 ++++++ .../src/subsystems/ZynqManager.cpp | 28 +++++++++++++++++++ CPU/CPUsoftware/src/subsystems/ZynqManager.h | 7 +++++ 3 files changed, 43 insertions(+) diff --git a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp index d7872c72..b8ef23e3 100755 --- a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp +++ b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp @@ -973,6 +973,14 @@ int RunInstrument::NightOperations() { std::cout << "waiting for boot..." << std::endl; this->CheckStatus(); + /* setup the Zynq */ + clog << "info: " << logstream::info << "setting up Zynq with DAC 10 tables and trigger mask" << std::endl; + std::string usb_str(USB_MOUNTPOINT_0); + { + std::unique_lock lock(this->Zynq.m_zynq); + this->Zynq.Setup(usb_str); + } + /* set hidden pixels */ if (this->CmdLine->hide_pixel == true) { { diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp index bda97437..219835f1 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp @@ -360,6 +360,34 @@ int ZynqManager::Reboot() { } +int ZynqManager::Setup(std::string setup_script_path) { + + std::stringstream conv_dac; + std::stringstream conv_trig; + std::string cmd_str; + const char * cmd = ""; + + std::string sub_dir(ZYNQ_SETUP_SUBDIR); + std::string cmd_path = setup_script_path + sub_dir; + std::string output; + + /* set ASIC DAC from tables */ + conv_dac << "(cd " << cmd_path << " && " << MATRIX_DAC_10_EXEC << ")" << std::endl; + cmd_str = conv_dac.str(); + cmd = cmd_str.c_str(); + output = CpuTools::CommandToStr(cmd); + clog << "info: " << logstream::info << "Zynq setup of ASIC DAC from tables output: " << output << std::endl; + + /* set trigger mask */ + conv_trig << "(cd " << cmd_path << " && " << NO_TRIG_MASK_EXEC << ")" << std::endl; + cmd_str = conv_dac.str(); + cmd = cmd_str.c_str(); + output = CpuTools::CommandToStr(cmd); + clog << "info: " << logstream::info << "Zynq setup of trigger mask output: " << output << std::endl; + + return 0; +} + /** * check the HV status diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.h b/CPU/CPUsoftware/src/subsystems/ZynqManager.h index 9583b3d4..cb5f43d4 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.h +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.h @@ -36,6 +36,12 @@ /* time between consecutive telnet commands in mus */ #define SLEEP_TIME 500000 +/* location of Zynq setup executables */ +#define ZYNQ_SETUP_SUBDIR "/automated_boot" +#define MATRIX_DAC_10_EXEC "./SetMatrixDac10" +#define NO_TRIG_MASK_EXEC "./SetNoTriggerMask" + + /** * class to handle the Zynq interface. * commands and information are sent and received over telnet @@ -143,6 +149,7 @@ class ZynqManager { static std::string GetZynqVer(); int InstrumentClean(); int Reboot(); + int Setup(std::string setup_script_path); private: From bb0014f87a4019184e45309c4441ba488bf8f7fc Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Wed, 26 Feb 2020 10:58:12 +0100 Subject: [PATCH 02/13] Testing in RunInstrument::DebugMode() --- .../src/instrument/RunInstrument.cpp | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp index b8ef23e3..fbfd46ac 100755 --- a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp +++ b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp @@ -158,7 +158,8 @@ int RunInstrument::DebugMode() { std::cout << std::endl; std::cout << "running checks of all subsystems..." <Usb.LookupUsbStorage(); std::cout << "there are " << num_usb_storage << " USB storage devices connected" << std::endl; @@ -233,7 +234,8 @@ int RunInstrument::DebugMode() { std::cout << "Zynq OFF " << std::endl; this->Lvps.SwitchOff(LvpsManager::ZYNQ); std::cout << "done!" << std::endl; - + */ + /* check the available disk space */ const char * cmd1 = "df -h"; std::string output1 = CpuTools::CommandToStr(cmd1); @@ -249,7 +251,26 @@ int RunInstrument::DebugMode() { std::cout << output2 << std::endl; clog << "info: " << logstream::info << "Checking CPU usage:" << std::endl; clog << "info: " << logstream::info << output2 << std::endl; - + + /* check new commands */ + std::string usb_str(USB_MOUNTPOINT_0); + std::string sub_dir(ZYNQ_SETUP_SUBDIR); + std::string cmd_path = usb_str + sub_dir; + + std::cout << "cmd_path: " << cmd_path << std::endl; + + std::stringstream conv_dac; + std::stringstream conv_trig; + std::string cmd_str; + + conv_dac << "(cd " << cmd_path << " && " << MATRIX_DAC_10_EXEC << ")" << std::endl; + cmd_str = conv_dac.str(); + std::cout << "cmd_str: " << cmd_str << std::endl; + + conv_trig << "(cd " << cmd_path << " && " << NO_TRIG_MASK_EXEC << ")" << std::endl; + cmd_str = conv_dac.str(); + std::cout << "cmd_str: " << cmd_str << std::endl; + std::cout << "debug tests completed, exiting the program" << std::endl; return 0; From 78a6ab03f02404dbbf8878250fbc45ae2d8ab33a Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Wed, 26 Feb 2020 10:58:41 +0100 Subject: [PATCH 03/13] Tidy up RunInstrument::DebugMode() --- .../src/instrument/RunInstrument.cpp | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp index fbfd46ac..840b4b6f 100755 --- a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp +++ b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp @@ -252,27 +252,6 @@ int RunInstrument::DebugMode() { clog << "info: " << logstream::info << "Checking CPU usage:" << std::endl; clog << "info: " << logstream::info << output2 << std::endl; - /* check new commands */ - std::string usb_str(USB_MOUNTPOINT_0); - std::string sub_dir(ZYNQ_SETUP_SUBDIR); - std::string cmd_path = usb_str + sub_dir; - - std::cout << "cmd_path: " << cmd_path << std::endl; - - std::stringstream conv_dac; - std::stringstream conv_trig; - std::string cmd_str; - - conv_dac << "(cd " << cmd_path << " && " << MATRIX_DAC_10_EXEC << ")" << std::endl; - cmd_str = conv_dac.str(); - std::cout << "cmd_str: " << cmd_str << std::endl; - - conv_trig << "(cd " << cmd_path << " && " << NO_TRIG_MASK_EXEC << ")" << std::endl; - cmd_str = conv_dac.str(); - std::cout << "cmd_str: " << cmd_str << std::endl; - - std::cout << "debug tests completed, exiting the program" << std::endl; - return 0; } From 5ce9ba7c0897b6216b7e78f0ac9b4fb6c272bf91 Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Wed, 26 Feb 2020 11:00:10 +0100 Subject: [PATCH 04/13] UPdate version info --- CPU/CPUsoftware/src/instrument/RunInstrument.cpp | 2 -- minieuso_data_format/minieuso_data_format.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp index 840b4b6f..0d91dca4 100755 --- a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp +++ b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp @@ -159,7 +159,6 @@ int RunInstrument::DebugMode() { std::cout << "running checks of all subsystems..." <Usb.LookupUsbStorage(); std::cout << "there are " << num_usb_storage << " USB storage devices connected" << std::endl; @@ -234,7 +233,6 @@ int RunInstrument::DebugMode() { std::cout << "Zynq OFF " << std::endl; this->Lvps.SwitchOff(LvpsManager::ZYNQ); std::cout << "done!" << std::endl; - */ /* check the available disk space */ const char * cmd1 = "df -h"; diff --git a/minieuso_data_format/minieuso_data_format.h b/minieuso_data_format/minieuso_data_format.h index f45c0a0a..2d090b35 100644 --- a/minieuso_data_format/minieuso_data_format.h +++ b/minieuso_data_format/minieuso_data_format.h @@ -19,8 +19,8 @@ * software definitions */ -#define VERSION 8.5 -#define VERSION_DATE_STRING "18/02/2020" +#define VERSION 8.6 +#define VERSION_DATE_STRING "26/02/2020" /* * instrument definitions From 161a84d852bedf69af028e73ca97fcbcb6efa2c5 Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Wed, 26 Feb 2020 18:17:58 +0100 Subject: [PATCH 05/13] Fix command selection and add standard output in ZynqManager::Setup() --- CPU/CPUsoftware/src/subsystems/ZynqManager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp index 219835f1..d9e42fa8 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp @@ -377,14 +377,19 @@ int ZynqManager::Setup(std::string setup_script_path) { cmd = cmd_str.c_str(); output = CpuTools::CommandToStr(cmd); clog << "info: " << logstream::info << "Zynq setup of ASIC DAC from tables output: " << output << std::endl; + std::cout << "Zynq setup of ASIC DAC from tables output: " << std::endl; + std::cout << output << std::endl; + /* set trigger mask */ conv_trig << "(cd " << cmd_path << " && " << NO_TRIG_MASK_EXEC << ")" << std::endl; - cmd_str = conv_dac.str(); + cmd_str = conv_trig.str(); cmd = cmd_str.c_str(); output = CpuTools::CommandToStr(cmd); clog << "info: " << logstream::info << "Zynq setup of trigger mask output: " << output << std::endl; - + std::cout << "Zynq setup of trigger mask output: " << std::endl; + std::cout << output << std::endl; + return 0; } From f3a91bcbefbc4272460e03d82d495b8ae0702416 Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Thu, 27 Feb 2020 13:43:16 +0100 Subject: [PATCH 06/13] In ZynqManager::Setup(), switch to using system() for debugging purposes. --- .../src/subsystems/ZynqManager.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp index d9e42fa8..d4148f9b 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp @@ -375,20 +375,21 @@ int ZynqManager::Setup(std::string setup_script_path) { conv_dac << "(cd " << cmd_path << " && " << MATRIX_DAC_10_EXEC << ")" << std::endl; cmd_str = conv_dac.str(); cmd = cmd_str.c_str(); - output = CpuTools::CommandToStr(cmd); - clog << "info: " << logstream::info << "Zynq setup of ASIC DAC from tables output: " << output << std::endl; - std::cout << "Zynq setup of ASIC DAC from tables output: " << std::endl; - std::cout << output << std::endl; - + //output = CpuTools::CommandToStr(cmd); + //clog << "info: " << logstream::info << "Zynq setup of ASIC DAC from tables output: " << output << std::endl; + //std::cout << "Zynq setup of ASIC DAC from tables output: " << std::endl; + //std::cout << output << std::endl; + system(cmd); /* set trigger mask */ conv_trig << "(cd " << cmd_path << " && " << NO_TRIG_MASK_EXEC << ")" << std::endl; cmd_str = conv_trig.str(); cmd = cmd_str.c_str(); - output = CpuTools::CommandToStr(cmd); - clog << "info: " << logstream::info << "Zynq setup of trigger mask output: " << output << std::endl; - std::cout << "Zynq setup of trigger mask output: " << std::endl; - std::cout << output << std::endl; + //output = CpuTools::CommandToStr(cmd); + //clog << "info: " << logstream::info << "Zynq setup of trigger mask output: " << output << std::endl; + //std::cout << "Zynq setup of trigger mask output: " << std::endl; + //std::cout << output << std::endl; + system(cmd); return 0; } From e889b640223a1fbd57e65a29c00020250593d749 Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Thu, 27 Feb 2020 14:34:33 +0100 Subject: [PATCH 07/13] In ZynqManager::Setup() run commands locally and switch order --- .../src/subsystems/ZynqManager.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp index d4148f9b..093d7125 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp @@ -372,24 +372,28 @@ int ZynqManager::Setup(std::string setup_script_path) { std::string output; /* set ASIC DAC from tables */ - conv_dac << "(cd " << cmd_path << " && " << MATRIX_DAC_10_EXEC << ")" << std::endl; - cmd_str = conv_dac.str(); - cmd = cmd_str.c_str(); + //conv_dac << "(cd " << cmd_path << " && " << MATRIX_DAC_10_EXEC << ")" << std::endl; + //cmd_str = conv_dac.str(); + //cmd = cmd_str.c_str(); //output = CpuTools::CommandToStr(cmd); //clog << "info: " << logstream::info << "Zynq setup of ASIC DAC from tables output: " << output << std::endl; //std::cout << "Zynq setup of ASIC DAC from tables output: " << std::endl; //std::cout << output << std::endl; - system(cmd); /* set trigger mask */ - conv_trig << "(cd " << cmd_path << " && " << NO_TRIG_MASK_EXEC << ")" << std::endl; - cmd_str = conv_trig.str(); - cmd = cmd_str.c_str(); + //conv_trig << "(cd " << cmd_path << " && " << NO_TRIG_MASK_EXEC << ")" << std::endl; + //cmd_str = conv_trig.str(); + //cmd = cmd_str.c_str(); //output = CpuTools::CommandToStr(cmd); //clog << "info: " << logstream::info << "Zynq setup of trigger mask output: " << output << std::endl; //std::cout << "Zynq setup of trigger mask output: " << std::endl; //std::cout << output << std::endl; - system(cmd); + + std::cout << "Sending the following command: " << NO_TRIG_MASK_EXEC << std::endl; + system(NO_TRIG_MASK_EXEC); + + std::cout << "Sending the following command: " << MATRIX_DAC_10_EXEC << std::endl; + system(MATRIX_DAC_10_EXEC); return 0; } From 5bdacb3e72d1555b35f07c4b765fc9582478fd11 Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Thu, 27 Feb 2020 15:35:51 +0100 Subject: [PATCH 08/13] Try sending command twice --- CPU/CPUsoftware/src/subsystems/ZynqManager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp index 093d7125..933ff74c 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp @@ -391,9 +391,11 @@ int ZynqManager::Setup(std::string setup_script_path) { std::cout << "Sending the following command: " << NO_TRIG_MASK_EXEC << std::endl; system(NO_TRIG_MASK_EXEC); + system(NO_TRIG_MASK_EXEC); std::cout << "Sending the following command: " << MATRIX_DAC_10_EXEC << std::endl; system(MATRIX_DAC_10_EXEC); + system(MATRIX_DAC_10_EXEC); return 0; } From a0888c33100308807d1471306ad11c9053426bfa Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Wed, 4 Mar 2020 13:36:45 +0100 Subject: [PATCH 09/13] Change from system() commnads to SetDac(200) in ZynqManager::Setup() for testing purposes. --- CPU/CPUsoftware/src/subsystems/ZynqManager.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp index 933ff74c..4e004da8 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp @@ -362,6 +362,7 @@ int ZynqManager::Reboot() { int ZynqManager::Setup(std::string setup_script_path) { + /* std::stringstream conv_dac; std::stringstream conv_trig; std::string cmd_str; @@ -370,6 +371,7 @@ int ZynqManager::Setup(std::string setup_script_path) { std::string sub_dir(ZYNQ_SETUP_SUBDIR); std::string cmd_path = setup_script_path + sub_dir; std::string output; + */ /* set ASIC DAC from tables */ //conv_dac << "(cd " << cmd_path << " && " << MATRIX_DAC_10_EXEC << ")" << std::endl; @@ -389,13 +391,8 @@ int ZynqManager::Setup(std::string setup_script_path) { //std::cout << "Zynq setup of trigger mask output: " << std::endl; //std::cout << output << std::endl; - std::cout << "Sending the following command: " << NO_TRIG_MASK_EXEC << std::endl; - system(NO_TRIG_MASK_EXEC); - system(NO_TRIG_MASK_EXEC); - - std::cout << "Sending the following command: " << MATRIX_DAC_10_EXEC << std::endl; - system(MATRIX_DAC_10_EXEC); - system(MATRIX_DAC_10_EXEC); + std::cout << "Trying to set DAC 10 values to 200...." << std::endl; + this->SetDac(200); return 0; } From 74cd214fa4be01d96cc4c930c71fac60f5c69a08 Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Sun, 8 Mar 2020 11:17:58 +0100 Subject: [PATCH 10/13] Implemented full DAC10 setting with ZynqManager::SetMatrixDac10() --- .../src/instrument/RunInstrument.cpp | 14 ++- .../src/subsystems/ZynqManager.cpp | 100 +++++++++++++----- CPU/CPUsoftware/src/subsystems/ZynqManager.h | 8 +- CPU/CPUsoftware/src/tools/CpuTools.cpp | 28 +++++ CPU/CPUsoftware/src/tools/CpuTools.h | 2 +- 5 files changed, 117 insertions(+), 35 deletions(-) diff --git a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp index 0d91dca4..8865d03a 100755 --- a/CPU/CPUsoftware/src/instrument/RunInstrument.cpp +++ b/CPU/CPUsoftware/src/instrument/RunInstrument.cpp @@ -159,6 +159,7 @@ int RunInstrument::DebugMode() { std::cout << "running checks of all subsystems..." <Usb.LookupUsbStorage(); std::cout << "there are " << num_usb_storage << " USB storage devices connected" << std::endl; @@ -233,23 +234,32 @@ int RunInstrument::DebugMode() { std::cout << "Zynq OFF " << std::endl; this->Lvps.SwitchOff(LvpsManager::ZYNQ); std::cout << "done!" << std::endl; + */ /* check the available disk space */ + /* const char * cmd1 = "df -h"; std::string output1 = CpuTools::CommandToStr(cmd1); std::cout << "Checking disk space: " << std::endl; std::cout << output1 << std::endl; clog << "info: " << logstream::info << "Checking disk space:" << std::endl; clog << "info: " << logstream::info << output1 << std::endl; - + */ + /* check CPU usage */ + /* const char * cmd2 = "top -d 5 -b -n1 | grep \"load average\" -A 15"; std::string output2 = CpuTools::CommandToStr(cmd2); std::cout << "Checking CPU usage: " << std::endl; std::cout << output2 << std::endl; clog << "info: " << logstream::info << "Checking CPU usage:" << std::endl; clog << "info: " << logstream::info << output2 << std::endl; - + */ + + /* test new DAC10 commands */ + std::string path(USB_MOUNTPOINT_0); + this->Zynq.SetMatrixDac10(path, false); + return 0; } diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp index 4e004da8..37271434 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp @@ -360,39 +360,81 @@ int ZynqManager::Reboot() { } -int ZynqManager::Setup(std::string setup_script_path) { +/** + * Set the ASIC DAC10 values from a text file provided by the USB. + * Adapted from C. Giammanco's script to use socket programming instead of netcat. + */ +int ZynqManager::SetMatrixDac10(std::string usb_mountpoint, bool debug) { - /* - std::stringstream conv_dac; - std::stringstream conv_trig; - std::string cmd_str; - const char * cmd = ""; - - std::string sub_dir(ZYNQ_SETUP_SUBDIR); - std::string cmd_path = setup_script_path + sub_dir; - std::string output; - */ + std::string dac10_filename; + std::vector dac10_values; + + dac10_filename = usb_mountpoint + ZYNQ_SETUP_SUBDIR + "/" + MATRIX_DAC_10; + + /* read values */ + if (debug == true) { + + /* set all values to 200 for testing */ + for (int i=0; iSetDac(200); + std::cout << "Using new ZynqManager::SetMatrixDac10()!" << std::endl; + + this->SetMatrixDac10(setup_script_path, true); return 0; } diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.h b/CPU/CPUsoftware/src/subsystems/ZynqManager.h index cb5f43d4..ae39cfb1 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.h +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.h @@ -32,14 +32,15 @@ /* for use with HV interface functions */ #define N_EC 9 +#define N_PMT 36 +#define N_ASIC 6 /* time between consecutive telnet commands in mus */ #define SLEEP_TIME 500000 -/* location of Zynq setup executables */ +/* location of Zynq setup files */ #define ZYNQ_SETUP_SUBDIR "/automated_boot" -#define MATRIX_DAC_10_EXEC "./SetMatrixDac10" -#define NO_TRIG_MASK_EXEC "./SetNoTriggerMask" +#define MATRIX_DAC_10 "dac10.txt" /** @@ -149,6 +150,7 @@ class ZynqManager { static std::string GetZynqVer(); int InstrumentClean(); int Reboot(); + int SetMatrixDac10(std::string usb_mountpoint, bool debug); int Setup(std::string setup_script_path); private: diff --git a/CPU/CPUsoftware/src/tools/CpuTools.cpp b/CPU/CPUsoftware/src/tools/CpuTools.cpp index 78b2a0cb..2fc56432 100755 --- a/CPU/CPUsoftware/src/tools/CpuTools.cpp +++ b/CPU/CPUsoftware/src/tools/CpuTools.cpp @@ -261,3 +261,31 @@ uint32_t CpuTools::BuildCpuTimeStamp() { return timestamp; } + +/** + * read the DAC10 matrix file into a vector + */ +std::vector CpuTools::ReadMatrixDac10(std::string dac10_filename) { + + std::vector output; + + std::ifstream matrix(dac10_filename, std::ios::in); + int number; + + while(matrix >> number){ + + output.push_back(number); + + } + + if(output.size() != 36){ + + /* debug */ + std::cout << "ERROR: file \"" << dac10_filename << "\" is out of format. Check number of elements." << std::endl; + return output; + + } + matrix.close(); + + return output; +} diff --git a/CPU/CPUsoftware/src/tools/CpuTools.h b/CPU/CPUsoftware/src/tools/CpuTools.h index e7dd0bfd..14dcf802 100755 --- a/CPU/CPUsoftware/src/tools/CpuTools.h +++ b/CPU/CPUsoftware/src/tools/CpuTools.h @@ -42,7 +42,7 @@ class CpuTools { static std::streampos FileSize(std::string file_path); static uint32_t BuildCpuHeader(uint32_t type, uint32_t ver); static uint32_t BuildCpuTimeStamp(); - + static std::vector ReadMatrixDac10(std::string dac10_filename); }; From c1d69574a78729ed28a080f73dfae447de570aef Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Sun, 8 Mar 2020 11:19:11 +0100 Subject: [PATCH 11/13] Update version info --- minieuso_data_format/minieuso_data_format.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minieuso_data_format/minieuso_data_format.h b/minieuso_data_format/minieuso_data_format.h index 2d090b35..2615d56d 100644 --- a/minieuso_data_format/minieuso_data_format.h +++ b/minieuso_data_format/minieuso_data_format.h @@ -19,8 +19,8 @@ * software definitions */ -#define VERSION 8.6 -#define VERSION_DATE_STRING "26/02/2020" +#define VERSION 8.7 +#define VERSION_DATE_STRING "08/03/2020" /* * instrument definitions From 696433b04bbfab9cebe53875a43b5f522c75142b Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Mon, 9 Mar 2020 12:12:33 +0100 Subject: [PATCH 12/13] Switch over to reading from DAC10 fit in ZynqManager::Setup() --- CPU/CPUsoftware/src/subsystems/ZynqManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp index 37271434..621c8246 100755 --- a/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp +++ b/CPU/CPUsoftware/src/subsystems/ZynqManager.cpp @@ -434,7 +434,7 @@ int ZynqManager::Setup(std::string setup_script_path) { std::cout << "Trying to set DAC 10 values to 200...." << std::endl; std::cout << "Using new ZynqManager::SetMatrixDac10()!" << std::endl; - this->SetMatrixDac10(setup_script_path, true); + this->SetMatrixDac10(setup_script_path, false); return 0; } From f6f9449be41dcaca8436de92076cdbf5b428a3d6 Mon Sep 17 00:00:00 2001 From: Francesca Capel Date: Mon, 9 Mar 2020 12:13:31 +0100 Subject: [PATCH 13/13] UPdate version info --- minieuso_data_format/minieuso_data_format.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minieuso_data_format/minieuso_data_format.h b/minieuso_data_format/minieuso_data_format.h index 2615d56d..327197e6 100644 --- a/minieuso_data_format/minieuso_data_format.h +++ b/minieuso_data_format/minieuso_data_format.h @@ -19,8 +19,8 @@ * software definitions */ -#define VERSION 8.7 -#define VERSION_DATE_STRING "08/03/2020" +#define VERSION 8.8 +#define VERSION_DATE_STRING "09/03/2020" /* * instrument definitions